Claude Code 子 agent 分工:Haiku 群跑、Sonnet 主写、Opus 待命
分享 Claude Code 的模型分层用法:Sonnet 5.5 主会话写代码跑测试,Haiku 5.5 子 agent 并行做 AST 映射与文档检索,Opus 5.5 仅在计划锁定、重复失败、收尾三处被叫出;并称 Jev 在更下一层用 16ms 清掉机械路由分支。
holy sh*t. Official Anthropic tip for Claude Code: stop wasting Opus 5.5 context on grunt work Haiku 5.5 can swarm, and let Sonnet 5.5 do the building keep the architect on call with custom subagents CLAUDE_CODE_SUBAGENT_MODEL=haiku claude --model sonnet Sonnet 5.5 runs the primary session on high effort, writing the diffs and driving the test runs Haiku 5.5 subagents swarm the repo in parallel at 340 tok/s, handling AST mapping, docs lookup and test runs Opus 5.5 waits on call in ~/.claude/agents/ as the code reviewer, and only gets pulled in at three critical moments: → before a plan locks: does it break an auth invariant or a schema contract nobody wrote down? → when the same test fails twice: is this the real root cause or the start of a rabbit hole? → before calling it done: did the final diff sneak in a regression or skip a pre-flight rule? Opus 5.5 reviews. Sonnet 5.5 builds. Haiku 5.5 swarms JEV engineering runs the identical pattern one layer down: decisions that need no reasoning (which file to open, which tool to call, retry or abort) resolve in 16ms, so the frontier models only wake up when the path actually forks Plan on high. Delegate on medium. Keep Opus on call. - the full subagent setup > Opus 5.5 on call in ~/.claude/agents/code-reviewer.md catches deep architectural traps > Sonnet 5.5 lead owns the edits, the core logic and the test harness > Haiku 5.5 explorer maps the AST and greps every call site in parallel > Haiku 5.5 researcher pulls API docs and specs without touching your context > Haiku 5.5 tester runs the suite inside isolation: worktree, so your git tree stays clean > 400k+ tokens of raw output stay inside subagents while the main session holds a clean 14k > JEV micro-fork layer clears 1,500+ mechanical routing branches in under 16ms paste the setup and this prompt into Claude Code below: "Configure my Claude Code workspace for hierarchical subagent orchestration: 1. Audit ~/.claude/settings.json and project config for model roles fitting lead, subagents, and reviewer: > Pin main session model: sonnet with effortLevel: high for primary execution > Set CLAUDE_CODE_SUBAGENT_MODEL to haiku in settings.json with CLAUDE_CODE_SUBAGENT_MODEL_FORCE to 1 > Pin custom code-reviewer model: opus with effort: high in ~/.claude/agents/code-reviewer.md 2. Create specialized subagent files in ~/.claude/agents/: > code-reviewer.md: model: opus, tools: Read, Grep, Glob, read-only review of plans and diffs > explorer.md: model: haiku, tools: Read, Grep, Glob, fast AST mapping and call site discovery > researcher.md: model: haiku, tools: Read, WebFetch, external docs and spec lookup > tester.md: model: haiku, tools: Bash, Read, isolation: worktree, runs test suites only 3. Configure automatic review checkpoints in ~/.claude/CLAUDE.md: > Invoke @ code-reviewer before finalizing any multi-file plan > Automatically summon @ code-reviewer when the same test or compiler error fails twice > Enforce an @ code-reviewer diff audit before declaring tasks complete or staging git commits 4. Constrain subagent scopes: > Subagents return structured summaries only, never raw logs, so the main context stays under 15k > Route mechanical forks (tool choice, path selection, retries) through JEV Show every configuration diff first. Do not apply edits until confirmed" ↳ http://code.claude.com/docs/en/sub-agents
这条是引用着另一条写的:x.com/0xtrackmind/status/2113644871529418857