Illustration: a blank code editor window, a blank JavaScript code block outline, a circle of arrows, and a coffee mug on a desk
Illustration

The most expensive part of a Claude Code session is not the model thinking. It is the narration. Read a file, report back. Run a command, report back. Edit a file, report back. Every round trip resends the conversation, and the conversation is mostly tool results I never asked to read twice. I have watched a session burn through its five-hour window on a job that was, in the end, twenty small steps in a row.

So when my feed filled up this weekend with people announcing that Claude Code's new Code Mode cuts token use by 37%, I wanted it to be true. I went looking for where the number came from before I repeated it. The feature is real, and it is worth trying. The number is borrowed from somewhere else, and the part of Code Mode that actually matters for how I work is not the token count at all. It is who reviews what, and when.

What shipped, in one changelog line

Code Mode arrived in Claude Code v2.1.323, dated November 12, 2026. The changelog entry is a single sentence: "Added Code Mode, an experimental opt-in in which Claude writes JavaScript to call its tools." Anthropic added a documentation page the same day, "Run tool calls from code with Code Mode," and that page is where the real detail lives.

The change is simple to describe. Without Code Mode, Claude asks for tool calls — Bash, Read, Edit — one at a time, reads each result, and then decides what to do next. With Code Mode, Claude writes a piece of JavaScript that makes the tool calls, and Claude Code runs that code in the session. One script can run commands in parallel, feed one result into the next call, and return only the part of the output Claude needs to read. In the conversation you still see the tool calls, like the diff of an edit. The code itself sits in the transcript viewer, behind Ctrl+O, as a collapsed Code row.

The docs give a small example that tells you exactly what kind of job this is for. You ask Claude to raise a retry limit. The script searches the source tree for the file containing retryPolicy, edits maxAttempts: 3 to maxAttempts: 5 in the first match, and runs the tests for that function, returning the file path and the test output. Find, edit, verify — three steps that used to be three round trips, now one.

Turning it on is one line:

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

You confirm a prompt, and you are in. An organization can block it with a managed setting, setting the same variable to 0, and users in a Code Mode session stay in it until they exit or restart. It is experimental and off by default, and Anthropic says plainly that it "may change or be removed in any release."

The 37% figure is real. It is just not about this feature

Here is the part I wish someone had told me before the weekend. Anthropic's Code Mode documentation gives no savings figure at all. The "37% fewer tokens" number that is everywhere comes from an Anthropic engineering post dated November 24, 2025 — almost a year ago — called "Introducing advanced tool use." That post launched Programmatic Tool Calling for the API, a feature where Claude writes Python in a sandbox. Its measurement was that average usage dropped from 43,588 to 27,297 tokens, a 37% reduction, on complex research tasks. An API feature, a different language, a different kind of task, a year ago. It is not a measurement of Code Mode in Claude Code, and Anthropic has not published one.

That does not mean Code Mode saves nothing. It means the only numbers in circulation come from two independent tests, both small, both worth reading with their caveats attached.

The first, by wmedia.es, ran the same task in two Opus 5.5 sessions: find the top three customers across 40 JSON files. Total input tokens, cache included, fell from 150,364 to 94,659. But the run took 37 seconds instead of 15, and the author says outright that one run each "is not a benchmark." The test also explains where the saving comes from, and it is not fewer turns. It is a much smaller fixed tool context riding along on every request: system tools at 11.1k tokens with Code Mode versus 24.6k without, in that setup. Every request carries the tool definitions with it, and Code Mode shrinks that payload by giving the model two tools — REPL, which runs the JavaScript, and Poll, which collects results — with the rest described inside REPL as shorter JavaScript functions.

The second, from a developer posting as @kairofeed, ran eight runs on Sonnet 5.5: about 40% fewer tokens on short tasks, and 55% fewer — 486K down to 218K — on a 30-file refactor. Same direction, different magnitudes, different tasks, different models. Nobody has run this at scale yet, and one of the two tests found the token saving came with a slower result.

I am not quoting either number as a fact about what Code Mode will do for you. I am quoting them as the only evidence that exists, and the honest summary of that evidence is: the mechanism is sound, the direction is consistent, and the size of the saving depends on the job. If you want a number for your own work, the docs-adjacent advice floating around is the right one: try it on a repetitive, multi-file job and watch /context yourself. Anthropic has not given you a number to promise your team, so do not promise one.

Where I would actually use it

Anthropic recommends Code Mode for tasks with many related tool calls: a change that repeats across many files, a search whose results need filtering before Claude reads them, several independent commands that can run at the same time. That list matches my own week more than I would like to admit. Renaming a function across a dozen files. Grepping a codebase for every place a config key is read, then touching only the ones that match a second condition. Running the linter, the type checker, and the test suite and reading only the failures. These are the jobs where the chatty version of Claude Code is at its worst, because most of what it reads back to me is output I would have filtered out myself.

