kane-cli finds and merges variables, how to mark a value as secret, and where to put context files for the agent to read.
Variables
Format
Variables are defined in JSON, as an object keyed by variable name. Each entry describes one variable:Usage in Objectives
Reference a variable in the objective with itssyntax. With the default syntax, that is {{<name>}}. Variables resolve anywhere Kane CLI types or sets a value: form fields, cookie and localStorage values, and clipboard writes.
{{email}} to {{global.email}} and the secret {{password}} to a secrets reference. The agent works with the resolved values when the run executes. Saved _test.md files keep the bare {{name}} form.
Loading Order
Kane CLI merges variables from four sources in this order. When two sources define the same key, the later source wins:- Global directory:
~/.testmuai/kaneai/variables/*.json - Local project directory:
{cwd}/.testmuai/variables/*.json(relative to where you invokekane-cli) - File flag:
--variables-file <path> - Inline flag:
--variables '<json>'(highest priority)
Inline Variables
Pass a JSON object directly on the command line. Inline variables have the highest precedence.Variables from a File
Point at a single JSON file to load all of its variables at once.Project-Local Variables
Drop one or more*.json files into .testmuai/variables/ inside your project’s working directory. They load automatically whenever you run kane-cli from that directory.
Global Variables
For values you want available across every project on your machine, place*.json files in ~/.testmuai/kaneai/variables/. These files are not the same as {{global.<name>}}, which reads a Test Manager global variable. See Runtime Namespaces.
Example Variable File
Secrets
Mark a variable as secret by setting"secret": true:
Runtime Namespaces: global, environment, smart
Requires Kane CLI 0.9.0 or later.
global. or smart.. It tells Kane CLI where the value comes from:
How they behave:
- Resolved when each objective starts. The agent sees the real value, so it can type it, reason about it, and assert on it. The saved test keeps the reference, not the value, so every replay resolves it fresh. A
{{smart.random_email}}is a different address on every run, and in an interactive session on every objective. {{…}}only.${global.x}is not a namespace reference.${…}is reserved for dataset columns.- Two references can sit side by side.
{{smart.random_int}}.{{smart.random_int}}is two values joined by a dot. - A value the test stored wins. If an earlier step stored a value under the same name, Kane CLI uses that value.
- An unresolved
globalorenvironmentreference stops the run before step 1, and Kane CLI shows the reason. Asmartreference never stops a run. An unknown name resolves to an empty string, so check the spelling.
Smart Variables
- Smart variables take no arguments. For a date format or offset the table does not have, describe it in the objective instead (“pick the date one week from today”).
- Dates and times in a browser run are in UTC, not your machine’s time zone. Keep that in mind around midnight.
Variables declared by kane-cli design tests
When a design session needs a value nobody has provided yet, such as a start URL or a test account, it references the value as {{name}} and declares it as a variable. Before it picks a name, design reads every *.json file in both variable directories and reuses a name you already have instead of inventing a new one. The agent sees only which names exist and whether each one has a value. It never sees the values themselves.
For each name it declares, Kane CLI writes an empty stub (the name with a blank value) into .testmuai/variables/assurance.json. It never writes a value. Kane CLI tells you about new stubs during the round (⚒ declared 2 new variables — login_email · login_password (values needed)) and again at the end (2 variable(s) need values — see .testmuai/variables/assurance.json):
value. Kane CLI never overwrites a key that already exists in any of your variable files, so a stub cannot replace a value you set. A value you type in chat stays in the step as literal text. Design creates a variable only when the value is unknown.
Before a run: unresolved variables
kane-cli run, kane-cli testmd run, and kane-cli testrun run check every {{name}} that an authored step references before the run starts. A name with no value produces a warning, not an error. The run goes ahead and types the name as written, unless an earlier step sets it:
- Grouping. The warning groups names by the variables file they belong in (the pool file, such as
.testmuai/variables/assurance.json) and names that file once per group. - Test filenames. A test filename appears only when it differs from the file you ran. An
@imported unit and atestrunmember both show their own filename. Akane-cli runobjective shows no location. - Names in no file. If the pool file exists, the warning says
Add it to <file>. If there is no pool file yet, it shows the JSON to create.
- An explicit
{{global.*}}. It resolves from Test Manager when the run executes. Only a bare{{name}}is looked up in your variables files. {{smart.*}},{{environment.*}},{{secrets.*}}, and{{totp.*}}, which resolve when the run executes.- A name that an earlier step stores (
store the price as 'price'). - A name that the test’s own frontmatter
variables:declares, even with an empty value. - Replayed steps, which resolve from their recording (tape) and from Test Manager. A
testrun runpreflight still lists a replayed step’s names, because it checks the file before it knows which steps replay.
${x} is a dataset column reference, not a variables-file reference. If ${x} is not a column of the dataset row the run received, it gets its own warning.
In agent mode, the same content arrives as one warning event with code: "unresolved_variables". See Modes of Operation.
Context Files
Context files are plain Markdown files whose contents are passed to the agent alongside your objective. Use them for standing instructions: coding conventions, accounts to use, sites to avoid, or domain knowledge the agent should always have.Two Levels
Global context (default path
~/.testmuai/kaneai/global-memory.md): put guidance that applies to every project and your whole account here. Kane CLI loads it for every run unless you override it.
Local context (default path .testmuai/context.md in the current working directory): put guidance here that only makes sense for the project you are testing. Kane CLI loads it automatically when you run kane-cli from a directory that contains it.
Example Local Context File
Override Per Run
Use the run flags to point at a different file for a single invocation:What to Put in Context
Global context:- Company terminology and naming conventions
- Standard test account references (no hardcoded values)
- Performance expectations (e.g., “page loads in under 3 seconds”)
- Universal navigation patterns
- App overview and purpose
- Test environment URL and known limitations
- Navigation patterns specific to this app
- Known UI quirks and workarounds
- Common test flows
- Test data references (IDs, emails: no passwords)
- Hardcoded secrets (use variables)
- Large code blocks or logs
- Information that changes frequently