Anthropic added Code Mode to Claude Code in v2.1.323 on 12 November 2026. Anthropic calls it experimental and off by default. The docs state it may change or be removed in any release. It runs with four models: Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2.
With Code Mode on, Claude writes JavaScript that chains several tool calls in one step. The script runs the calls, filters the results, and returns only what the model reads next. Standard tool calling already emits several independent calls in one response. Anthropic's parallel tool use docs state that default plainly. A call that depends on an earlier result needs a fresh model round trip. Every intermediate result enters the model context before the next call runs. With Code Mode on, Claude chains dependent calls in one script, filters and aggregates inside it, and returns only the part Claude reads next. Each round trip waits for the model to answer, and each answer includes the full context with it. The script runs in the operator's session, on the operator's machine, with the operator's tools. Claude asks for the next step only after the script returns. Claude receives the return value, not the raw output of each call. The model context contains the return value instead of every intermediate result.
Code Mode runs in one place only: an interactive terminal session. The terminal session is the operator's own working session, not a hosted session. It does not run headless, in an IDE panel, in the Desktop app, or in the cloud. Every call runs in the operator's terminal, and nothing about it runs in the SDK or the cloud sessions.
The operator approves a script once, not each call inside it. Without Code Mode, the operator answers a prompt for each tool call that prompts. With Code Mode on, one approval applies to a whole script, and the calls inside it get no individual approval. The approver sees the tool calls and their results, and the script stays in a collapsed row in the transcript viewer. The operator opens the script in the transcript viewer before approving. In auto mode, the classifier reviews each piece of code before it runs, not each tool call. One check applies to a whole script, and the check does not receive values the script computes while it runs.
The operator gets no new tools from Code Mode. Claude calls the operator's existing tools inside the script, under their usual names. The script uses the same tools the operator already uses: shell commands, file reads, and edits. The operator's tools, files, and credentials stay the same. Only the call pattern changes: the calls run inside one script instead of arriving one by one from the model.
Follow the steps in order. Turn the mode on, check the limits, and set the controls before you run it on a repo you care about.
Figure 1 is the two flows side by side. On the standard side, each call returns its full output into the model context, and the model sends the next call. On the Code Mode side, the script runs the calls, filters the output, and returns only the filtered result.
Figure 1: Standard tool calling on top, Code Mode below.
The name — the stake is the Cloudflare origin and our suggestion for a better name.
One script — the stake is Anthropic's retry example, with the target computed at run time.
Turning it on — the stake is one environment variable, a confirmation, and a resume rule.
Where it runs — the stake is the terminal-only surface and the excluded clouds and tools.
Time limits — the stake is the wait cap and the background cap.
Blocked settings — the stake is the telemetry and key-helper settings that stop startup.
Token numbers — the stake is the correction of the viral figure to its real source.
Comparison — the stake is four approaches on eight rows, with the token figures kept apart.
Review and hooks — the stake is one classifier check per script against per-call rules.
Security — the stake is the coarser auto-mode review, hidden code, and the first-release bug.
Changelog — the stake is five releases and the fixes in each one.
When Anthropic recommends it — the stake is three task types from the docs.
MAESTRO threat modeling — what are potential threats when using the mode and how you can mitigate?