@ancha-labs/cli 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ Ancha gives an AI agent the other side of its job: stateful replicas of the tool
11
11
 
12
12
  Before the CLI is installed, run every command as `npx -y @ancha-labs/cli <command>`. After `npm install -g @ancha-labs/cli` (Node 24 or newer), run `ancha <command>`. Never run `npx` with the bare name `ancha`: that npm name is not this package.
13
13
 
14
- Add `--json` to every command. Runs print NDJSON events that end with `run_finished`; hosted imports print one result per saved test. `env list` and `sandbox list` return arrays; trace commands use the fields described in `ancha docs traces`. `ancha schema <kind> --json` prints the JSON Schema of `ancha.yaml`, scene files and these outputs. If your command can time out, give `ancha run` an `--idempotency-key <key>`: running it again with the same key returns the same run instead of starting another.
14
+ Add `--json` to every command. Runs print NDJSON events that end with `run_finished`; `ancha traces upload` prints the tests it made. `env list` and `sandbox list` return arrays; trace commands use the fields described in `ancha docs traces`. `ancha schema <kind> --json` prints the JSON Schema of `ancha.yaml`, test files (`scene.yaml`) and these outputs. If your command can time out, give `ancha run` an `--idempotency-key <key>`: running it again with the same key returns the same run instead of starting another.
15
15
 
16
16
  ## First steps
17
17
 
@@ -21,46 +21,48 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
21
21
  ancha --version || npm install -g @ancha-labs/cli
22
22
  ancha login
23
23
  ```
24
- 2. **Name the agent's command.** Run it in the agent's project: it writes `ancha.yaml`, and installs and runs nothing.
24
+ 2. **Set up the project.** Run it in the agent's project: it finds the command that starts the agent and how the agent takes its task, and writes both to `ancha.yaml`. It installs and runs nothing.
25
25
  ```sh
26
- ancha init --agent "<the command that starts your agent>"
26
+ ancha init
27
27
  ```
28
- 3. **Store the secrets it needs.** Run it in the agent's project: it stores the key in your workspace and names it under `agent.pass_env` in `ancha.yaml`, so the agent gets it in cloud runs. The value comes from your shell, never from an argument.
28
+ - To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
29
+ 3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
29
30
  ```sh
30
- ancha secrets set OPENAI_API_KEY
31
+ ancha secrets set ANTHROPIC_API_KEY
31
32
  ```
32
- 4. **Connect it.** A fresh machine in the cloud installs the project's dependencies and finds the agent's command; an agent served over HTTP also starts and answers.
33
+ 4. **Upload your agent.** A fresh machine in the cloud installs the project's dependencies and starts the agent once with a task. It says the agent is ready, or shows the end of its log.
33
34
  ```sh
34
- ancha doctor --on cloud
35
+ ancha agent upload
35
36
  ```
36
37
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
37
- 5. **Make a test from one production failure.** Take the trace of one run where the agent went wrong, with its tool calls and their results, and say what went wrong. The test lands in `scenes/from-traces/` and in your workspace.
38
+ 5. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
38
39
  ```sh
39
- ancha import trace.jsonl --expect "<what went wrong>" --json
40
+ ancha traces upload ./traces
40
41
  ```
41
- - A trace in Langfuse or LangSmith: `ancha import --from langfuse <trace id>`, or `--from langsmith`.
42
- - A trace your agent already sent to your workspace: `ancha traces --failed`, then `ancha pull <trace id> --expect "<what went wrong>"`.
43
- - The test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
42
+ - From Langfuse or LangSmith, with your keys on this computer: `ancha traces upload --from langfuse --limit 50`, or `--from langsmith`.
43
+ - A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
44
+ - Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
45
+ - A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
44
46
  6. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
45
47
  - Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
46
48
  - Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
47
- 7. **Run it in the cloud.** Three attempts of the test. The run says, check by check, whether production's failure happens again, and ends with the link to its result.
49
+ 7. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
48
50
  ```sh
49
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --json
51
+ ancha run
50
52
  ```
51
53
  - Your agent and its worlds run in the cloud, each attempt on a fresh machine of its own; a run keeps going when your laptop closes, and its results land in Runs.
52
- - `--concurrency <n>` sets how many attempts run at once.
54
+ - `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
53
55
  - `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
54
- - `ancha status --on cloud` shows which of these steps your workspace has done.
56
+ - `ancha status` shows which of these steps your workspace has done.
55
57
  8. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
56
58
  ```sh
57
59
  ancha baseline save before --from <run id>
58
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --compare before --json
60
+ ancha run --compare before
59
61
  ```
60
62
  - Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
61
63
  9. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
62
64
  ```sh
