// How-to for coding agents

How a coding agent verifies a change with Kane CLI

Short answer

After you edit the code and start the app, run kane-cli run "Go to <url> and <action>, then verify <expected result>" --agent --headless --timeout 180.

Check the exit code, then read the last stdout line ("type":"run_end"). 0 means every check in the objective passed in a real browser. 1 means the run did not pass: read the failing step's remark before you edit code, because a stuck step or a vague objective also ends there.

For Claude Code, Codex CLI, Gemini CLI, Cursor and GitHub Copilot · Checked against kane-cli 0.9.0 · Updated

When a coding agent should verify a change

Run this check every time you change something an end user can see or click, such as a form, a page, a checkout step, a sign-in flow or a layout fix. Run it before you tell the developer the work is done.

Steps to verify a change in a real browser

  1. 1

    Start the app or open its preview URL

    Run the dev server (for example npm run dev) or take the preview URL from the deploy. Kane CLI needs a URL it can open, either at the start of the objective or passed with --url; a non-interactive run with no start URL fails instead of guessing. Before the first run, check that kane-cli whoami shows a signed-in user and that Chrome is installed, because the npm package does not install it.

  2. 2

    Write one objective that ends with a verify check

    Start with the URL, describe the actions as goals, and end with a check of what should be on screen when the change works:

    text
    Go to http://localhost:3000/products, filter by size M, then verify every product card shows size M
  3. 3

    Run kane-cli with --agent and --headless

    --agent prints NDJSON on stdout, one JSON object per line, and keeps the human progress view on stderr. Add --headless on any machine without a display, and --timeout <seconds> so a stuck run ends. Give your shell tool a longer timeout than that: runs take from 30 seconds to a few minutes.

    bash
    kane-cli run "Go to http://localhost:3000/products, filter by size M, then verify every product card shows size M" --agent --headless --timeout 180
  4. 4

    Read the run_end result on the last stdout line

    Check the exit code first: a run refused before it starts exits 2 and can end with no run_end. Otherwise the first line is stream_start, step lines have no type field and carry step, status (running, done or failed) and remark, and the last line is run_end. An example run_end line, with values that will differ on your run:

    json
    {"type":"run_end","status":"passed","summary":"Filtered by size M and every product card shows size M","one_liner":"Size filter works","reason":"Objective completed","duration":19.8,"credits_consumed":8.4,"final_state":{},"test_url":"https://test-manager.lambdatest.com/…","session_dir":"…"}

    Fields to rely on: status, summary, one_liner, reason, duration, credits_consumed, final_state (values saved with "store … as"), test_url (the Test Manager link, present when the upload succeeded) and session_dir. Ignore fields and event types you do not recognize, because new ones can appear in any release.

  5. 5

    Act on the kane-cli exit code

    Branch on the exit code: 0 passed, 1 ran and did not pass, 2 did not start, 3 timed out or was cancelled. Use run_end for the details you report.

    • 0 passed: tell the developer, with the summary and the test_url Test Manager link.
    • 1 failed: read the failing step's remark first (the line with "status":"failed"). If the app is wrong, fix the code and run the same command again. If the objective was vague or a step got stuck, rewrite the objective or tell the developer, and never weaken the check to get a pass. A failed upload also exits 1: if no step failed and test_url is missing, report that instead of changing code.
    • 2 did not start: nothing ran and no credits were used. Check three things: sign-in (kane-cli whoami), that Chrome is installed, and the start URL. If the developer is not signed in, run kane-cli login --oauth for them (it opens their browser and waits), or ask them to run kane-cli login in their own terminal.
    • 3 timeout or cancelled: raise --timeout or split the objective into shorter runs.

Rules for reliable Kane CLI runs from agents

  • One objective, one task. If a task needs more than about 15 steps, split it into separate kane-cli run calls. Independent runs can go in parallel when each one opens its own page, signs in and checks its own result.
  • End with a check of the visible end state, such as verify the cart shows 1 item. Without a verify or assert step, the run records no pass or fail that a replay can repeat.
  • Check what the action produced. Do not write verify the Submit button is visible: the button goes away when the submit works, so that check fails on success.
  • To get a value back, write store the order number as 'order_id'. It lands in run_end.final_state. Words like "read", "tell me" or "report" do not capture a value.
  • Keep secrets out of the objective and the chat. Put them in a variables file the developer fills in, such as .testmuai/variables/local.json with {"password":{"value":"","secret":true}}, and write {{password}} in the objective. Kane CLI loads that folder on every run, so keep it out of git.
  • Write objectives that never need input mid-run. When stdin is not a terminal, Kane CLI turns prompts off, so a step that waits for an answer fails.
  • In a double-quoted objective, write a dollar sign as \$. Bash turns an unescaped $42.00 into 2.00.
  • Tag each command with your agent's name so runs are attributed to it: KANE_CLI_USER_AGENT=claude-code kane-cli run "<objective>" --agent in bash or zsh, or $env:KANE_CLI_USER_AGENT='cursor'; kane-cli run "<objective>" --agent in PowerShell. An export does not survive between shell calls in most agent hosts.

Keep a passing check as a committed test

To keep the check, pass --name <flow> when you run it; the name is set at the start, not afterwards. When the run exits, Kane CLI writes .testmuai/tests/<flow>_test.md and an output-<flow>/ recordings folder next to it. Keep them if the run passed, move both into your repo and commit them. kane-cli testmd run <file> --agent then replays the unchanged steps instead of authoring them again. See Save a verified run as a committed test.

Kane CLI docs for verifying a change

Questions about verifying a change with Kane CLI

Does a coding agent need to write Playwright code to verify a change?

No. The objective is the test. Kane CLI works out the steps, drives Chrome and checks the result you described.

Can a coding agent verify a change in a mobile app?

Yes, for app builds. Add --target android or --target ios with --app <build> to run on a real device in the TestMu AI cloud from any machine (kane-cli 0.9.0 or later, on a plan that includes real devices). --target emulator and --target simulator, also with --app, run locally only on an Apple Silicon Mac with Android Studio or Xcode 16 or later. From other machines, run saved emulator and simulator tests on the cloud grid with kane-cli testrun run --remote. Web pages always run in desktop Chrome.

What does the developer get after a Kane CLI run?

A pass or fail summary, a Test Manager link (test_url, when the upload succeeded) and a sealed evidence pack with per-step screenshots and console and network logs. Kane CLI prints the pack path on stderr. To show it, start kane-cli evidence serve <path> in the background, because it keeps serving until stopped, and share the viewer link it prints.

Install Kane CLI so your coding agent verifies changes

Sign in once, then add the Kane CLI skill to Claude Code, Codex CLI or Gemini CLI, or commit the AGENTS.md file to your repo. Your agent can then check each change in Chrome before it reports the work as done.

Start free