Guides

Claude Code Code Mode: what it is, how to turn it on, and whether it saves tokens

Code Mode is an experimental Claude Code feature, available since v2.1.323. Normally Claude calls Bash, Read or Edit one at a time and reads each result. In Code Mode it writes a piece of JavaScript that makes several tool calls in one step. It’s off by default: set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in your shell or in the env block of ~/.claude/settings.json, and use it in an interactive terminal session. Does it save tokens? Anthropic hasn’t published a number. The “37% fewer tokens” you see online comes from a different feature and from one test on one task, where Code Mode also took more than twice as long. Measure it on your own work.

Code Mode is experimental, and the docs say it “may change or be removed in any release.” Everything below is from Anthropic’s docs and changelog as of November 25, 2026, up to v2.1.332.

What Code Mode does

Without Code Mode, Claude asks for one tool call, reads the result, then decides on the next. With it, “Claude writes a piece of JavaScript that makes the tool calls, and Claude Code runs that code in your session.” The script can loop over files, filter a search before Claude reads it, or run several commands in parallel, and only what the script returns goes back to the model.

The docs point to three kinds of work where this helps:

In the transcript you still see the individual tool calls, not the code. Press Ctrl+O to see the script as a collapsed Code row.

It sounds like Claude now writes its own programs. In a way, yes. But the tools are the same ones you already approve: Bash, Read, Edit, MCP tools. What changes is how many of them run between two looks from the model.

How to turn it on and off

For one session, start Claude Code with the variable set:

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

To keep it on, add it to your user settings:

~/.claude/settings.json

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
  }
}

Claude Code ignores this variable in a project’s settings files, so a repository you clone can’t turn Code Mode on for you. The first time, Claude Code asks you to confirm (“Yes, turn on Code Mode”), restarts, and shows that Code Mode is on.

What it needs, and where it doesn’t work

RequirementWhat the docs say
VersionClaude Code v2.1.323 or later, native build
AccountA Claude subscription, a Console account, or a cloud provider such as Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry (v2.1.331 or later); not through a gateway, not with Claude for Government, HIPAA or zero data retention configurations
ModelsClaude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2
WhereAn interactive session in a terminal; not the VS Code panel, the desktop app or cloud sessions
Not withRemote Control, Claude in Chrome or computer use
Agent teamsv2.1.326 or later; teammates use Code Mode in the default in-process display, not in split panes
Script timeUp to ten minutes; a background script up to two hours in auto or bypass-permissions mode

Cloud providers: Code Mode came to Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry and Claude Platform on AWS in v2.1.331 (November 23, 2026), so update Claude Code first. Two catches from the docs: a session that ran on a Claude subscription or a Console account can’t be resumed on a cloud provider, and with an Enterprise Admin Console sign-in you need Agent Platform, or Bedrock without the Mantle endpoint.

Permissions and the sandbox

Each tool call inside a script still goes through your deny and ask rules and your PreToolUse hooks, under its usual name (Bash, an MCP tool’s name and so on). Two details matter:

If you rely on the sandbox for safety, that second line is the one to remember.

Does Code Mode save tokens?

Anthropic’s Code Mode page gives no number: no percent of tokens, no speed. The only token note is in the changelog for v2.1.328: “Code Mode’s tool descriptions are shorter, reducing token use.”

The 37% that people quote has two sources, and neither is an Anthropic measurement of Code Mode:

Personally, I wouldn’t trust anyone’s number for this, including mine. A loop over 40 files is exactly where a script should win. A task where Claude reads one file and edits it is not. The honest answer is “it depends on the task”, and the only way to know is to measure your own.

How to measure it on your own task

  1. Pick a real task with many tool calls, such as a rename across 30 files or a search across a large repo.
  2. Commit your work, so both runs start from the same state.
  3. Start a fresh session without Code Mode, with the same model and effort you normally use. Give the task.
  4. When it’s done, note /context. On a Console account, also note /cost; on a subscription, note /usage.
  5. Reset the files, for example with git stash -u. Start a fresh session with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1, give the same prompt, and note the same numbers.
  6. Compare tokens, time and the result. If the answers differ, the token count doesn’t matter.

On a subscription, /usage shows your share of the 5-hour and weekly limits in percent, so one run may not move it much. Run the pair a few times, or compare /context, which shows how much of the context window each session used.

When to keep it off

Where Meowdoro fits

We built Meowdoro, a focus timer in the MacBook notch that shows which Claude Code and Codex sessions are working, done or waiting for your answer. A ten-minute script is a good moment to stay in your focus block instead of watching the terminal. We haven’t tested Meowdoro with Code Mode yet. If you try it, tell us what you see: meow@meowdoro.com.

Questions

How do I enable Code Mode in Claude Code?

Set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in your shell or in the env block of ~/.claude/settings.json, start an interactive terminal session on v2.1.323 or later, and confirm when asked. Project settings can’t turn it on.

Does Code Mode work in the Claude desktop app or VS Code?

No. As of v2.1.332, it works only in an interactive terminal session, not in the VS Code panel, the desktop app or cloud sessions.

Is the 37% token saving real?

Not as a general number. Anthropic hasn’t published one for Code Mode. 37% is the result of a different API feature, Programmatic Tool Calling, on research tasks, and of one Claude Code test on one task.

Does Code Mode work with MCP tools?

Yes. A script can call MCP tools, and each call goes through your permission rules and PreToolUse hooks under the tool’s name. Those calls run outside the sandbox.

How do I turn Code Mode off?

Remove the variable from your shell and settings, or set it to 0. Sessions started in Code Mode resume only with it on.

Sources: Anthropic’s Code Mode documentation and Claude Code changelog (v2.1.326 to v2.1.332), read on November 25, 2026; Anthropic’s “Introducing advanced tool use on the Claude Developer Platform” (November 24, 2025) for Programmatic Tool Calling; the paired Code Mode test as reported by Wavect (November 16, 2026), from runs by wmedia.es. Code Mode is experimental; check the docs for changes.