Coding

Claude Code’s experimental Code Mode: what it changes and when to use it

Anthropic is testing Code Mode in Claude Code: Claude writes JavaScript that runs several tool calls at once and reads only the result. Here is how it works, how to switch it on and where it does not run.

Oliver · FoxAI World4 min read
18
Oliver points at a stylized code panel beside an Anthropic logo while sitting behind a laptop.Code Mode, explained

Conceptual cover created with AI.

Ask Claude Code to change one setting across fifty files and, until now, you would watch it work step by step: search, read the result, open a file, edit it, read the result again, move to the next file. Every one of those intermediate outputs lands in the conversation. Anthropic is now testing a different approach called Code Mode, and the change is less about what Claude can do than about how much text it has to carry while doing it.

What Code Mode changes

Claude Code works through tools: small built-in actions such as reading a file, running a shell command or editing text. Normally the model calls them one at a time and reads every answer. In Code Mode, Claude instead writes a short piece of JavaScript that makes several tool calls in one step. Claude Code runs that code inside the session, and Claude reads only the result the code returns.

According to Anthropic’s documentation, that code can run commands in parallel, pass the result of one call into the next and return only the output that is actually needed. The changelog lists the feature under version 2.1.323 as an experimental opt-in. First, isolate the change: Claude gets no new abilities here. It could already search, read and edit. What changes is the route the work takes.

Oliver gives a thumbs-up behind an Anthropic-branded laptop, surrounded by switches and device icons.
AI-generated conceptual illustration.

Why it could use fewer tokens

A token is the unit of text a language model reads and is billed for. In the usual step-by-step flow, raw file contents and command outputs pile up in the context, the working memory of the conversation, even when only a short summary matters. If a script filters that material before Claude sees it, the model reads less.

That is the logic. Anthropic’s Code Mode page does not publish an official saving, in percent or in tokens. Any number you see elsewhere comes from someone’s own test on their own project, so treat it as a hint, not a rule.

How to turn it on and off

Code Mode is off by default. You need Claude Code version 2.1.323 or later and the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1 when you start claude. To keep it on, the documentation shows adding the variable to the env block of your user settings file; a project settings file cannot switch it on. On first use, Claude Code asks for confirmation and then restarts.

To switch it off, remove the variable or set it to 0. Administrators can set it to 0 in managed settings to keep it off for a whole organisation.

Where it does not work

The list of limits is long, which fits the experimental label. Code Mode runs only in the interactive terminal version of Claude Code, from the native build. It is not available in the VS Code panel, the Desktop app or cloud sessions, and on Windows it needs Git for Windows.

It requires a Claude subscription or a Console account. It does not work through a gateway, Amazon Bedrock, Google Cloud or Microsoft Foundry offerings, and not in organisations with a HIPAA configuration or zero data retention. Supported models are Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2.

The trade-offs you accept

Batching work into a script changes how you supervise it. In auto mode, the safety classifier reviews the code as a whole, not each individual tool call. Foreground code stops after ten minutes. Remote Control, Claude in Chrome and computer use are unavailable, and a session cannot be moved to the Desktop app or turned into a background session. A session started with Code Mode can only be resumed in the terminal with the feature still on. Anthropic also states that it may change or be removed in any release.

Our assessment

This is a sensible idea for repetitive, multi-file jobs: bulk searches, the same edit in many places, collecting test results. Those are exactly the cases where intermediate output is noise. For short, exploratory tasks the gain is likely small, and you lose some visibility.

Our practical rule: if you try it, read the script before you approve it, because that script is now the unit of review. And measure on your own work. Run the same task once with Code Mode and once without, then compare token use and whether the result is what you asked for. A cheaper run that does the wrong thing is not a saving.

Ask AI about this article

Opens in a new tab with the question filled in.

Sources and research

Written by FoxAI World. The cover and illustrations are AI-generated conceptual artwork.

Your favourites

This list stays in this browser on your device. No account is needed, and other visitors cannot see it.

Use a story’s bookmark button to add your first favourite.