Claude Code 多智能体协作代码处理工作流
Skunzu
THIS IS STUPIDLY F*CKING GOOD Anthropic's own Claude Code playbook has a trick almost nobody uses. The idea: stop running one giant session on a 300-file job. Opus 5.5 writes the plan once, then Claude Code runs headless, one fresh Haiku 5.5 session per file, 8 at a time. No context rot, no 4-hour transcript, and you see the exact cost of every file. You just run Claude Code like this: claude -p "$task" --model haiku --max-turns 8 --output-format json here's the split: → Opus 5.5 reads the repo once and writes tasks.txt, one line per file → Haiku 5.5 does one file per session with a clean context → Sonnet 5 only touches the files that come back FAIL → you read a cost column instead of babysitting a chat You only look at three moments: → before the loop starts (read tasks.txt) → when the FAIL rate goes over 10% → before you merge Opus plans. Haiku grinds. Sonnet cleans up. JEV engineering is the same move one layer down: the forks that need no thinker (which file, which tool, retry or stop) go to JEV in milliseconds, and the big models only see the ones that split the full tree > Opus 5.5 writes tasks.txt: every file + the one rule to apply > xargs -P 8 runs 8 headless Haiku 5.5 sessions at once > each session: fresh context, max 8 turns, only Edit and git commit allowed > each one must answer OK or FAIL, nothing else > --output-format json gives you the result and total_cost_usd per file > FAIL lines go to Sonnet 5 with the error attached > JEV routes micro-forks in milliseconds paste the tree and this prompt into Claude Code ↓ "Set up a fan-out run for this repo: 1. Use Opus 5.5 to write tasks.txt: one line per file that needs [your change], plus the exact rule to apply. 2. Write https://t.co/o9zohGK0sD: for each line, call claude -p with --model haiku --max-turns 8 --allowedTools "Edit" "Bash(git commit:*)" --output-format json, 8 in parallel with xargs -P 8. The prompt must end with: reply OK if done, FAIL if not. 3. Log file, OK/FAIL and total_cost_usd to results.csv. 4. Send every FAIL back through Sonnet 5 with its error, then stop. Show me tasks.txt and https://t.co/o9zohGK0sD first. Don't run anything until I say go." ↳ https://t.co/7EzN9Eba0m this is how you clear a week of refactors in one afternoon.查看原帖