Claude Code 构建日志隔离:Haiku 构建,Jev 分流决策
让 Haiku 子 agent 跑构建只回 3 行日志,主会话省下 40k token;同一思路下 Jev 在代码里以 0.90 阈值分流 1,301 次 fork 决策,只有拿不准的才交给 Sonnet。
THIS IS A PURE F*CKING GOLDMINE Anthropic just shared one of the best tricks for Claude Code. The idea: never let build logs touch your main session. One tiny agent runs the build and hands back 3 lines. Same build, two ways: inline it is 40k tokens and $0.09 every single run. Through the builder it is 3 lines and nothing. You just launch Claude Code like this: claude --model sonnet # builder.md: model: haiku here's the split: → Sonnet 5.5 edits code in the main session and never sees a log → a Haiku 5.5 builder runs npm build, tsc and the test suite → it reads all 2k log lines, 227 files and 18 tests itself → it returns 3 lines: what ran, what failed, where the part everyone gets wrong: they run the build in the main session. 40k tokens of log noise per run, and every later message in that session carries it. you pay for that log again on every turn until the context resets. the builder agent is 10 lines of markdown. name, model haiku, tools Bash, and one rule: run the build, fix nothing, return 3 lines. that "fix nothing" is the whole trick. the cheap agent never tries to be clever, it just reports, and the lead decides what to do. one catch worth knowing: past 100k of context Haiku jumps to 5x its own price, so the builder is kept deliberately small. main context grows by +0 instead of +40k. that is the entire win. Sonnet edits. Haiku builds. The log never leaves the agent. JEV engineering is the same move one layer down: 1,301 forks this run - which agent, retry or stop, fix or report - resolved in code at 0.90 sharpness, and only the split ones ever reach Sonnet the full tree ▸ Sonnet 5.5 runs the main session and edits code only ▸ a Haiku 5.5 builder agent runs build, typecheck and tests ▸ the builder reads every log line and returns 3 lines, never the log ▸ the builder fixes nothing, it only reports ▸ Sonnet 5.5 reads those 3 lines and decides the next edit ▸ JEV resolves micro-forks in code and escalates only the split ones paste the tree and this prompt into Claude Code ↓ "Rebuild my Claude Code setup around this tree: 1. Run the main session on Sonnet 5.5 for editing code only. 2. Create a builder subagent with model: haiku and tools: Bash. 3. The builder runs build, typecheck and tests, reads all output itself, and returns at most 3 lines: what ran, what failed, where. 4. The builder never fixes anything, it only reports. 5. Add one rule to CLAUDE.md: build output never enters the main session, no exceptions. 6. Route deterministic forks (which agent, retry or stop, fix or report) through JEV. Show me every change as a diff first. No edits until I say go." ↳ http://code.claude.com/docs/en/model-config save it, it'll come in handy.
这条是引用着另一条写的:x.com/sprytixl/status/2107763347097534680