How Claude Code's Code Mode works: one model round-trip replaces sequential tool calls
Arindam_1729 · x · 2026-11-21
The author dissects Claude Code's experimental Code Mode by reading the docs and running the same task twice (on/off) on v2.1.330, then diffing the session logs.
- Mechanism: by default each tool call is a round trip where Claude re-reads the whole conversation; Code Mode has Claude write a short JavaScript program that makes the tool calls itself, so one trip can search, edit, and test. Off by default, requires v2.1.323+
- Measured deltas (9-file toy repo): requests 5→4, avg tokens/request 52.7k→35.0k, total tokens read 263.6k→140.2k (mostly cheap cache reads), model time 18.6s→15.2s, cost roughly flat ($0.34 vs $0.35)
- Script anatomy: 3 scripts made 18 tool calls; one script did 12 calls (4 Bash, 8 Edit) in 2.5s from a single request, running git diff/rg/npm test concurrently via Promise.all, returning only the final expression to Claude's context
- Trade-off: a sed loop bypassed the Edit tool's diff+checkpoint flow (0 diffed edits with Code Mode off, 8 with it on), and permission prompts became "can't be checked before it runs"
The author notes this is directional, not a benchmark.
More from coding & agent
- Is Haskell 'unsafe' too? A debate on types vs verification in the LLM era — satnam6502 · 2026-11-22
- Lessons from building a desktop AI agent that sees your screen and drives the mouse — SpeechAggravating453 · 2026-11-22
- MCP server checks if a pay-per-call x402 API is worth paying, from 24,766 real paid calls — biryaniAssasin · 2026-11-22
- Walmart and Muse to launch first agent-to-agent agentic commerce integration over MCP — AccBalanced · 2026-11-22
- scientific-toolkit: one MCP server fronting nine repos that refuses to fabricate results — Emergency-Tutor-7 · 2026-11-22
- Zero-degradation Strata tuning: fixing layer_split lifts decode ~10-15% and halves CPU expert misses — PathfinderTactician · 2026-11-22