63
- ancha run --on local scenes/from-traces/<test>/scene.yaml --attempts 1 --json
65
+ ancha run --on local --attempts 1
64
66
  ```
65
67
  - Here the agent gets the keys in `agent.pass_env` from your shell, and model-graded checks need `OPENROUTER_API_KEY`.
66
68
  <!-- /ancha:first-steps -->
@@ -71,7 +73,8 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
71
73
  - The agent gets the workspace's secrets for the names in `agent.pass_env`, and its network reaches its tools and its model providers. Model-graded checks and the people in a world run on the workspace's model credit.
72
74
  - The `run_finished` event carries `url` (the result in the workspace) and `summary`, with `counts` of the attempts: requested, completed, invalid, skipped and cancelled. Interrupting the command stops the following, never the run: `ancha wait <run id>` follows it again, and `--detach` returns once the run is accepted.
73
75
  - `ancha explain <run id> --json` shows each failed check: what was expected, what happened, and the calls and world events behind it. Read it before guessing from the code; many bugs only show up with the world's data and timing.
74
- - `ancha status --on cloud --json` shows the workspace's checks (agent connected, traces imported, first graded cloud run) and the next command. In CI, `ANCHA_SERVER_URL` and `ANCHA_API_KEY` replace the login. More: `ancha docs cloud`.
76
+ - When every attempt ended before the agent did anything (it exited within seconds without a call, or its command could not start), the run, `ancha wait` and `ancha explain` say that first: "Your agent didn't run", the end of its log once, and the likely fix read from it, such as the `agent.env` line that gives the agent its task under the name it reads. `agentNeverRan` in the JSON carries the same. Make that fix first: the failed checks follow from it, and `ancha explain <run id> --all` lists them.
77
+ - `ancha status --json` shows the workspace's three steps (agent uploaded, traces uploaded, tests run in the cloud) and the next command. In CI, `ANCHA_SERVER_URL` and `ANCHA_API_KEY` replace the login. More: `ancha docs cloud`.
75
78
 
76
79
  ## An app, not a command
77
80
 
@@ -79,21 +82,21 @@ If the AI feature lives inside an app (a web app or API server with its database
79
82
 
80
83
  ## More from production traces
81
84
 
82
- `ancha import <trace file> --json` sends the trace to the workspace, which rebuilds the world and the checks, and writes the test to `scenes/from-traces/<name>/scene.yaml`. The test lists the questions one trace cannot settle, each with the default it uses. Ask the user for the answers; don't guess them. Pass them with `ancha pull <test id> --answer <question>=<value>`. `ancha import --offline <trace file> --json` makes the tests on this computer instead, one per conversation, and uploads nothing; there, `--answer` and `--force` go on the import.
85
+ `ancha traces upload <file or folder> --json` sends the traces to the workspace, which rebuilds each one's world and checks, and writes each test to `scenes/from-traces/<name>/scene.yaml`: runs that went fine and runs that failed. `--from langfuse` or `--from langsmith` takes the newest traces there instead (`--limit`, `--since`), with the keys in this shell. For one trace of a failure, `--expect "<what went wrong>"` adds a check for it. A test lists the questions one trace cannot settle, each with the default it uses. Ask the user for the answers; don't guess them. Pass them with `ancha pull <test id> --answer <question>=<value>`. `ancha import --offline <trace file> --json` makes the tests on this computer instead, one per conversation, and uploads nothing; there, `--answer` and `--force` go on the import.
83
86
 
84
- The test should fail the same way production did. If it doesn't, run it on this computer: `ancha traces diff <trace file> latest` shows the calls production made and the attempt didn't, and the import also lists the app's own setup calls, which the start script or an `app_call` has to make.
87
+ A test from a run that failed should fail the same way production did. If it doesn't, run it on this computer: `ancha traces diff <trace file> latest` shows the calls production made and the attempt didn't, and the import also lists the app's own setup calls, which the start script or an `app_call` has to make.
85
88
 
86
89
  If the user's workspace takes traces (their agents send them to it), each trace becomes a test there: `ancha pull --all --json` writes every test that is turned on (`--agent <name>` for one agent's), `ancha traces --failed --json` lists the ones where production failed a check, `ancha traces show <id> --json` previews the test, and `ancha pull <id> --json` writes one, with `--answer` for its questions. Checks you add to a pulled `scene.yaml` stay when you pull a newer version; any other edit stops the pull. More: `ancha docs traces`.
87
90
 
88
91
  ## Other tests
89
92
 
90
- The starter scene `ancha init` writes when `scenes/` holds no tests only proves that the agent reaches each tool. For the agent's real job beyond its traces, `ancha test new "<the test in one sentence>" --json` drafts a test with people for the project's world (`ancha init --intent "<company and scenario>"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a scene can make on it. More: `ancha docs scenes`.
93
+ The starter test `ancha init` writes when `scenes/` holds no tests only proves that the agent reaches each tool. For the agent's real job beyond its traces, `ancha test new "<the test in one sentence>" --json` drafts a test with people for the project's world (`ancha init --intent "<company and scenario>"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a test can make on it. More: `ancha docs scenes`.
91
94
 
92
95
  ## The rule
93
96
 
94
- Fix the agent, not `ancha.yaml`, the scenes or their checks. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.
97
+ Fix the agent, not the tests or their checks. `ancha.yaml` says how to start the agent and give it its task and keys: change it for that, never to make a check pass. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.
95
98
 
96
- Never give the agent under test the scenes, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.
99
+ Never give the agent under test the tests, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.
97
100
 
98
101
  ## What the agent gets
99
102
 
@@ -103,7 +106,7 @@ Each attempt gives the agent its tools as environment variables, with fake crede
103
106
  - GitHub: `GITHUB_API_URL`, `GITHUB_TOKEN`
104
107
  - Datadog: `DATADOG_API_URL`, `DD_API_KEY`, `DD_APP_KEY`
105
108
  - PagerDuty: `PAGERDUTY_API_URL`, `PAGERDUTY_API_TOKEN`, `PAGERDUTY_FROM_EMAIL`, `PAGERDUTY_ROUTING_KEY`
106
- - the same pattern for the other tools in the world; `ANCHA_TASK` carries a command-line task.
109
+ - the same pattern for the other tools in the world; `ANCHA_TASK` carries a command-line task, and `ANCHA_TASK_FILE` names a file holding it. An agent that reads its task under another name gets it with `agent.env: { MY_TASK: "{{task}}" }` (`{{task_file}}` for the file); `ancha init` writes that line when it finds the name.
107
110
 
108
111
  `ancha connect <tool> --lang ts|py` prints the SDK settings. `ancha twins coverage <tool>` lists the endpoints each replica implements.
109
112
 
@@ -114,8 +117,8 @@ The agent's own keys are the names in `agent.pass_env` in `ancha.yaml`, such as
114
117
  ## When something fails
115
118
 
116
119
  - Exit 1: a check failed or the comparison regressed (a single check's drop counts, see `comparison.droppedChecks`). Run `ancha explain <run id> --json`.
117
- - Exit 2: usage, config, scene or authentication error, or a cancelled cloud run. `AUTH_INVALID` means `ancha login` again or a valid `ANCHA_API_KEY`; `CONFIG_INVALID` naming a workspace secret means `ancha secrets set NAME`. Read the `hint`.
118
- - Exit 3: infrastructure, or an attempt the harness couldn't run or grade. It counts as invalid, never as a failed check, so it's not the agent's fault; run again, and `ancha doctor --on cloud --json` if it repeats.
120
+ - Exit 2: usage, config, test file or authentication error, or a cancelled cloud run. `AUTH_INVALID` means `ancha login` again or a valid `ANCHA_API_KEY`; `CONFIG_INVALID` naming a workspace secret means `ancha secrets set NAME`. Read the `hint`.
121
+ - Exit 3: infrastructure, or an attempt the harness couldn't run or grade. It counts as invalid, never as a failed check, so it's not the agent's fault; run again, and `ancha agent upload --json` if it repeats.
119
122
  - Exit 4, only with `--strict`: an endpoint coverage error or a verdict using simulated tool answers. The summary names the tests, trials and evaluated checks using those answers. `ancha explain` lists endpoint errors; `ancha twins coverage <tool>` shows the endpoint inventory.
120
123
 
121
124
  Read the error's stable `code` and `message`, then follow its `hint` when provided. More: `ancha docs`, `ancha docs <topic>` for setup, run, traces, explain, compare, scenes, integrations, cloud and playgrounds, and https://docs.ancha.io/coding-agents.
@@ -6,52 +6,54 @@
6
6
  ancha --version || npm install -g @ancha-labs/cli
7
7
  ancha login
8
8
  ```
9
- 2. **Name the agent's command.** Run it in the agent's project: it writes `ancha.yaml`, and installs and runs nothing.
9
+ 2. **Set up the project.** Run it in the agent's project: it finds the command that starts the agent and how the agent takes its task, and writes both to `ancha.yaml`. It installs and runs nothing.
10
10
  ```sh
11
- ancha init --agent "<the command that starts your agent>"
11
+ ancha init
12
12
  ```
13
- 3. **Store the secrets it needs.** Run it in the agent's project: it stores the key in your workspace and names it under `agent.pass_env` in `ancha.yaml`, so the agent gets it in cloud runs. The value comes from your shell, never from an argument.
13
+ - To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
14
+ 3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
14
15
  ```sh
15
- ancha secrets set OPENAI_API_KEY
16
+ ancha secrets set ANTHROPIC_API_KEY
16
17
  ```
17
- 4. **Connect it.** A fresh machine in the cloud installs the project's dependencies and finds the agent's command; an agent served over HTTP also starts and answers.
18
+ 4. **Upload your agent.** A fresh machine in the cloud installs the project's dependencies and starts the agent once with a task. It says the agent is ready, or shows the end of its log.
18
19
  ```sh
19
- ancha doctor --on cloud
20
+ ancha agent upload
20
21
  ```
21
22
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
22
- 5. **Make a test from one production failure.** Take the trace of one run where the agent went wrong, with its tool calls and their results, and say what went wrong. The test lands in `scenes/from-traces/` and in your workspace.
23
+ 5. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
23
24
  ```sh
24
- ancha import trace.jsonl --expect "<what went wrong>" --json
25
+ ancha traces upload ./traces
25
26
  ```
26
- - A trace in Langfuse or LangSmith: `ancha import --from langfuse <trace id>`, or `--from langsmith`.
27
- - A trace your agent already sent to your workspace: `ancha traces --failed`, then `ancha pull <trace id> --expect "<what went wrong>"`.
28
- - The test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
27
+ - From Langfuse or LangSmith, with your keys on this computer: `ancha traces upload --from langfuse --limit 50`, or `--from langsmith`.
28
+ - A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
29
+ - Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
30
+ - A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
29
31
  6. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
30
32
  - Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
31
33
  - Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
32
- 7. **Run it in the cloud.** Three attempts of the test. The run says, check by check, whether production's failure happens again, and ends with the link to its result.
34
+ 7. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
33
35
  ```sh
34
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --json
36
+ ancha run
35
37
  ```
36
38
  - Your agent and its worlds run in the cloud, each attempt on a fresh machine of its own; a run keeps going when your laptop closes, and its results land in Runs.
37
- - `--concurrency <n>` sets how many attempts run at once.
39
+ - `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
38
40
  - `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
39
- - `ancha status --on cloud` shows which of these steps your workspace has done.
41
+ - `ancha status` shows which of these steps your workspace has done.
40
42
  8. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
41
43
  ```sh
42
44
  ancha baseline save before --from <run id>
43
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --compare before --json
45
+ ancha run --compare before
44
46
  ```
45
47
  - Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
46
48
  9. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
47
49
  ```sh
48
- ancha run --on local scenes/from-traces/<test>/scene.yaml --attempts 1 --json
50
+ ancha run --on local --attempts 1
49
51
  ```
50
52
  - Here the agent gets the keys in `agent.pass_env` from your shell, and model-graded checks need `OPENROUTER_API_KEY`.
51
53
 
52
- Fix the agent, not `ancha.yaml`, the scenes or their checks. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.
54
+ Fix the agent, not the tests or their checks. `ancha.yaml` says how to start the agent and give it its task and keys: change it for that, never to make a check pass. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.
53
55
 
54
- Never give the agent under test the scenes, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.
56
+ Never give the agent under test the tests, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.
55
57
 
56
58
  Full instructions: .claude/skills/ancha/SKILL.md, or `ancha docs cloud`.
57
59
  <!-- ancha:end -->
@@ -19,14 +19,14 @@ scenes: [ancha/scenes/*.yaml]
19
19
  trials: 3
20
20
  ```
21
21
 
22
- `ancha run --dry-run` checks this file and every scene and starts nothing.
22
+ `ancha run --dry-run` checks this file and every test and starts nothing.
23
23
 
24
24
  - `{{agent.port}}` is reserved for the trial, so the health route and the event routes need nothing Ancha-specific.
25
25
  - `clock: node` needs `start`. Apps in other runtimes keep real time: give them short thresholds in their seeded settings instead.
26
26
 
27
27
  ## The start script
28
28
 
29
- - From your shell it gets only a base set (`PATH`, `HOME`, the locale and the like). It also gets Ancha's variables (`ANCHA_AGENT_PORT`, `ANCHA_TRIAL` …), the variables of every tool in the scene (`ancha connect <tool> --json` lists them) and `agent.env`. Set database and cache URLs and the app's test secrets in the script. A real key, such as the app's model key, goes in `agent.pass_env` by name (or `ancha run --pass-env NAME`): its value stays in your shell, not in a script you commit.
29
+ - From your shell it gets only a base set (`PATH`, `HOME`, the locale and the like). It also gets Ancha's variables (`ANCHA_AGENT_PORT`, `ANCHA_TRIAL` …), the variables of every tool in the test (`ancha connect <tool> --json` lists them) and `agent.env`. Set database and cache URLs and the app's test secrets in the script. A real key, such as the app's model key, goes in `agent.pass_env` by name (or `ancha run --pass-env NAME`): its value stays in your shell, not in a script you commit.
30
30
  - Every trial is a new world with new URLs and tokens, so every trial starts the app clean:
31
31
  1. restore the database from a template copy (`CREATE DATABASE app_trial TEMPLATE app_base`, with `app_base` migrated once);
32
32
  2. flush caches and queues the tests own;
@@ -41,10 +41,10 @@ trials: 3
41
41
 
42
42
  - Use the app's base-URL setting if it has one; `ancha connect <tool> --lang ts|py` prints the SDK settings. If the SDK has none, add a development-only initializer that reads the tool's variable and does nothing when it is unset. Keep app changes that small and say why in a comment.
43
43
  - Google clients keep only the host of a `rootUrl` set on the client; Ancha routes those calls by their token.
44
- - Gmail reaches an app the way it does in production: the app calls `users.watch`, and the world then pushes Pub/Sub notifications to `agent.url`. If the app registers its watch on a schedule, call that route with an `app_call` early in the scene. The world gives `GMAIL_API_URL`, `GMAIL_ACCESS_TOKEN` and `GMAIL_ADDRESS`, the mailbox's address (`{{gmail.url}}`, `{{gmail.token}}`, `{{gmail.address}}`); `GET /gmail/v1/users/me/profile` answers the same address, as in Gmail. `ancha connect gmail --lang ts` prints the client settings.
45
- - Identifiers a scene relies on (an inbox token, a cron secret, an API key the world sends) should be fixed values your seed creates, because a scene is static.
44
+ - Gmail reaches an app the way it does in production: the app calls `users.watch`, and the world then pushes Pub/Sub notifications to `agent.url`. If the app registers its watch on a schedule, call that route with an `app_call` early in the test. The world gives `GMAIL_API_URL`, `GMAIL_ACCESS_TOKEN` and `GMAIL_ADDRESS`, the mailbox's address (`{{gmail.url}}`, `{{gmail.token}}`, `{{gmail.address}}`); `GET /gmail/v1/users/me/profile` answers the same address, as in Gmail. `ancha connect gmail --lang ts` prints the client settings.
45
+ - Identifiers a test relies on (an inbox token, a cron secret, an API key the world sends) should be fixed values your seed creates, because a test is static.
46
46
 
47
- ## Scenes for an app
47
+ ## Tests for an app
48
48
 
49
49
  ```yaml
50
50
  id: stale-question
@@ -77,14 +77,14 @@ checks:
77
77
 
78
78
  - `app_calls` take `at`, `method` (default GET), `path`, `headers` and `body`; they go to the origin of `ready_url`.
79
79
  - `gmail.send` takes `from`, `to`, `cc`, `subject`, `body`, `in_reply_to` and `ref`. The `gmail.thread` check takes `of` (a message ref), `label` with `present`, `drafts_gte`, `drafts_lte` and `messages_gte`.
80
- - People who answer like a person go in the scene's `people:` (`ancha schema scene` lists every field). One with a Gmail account reads the mail delivered to that mailbox, which must be in `seed.gmail.mailboxes`, and replies in the thread: `{ ref: tom, name: Tom, role: a client who answers email himself within a day or two, accounts: { gmail: tom@client.example }, replies_after: 1d..2d }`. People call a model with your `OPENROUTER_API_KEY`, or `ANCHA_PEOPLE_BASE_URL` and `ANCHA_PEOPLE_API_KEY` (`ancha docs cloud`). `ancha twins seed <tool> --json` prints each tool's seed fields and checks.
81
- - Make every check able to fail. Run a scene once against a build with the feature broken, or also check the state in between (the label the app should have removed). A check can pass for the wrong reason: a reminder that never comes because the scheduled call ran too early proves nothing.
80
+ - People who answer like a person go in the test's `people:` (`ancha schema scene` lists every field). One with a Gmail account reads the mail delivered to that mailbox, which must be in `seed.gmail.mailboxes`, and replies in the thread: `{ ref: tom, name: Tom, role: a client who answers email himself within a day or two, accounts: { gmail: tom@client.example }, replies_after: 1d..2d }`. People call a model with your `OPENROUTER_API_KEY`, or `ANCHA_PEOPLE_BASE_URL` and `ANCHA_PEOPLE_API_KEY` (`ancha docs cloud`). `ancha twins seed <tool> --json` prints each tool's seed fields and checks.
81
+ - Make every check able to fail. Run a test once against a build with the feature broken, or also check the state in between (the label the app should have removed). A check can pass for the wrong reason: a reminder that never comes because the scheduled call ran too early proves nothing.
82
82
 
83
83
  ## From a production trace, on this computer
84
84
 
85
85
  1. `ancha import --offline <trace file> --json` reads an Ancha Trace IR file, or an OTLP JSON export whose spans carry the bodies of the app's calls to its tools. It writes `scenes/from-traces/trace-<id>/scene.yaml` and `provenance.json`; nothing is uploaded.
86
86
  2. It lists the questions one trace cannot settle, each with the default the test uses. Examples: should a label the app added still be on the thread at the end, and what header do the app's scheduled calls carry? Ask the user, then import again with `--answer <id>=<value>` for each and `--force`.
87
- 3. Run the scene against the build that failed in production. It should fail the way production did. Then fix the app and run again.
87
+ 3. Run the test against the build that failed in production. It should fail the way production did. Then fix the app and run again.
88
88
 
89
89
  - A trace holds the app's calls, not what started each one. The import lists the calls production made before the first event the test replays: the app's own setup, such as a watch or its labels. The test has them only if the app makes them when it starts, or the start script or an `app_call` does.
90
90
  - When a test does not fail the way production did, `ancha traces diff <trace file> <run>/<trial>` lists the calls only production made, the ones only the trial made, and the first call where their orders part. A call production made and the trial didn't (labels created at setup, a settings read) usually points at what the seed lacks.
@@ -14,77 +14,80 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
14
14
  ancha --version || npm install -g @ancha-labs/cli
15
15
  ancha login
16
16
  ```
17
- 2. **Name the agent's command.** Run it in the agent's project: it writes `ancha.yaml`, and installs and runs nothing.
17
+ 2. **Set up the project.** Run it in the agent's project: it finds the command that starts the agent and how the agent takes its task, and writes both to `ancha.yaml`. It installs and runs nothing.
18
18
  ```sh
19
- ancha init --agent "<the command that starts your agent>"
19
+ ancha init
20
20
  ```
21
- 3. **Store the secrets it needs.** Run it in the agent's project: it stores the key in your workspace and names it under `agent.pass_env` in `ancha.yaml`, so the agent gets it in cloud runs. The value comes from your shell, never from an argument.
21
+ - To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
22
+ 3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
22
23
  ```sh
23
- ancha secrets set OPENAI_API_KEY
24
+ ancha secrets set ANTHROPIC_API_KEY
24
25
  ```
25
- 4. **Connect it.** A fresh machine in the cloud installs the project's dependencies and finds the agent's command; an agent served over HTTP also starts and answers.
26
+ 4. **Upload your agent.** A fresh machine in the cloud installs the project's dependencies and starts the agent once with a task. It says the agent is ready, or shows the end of its log.
26
27
  ```sh
27
- ancha doctor --on cloud
28
+ ancha agent upload
28
29
  ```
29
30
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
30
- 5. **Make a test from one production failure.** Take the trace of one run where the agent went wrong, with its tool calls and their results, and say what went wrong. The test lands in `scenes/from-traces/` and in your workspace.
31
+ 5. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
31
32
  ```sh
32
- ancha import trace.jsonl --expect "<what went wrong>" --json
33
+ ancha traces upload ./traces
33
34
  ```
34
- - A trace in Langfuse or LangSmith: `ancha import --from langfuse <trace id>`, or `--from langsmith`.
35
- - A trace your agent already sent to your workspace: `ancha traces --failed`, then `ancha pull <trace id> --expect "<what went wrong>"`.
36
- - The test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
35
+ - From Langfuse or LangSmith, with your keys on this computer: `ancha traces upload --from langfuse --limit 50`, or `--from langsmith`.
36
+ - A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
37
+ - Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
38
+ - A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
37
39
  6. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
38
40
  - Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
39
41
  - Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
40
- 7. **Run it in the cloud.** Three attempts of the test. The run says, check by check, whether production's failure happens again, and ends with the link to its result.
42
+ 7. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
41
43
  ```sh
42
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --json
44
+ ancha run
43
45
  ```
44
46
  - Your agent and its worlds run in the cloud, each attempt on a fresh machine of its own; a run keeps going when your laptop closes, and its results land in Runs.
45
- - `--concurrency <n>` sets how many attempts run at once.
47
+ - `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
46
48
  - `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
47
- - `ancha status --on cloud` shows which of these steps your workspace has done.
49
+ - `ancha status` shows which of these steps your workspace has done.
48
50
  8. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
49
51
  ```sh
50
52
  ancha baseline save before --from <run id>
51
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --compare before --json
53
+ ancha run --compare before
52
54
  ```
53
55
  - Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
54
56
  9. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
55
57
  ```sh
56
- ancha run --on local scenes/from-traces/<test>/scene.yaml --attempts 1 --json
58
+ ancha run --on local --attempts 1
57
59
  ```
58
60
  - Here the agent gets the keys in `agent.pass_env` from your shell, and model-graded checks need `OPENROUTER_API_KEY`.
59
61
  <!-- /ancha:first-steps -->
60
62
 
61
63
  ## Sign in once
62
64
 
63
- `ancha login` prints a link and a code and opens the browser; the engineer approves this computer once (`--no-browser` only prints the link). With `--json` the first line is `{"event": "login_pending", "verificationUrl", "userCode", "expiresIn"}`, for a coding agent to show its user, and the last is the saved login. The CLI saves an API key for the workspace in `~/.config/ancha/credentials.json` (mode 0600; `ANCHA_CREDENTIALS_FILE` moves it). A process started without `HOME` (or `XDG_CONFIG_HOME`) has no saved login. After it signs in, `ancha login` prints the workspace's checks (below).
65
+ `ancha login` prints a link and a code and opens the browser; the engineer approves this computer once (`--no-browser` only prints the link). With `--json` the first line is `{"event": "login_pending", "verificationUrl", "userCode", "expiresIn"}`, for a coding agent to show its user, and the last is the saved login. The CLI saves an API key for the workspace in `~/.config/ancha/credentials.json` (mode 0600; `ANCHA_CREDENTIALS_FILE` moves it). A process started without `HOME` (or `XDG_CONFIG_HOME`) has no saved login. After it signs in, `ancha login` prints the workspace's first steps, done or not (below).
64
66
 
65
67
  `ancha whoami --json` shows the workspace and where that choice came from (`--server-url`, `server.url` in `ancha.yaml`, `ANCHA_SERVER_URL`, or the saved login). `ancha whoami --verify` also asks the server whether it accepts the key. `ancha logout` forgets the saved login.
66
68
 
67
- ## Connect the agent
69
+ ## Upload the agent
68
70
 
69
- `ancha doctor --on cloud` checks the agent where its tests run, before any test exists. A fresh machine installs the project's dependencies and finds the agent's command there; an agent served over HTTP (`agent.url`) also starts and answers its ready check. That marks the agent connected in the workspace's checks, and the command prints the link to the connection.
71
+ `ancha agent upload` (also `ancha doctor --on cloud`) checks the agent where its tests run, before any test exists. A fresh machine installs the project's dependencies and starts the agent once with a task, through the same launcher and variables as an attempt: an agent that exits 0, or is still working after 20 seconds, is ready. One that exits with an error shows its exit code, the end of its log and, when the log names where it looks for its task, the `ancha.yaml` line that gives it there. An agent served over HTTP (`agent.url`) starts and answers its ready check. That marks the agent uploaded in the workspace's first steps, and the command prints the link to the upload.
70
72
 
71
73
  The install follows the project's own files, Node and Python alike: a Node lockfile installs exactly what it locks, with its package manager, and a `package.json` without one runs `npm install`; `uv.lock` and `pyproject.toml` run `uv sync`, and `requirements.txt` installs with pip into `.venv`. `agent.install` in `ancha.yaml` sets the command instead, for example `agent: { install: "npm ci && npm run build" }`. The machine has Node 24 and Python 3.12 with their package managers. The install runs as its own user with public internet; the agent then runs as another, and its network reaches only its tools and its model providers.
72
74
 
73
75
  ## Run tests in the cloud
74
76
 
75
77
  ```sh
76
- ancha run --on cloud scenes/from-traces/<test>/scene.yaml --attempts 3 --concurrency 3 --json
78
+ ancha run --on cloud
77
79
  ```
78
80
 
79
- - `--attempts <n>` (also `-n`, `--trials`) is the number of attempts per test. Each attempt is independent: its own machine, agent process, memory and tool state. `--concurrency <n>` (also `--parallel`) is how many run at once, up to the workspace's cap; without it, `parallel` in `ancha.yaml` decides, and `ancha init` writes 1. The summary records the concurrency asked for and the one the run had.
80
- - A workspace runs 3 attempts at once and up to 30 in a run (a workspace with hosted runs: 10 and 150); an attempt has 15 minutes and a run 2 hours. Cloud runs count toward the workspace's machine hours. The summary's `caps` and the run's last lines name the caps it ran under.
81
- - Without a path, the run takes the tests `scenes:` in `ancha.yaml` names.
81
+ - `--attempts <n>` (also `-n`, `--trials`) is the number of attempts per test. Each attempt is independent: its own machine, agent process, memory and tool state. `--concurrency <n>` (also `--parallel`) is how many run at once, up to the workspace's cap; without it, `parallel` in `ancha.yaml` decides, and `ancha init` writes 3. The summary records the concurrency asked for and the one the run had.
82
+ - A workspace runs 3 attempts at once and up to 150 in a run (a workspace with hosted runs: 10 at once); an attempt has 15 minutes and a run 2 hours. Cloud runs count toward the workspace's machine hours. The summary's `caps` and the run's last lines name the caps it ran under.
83
+ - Without a path, the run takes every test `scenes:` in `ancha.yaml` names (by default `scenes/**/scene.yaml`, so the tests your traces made too).
82
84
  - The project goes up as one bundle: the agent's files, without hidden directories, dependencies or credential-like files, and the tests with their worlds and checks. Those stay with the grader: the agent never sees them.
83
85
  - The first attempt runs ahead, and the others start once its agent has started.
86
+ - When every attempt ended before the agent did anything (it exited with an error within 5 seconds without a call, or its command could not start), the run's last lines say that first: "Your agent didn't run: it exited with code 1 within 96 ms in all 3 attempts", the end of its log from the cloud machine, the likely fix read from that log, and the commands to run again. The checks that failed because of it are one line; `ancha explain <run id> --all` lists them. With `--json`, `run_finished` carries the same as `agentNeverRan`.
84
87
  - The agent gets Ancha's and the tools' variables, `agent.env`, and the workspace's secrets for the names in `agent.pass_env`, as they were when the run was accepted. Its model providers are `openrouter.ai`, `api.openai.com` and `api.anthropic.com`, or the ones `agent.execution.modelHosts` names.
85
88
  - Model-graded checks and the people in a world run on the workspace's model credit, so a cloud run needs no `OPENROUTER_API_KEY`.
86
89
  - `--agent`, `--seed`, `--strict`, `--min-pass-rate`, `--allow-unwrapped` and `--idempotency-key` mean what they mean on this computer. `--compare <baseline>` compares with a saved baseline: `ancha baseline save before --from <run id>`, fix the agent, then `--compare before`. A cloud run's keys come from the workspace, so `--pass-env` and `--inherit-env` belong to runs on this computer, and its results live in the workspace, so it takes no `--out` or `--upload`.
87
- - With `--json` the run announces acceptance with `run_submitted` (`run_detached` with `--detach`), carrying `target: "cloud"` and adding `defaulted: true` when the saved login chose cloud. A followed run prints NDJSON events and ends with `run_finished`: `url` is the result, `summary` the verdict with the attempt and check counts, and `next` the command that explains it. The exit codes are `ancha run`'s: 0 when every check passes, 1 when a check failed, 3 when an attempt could not run or be graded, 4 with `--strict` for an endpoint coverage error or a verdict using simulated tool answers, and 2 for a cancelled run.
90
+ - With `--json` the run announces acceptance with `run_submitted` (`run_detached` with `--detach`), carrying `target: "cloud"` and adding `defaulted: true` when the saved login chose cloud. A followed run prints NDJSON events and ends with `run_finished`: `url` is the result, `summary` the verdict with the attempt and check counts, and `next` the commands to run next. The exit codes are `ancha run`'s: 0 when every check passes, 1 when a check failed, 3 when an attempt could not run or be graded, 4 with `--strict` for an endpoint coverage error or a verdict using simulated tool answers, and 2 for a cancelled run.
88
91
 
89
92
  ## Follow a run from anywhere
90
93
 
@@ -93,17 +96,17 @@ A run keeps going when the command stops: Ctrl-C or a dropped connection ends on
93
96
  ```sh
94
97
  ancha wait <run id> # follow it to the end; exits with the run's exit code
95
98
  ancha status <run id> # where it is now
96
- ancha explain <run id> --json # each failed check: expected, actual, and the calls behind it
99
+ ancha explain <run id> # each failed check: expected, actual, and the calls behind it
97
100
  ancha runs show <run id> # the run and its attempts
98
101
  ```
99
102
 
100
- ## The checks
103
+ ## The first steps, done or not
101
104
 
102
- `ancha status --on cloud` prints the workspace's three checks, the ones Get started shows, and the next command:
105
+ `ancha status` prints the workspace's three steps, the ones Get started shows, and the next command:
103
106
 
104
- - **Agent connected**: `ancha doctor --on cloud` connected this project's agent.
105
- - **Traces imported**: the workspace holds a trace, or a test made from one.
106
- - **First graded cloud run**: a cloud run graded at least one check on an attempt that ran.
107
+ - **Agent uploaded**: `ancha agent upload` started this project's agent with a task, or a cloud run graded it.
108
+ - **Traces uploaded**: the workspace holds a trace, or a test made from one.
109
+ - **Tests run in the cloud**: a cloud run graded at least one check on an attempt that ran.
107
110
 
108
111
  With `--json`: `{"version": 1, "workspace", "checks": {"agentConnected": {"done", "agentId", "at"}, "tracesImported": {"done", "traceId", "at"}, "firstGradedCloudRun": {"done", "runId", "at"}}, "nextCommand"}`.
109
112
 
@@ -141,7 +144,7 @@ The key needs the Write tier or Admin. `ANCHA_API_KEY` wins over a saved login;
141
144
  ## What else the workspace holds
142
145
 
143
146
  - `ancha agent` (except `agent detect`), `ancha world list|show|create|update|archive`, `ancha test`, `ancha runs` and `ancha attempt` work on the workspace's agents, worlds, tests and runs, the ones the console shows, and every JSON object they print names its `workspace`. `--local` keeps them on this project's `.ancha/`. `ancha playground` stays on this computer.
144
- - `ancha runs start --agent <id> --world <saved-world> --test task.yaml --json` runs a connected agent's tasks in a saved world of the workspace.
147
+ - `ancha runs start --agent <id> --world <saved-world> --test task.yaml --json` runs an uploaded agent's tasks in a saved world of the workspace.
145
148
  - `ancha doctor`, `ancha world up`, `ancha env`, `ancha sandbox` and `ancha replay` create their worlds on this computer, also when you're logged in. `--server-url`, `server.url` in `ancha.yaml` or `ANCHA_SERVER_URL` put them on that server instead, for example the workspace's world server `https://app.ancha.io/t/<workspace>`.
146
149
 
147
150
  ## People and world generation
@@ -4,10 +4,10 @@ Run `ancha run --json`, then `ancha baseline save before` to freeze a completed
4
4
 
5
5
  `ancha baseline save <name> [--from <runId|latest>] [--force] [--out <runs-dir>]` defaults to the most recent run from this project, on this computer or in the workspace; `--from run_cloud_…` takes a cloud run's summary from the workspace. It copies the summary into `.ancha/baselines/<name>.json`, or a baselines directory next to a custom runs directory. Later changes to latest leave the snapshot intact. Saving an existing name requires --force. Names use 1–64 letters, digits, hyphens or underscores; latest and names beginning with run_ are reserved. `ancha run --compare <runId|baseline-name>` resolves its reference before starting agents or updating latest.
6
6
 
7
- Comparison requires exactly matching scene sets and normalized scene fingerprints, including their success criteria. YAML formatting and object key order do not affect fingerprints. Scene content changes require a fresh reference. Trial counts may differ. References containing invalid harness trials must be rerun with a healthy harness; genuine agent failures remain valid references. Legacy summaries remain readable with report/explain, but summaries without scene fingerprints cannot establish a verified comparison.
7
+ Comparison requires exactly matching sets of tests and normalized test fingerprints, including their success criteria. YAML formatting and object key order do not affect fingerprints. Test content changes require a fresh reference. Trial counts may differ. References containing invalid harness trials must be rerun with a healthy harness; genuine agent failures remain valid references. Legacy summaries remain readable with report/explain, but summaries without scene fingerprints cannot establish a verified comparison.
8
8
 
9
- `ancha report latest --html [--out <runs-dir>]` writes a self-contained offline report.html in that run's directory and returns its absolute path (JSON: runId and path). The trial matrix shows failed, passed, harness-invalid and skipped grading separately. Expand scenes for check outcomes and evidence. URLs and artifact paths are inert text; no remote assets are loaded.
9
+ `ancha report latest --html [--out <runs-dir>]` writes a self-contained offline report.html in that run's directory and returns its absolute path (JSON: runId and path). The trial matrix shows failed, passed, harness-invalid and skipped grading separately. Expand tests for check outcomes and evidence. URLs and artifact paths are inert text; no remote assets are loaded.
10
10
 
11
- Inspect per-scene pass-rate changes and check evidence, including invalid trials. Every required check is compared too: if one check's pass rate falls, the run regresses (exit 1) even when the scene's rate is unchanged, for example when one check went from 3/3 to 0/3 while another went from 0/3 to 3/3. Dropped checks are listed first, in the text and in `comparison.droppedChecks`. Missing or changed scenes reject comparison and require a fresh reference. A regression in a comparable scene can fail the run even when the overall threshold passes. Infrastructure-invalid trials take precedence, then strict coverage gaps, then failed thresholds or regressions.
11
+ Inspect per-test pass-rate changes and check evidence, including invalid trials. Every required check is compared too: if one check's pass rate falls, the run regresses (exit 1) even when the test's rate is unchanged, for example when one check went from 3/3 to 0/3 while another went from 0/3 to 3/3. Dropped checks are listed first, in the text and in `comparison.droppedChecks`. Missing or changed tests reject comparison and require a fresh reference. A regression in a comparable scene can fail the run even when the overall threshold passes. Infrastructure-invalid trials take precedence, then strict coverage gaps, then failed thresholds or regressions.
12
12
 
13
13
  Never use a run as its own before reference. Keep a trusted base reference separate from the modified agent's output.
@@ -1,8 +1,10 @@
1
1
  # Inspect a saved run
2
2
 
3
- `ancha explain latest --json` explains the most recent run from this project, on this computer or in the workspace; pass a run id for an earlier one, `--scene` and `--trial` to narrow it, and `--out <dir>` when the run used a custom output directory.
3
+ `ancha explain latest` explains the most recent run from this project, on this computer or in the workspace; pass a run id for an earlier one, `--scene` (a test's id) and `--trial` to narrow it, and `--out <dir>` when the run used a custom output directory.
4
4
 
5
- It reports, in order:
5
+ When every attempt ended before the agent did anything (it exited with an error within 5 seconds without a call, or its command could not start), it says that first: "Your agent didn't run: it exited with code 1 within 96 ms in all 3 attempts", the end of its log once, and the likely fix read from that log: the `agent.env` line that gives the agent its task under the name it reads (`env: { OFFBOARDING_TASK: "{{task}}" }`), the flag to add to `agent.command`, a key to pass, or a file or package it could not find. The failed checks are one line then; `--all` lists them, and `--scene` or `--trial` shows them for that test or attempt.
6
+
7
+ Otherwise it reports, in order:
6
8
 
7
9
  - harness issues: a part of Ancha that failed, which makes the trial invalid rather than a failure of the agent;
8
10
  - agents that crashed or timed out, with the end of `agent.log`, and, when it names a variable this shell has but the agent didn't get (`missing OPENROUTER_API_KEY`), the `--pass-env` that passes it;
@@ -10,15 +12,15 @@ It reports, in order:
10
12
  - coverage gaps, with or without `--strict`: "the agent called POST /api/chat.scheduleMessage, which the slack twin doesn't implement; it answered unknown_method". The agent's call may be right; check `ancha twins coverage <tool>` before changing it;
11
13
  - when the agent ran on this computer and no crash named a variable, how many of this shell's variables were withheld from it. If it needs one, such as a provider key, pass it with `--pass-env NAME` or `agent.pass_env`.
12
14
 
13
- JSON keys: `runId`, `agentIssues` (each with `exit`, `exitCode`, `log`, `logTail`, and a `hint` when its log names a withheld variable), `harnessIssues`, `failures` (each with `check`, `expected`, `actual`, `explanation`, `traceExcerpt`, and when the world recorded them `kind`, `evidence` (each with `type`, `simAt`, `at`, `from`, `to`, `where`, `excerpt`), `conversation` and `people`), `coverageGaps` (each with `service`, `method`, `path`, `count`, the twin's `status` and `error`, and a `hint`), `agentEnvironment` (`target`, and for this computer `inherited`, `withheld` and `withheldInLogs`, the withheld variables a crashed agent's log names), and `gradingWarnings` when a check produced one.
15
+ JSON keys: `runId`, `agentNeverRan` when the agent never ran (`attempts`, `tests`, `exit`, `exitCode`, `ms`, `logTail`, `log` on this computer, `fix`, `checksFailed`), `agentIssues` (each with `exit`, `exitCode`, `log`, `logTail`, and a `hint` when its log names a withheld variable), `harnessIssues`, `failures` (each with `check`, `expected`, `actual`, `explanation`, `traceExcerpt`, and when the world recorded them `kind`, `evidence` (each with `type`, `simAt`, `at`, `from`, `to`, `where`, `excerpt`), `conversation` and `people`), `coverageGaps` (each with `service`, `method`, `path`, `count`, the twin's `status` and `error`, and a `hint`), `agentEnvironment` (`target`, and for this computer `inherited`, `withheld` and `withheldInLogs`, the withheld variables a crashed agent's log names), and `gradingWarnings` when a check produced one.
14
16
 
15
- A clean process exit doesn't mean the task passed, and an invalid trial isn't an agent failure. The reference companions (`oracle.mjs`, `null.mjs`) prove the scene and harness behave.
17
+ A clean process exit doesn't mean the task passed, and an invalid trial isn't an agent failure. The reference companions (`oracle.mjs`, `null.mjs`) prove the test and harness behave.
16
18
 
17
- Fix the agent after reading the evidence, then prove the fix with `ancha run --compare before --json` against a saved reference: `ancha docs compare`.
19
+ Fix the agent after reading the evidence, then prove the fix with `ancha run --compare before` against a saved reference: `ancha docs compare`.
18
20
 
19
21
  ## Replay an attempt
20
22
 
21
- `ancha replay latest/trial-<scene>-1 --json` runs one attempt again: its world with the same seed, its people answering from what they said in it, and the agent as it is now (or `--agent "<command>"`). Name the attempt as `<run id or latest>/<trial directory>`, as it appears under the runs directory. The replay is saved as a new run, so `ancha explain` and `ancha report` read it.
23
+ `ancha replay latest/trial-<test>-1` runs one attempt again: its world with the same seed, its people answering from what they said in it, and the agent as it is now (or `--agent "<command>"`). Name the attempt as `<run id or latest>/<trial directory>`, as it appears under the runs directory. The replay is saved as a new run, so `ancha explain` and `ancha report` read it.
22
24
 
23
25
  It reports whether the agent acted differently and where: the first of its writes that differs from the attempt (`diverged`, with the recorded and the new call), then every check against the attempt's outcome (`was`). With the same agent, nothing diverges and no model is called. Once the agent acts differently, people answer live with `--people live` (your `OPENROUTER_API_KEY`, or the workspace's model credit after `ancha login`), or the replay stops there with `--people strict`, the default when there is no model. A replay stopped that way is invalid (exit 3, `invalidReason: "diverged"`): its checks say nothing about the agent. `ancha schema replay_finished` describes the JSON.
24
26