zcode-agent 1.3.1 → 1.4.0

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.
package/README.md CHANGED
@@ -1,27 +1,29 @@
1
1
  <p align="center">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/403b95529a796bc4050577ae2ea6d9fe3016e2ce/docs/assets/hero-dark.svg">
4
- <img src="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/403b95529a796bc4050577ae2ea6d9fe3016e2ce/docs/assets/hero-light.svg" width="960" alt="Your agent (Claude Code, Codex or any agent with a shell) writes the decisions and a task contract. zcode-agent runs parallel GLM-5.3 sessions that build, run their own checks and repair failures, and has a fresh GLM-5.3-Flash session judge screenshots. One handback line returns to your agent.">
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/main/docs/assets/hero-dark.svg">
4
+ <img src="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/main/docs/assets/hero-light.svg" width="960" alt="Your agent (Claude Code, Codex or any agent with a shell) writes the decisions and a task contract. zcode-agent runs parallel GLM-5.4 sessions that build, run their own checks and repair failures, and has a fresh GLM-5.3-Flash session judge screenshots. One handback line returns to your agent.">
5
5
  </picture>
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
9
  <a href="https://www.npmjs.com/package/zcode-agent"><img src="https://img.shields.io/npm/v/zcode-agent.svg?color=2E2A7A&label=npm" alt="npm version"></a>
10
10
  <img src="https://img.shields.io/badge/node-%E2%89%A522.13-2E2A7A" alt="node 22.13 or later">
11
- <img src="https://img.shields.io/badge/models-GLM--5.3%20%C2%B7%20GLM--5.3--Flash-1C7C54" alt="runs on GLM-5.3 and GLM-5.3-Flash">
11
+ <img src="https://img.shields.io/badge/models-GLM--5.4%20%C2%B7%20GLM--5.3%20%C2%B7%20GLM--5.3--Flash-1C7C54" alt="runs on GLM-5.4, GLM-5.3 and GLM-5.3-Flash">
12
12
  <a href="https://github.com/0xgeorgemathew/zcode-agent/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-2E2A7A" alt="MIT license"></a>
13
13
  </p>
14
14
 
15
15
  # zcode-agent
16
16
 
17
- zcode-agent is a command-line executor for any agent that can run a shell command: Claude Code, Codex, or your own. Your agent writes the decisions and a task contract. zcode-agent builds it with GLM-5.3, runs your checks itself, repairs what fails, and has a separate GLM-5.3-Flash session that never saw the code look at screenshots of the result. It returns one line of JSON. Your agent never reads the diff, re-runs the tests or opens a screenshot, so its expensive tokens go to decisions and exceptions.
17
+ zcode-agent is a command-line executor for any agent that can run a shell command: Claude Code, Codex, or your own. Your agent makes the decisions and writes a task contract. zcode-agent builds it with **GLM-5.4**, runs your checks itself, repairs what fails, and has a separate GLM-5.3-Flash session that never saw the code judge screenshots of the result. It hands back one line of JSON, so your agent's expensive tokens go to decisions and exceptions, not to reading diffs, re-running tests or opening screenshots.
18
18
 
19
19
  | | does | never does |
20
20
  |---|---|---|
21
21
  | **Your agent** | product, design and logic decisions; splits the work; answers questions | writes code, re-runs checks, looks at screenshots |
22
- | **zcode-agent** (GLM-5.3, or Flash with `--model flash`) | builds inside the paths it owns, runs subagents in parallel, runs the checks, fixes failures | invents anything user-visible the decisions left open, commits, deploys |
22
+ | **zcode-agent** (GLM-5.4 by default) | builds inside the paths it owns, runs subagents in parallel, runs the checks, fixes failures | invents anything user-visible the decisions left open, commits, deploys |
23
23
  | **The verifier** (a fresh GLM-5.3-Flash session) | serves the app, screenshots every viewport, quotes the text it can read, judges each criterion | edits files, trusts the DOM over the pixels |
24
24
 