Where I would not reach for it is the opposite kind of job: one careful edit in one file I do not fully understand yet, or a debugging session where the point is to watch what happens at each step. Code Mode moves the unit of work from a tool call to a program, and when something goes wrong in a program, the first thing you have to do is understand the program it wrote before you can trace which step failed. One developer put it exactly that way this weekend, and another asked the fair question: why would this be dramatically better than the absurdly long shell commands Claude Code already writes? Both are worth sitting with. The win here is not that Claude writes better code than you. It is that a loop is a better shape than twenty sequential tool calls for a certain kind of job, and that the fixed cost of describing the tools drops on every request.

There is also a context worth knowing: Claude Code is not alone in this direction. Codex does its version in v8, OpenCode in a custom interpreter, Pi in quickjs. Claude Code's implementation, according to a developer who read it, uses node:vm running in process in Bun. The harness around the model is becoming as much of the product as the model, and every major coding agent is converging on the same idea — let the model write the loop instead of narrating it.

The part that changed my mind about turning it on

The token numbers are what everyone is arguing about. The permissions change is what I spent the most time on, because it is the part that affects whether I trust the tool with a real repository.

Every tool call Claude's code makes still goes through your deny and ask rules and your PreToolUse hooks. That has not changed, and it is the reason I am willing to try Code Mode at all. What has changed is the shape of review in auto mode. The docs say it directly: in auto mode, "the classifier reviews each piece of code before it runs, not each tool call," and "it doesn't see values computed at run time, such as a path taken from search output." If your safety depends on a rule that matches command text — say, a deny rule for a particular path or a destructive command — that rule still applies to the tool call, but the classifier that decides whether a block of code is safe to run in auto mode cannot see what the code will compute. The docs' own advice is to keep rules or hooks for calls you must control, and they give you the mechanism: a PreToolUse hook that matches REPL, the tool that runs Claude's code, can read the JavaScript from tool_input.code and inspect it before it executes.

There is a second wrinkle worth knowing before you turn it on in auto mode. When Claude starts more code while earlier code is still running, the earlier code loses its classifier review, and Claude Code asks you about the remaining calls that would need one — with a countdown, if no IDE is connected. Answer before the countdown ends, or that call is refused, and later calls that would show a countdown are refused without a prompt. It is a small detail, and it is exactly the kind of small detail that costs you twenty minutes the first time you meet it in the middle of a long job.

Then there are the limits, and they are long enough to check before you get attached to the idea. Code Mode only works in an interactive claude session in a terminal, on the native build. It does not work with -p, the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions. It needs a Claude subscription or Console account — not a gateway, not Amazon Bedrock, not Claude Platform on AWS, not Google Cloud's Agent Platform, not Microsoft Foundry — and not an organization on the HIPAA configuration or zero data retention. It works with Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2, and on Windows it needs Git for Windows installed. You cannot start it with an API key helper, agent teams, OpenTelemetry export, or DISABLE_TELEMETRY set. You cannot use Remote Control, Claude in Chrome, or computer use while it is on, and you cannot move a session to the Desktop app or turn it into a background session. A Code Mode session can only be resumed in the terminal, with Code Mode on — start a normal session and that work is not waiting for you there.

The time limits are concrete, too. Code that Claude waits for stops after ten minutes, including time spent at permission prompts. Code running in the background can run for up to two hours, but only if you started in auto or bypassPermissions mode. If you switched modes mid-session, or picked the session from the resume list, the docs tell you to exit and restart with claude --continue --permission-mode auto and Code Mode on. I have not hit these edges yet, and I would rather know them from the docs than discover them at minute eleven of a migration script.

Update first, then experiment

One more thing, and it is the most practical item in this whole piece. The same week that brought Code Mode also brought fixes you should have before you experiment with a feature that changes how permissions are reviewed. Version 2.1.321 fixed four permission and sandbox gaps — cases where a prompt that should have appeared did not, including a read-only Bash command running outside the sandbox without a prompt, and deny rules not applying to the file a cp or mv into a directory writes. Version 2.1.325, dated November 13, fixed a security issue in how zstd-compressed responses are decoded, and fixed sessions on third-party gateways stopping with a context length error instead of compacting. Code Mode is available in 2.1.325 as well, so there is no reason to try it on an older build. Update, check that you are on 2.1.321 or later, and then turn the experiment on.

My verdict

Code Mode is a good idea with a borrowed number attached to it. The engineering logic is sound: models are better at writing a loop than at eyeballing twenty tool results in a row, and every avoided round trip saves context. The independent tests point the same direction with big caveats — single runs, different models, different tasks, and in one case a slower result. What Anthropic has actually shipped is an experiment, clearly labeled, with a long list of conditions and one genuine trade-off I care about: the unit of review moves from a tool call to a program, and in auto mode the reviewer cannot see what the program computes at run time.

So I will turn it on, on a repetitive, multi-file job, with my deny rules and hooks in place, and I will measure it with /context instead of quoting a percentage I did not earn. If the saving shows up in my own sessions, I will keep it on for that kind of work and off for everything else. And I will wait for Anthropic's own measurements before I tell anyone — including myself — that it saves 37%.

About the author

Marcus Kim is a full-stack developer based in Boston, MA. Dev Day Notes is his field notebook of dev tools, coffee, and games. More about Marcus →

← Back to all posts