Repository navigation
[bug] ZCode user-scope rules dropped: pull deletes ~/.zcode/AGENTS.md though ZCode loads it as its user instruction file #1029
Description
Note: This issue was drafted by an AI coding agent (ZCode) on behalf of the reporter, based on first-hand reproduction logs. Evidence below is verbatim from actual runs; please treat the tone/wording accordingly.
Summary
On Windows, teamai pull deletes the ZCode user-scope instruction file ~/.zcode/AGENTS.md, judging it a stale block "in files no tool loads them from". However, ZCode does load ~/.zcode/AGENTS.md as its user instruction file (official documented behavior). As a result, there is currently no working channel to deliver team claudemd rules to ZCode, while teamai doctor reports all-green:
- the claudemd block channel does not write
~/.zcode/AGENTS.md(pull printsSynced shared instructions (1 file(s)), but that one file only lands in e.g.~/.codex/AGENTS.md); - manually placing the marked block in
~/.zcode/AGENTS.mdgets deleted by the nextteamai pull; - the hook channel cannot inject rules either: on Windows, ZCode hooks launch via a vbs wrapper whose command line ends with
>nul 2>&1, discarding the hook's stdout (this is the fix(zcode): launch hooks via hidden wscript VBS — no console flash, bounded wait #596 launcher, so it is by design).
Environment
- teamai-cli: 0.27.0 (published 2026-10-09, installed via
npm i -g teamai-cli@latest) - OS: Windows 11 24H2 (10.0.26100), ZCode desktop
- team repo: user scope (
~/.teamai), customtoolPathssnapshot copied from the 0.26.0 default table - Relevant config in
teamai.yaml:
zcode:
skills: '.zcode/skills'
agents: '.zcode/agents'
settings: '.zcode/cli/config.json'
mcp: '.agents/mcp.json'
claudemd: '.zcode/AGENTS.md' # ← the channel that is expected to work but does notReproduction
-
Team repo has
claudemd/harness-rules.md;teamai.yamlmapszcode.claudemd: '.zcode/AGENTS.md'. -
teamai pull --force→✔ [user] Synced 42 skills (all updated) ✔ [user] Synced shared instructions (1 file(s))~/.zcode/AGENTS.mdis never created. The "1 file" goes to~/.codex/AGENTS.mdonly. -
Manually create
~/.zcode/AGENTS.mdcontaining the exact marked block copied from the delivered~/.codex/AGENTS.md(delimited by<!-- [teamai:claudemd:start] -->/...end] -->). -
Run
teamai doctor→✖ No team instruction blocks are left in files no tool loads them from → Earlier teamai releases left team instruction blocks in C:\Users\<user>\.zcode\AGENTS.md, which can carry another member's selection. Run `teamai pull`. -
Run
teamai pull→ℹ [user] Removed teamai instruction blocks from C:\Users\<user>\.zcode\AGENTS.md: replacement instructions are readyThe file is deleted. After that,
doctoris fully green again — with no team rules reaching ZCode at all.
Why the premise is wrong
#946 (closed 2026-10-04) listed "ZCode 3.14.3 from its source" among the tools it verified, and its fix delivered user-scope rule blocks only to tools like Codex ($CODEX_HOME/AGENTS.md). But ZCode's official configuration docs define:
User instruction file:
~/.zcode/AGENTS.md. Applies as default instructions for every workspace.
Merge order: user~/.zcode/AGENTS.mdis injected first, then the workspace<repo>/AGENTS.md.
We verified ZCode actually injects this file into the model context at session start (standard user-scope instruction file behavior). So the doctor check "files no tool loads them from" contains a false positive for ~/.zcode/AGENTS.md, and the cleanup deletes a file ZCode does load.
Side note on the hook channel: the session-start dispatch for zcode logs team-rules ... (ok) every run, yet the hook's stdout is discarded by the vbs wrapper (>nul 2>&1), so even a non-empty rules payload could not reach the model through hooks either. This means for ZCode the only viable channel is the file ~/.zcode/AGENTS.md — which pull actively deletes.
Expected
teamai pullwrites the claudemd block to~/.zcode/AGENTS.mdwhentoolPaths.zcode.claudemdis configured (consistent with what the config comment and the [bug] Team rules miss most tools: each tool's own rules format, else a file only it reads, else a hook or extension in project scope #946 fix intended), or- at minimum, the "no tool loads them from" check must not treat
~/.zcode/AGENTS.mdas residue, anddoctorshould surface the delivery gap instead of reporting all-green.
Actual
- pull reports success ("Synced shared instructions") while ZCode receives nothing; a manually placed file is deleted on the next pull; doctor passes.
Suggested fix
Add ZCode to the instruction-delivery targets (user scope: ~/.zcode/AGENTS.md, already declared in the toolPaths default as claudemd), and align the residue-cleanup allowlist with the same target list so it cannot delete its own delivery destination.
Workaround currently in place
We disabled zcode.claudemd in our teamai.yaml and documented the gap in a comment, so pull no longer oscillates between "manually placed" and "deleted as residue". Happy to re-enable and re-test as soon as a fix lands.
Activity
SaulMoro commentedon Oct 10, 2026
Confirmed, and it is a regression from #957. Before it, ZCode, DeepSeek Harness and JoyCode had no user-scope instruction target of their own and fell back to the configured
claudemd. #957 gave them a team-rules file and no instruction file, so:claudemdno longer receives the shared instructions, culture or recall blocks;~/.zcode/AGENTS.md,$DSH_HOME/AGENTS.md,~/.joycode/rules.txt), pull strips it, deletes it when teamai created it, and doctor reports it as a leftover.One correction:
zcode.claudemdwas never in the defaulttoolPaths(v0.25.0 through v0.27.0); it came from your custom table, which is the configuration that triggers the cleanup.Fix plan: those three tools read the instruction blocks from the same file as their team rules, with no
claudemdneeded, so the default config gets them too. Aclaudemdpointing anywhere else is a file the tool does not read and is cleaned as before. Codex, Pi and OpenClaw already work this way and are unaffected.The Windows hook point is real as well: the ZCode launcher discards the hook's stdout, so on Windows ZCode gets no project rules from its SessionStart hook. That is a separate change to the launcher, tracked in #1030.
We'll open a PR for this.
fix(rules): give ZCode, DeepSeek Harness and JoyCode the instruction …
d542Bb commentedon Oct 15, 2026
Verified fixed in 0.28.0-beta.3 (Windows 11 24H2, ZCode desktop, user scope). After
npm i -g teamai-cli@0.28.0-beta.3and ateamai pull:~/.zcode/AGENTS.mdis now written automatically with the team instruction blocks (markedteamai:claudemdblock), and subsequent pulls no longer delete it as residue — the false positive is gone;wscript.exe+teamai-hook-dispatch.vbs→node+teamai-hook-dispatch.mjs), consistent with fix: deliver the ZCode SessionStart hook through a Node launcher #1047;teamai doctoris fully green.One side note from the upgrade itself, mentioning in passing — not asking for a separate issue: sessions that were already running at upgrade time still had the old hook configuration in memory, pointing at
teamai-hook-dispatch.vbs. Becausepulldeletes that file, every hook fire from those live sessions popped a "Windows Script Host: cannot find script file ..." dialog until the sessions were restarted. Any Windows user upgrading while agents are running gets a burst of these dialogs. If it is cheap, consider keeping the.vbsshim one release (or dropping the reference without deleting the file) so upgrades are silent.Thanks for the fast turnaround — the whole loop (report → confirmed regression → merged fix → beta) took two days.