25
+ It is also an [ACP](https://agentclientprotocol.com) agent: `zcode-agent acp` lets you chat with GLM-5.4 directly in T3 Code, Zed or any other Agent Client Protocol client. See [Use it in T3 Code, Zed or any ACP client](#use-it-in-t3-code-zed-or-any-acp-client).
26
+
25
27
  &nbsp;
26
28
 
27
29
  ## Quick start
@@ -39,11 +41,9 @@ npx zcode-agent task \
39
41
  "Fix the off-by-one in paginate.ts"
40
42
  ```
41
43
 
42
- To skip `npx`, install it once with `npm install -g zcode-agent`. It needs Node 22.13 or later.
43
-
44
- zcode-agent is also an [ACP](https://agentclientprotocol.com) agent: `zcode-agent acp` lets you chat with GLM-5.3 directly in T3 Code, Zed or any other Agent Client Protocol client. See [Use it in T3 Code, Zed or any ACP client](#use-it-in-t3-code-zed-or-any-acp-client).
44
+ To skip `npx`, install it once with `npm install -g zcode-agent`. It needs Node 22.13 or later and runs on macOS and Linux. Windows is not supported: checks run through `/bin/sh` and rely on POSIX process groups.
45
45
 
46
- **With the ZCode app installed, there is nothing to configure.** zcode-agent reads the app's Z.ai API key where it is stored (it never copies or prints it) and gives every session the app's MCP servers and skills. It leaves out remote MCP servers that sign in with OAuth, because a headless session can't complete the sign-in, and it skips a server that failed to connect for the next six hours (twice as long after each further failure, up to four days). The app's plugins, agent profiles and your global `AGENTS.md` stay out unless you pass `--inherit-desktop`. `--hermetic` leaves out the app's MCP servers and skills as well.
46
+ **With the ZCode app installed, there is nothing to configure.** zcode-agent reads the app's Z.ai API key where the app stores it (it never prints it) and gives every session the app's MCP servers and skills. Two kinds of server are left out: remote ones that sign in with OAuth, because a headless session can't complete the sign-in, and any that failed to connect in the last six hours (twice as long after each further failure, up to four days). The app's plugins, agent profiles and your global `AGENTS.md` stay out unless you pass `--inherit-desktop`. `--hermetic` leaves out the app's MCP servers and skills too; the Playwright browser server stays until you add `--no-browser`.
47
47
 
48
48
  **Without the app**, set an API key and install a browser for visual checks:
49
49
 
@@ -61,7 +61,43 @@ npx zcode-agent doctor \
61
61
 
62
62
  The engine comes with the package. `@zcode-agent/engine` is the headless ZCode engine, built unmodified from the Apache-2.0 source of [zai-org/ZCode](https://github.com/zai-org/ZCode) and pinned to the version zcode-agent is tested with.
63
63
 
64
- `zcode-agent skills install` copies the Claude Code skill to `~/.claude/skills/zcode-agent` and the Codex skill to `${CODEX_HOME:-~/.codex}/skills/zcode-agent`, and removes a pre-1.0 `zcode` skill if it finds one. Pass `claude` or `codex` to install one of them. `zcode-agent skills` shows what is installed and `zcode-agent skills uninstall` removes both. The package runs no install scripts. The skills themselves are in [`packages/cli/skills`](https://github.com/0xgeorgemathew/zcode-agent/blob/main/packages/cli/skills/README.md).
64
+ `zcode-agent skills install` copies the Claude Code skill to `~/.claude/skills/zcode-agent` and the Codex skill to `${CODEX_HOME:-~/.codex}/skills/zcode-agent`, and removes a pre-1.0 `zcode` skill if it finds one. `zcode-agent skills install claude` or `codex` installs one of them, `zcode-agent skills` shows what is installed, and `zcode-agent skills uninstall` removes both. The package runs no install scripts. The skills themselves are in [`packages/cli/skills`](https://github.com/0xgeorgemathew/zcode-agent/blob/main/packages/cli/skills/README.md).
65
+
66
+ &nbsp;
67
+
68
+ ## Models
69
+
70
+ Every command runs on **GLM-5.4** at effort `high` unless you say otherwise, on the command line and in `zcode-agent acp` alike.
71
+
72
+ | model | `--model` | context | reads images | use it for |
73
+ |---|---|---|---|---|
74
+ | **GLM-5.4** (default) | `glm-5.4`, `5.4`, `54` | 1M tokens | yes | everything, unless you have a reason not to |
75
+ | GLM-5.3 | `glm-5.3`, `5.3`, `53` | 1M tokens | no | the previous flagship, when you need its behaviour |
76
+ | GLM-5.3-Flash | `glm-5.3-flash`, `flash`, `5.3-flash`, `53f` | 200K tokens, as the engine runs it | yes | cheaper, faster work; it is also the visual verifier |
77
+
78
+ GLM-5.4 is Z.ai's newest model, released on 23 November 2026. Unlike GLM-5.3 it reads images, so the executor can look at its own screenshots and at images you attach. The independent visual verifier stays on GLM-5.3-Flash, the cheapest model that can see, so `--visual` costs the same whichever model builds.
79
+
80
+ `--effort` takes `low`, `high` (default) or `max` on all three models. A task contract can set `"model"` and `"effort"`, and flags override it; a plan sets them in the plan file. A resumed session keeps its model and effort unless you pass the flags again. Any other model, or an effort the model does not accept, exits 2 before anything starts.
81
+
82
+ <details>
83
+ <summary><b>How GLM-5.4 runs on the bundled engine, and what was measured</b></summary>
84
+
85
+ &nbsp;
86
+
87
+ The bundled engine (ZCode 0.16.9) predates GLM-5.4, and so does every ZCode release so far: their built-in Z.ai provider lists only GLM-5.3 and GLM-5.3-Flash, and the engine refuses a model it does not know. zcode-agent therefore registers GLM-5.4 itself, in each session's own provider config, the way the ZCode app registers a model you add by hand: the id goes on the Z.ai provider with a rule giving its context window, image input, reasoning levels and how a level is sent to the API (the mapping GLM-5.3 uses). Your ZCode app's files are never changed. When an engine ships that lists GLM-5.4, zcode-agent stops registering it and uses the engine's own settings.
88
+
89
+ Checked against Z.ai's API on release day, since Z.ai has not published a model page yet:
90
+
91
+ - The API serves the id `GLM-5.4`, and the engine runs it through this registration, with the ZCode app's config and with none (`npm run test:live`).
92
+ - It reads images: it returned the number written in a generated PNG. GLM-5.3 could not.
93
+ - It accepted a 521,000-token prompt, so the window is well past 200K. Z.ai's plan pages label it 1M, which is what zcode-agent reports.
94
+ - The API accepts up to 131,072 output tokens. zcode-agent registers the engine's GLM-5.3 limit of 128,000.
95
+ - Reasoning levels are registered as `low`, `high`, `max`, the levels GLM-5.3 has. The API does not reject other values for GLM-5.4, so this cannot be read from it.
96
+ - Z.ai has published no API price. See [Cost](#cost).
97
+
98
+ `zcode-agent doctor` shows the levels and image support in use for each model.
99
+
100
+ </details>
65
101
 
66
102
  &nbsp;
67
103
 
@@ -70,7 +106,7 @@ The engine comes with the package. `@zcode-agent/engine` is the headless ZCode e
70
106
  With the skill installed, your agent works in four steps. Only the first one costs much.
71
107
 
72
108
  1. **Decide.** Read the repo, then write down every user-visible and behavioural decision once, as short statements in a file such as `docs/decisions.md`: palette, copy, motion, validation rules, storage keys.
73
- 2. **Shape.** Pick one session, one session with units, parallel sessions, or a plan. The next section says which.
109
+ 2. **Shape.** One session, one session with units, parallel sessions, or a plan. [Split work only when it splits](#split-work-only-when-it-splits) says which.
74
110
  3. **Dispatch and wait.** One background `zcode-agent wait` or `zcode-agent plan wait`, with no polling.
75
111
  4. **Handle exceptions.** A `completed` session needs nothing. Any other status comes with the questions, the tail of the failing check, or the unmet criterion, and your agent answers with a one-line `zcode-agent resume`.
76
112
 
@@ -78,28 +114,13 @@ You can watch sessions while they run. Your agent doesn't need to.
78
114
 
79
115
  ```text
80
116
  $ zcode-agent watch
81
- api-auth completed 22m last: Bash 3m ago req 61 sub 0 $0.09
82
- settings-page running verifying round 1 31m last: Read 4s ago req 84 sub 2 $0.14
83
- billing-page running executing 31m last: Edit 12s ago req 77 sub 3 $0.12
84
- total $0.35 (3 sessions, Z.ai list price)
117
+ api-auth completed 22m last: Bash 3m ago req 61 sub 0 $0.09~
118
+ settings-page running verifying round 1 31m last: Read 4s ago req 84 sub 2 $0.14~
119
+ billing-page running executing 31m last: Edit 12s ago thinking 40s 2.1k chars req 77 sub 3 $0.12~
120
+ total $0.35~ (3 sessions, Z.ai list price; ~ = estimate)
85
121
  ```
86
122
 
87
- The line says `thinking` while a model request streams, so a long request doesn't look stuck. A running session with no engine event for 8 minutes gets `STALLED?` (`--stall-min` changes the threshold). Nothing happens automatically.
88
-
89
- &nbsp;
90
-
91
- ## Split work only when it splits
92
-
93
- Parallel work can cut wall time, and it is always optional. One well-specified session is correct for most tasks.
94
-
95
- | the work | shape |
96
- |---|---|
97
- | small, or tightly coupled | **one session** |
98
- | one deliverable with separable parts that share decisions | **one session with units**: a `--unit` per part, each run by a subagent, integrated by the session |
99
- | independent deliverables that own different paths | **parallel sessions**: `--detach` each, then one `wait` on all of them |
100
- | a shared base first, then parallel features | **a plan**: `plan run plan.json`, with `after` for the order |
101
-
102
- Split only when every concurrent session owns different paths, one session owns the shared files (`package.json`, lockfiles, router, global styles) and installs every dependency up front, and no piece waits on a decision another piece will make. Two to four sessions at a time is the useful range. More sessions compete for the API rate limit and your machine. zcode-agent refuses overlapping ownership with exit 7, and every session gets its own `ZCODE_PORT`, `ZCODE_OUT` and `ZCODE_TMP` so dev servers and build output don't collide.
123
+ A line says `thinking` or `writing` while a model request streams, so a long request doesn't look stuck. A running session with no engine event for 8 minutes gets `STALLED?` (`--stall-min` changes the threshold); nothing happens automatically. `~` marks an estimated amount, which today includes every GLM-5.4 session (see [Cost](#cost)).
103
124
 
104
125
  &nbsp;
105
126
 
@@ -131,24 +152,26 @@ visual
131
152
  - met all three plan cards are readable side by side at 1440 and stacked at 390 @390x844
132
153
  ```
133
154
 
134
- The summary goes to stdout and the live feed (phases, tools, subagents, check results) to stderr. With `--json` you get one machine-readable result line instead (see [Machine interface](#machine-interface)). For a small fix the objective alone is enough: `zcode-agent task "Fix the typo in the README heading"`.
155
+ The summary goes to stdout and the live feed (phases, tools, subagents, check results) to stderr. With `--json`, stdout carries NDJSON events and then one machine-readable result line, and `--quiet` leaves only the result line (see [Machine interface](#machine-interface)). For a small fix the objective alone is enough: `zcode-agent task "Fix the typo in the README heading"`.
156
+
157
+ **Checks** are shell commands zcode-agent runs in `--cwd` after the work, with `CI=1` set unless you set it. A check is over when its shell exits, and anything it left running in the background (a preview server started with `&`) is stopped with it. Each check gets `--check-timeout-ms`, or the time the run has left if that is less.
135
158
 
136
159
  ### What a status means
137
160
 
138
161
  | status | meaning | exit |
139
162
  |---|---|---|
140
163
  | `completed` | zcode-agent's own checks passed, the executor reports done, no criterion is unmet and nothing changed outside `--owns` | 0 |
141
- | `unverified` | the executor reports done, but there were no checks to run, so nothing confirms it | 9 |
164
+ | `unverified` | nothing confirms the work: there were no checks to run, or the checks passed but the executor gave no usable "done" report | 9 |
142
165
  | `partial` | work remains: the executor says so, a criterion is unmet, or files changed outside the owned paths | 8 |
143
166
  | `blocked` | the executor needs an answer; `questions` lists them with options and a recommendation | 10 |
144
- | `failed` | checks still fail after the repair turns (8), the engine or turn failed (5), or it timed out (124) | 5, 8, 124 |
145
- | `cancelled` | stopped by `zcode-agent cancel`, Ctrl-C or SIGTERM | 130 |
167
+ | `failed` | checks still fail after the repair turns (8), the engine or turn failed (5), the run ran out of time (124), or it never started (no key 3, engine missing 4) | 3, 4, 5, 8, 124 |
168
+ | `cancelled` | stopped by `zcode-agent cancel`, Ctrl-C, SIGTERM or a closed terminal (SIGHUP) | 130 |
146
169
 
147
- zcode-agent derives the status from what it observed, not from what the model claims. The model's own report is kept as `handback`, and `notVerified` lists anything zcode-agent could not check itself.
170
+ zcode-agent derives the status from what it observed, not from what the model claims. The model's own report is kept as `handback`, and `notVerified` lists anything zcode-agent could not check itself. `--timeout-ms` covers the whole run: engine start, the work, checks, repairs and the verifier. Running out anywhere is exit 124, and `zcode-agent resume <id> "continue"` picks up from the files already written.
148
171
 
149
172
  ### The contract
150
173
 
151
- Flags cover the common fields. For a larger handoff, pass `--task contract.json`, `--task brief.md`, or `--task -` to read stdin. Only `objective` is required, and zcode-agent rejects unknown keys so a typo never drops a requirement silently.
174
+ Flags cover the common fields. For a larger handoff, pass `--task contract.json`, `--task brief.md`, or `--task -` to read stdin. Only `objective` is required. Unknown keys and entries of the wrong type are rejected, so a typo never drops a requirement silently.
152
175
 
153
176
  ```json
154
177
  {
@@ -178,28 +201,28 @@ Flags cover the common fields. For a larger handoff, pass `--task contract.json`
178
201
 
179
202
  **Units.** `--unit "name: objective [owns a,b]"` (repeatable, or contract `units`) makes the executor give each unit its own subagent inside the one session, in parallel where they are independent, then integrate and verify the whole. Unit paths must lie inside the session's `--owns` and must not overlap each other (exit 2 otherwise).
180
203
 
181
- **Visual verification.** `--visual "criterion"` (repeatable), `--viewport WxH` (repeatable, default `390x844` and `1440x900`) and `--serve "cmd"` (must honour `$ZCODE_PORT`; by default the verifier reads `package.json`) hand the judgement to a fresh session that did not build the result. After the checks pass, it serves the app, waits for fonts and animations, scrolls one window height at a time to the bottom at every viewport, saves the screenshots under `$ZCODE_OUT/verify/<round>/`, and answers with what it can read (`seen`) for each criterion. It always judges one more criterion: all text the page means to show is readable after animations finish. Unmet criteria go back to the executor as repair turns with the verifier's notes and screenshot paths. A verifier that fails twice gives `met: null` and status `partial`. Write criteria as what must be visible: "the headline 'Plans for every team' is fully readable at 390 and 1440".
204
+ **Visual verification.** `--visual "criterion"` (repeatable), `--viewport WxH` (repeatable, default `390x844` and `1440x900`) and `--serve "cmd"` (must honour `$ZCODE_PORT`; by default the verifier reads `package.json`) hand the judgement to a fresh GLM-5.3-Flash session that did not build the result. After the checks pass, it serves the app, waits for fonts and animations, scrolls one window height at a time to the bottom at every viewport, saves the screenshots under `$ZCODE_OUT/verify/<round>/`, and answers with what it can read (`seen`) for each criterion. It always judges one more criterion: all text the page means to show is readable after animations finish. Unmet criteria go back to the executor as repair turns with the verifier's notes and screenshot paths. A verifier that fails twice gives `met: null` and status `partial`. Write criteria as what must be visible: "the headline 'Plans for every team' is fully readable at 390 and 1440".
182
205
 
183
206
  </details>
184
207
 
185
208
  &nbsp;
186
209
 
187
- ## Models and effort
188
-
189
- Every command runs on GLM-5.3 at effort `high` unless you pass a flag, in `zcode-agent acp` as well as on the command line. Both models are always available: `--model flash` switches to GLM-5.3-Flash, which is cheaper and faster and, unlike GLM-5.3, can read images. The visual verifier always runs on Flash, so `--visual` works on either model. Pass `--model flash` when the executor should look at its own screenshots too.
210
+ ## Split work only when it splits
190
211
 
191
- | flag | values | default |
192
- |---|---|---|
193
- | `--model` | `glm-5.3`, `glm-5.3-flash` | GLM-5.3 |
194
- | `--effort` | `low`, `high`, `max` | `high` |
212
+ Parallel work can cut wall time, and it is always optional. One well-specified session is correct for most tasks.
195
213
 
196
- `--model` also takes the short names `5.3` and `53` for GLM-5.3, and `flash`, `5.3-flash` and `53f` for Flash. A contract can set `"model"` and `"effort"`, and flags override it. A resumed session keeps its model and effort unless you pass the flags again. Any other model or an unsupported effort exits 2 before anything starts.
214
+ | the work | shape |
215
+ |---|---|
216
+ | small, or tightly coupled | **one session** |
217
+ | one deliverable with separable parts that share decisions | **one session with units**: a `--unit` per part, each run by a subagent, integrated by the session |
218
+ | independent deliverables that own different paths | **parallel sessions**: `--detach` each, then one `wait` on all of them |
219
+ | a shared base first, then parallel features | **a plan**: `plan run plan.json`, with `after` for the order |
197
220
 
198
- &nbsp;
221
+ Split only when every concurrent session owns different paths, one session owns the shared files (`package.json`, lockfiles, router, global styles) and installs every dependency up front, and no piece waits on a decision another piece will make. Two to four sessions at a time is the useful range; more compete for the API rate limit and your machine. zcode-agent refuses overlapping ownership with exit 7, and every session gets its own `ZCODE_PORT`, `ZCODE_OUT` and `ZCODE_TMP` so dev servers and build output don't collide.
199
222
 
200
- ## Sessions
223
+ ### Sessions
201
224
 
202
- Every run is a session, named with `--id` or given a `zc-xxxxxxxx` id. Each session has its own engine home under `~/.zcode-agent/sessions/<id>/`, so conversations, MCP servers and skills never leak between sessions. zcode-agent never re-runs an existing id, so a retried start fails fast instead of doing the work twice.
225
+ Every run is a session, named with `--id` or given a `zc-xxxxxxxx` id. Each has its own engine home under `~/.zcode-agent/sessions/<id>/`, so conversations, MCP servers and skills never leak between sessions. zcode-agent never re-runs an existing id, so a retried start fails fast instead of doing the work twice.
203
226
 
204
227
  ```sh
205
228
  zcode-agent task --detach --id home --owns src/pages/home/ --check "npm run build" "Build the home page"
@@ -212,17 +235,19 @@ zcode-agent resume team "Use the 2-column variant below 1024px."
212
235
  zcode-agent cancel home
213
236
  ```
214
237
 
215
- A session goes from `queued` to `running` to `finished`. If the process that owns it dies, it shows as `interrupted` and can be resumed. `resume` sends your message into the same engine conversation. For task sessions the executor is told the earlier work is already on disk, and zcode-agent runs the checks and repairs again and writes a fresh handback. zcode-agent retries only engine start-up, before anything reaches the model. It never re-sends a prompt on its own.
238
+ A session goes from `queued` to `running` to `finished`. If the process that owns it dies, it shows as `interrupted` and can be resumed. `resume` sends your message into the same engine conversation. For task sessions the executor is told the earlier work is already on disk, and zcode-agent runs the checks and repairs again and writes a fresh handback. A session that never reached the model (it timed out while queued, or the engine failed to start) is resumed with what it was first asked, followed by your message. zcode-agent retries only engine start-up, before anything reaches the model. It never re-sends a prompt on its own.
239
+
240
+ `zcode-agent status` lists the 15 most recent sessions, and `--all` lists every one.
216
241
 
217
242
  <details>
218
243
  <summary><b>Ownership and concurrency</b></summary>
219
244
 
220
245
  &nbsp;
221
246
 
222
- `--owns` declares what a session may change. A path owns its subtree, globs work, and patterns are relative to `--cwd`. A session without `--owns` owns the whole workspace.
247
+ `--owns` declares what a session may change, relative to `--cwd`. A path owns itself and everything under it. A glob (`*`, `**`, `?`) owns each match and everything under it, so `packages/*` covers every package's files. Braces and brackets are literal, so `app/[id]` names that directory. A session without `--owns` owns the whole workspace.
223
248
 
224
249
  - zcode-agent refuses to start a session whose ownership overlaps a running session in the same git repo (exit 7). `--allow-overlap` starts it anyway.
225
- - After the work, zcode-agent diffs the workspace. Changes outside the session's paths are listed in `scopeViolations` and make a task `partial`. Files in a concurrent session's paths count against that session, not this one.
250
+ - After the work, zcode-agent diffs the workspace. Changes outside the session's paths are listed in `scopeViolations` and make a task `partial`. Files in the paths of another session that ran at the same time count against that session, not this one.
226
251
  - `--touch <path>` allows a small edit outside `--owns` without claiming the path. Touched files are listed in `touched`. Starting is refused if a running session owns a matching path.
227
252
  - Every session and every check gets `ZCODE_SESSION_ID`, `ZCODE_PORT` (a free port from 41000 to 48999), `ZCODE_OUT` (`<cwd>/.zcode/out/<id>`) and `ZCODE_TMP`. Files under `.zcode/` never count as changes, and zcode-agent adds `.zcode/` and `.playwright-mcp/` to the repo's `.git/info/exclude`, never to `.gitignore`.
228
253
  - `ZAI_CODE_MAX_ACTIVE` (default 8) caps running sessions per machine. Extra sessions wait in `queued`.
@@ -252,10 +277,12 @@ zcode-agent plan check plan.json # validate: one line per problem,
252
277
  zcode-agent plan run plan.json --preflight # read-only questions for every session
253
278
  zcode-agent plan run plan.json --detach # run it in the background
254
279
  zcode-agent plan wait plan --json # one summary line when it ends
255
- zcode-agent plan resume plan "answers" # resume failed, partial or blocked sessions
280
+ zcode-agent plan resume plan "answers" # resume sessions that did not complete; relaunch skipped ones
256
281
  ```
257
282
 
258
- A session starts when every session it is `after` has completed. Sessions that can run at the same time must own different paths, and `plan check` enforces it. When a session ends without completing, the sessions after it are `skipped` and the rest carry on. Top-level `decisions`, `context`, `files`, `model`, `effort` and `limits` apply to every session. Keep the chain short: each `after` waits for a whole session, and visual criteria belong on the sessions that build finished UI.
283
+ A session starts when every session it is `after` has completed. Sessions that can run at the same time must own different paths, and `plan check` enforces it. When a session ends without completing, the sessions after it are `skipped` and the rest carry on. Top-level `decisions`, `context`, `files`, `model`, `effort` and `limits` apply to every session; `--model`, `--effort` and the MCP and skills flags are refused on `plan`, because plan sessions take their setup from the plan file and the defaults. `plan resume` resumes every session that ended without completing (failed, partial, unverified, blocked, cancelled or interrupted) and keeps going when one of them refuses. Keep the chain short: each `after` waits for a whole session, and visual criteria belong on the sessions that build finished UI.
284
+
285
+ `plan run` and `plan wait` exit 0 when every session completed, 10 when one is blocked, 124 when `--timeout-ms` runs out first (the plan keeps running) and 8 otherwise. A plan name that already exists is exit 7.
259
286
 
260
287
  &nbsp;
261
288
 
@@ -265,10 +292,13 @@ A session starts when every session it is `after` has completed. Sessions that c
265
292
 
266
293
  | model | input | cached input | output |
267
294
  |---|---|---|---|
268
- | GLM-5.3-Flash | 0.15 | 0.03 | 0.50 |
295
+ | GLM-5.4 | 1.40~ | 0.26~ | 4.40~ |
269
296
  | GLM-5.3 | 1.40 | 0.26 | 4.40 |
297
+ | GLM-5.3-Flash | 0.15 | 0.03 | 0.50 |
270
298
 
271
- The counts come from each session's own engine database and include the executor, its subagents and the verifier, across every resume. `--app` adds the ZCode app's own sessions in that directory, and `--json` prints one object. Set `ZCODE_PRICES='{"GLM-5.3-Flash":{"input":0.15,"cached":0.03,"output":0.5}}'` to use other rates. On a Z.ai coding plan, this is what the work would cost at API rates, not what you pay.
299
+ ~ Z.ai launched GLM-5.4 on its coding plans and has not published an API price. Until it does, zcode-agent prices it like GLM-5.1, 5.2 and 5.3 (which all list at the same rate) and marks every amount that includes it with `~`, in `cost` and in `watch`. Set the real rate as soon as it is known: `ZCODE_PRICES='{"GLM-5.4":{"input":1.4,"cached":0.26,"output":4.4}}'`. A rate you set is not marked.
300
+
301
+ The counts come from each session's own engine database and include the executor, its subagents and the verifier, across every resume. `--app` adds the ZCode app's own sessions in that directory, and `--json` prints one object. Usage of a model zcode-agent has no price for is not counted and is flagged `+?`. On a Z.ai coding plan, the total is what the work would cost at API rates, not what you pay.
272
302
 
273
303
  &nbsp;
274
304
 
@@ -276,12 +306,12 @@ The counts come from each session's own engine database and include the executor
276
306
 
277
307
  <p align="center">
278
308
  <picture>
279
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/403b95529a796bc4050577ae2ea6d9fe3016e2ce/docs/assets/acp-dark.svg">
280
- <img src="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/403b95529a796bc4050577ae2ea6d9fe3016e2ce/docs/assets/acp-light.svg" width="960" alt="An ACP client such as T3 Code or Zed sends prompts and answers to zcode-agent over stdio. zcode-agent streams text, diffs and the plan back and asks before edits and commands. Mode, model and effort are pickers; the defaults are GLM-5.3, effort high and Ask mode.">
309
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/main/docs/assets/acp-dark.svg">
310
+ <img src="https://raw.githubusercontent.com/0xgeorgemathew/zcode-agent/main/docs/assets/acp-light.svg" width="960" alt="An ACP client such as T3 Code or Zed sends prompts and answers to zcode-agent over stdio. zcode-agent streams text, diffs and the plan back and asks before edits and commands. Mode, model and effort are pickers; the defaults are GLM-5.4, effort high and Ask mode.">
281
311
  </picture>
282
312
  </p>
283
313
 
284
- `zcode-agent acp` speaks the [Agent Client Protocol](https://agentclientprotocol.com) (v1) on stdio, so an ACP client drives GLM-5.3 directly: you chat with it, approve its edits and commands, and watch its tool calls, diffs and plan as they happen. `zcode-agent-acp` is the same command for clients that take only an executable. Key and skills work the same way as for `task`. MCP servers differ: a session gets your client's servers and Playwright, but not the app's other servers, because every server's tool list is sent with every model request (the app's servers added about 12k input tokens per request in a measured setup). `--mcp-inherit` (or `ZCODE_ACP_INHERIT_MCP=1`) adds them back.
314
+ `zcode-agent acp` speaks the [Agent Client Protocol](https://agentclientprotocol.com) (v1) on stdio, so an ACP client drives GLM-5.4 directly: you chat with it, approve its edits and commands, and watch its tool calls, diffs and plan as they happen. `zcode-agent-acp` is the same command for clients that take only an executable. Key and skills work the same way as for `task`. MCP servers differ: a session gets your client's servers and Playwright, but not the app's other servers, because every server's tool list is sent with every model request (the app's servers added about 12k input tokens per request in a measured setup). `--mcp-inherit` (or `ZCODE_ACP_INHERIT_MCP=1`) adds them back.
285
315
 
286
316
  **T3 Code** (a build with the ACP Registry provider): install zcode-agent globally, then add a provider in Settings → Providers. Choose **ACP Registry**, set **ACP source** to **Local command** and **Executable override** to `zcode-agent-acp`. To set it in `~/.t3/userdata/settings.json` instead:
287
317
 
@@ -289,14 +319,14 @@ The counts come from each session's own engine database and include the executor
289
319
  "providerInstances": {
290
320
  "zcodeAgent": {
291
321
  "driver": "acpRegistry",
292
- "displayName": "zcode-agent (GLM-5.3)",
322
+ "displayName": "zcode-agent (GLM)",
293
323
  "enabled": true,
294
324
  "config": { "source": "local", "commandPath": "zcode-agent-acp", "commandArgs": [] }
295
325
  }
296
326
  }
297
327
  ```
298
328
 
299
- T3 Code then offers GLM-5.3 (the default, at effort high) and GLM-5.3-Flash, with **Mode** and **Effort** pickers. Its runtime modes map onto the agent's approvals: in full access T3 answers every approval itself, and in approval-required it asks you. T3's plan mode switches the agent to its read-only Plan mode.
329
+ T3 Code then offers GLM-5.4 (selected, at effort high), GLM-5.3 and GLM-5.3-Flash, with **Mode** and **Effort** pickers. Its runtime modes map onto the agent's approvals: in full access T3 answers every approval itself, and in approval-required it asks you. T3's plan mode switches the agent to its read-only Plan mode.
300
330
 
301
331
  **Zed** (`settings.json`):
302
332
 
@@ -315,15 +345,19 @@ T3 Code then offers GLM-5.3 (the default, at effort high) and GLM-5.3-Flash, wit
315
345
 
316
346
  What the client gets:
317
347
 
318
- - **Live output.** Streaming text and reasoning, tool calls with titles, file locations and diffs, command output, and the to-do list as the plan.
348
+ - **Live output.** Streaming text and reasoning, tool calls with titles, file locations and diffs (a finished edit keeps its diff next to the result), command output, and the to-do list as the plan.
319
349
  - **Approvals.** The engine's permission prompts (allow once, always allow in this project, deny) are forwarded to you.
320
- - **Picker updates.** Mode, model and effort as session config options; switching model keeps the effort when the new model supports it.
350
+ - **Pickers.** Mode, model and effort as session config options. Switching model keeps the effort when the new model supports it. A mode change always reaches the engine, also while it is still starting.
351
+ - **Images.** An attached image is saved to the session's tmp dir and opened by the model. GLM-5.4 and GLM-5.3-Flash read it; on GLM-5.3 the prompt says it cannot and names the models that can.
352
+ - **Other inputs.** Embedded files, and links (file paths, or the URL itself for other links). Your client's MCP servers (stdio, HTTP, SSE) are added to the session.
321
353
  - **Usage.** Context use and the session's GLM cost so far at API list price, after every turn.
322
- - **Sessions.** `session/list` and `session/load`: a session reopens in a new process with its history replayed. Every ACP session is a zcode-agent session (`kind: "acp"`), so `zcode-agent status`, `watch` and `cost` include it.
323
- - **Inputs.** Images (saved to the session's tmp dir; GLM-5.3 cannot read them, so the prompt says so and suggests GLM-5.3-Flash), embedded files and file links in prompts. Your client's MCP servers (stdio, HTTP, SSE) are added to the session.
324
- - **Cancel.** Stops the running turn and its tools.
354
+ - **Stop reasons.** `end_turn`; `cancelled` when you cancel, when the engine stops the turn, or when the agent's own `--timeout-ms` ends it (with a line in the conversation saying so); `max_turn_requests` at the engine's turn or tool-call limit. Other engine failures are errors.
355
+ - **Sessions.** `session/list`, `session/load` (reopens a session in a new process and replays its history), `session/resume` (the same without the replay, for a client that already shows it) and `session/close`. Every ACP session is a zcode-agent session (`kind: "acp"`), so `zcode-agent status`, `watch` and `cost` include it.
356
+ - **Cancel.** Stops the running turn and its tools. A client that closes the connection mid-prompt still gets that prompt's reply before the agent exits.
357
+
358
+ A new session's engine starts 1.5 s after `session/new`, while you type, so the first prompt reaches the model in well under a second instead of waiting about 3 s for the engine and its MCP servers. The session record is written only at the first prompt: a client that probes with `session/new` and exits right away starts nothing, and a session closed before its first prompt leaves nothing behind. `ZCODE_ACP_PREWARM_MS` sets the delay in milliseconds, or `off` to start the engine at the first prompt.
325
359
 
326
- A new session's engine starts 1.5 s after `session/new`, while you type, so the first prompt reaches the model in well under a second instead of waiting ~3 s for the engine and its MCP servers. The session record is written only at the first prompt: a client that probes with `session/new` and exits right away starts nothing, and a session closed before its first prompt leaves nothing behind. `ZCODE_ACP_PREWARM_MS` sets the delay in milliseconds, or `off` to start the engine at the first prompt. Flags set the defaults for new sessions: `--mode`, `--model`, `--effort`, `--mcp-inherit`, `--hermetic` (also leaves out the app's skills), `--no-browser`, `--mcp`, `--skills`, `--timeout-ms` (per prompt; default none). `ZCODE_ACP_MODE` sets the default mode for clients that take no arguments, and `ZCODE_ACP_LOG=<file>` logs every frame. Questions the model would ask through a form are asked in its reply instead, because ACP v1 has no form UI.
360
+ Flags set the defaults for new sessions: `--mode`, `--model`, `--effort`, `--mcp-inherit`, `--hermetic` (also leaves out the app's skills), `--no-browser`, `--mcp`, `--skills`, `--timeout-ms` (per prompt; default none). `ZCODE_ACP_MODE` sets the default mode for clients that take no arguments, and `ZCODE_ACP_LOG=<file>` logs every frame. Questions the model would ask through a form are asked in its reply instead: zcode-agent does not use ACP elicitation yet.
327
361
 
328
362
  &nbsp;
329
363
 
@@ -337,7 +371,7 @@ The result line is the compact brief (`zcode.brief/1`). Empty keys are left out:
337
371
  {"type":"result","schema":"zcode.brief/1","status":"failed","ok":false,"id":"pricing",
338
372
  "summary":"…","files":["src/pages/pricing/index.tsx"],
339
373
  "checks":[{"command":"npm test","ok":false,"exitCode":1,"tail":"…last 1500 characters…"}],"checksPassed":1,
340
- "questions":[],"issues":["…"],"scopeViolations":[],"error":{"kind":"checks_failed"},
374
+ "issues":["…"],"error":{"kind":"checks_failed"},
341
375
  "result":"/…/sessions/pricing/result.json"}
342
376
  ```
343
377
 
@@ -346,19 +380,23 @@ The result line is the compact brief (`zcode.brief/1`). Empty keys are left out:
346
380
 
347
381
  &nbsp;
348
382
 
349
- The brief lists only failing checks (`checksPassed` counts the rest), unmet visual criteria (`visualMet` is `met/total`), up to 6 `decisions` (`decisionsMore` counts the rest) and 40 `files` (`filesMore`). `run` and `agent` briefs also carry `response`, because the answer is the product there. `result` is the path to the full record. `result.json` on disk is always the full `zcode.result/1` record, and `--full` prints it instead of the brief on `task`, `run`, `agent`, `resume`, `wait` and `result`.
383
+ The brief lists only failing checks (`checksPassed` counts the rest), unmet visual criteria (`visualMet` is `met/total`), up to 6 `decisions` (`decisionsMore` counts the rest) and 40 `files` (`filesMore`). `questions`, `unresolved`, `scopeViolations`, `touched` and `units` appear when they have entries. `run` and `agent` briefs also carry `response`, because the answer is the product there. `result` is the path to the full record. `result.json` on disk is always the full `zcode.result/1` record, and `--full` prints it instead of the brief on `task`, `run`, `agent`, `resume`, `wait` and `result`.
350
384
 
351
385
  | `type` | meaning |
352
386
  |---|---|
353
387
  | `session` | the active session and its scope: id, kind, cwd, owns, checks, model, effort |
354
388
  | `phase` | what is running: starting, executing, reporting, checking, repairing, verifying or queued |
389
+ | `turn`, `model_request_started`, `state` | a turn began; a model request started (with the model and effort the engine used); the engine's mode changed |
355
390
  | `tool` | a tool call was scheduled, started, returned or failed |
356
391
  | `subagent` | a subagent started, returned or failed |
357
392
  | `check` | a check zcode-agent ran, with its exit code and duration |
358
393
  | `mcp` | an MCP server connected or failed |
394
+ | `retry` | the engine was restarted once before anything reached the model |
359
395
  | `stream` | live text or reasoning (run and agent, or task with `--stream`) |
360
396
 
361
- `zcode-agent status <id> --json` returns state, phase, pid, recent events and the result. `zcode-agent wait --json` prints one brief per session as each finishes. When `--timeout-ms` runs out first, it prints one `{"type":"pending","id","state","phase","elapsedMs","idleMs"}` line per running session and exits 124. `zcode-agent <command> --help` prints only that command's usage. Usage errors are always one line.
397
+ `zcode-agent status <id> --json` returns state, phase, pid, recent events and the result; without an id it lists 50 sessions, or all of them with `--all`. `zcode-agent result <id> --json` prints a finished session's brief (exit 7 while it is still running). `zcode-agent wait --json` prints one brief per session as each finishes. When `--timeout-ms` runs out first, it prints one `{"type":"pending","id","state","phase","elapsedMs"}` line per unfinished session, with `idleMs` and `stalled` for a running one, and exits 124.
398
+
399
+ `zcode-agent <command> --help` prints only that command's usage. Usage errors are always one line. A single word that is one or two letters away from a command name (say `stauts`) is refused as a typo instead of being sent as a prompt; `zcode-agent run <word>` sends it anyway. `--mcp-list` prints the MCP servers a run with the same flags would get, with header, environment and URL credentials replaced by `***`.
362
400
 
363
401
  </details>
364
402
 
@@ -372,7 +410,7 @@ The brief lists only failing checks (`checksPassed` counts the rest), unmet visu
372
410
  | option | what it does |
373
411
  |---|---|
374
412
  | `--id`, `--label` | name the session (run, task, agent). Default id: `zc-<random>` |
375
- | `--detach` | run in the background and print the id (run, task, agent, resume) |
413
+ | `--detach` | run in the background and print the id (run, task, agent, resume, plan run, plan resume) |
376
414
  | `--cwd` | the workspace, and the limit of what the session may touch. Default: the current directory |
377
415
  | `--owns` | repeatable path or glob the session may change. Default: the whole workspace |
378
416
  | `--touch` | task: repeatable small edits outside `--owns` |
@@ -389,16 +427,17 @@ The brief lists only failing checks (`checksPassed` counts the rest), unmet visu
389
427
  | `--visual` | task: repeatable criterion a fresh session judges from screenshots |
390
428
  | `--viewport` | task: repeatable `WxH` for `--visual`. Default: `390x844` and `1440x900` |
391
429
  | `--serve` | task: the command that serves the app on `$ZCODE_PORT` |
392
- | `--max-repairs` | task and resume: repair turns after failures. Default: 2 |
430
+ | `--max-repairs` | task and resume: repair turns after failures, a whole number. Default: 2 |
393
431
  | `--check-timeout-ms` | task and resume: time limit per check. Default: 300000 |
394
- | `--model` | `glm-5.3` (default) or `glm-5.3-flash` |
432
+ | `--model` | `glm-5.4` (default), `glm-5.3` or `glm-5.3-flash` |
395
433
  | `--effort` | `low`, `high` (default) or `max` |
396
- | `--timeout-ms` | the whole run, checks and repairs included. Default: 10 min for run, 2 h for task |
397
- | `--session` | run: continue by zcode-agent id or engine `sess_` id |
434
+ | `--timeout-ms` | the whole run: engine start, work, checks, repairs, verifier. Default: 10 min for run, 2 h for task; at most 2147483647 (about 24.8 days) |
435
+ | `--session` | run: continue by zcode-agent id or engine `sess_` id; plan resume: only this session |
436
+ | `-p`, `--prompt` | the prompt (run, task, agent) or the message (resume), instead of positional text |
398
437
  | `--profile` | agent: the subagent profile. Default: `general-purpose` |
399
438
  | `--mcp` | add MCP servers, as inline JSON or `@file` |
400
- | `--mcp-list` | print the effective MCP server set and exit |
401
- | `--hermetic` | leave out the ZCode app's MCP servers and skills |
439
+ | `--mcp-list` | print the effective MCP server set, credentials redacted, and exit |
440
+ | `--hermetic` | leave out the ZCode app's MCP servers and skills (Playwright stays) |
402
441
  | `--no-browser` | drop the Playwright MCP server |
403
442
  | `--skills` | add skills: one skill directory, or a directory of them |
404
443
  | `--no-skills` | run with no skills at all |
@@ -408,10 +447,16 @@ The brief lists only failing checks (`checksPassed` counts the rest), unmet visu
408
447
  | `--full` | with `--json`, and on result and wait: the full record instead of the brief |
409
448
  | `--quiet` | no progress output |
410
449
  | `--any` | wait: return when the first session finishes |
450
+ | `--all` | status: list every session, not only the most recent |
451
+ | `--plan` | watch: every session of a plan |
452
+ | `--stall-min` | watch: minutes without an engine event before `STALLED?`. Default: 8 |
453
+ | `--mode` | acp: default permission mode of new sessions (`build`, `edit`, `plan`, `yolo`) |
454
+ | `--mcp-inherit` | acp: also give sessions the ZCode app's MCP servers |
411
455
  | `--app` | cost: also count the ZCode app's sessions |
412
456
  | `--thinking` | mirror reasoning to stderr (on for run, off for task; `--no-thinking` turns it off) |
413
457
  | `--stream` | task: include text deltas in the events |
414
458
  | `--include-reasoning` | put the full reasoning in the result |
459
+ | `--version`, `--help` | print the version; print usage (`--help <command>` for one command) |
415
460
 
416
461
  </details>
417
462
 
@@ -422,16 +467,16 @@ The brief lists only failing checks (`checksPassed` counts the rest), unmet visu
422
467
  |---|---|
423
468
  | 0 | completed |
424
469
  | 1 | unexpected internal error |
425
- | 2 | usage error: bad flag, model, effort, contract, or a session id that exists |
426
- | 3 | no API key (`ZAI_API_KEY`, `zcode-agent login`, or a key in the ZCode app) |
470
+ | 2 | usage error: bad flag, model, effort, contract or plan; a mistyped command; a session id that exists; a session whose workspace is gone |
471
+ | 3 | no API key (`ZAI_API_KEY`, `zcode-agent login`, or a key in the ZCode app); `wait` on a detached run that never started returns its code too |
427
472
  | 4 | engine not found (reinstall; the engine comes with the package) |
428
473
  | 5 | failed: engine or turn error |
429
474
  | 6 | `agent`: no subagent ran, or none ended `success` |
430
- | 7 | overlapping ownership, or the session is already running |
431
- | 8 | partial, or checks still failing after repairs |
475
+ | 7 | overlapping ownership; the session is already running (`resume`, `result`); a plan name that exists |
476
+ | 8 | partial, or checks still failing after repairs; a plan that ended with a session not completed |
432
477
  | 9 | unverified |
433
- | 10 | blocked |
434
- | 124 | `--timeout-ms` ran out |
478
+ | 10 | blocked (a session, or a plan with a blocked session) |
479
+ | 124 | `--timeout-ms` ran out (for `wait` and `plan wait`: still running) |
435
480
  | 130 | cancelled |
436
481
 
437
482
  </details>
@@ -441,15 +486,15 @@ The brief lists only failing checks (`checksPassed` counts the rest), unmet visu
441
486
 
442
487
  &nbsp;
443
488
 
444
- **The API key.** zcode-agent takes the key from `ZAI_API_KEY`, then from `zcode-agent login` (stored in `~/.zcode-agent/credentials.json`, mode 600), then from the ZCode app's own Z.ai API key, read where the app stores it. `ZCODE_NO_DESKTOP_KEY=1` turns the last one off. zcode-agent never reads the app's OAuth tokens, never prints or logs the key, and scrubs it from engine messages and check output. The only file it writes the key to is each session's own provider config, which the engine needs.
489
+ **The API key.** zcode-agent takes the key from `ZAI_API_KEY`, then from `zcode-agent login` (stored in `~/.zcode-agent/credentials.json`, mode 600), then from the ZCode app's own Z.ai API key, read where the app stores it. `ZCODE_NO_DESKTOP_KEY=1` turns the last one off. zcode-agent never reads the app's OAuth tokens, never prints or logs the key, and scrubs it from engine and MCP messages, check output and the result. The key is written only inside each session's own engine home (mode 700): its provider config and its copy of the app's `cli/config.json`, both mode 600, which the engine reads. The copies of the app's `v2` settings files there can hold the app's other provider keys and are mode 600 too.
445
490
 
446
- **Isolation.** zcode-agent keeps its state in `~/.zcode-agent` and never writes to `~/.zcode`, which belongs to the ZCode app. On first run it moves a pre-1.0 `~/.zcode-cli` there and leaves a symlink. Each session's engine runs with `HOME` set to the session's own directory. On every run zcode-agent rewrites that directory's config: the provider with your key, the app's MCP servers (minus OAuth servers and those in `~/.zcode-agent/mcp-health.json` that failed recently), and the app's user skills, including symlinked ones. The skills are copied once into a shared snapshot under `~/.zcode-agent/shared/skills/` and linked into each session; editing a skill makes a new snapshot, and snapshots unused for two weeks are deleted. The engine starts with Node's compile cache in `~/.zcode-agent/compile-cache` (`ZCODE_NO_COMPILE_CACHE=1` turns it off). Every session gets zcode-agent's executor instructions as its `AGENTS.md`: headless rules, the session's port and output directories, and when to split work across subagents. The Playwright server runs with a fresh browser profile per engine, so the executor's and the verifier's browsers never share a lock or a cache. zcode-agent never touches the engine's database, so sessions stay resumable.
491
+ **Isolation.** zcode-agent keeps its state in `~/.zcode-agent` and never writes to `~/.zcode`, which belongs to the ZCode app. On first run it moves a pre-1.0 `~/.zcode-cli` there and leaves a symlink. Each session's engine runs with `HOME` set to the session's own directory. On every run zcode-agent rewrites that directory's config: the provider with your key (and GLM-5.4 registered on it while the engine does not list it), the app's MCP servers (minus OAuth servers and those in `~/.zcode-agent/mcp-health.json` that failed recently), and the app's user skills, including symlinked ones. The skills are copied once into a shared snapshot under `~/.zcode-agent/shared/skills/` and linked into each session; editing a skill makes a new snapshot, and snapshots unused for two weeks are deleted. A skill that cannot be copied (a link loop, say) is left out and named by `zcode-agent doctor`, instead of failing every session. The engine starts with Node's compile cache in `~/.zcode-agent/compile-cache` (`ZCODE_NO_COMPILE_CACHE=1` turns it off). Every session gets zcode-agent's executor instructions as its `AGENTS.md`: headless rules, the session's port and output directories, and when to split work across subagents. The Playwright server runs with a fresh browser profile per engine, so the executor's and the verifier's browsers never share a lock or a cache. zcode-agent never touches the engine's database, so sessions stay resumable.
447
492
 
448
- **The engine.** `@zcode-agent/engine` is the headless ZCode engine (`zcode.cjs`), built by `npm run build:engine` from the tag in `packages/engine/engine.json`, with the content plugins and bundled skills the app ships and upstream's `LICENSE`, `NOTICE.md` and third-party notices. `ZAI_CODE_ENGINE` points at another `zcode.cjs`. Without the package, zcode-agent uses the ZCode app's engine. `zcode-agent doctor` shows which engine runs and warns when its version differs from the tested one.
493
+ **The engine.** `@zcode-agent/engine` is the headless ZCode engine (`zcode.cjs`), built by `npm run build:engine` from the tag in `packages/engine/engine.json`, with the content plugins and bundled skills the app ships and upstream's `LICENSE`, `NOTICE.md` and third-party notices. `ZAI_CODE_ENGINE` points at another `zcode.cjs`. Without the package, zcode-agent uses the ZCode app's engine. `zcode-agent doctor` shows which engine runs and warns when its version differs from the tested one; it takes the MCP, skills and browser flags of a run and reports the setup that run would get.
449
494
 
450
495
  **Yolo mode.** The engine approves tool calls on its own, as in its headless default, and `--cwd` limits where they run. A headless turn that asks for input ends as `blocked` instead of hanging. The executor instructions forbid commits, pushes, deploys and other outside effects unless the task asks for them.
451
496
 
452
- **Environment.** `ZAI_API_KEY`, `ZAI_CODE_HOME` (state directory), `ZAI_CODE_ENGINE`, `ZAI_CODE_NODE` (the engine's Node), `ZAI_CODE_BUILTIN_PROVIDER_CONFIG`, `ZAI_CODE_LIVE_DIR` (the app's directory, default `~/.zcode`), `ZCODE_HERMETIC=1`, `ZCODE_INHERIT_DESKTOP=1`, `ZCODE_NO_DESKTOP_KEY=1`, `ZAI_CODE_MAX_ACTIVE`, `ZCODE_PRICES`, `ZCODE_APP_DB` (the app's database for `cost --app`), `NO_COLOR`.
497
+ **Environment.** `ZAI_API_KEY`, `ZAI_CODE_HOME` (state directory), `ZAI_CODE_ENGINE`, `ZAI_CODE_NO_PACKAGED_ENGINE=1` (skip the bundled engine), `ZAI_CODE_NODE` (the engine's Node), `ZAI_CODE_BUILTIN_PROVIDER_CONFIG`, `ZAI_CODE_LIVE_DIR` (the app's directory, default `~/.zcode`), `ZCODE_HERMETIC=1`, `ZCODE_INHERIT_DESKTOP=1`, `ZCODE_NO_DESKTOP_KEY=1`, `ZCODE_NO_COMPILE_CACHE=1`, `ZAI_CODE_MAX_ACTIVE`, `ZCODE_PRICES`, `ZCODE_APP_DB` (the app's database for `cost --app`), `ZCODE_WATCH_POLL_MS` (watch refresh, default 2000), `ZCODE_VERIFIER_MAX_STREAM_CHARS`, `ZCODE_ACP_MODE`, `ZCODE_ACP_INHERIT_MCP=1`, `ZCODE_ACP_PREWARM_MS`, `ZCODE_ACP_LOG`, `NO_COLOR`. The engine's tools also see your `PLAYWRIGHT_BROWSERS_PATH` and npm cache, so installed browsers and packages are found from the session's own `HOME`.
453
498
 
454
499
  </details>
455
500
 
@@ -462,12 +507,12 @@ The repo is an npm workspace with two packages. [`packages/cli`](https://github.
462
507
  ```sh
463
508
  npm install # link the workspace
464
509
  npm run build:engine # build the engine from the pinned zai-org/ZCode tag
465
- npm test # unit tests: in-process fake engine, no API calls
510
+ npm test # unit tests: a scripted fake engine, no API calls
466
511
  npm run test:live # live tests: the real engine and the GLM API
467
- npm run release:check # verify the engine pin, run the tests, pack both packages
512
+ npm run release:check # verify the engine pin and the changelog, run the tests, pack both packages
468
513
  ```
469
514
 
470
- Live tests read the key from the repo's `.env`, which is never committed or published. `DESIGN.md` records the design decisions and the engine protocol facts.
515
+ Live tests need the built engine and a key: they read `API-KEY=…` from the repo's `.env`, which is never committed or published, and they cost a few cents of API usage per run. `DESIGN.md` records the design decisions and the engine protocol facts.
471
516
 
472
517
  ## License
473
518