Files
magpie/docs
yetone eb8b840dd4 claude: a one-off ask's instructions go after Claude Code's system prompt in the interactive mode (#2432)
The interactive mode's helper pastes a run's first message as one text,
without the cache marks renderClaudePrompt puts on it. A one-off ask's
caller instructions were in that message, so Claude Code's auto mode
classifier wrote them to the cache on every check of one conversation:
laozhang713's six checks on one account, no 429, read 1,197 and wrote
83-85k each (#2432; j1374615791-lab saw the same at 125k).

A new interactive run for a one-off ask (no tools, no reply before it,
not lean, no client marks: appendsPrompt) now gets the instructions by
--append-system-prompt-file (append.md, the leanSystem text, the
environment note worded as a lean run's), and its first message holds
the ask alone. Such a run is let go after its reply (ended); it is never
shelved or branched (run.appended), since a session resumed without the
file would have no instructions. Every other run is unchanged.

Run:
- TestClaudeTUIOneOffAskAppendsInstructions and
  TestClaudeAppendOnlyForInteractiveOneOffs (tools, reply, -p) on mote.
  Broken by hand (appendsPrompt returning false): the first goes red.
- mote: gofmt; go vet ./internal/gateway for darwin, linux and windows;
  go test ./internal/gateway -run 'Claude|Lean|TUI|Subscription|Replay|Branch'
  ok (65s), at base a3768cdd1.
- Real Claude Code 2.1.316, interactive, in a sandbox HOME against a
  recording server, two runs with the same appended rules and different
  asks: the two marked system blocks are byte for byte the same, the
  rules at the end of the 110k one; only the unmarked billing line differs.

Not tried: a real account's cache_read on the second classifier ask;
the full internal/gateway package and the full suite (running after the
push); Windows/WSL runs of the bridge.
2026-11-03 02:08:41 +08:00
..