用 Code Mode 批跑工具
Batch tool calls with Code Mode
要点
- Claude Code 推出实验性 Code Mode:不再一次调用一个工具再读回结果,而是让 Claude 写一小段 JavaScript,并行执行调用并只把需要的输出交回模型。
- 作者把它比作修 N+1 查询:爱说话的 agent,解决办法是改成批量调用。
- 文档里有一句值得读两遍:auto mode 的分类器审查的是这段代码,而不是每一次工具调用。
- 文档见 code.claude.com/docs/en/code-mode。
原帖开头
Claude Code shipped an experimental Code Mode. Instead of calling tools one at a time and reading each result, Claude writes a bit of JavaScript that runs the calls in parallel and hands back only the output it needs. So the fix for chatty agents turned out to be batching, just …





