Three fixes from live 406s on 11-03 to 11-05.
- The Fable harness's model line "You are powered by the model glm-5.3-flash[1m]." is rewritten to "You are powered by the GLM-5.3-flash model." in the author's own case. A bare model name without GLM is left as written.
- The subagent opening "You are an agent for Claude Code, …" becomes "You are an agent for the Claude Code CLI, …". A `(?! CLI)` lookahead keeps an already-rewritten line from getting a second CLI.
- An opt-in 406 dump. It is off by default. `AUTOCLAW_406_DUMP_DIR` (any directory) or `"dump406": true` (strictly boolean; the default dir is $XDG_CONFIG_HOME, else HOME, USERPROFILE or os.homedir(), then /.config/magpie/autoclaw-406) turns it on. A 406 then writes the rewritten system and developer messages plus `model` (never user, assistant or tool content) to `autoclaw-406-<stamp>-<rand>-<provider>.json`, mode 0600 in a 0700 directory. Only the 10 newest are kept, by mtime. Rotation matches that whole name, so other files in the directory are never touched. A dump that fails never changes the 406. The README documents the switch and says a system prompt can carry the working directory, git status and an email.
Reviewed head 390024c2, merged onto main 367edb50, run on macOS (Bun 1.4.2) with a fresh mktemp -d HOME:
- bun test packages/autoclaw: 67 pass, 0 fail. Nothing was written into HOME.
- Repo bun test: 6570 pass, 20 skip, 0 fail. bun scripts/check.mjs autoclaw: ok.
- Broken by hand, each red: the rotation filter as endsWith(".json"), a truthy dump406, the file's 0600, the dir's 0700, no rotation, no name prefix (and, in the earlier round, the user/tool filter, the default-off check, name-order rotation, both loaders' sent body, the (?! CLI) lookahead, and ?? for XDG_CONFIG_HOME). Loosening the name regex to autoclaw-406-.*\.json stays green; it is covered by a probe only.
- Probes: 21 foreign files and near-miss names, each backdated an hour, all survived eleven 406s, and 10 dumps were kept. dump406 set to "false", "true", 0, 1, "1", {}, [], null or undefined stays off. The user turn is in no dump.
- Not tried: Windows modes and the USERPROFILE fallback on a real Windows GUI process, and a real AutoClaw 406.