Claude Code Code Mode: how to turn it on, what it changes, and why it won't start
Short answer
Code Mode is an experimental Claude Code setting where Claude writes a short JavaScript program that makes several tool calls in one step, instead of calling Bash, Read or Edit one at a time and reading every result. To try it, update to Claude Code v2.1.323 or later and start a terminal session with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude, then pick Yes, turn on Code Mode. It only works in an interactive terminal session on a Claude subscription or Console account, with Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2. It is off by default, and a session you start in Code Mode can only be resumed with Code Mode still on.
Anthropic's developer account posted about Code Mode on X at 01:18 Dubai time on November 18 (21:18 UTC on November 17). By about 10:30 Dubai time it had 692,413 views, 6,833 likes and 6,813 bookmarks (X API). That bookmark count is almost the same as the like count, which tells you people saved it to try later. The feature itself is not brand new: the changelog lists "Added Code Mode" under v2.1.323 on November 12. The X post is what put it in front of most people.
Yes, the name is "Claude Code Code Mode", and half the replies were jokes about that. Below is what it actually does, how to turn it on, the reasons it refuses to start, and when it is worth using. We built this from Anthropic's docs and changelog as of November 18, 2026. We did not run it ourselves.
What is Code Mode in Claude Code?
Normally Claude works one tool call at a time. It asks to run a command or read a file, looks at the result, then decides the next step. Every one of those results lands in the conversation, even when Claude only needed one line of it.
With Code Mode on, the Claude Code docs say Claude "writes a piece of JavaScript that makes the tool calls, and Claude Code runs that code in your session." One piece of code can run commands in parallel, feed one result into the next call, and hand back only the part of the output Claude needs to read. This is the docs' own example, for a prompt asking Claude to raise a retry limit:
const files = await $`rg -l "function retryPolicy" src`.text();
const target = files.trim().split("\n")[0];
await edit(target, "maxAttempts: 3", "maxAttempts: 5");
({ edited: target, tests: $`npm test -- retryPolicy`.nothrow() });
That is a search, an edit and a test run in one step, and only the file path and the test output come back to Claude. You still see the tool calls in the chat, such as the edit's diff. The code itself is hidden until you press Ctrl+O to open the transcript viewer, where each script shows as a collapsed Code row.
How do you turn on Code Mode?
- Check your version. Run
claude --version. Below v2.1.323, runclaude update. If you are on the stable channel and the update stops short of v2.1.323, wait or switch to the latest channel. - Set the variable. On macOS, Linux or WSL:
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude. In Windows PowerShell:$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1", thenclaude. - Confirm once. Claude Code asks before your first Code Mode session. Pick Yes, turn on Code Mode. It restarts and shows
Code Mode (experimental) is on · this session can be resumed only with Code Mode onnear the top. - Give it a task with many tool calls. The docs suggest:
Read every Markdown file in this project and list the links that point to local files that don't exist. - Read what Claude wrote. Press Ctrl+O, expand a Code row, and press Ctrl+O again to go back.
To keep it on for every new session, put it in your user settings at ~/.claude/settings.json:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
}
}
One detail that trips people up: Claude Code ignores this variable in a project's settings files. That is on purpose, so a repository you clone cannot switch Code Mode on for you. If you set it in .claude/settings.json inside a repo, nothing happens. Use your shell or the user-level file.
What do you need before Code Mode will work?
- Version: Claude Code v2.1.323 or later. Agent teams with Code Mode need v2.1.326 or later.
- Account: a Claude subscription or Console account. Not through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Microsoft Foundry.
- Organization: no HIPAA configuration and no zero data retention.
- Model: Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2.
- Surface: an interactive
claudesession in a terminal. It does not work with-p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions. - Install: the native build of Claude Code, plus Git for Windows if you are on Windows.
Some settings also block it: an API key helper, OpenTelemetry export, or DISABLE_TELEMETRY. That last one catches a lot of privacy-minded setups.
Get the AI tools worth your time
Era of Minds by Salman Ahmed: one short email with the AI tools and news that actually matter. Free.
You're in. Check your inbox.
Confirm your email and your 50 AI prompts are on their way.
Free. Unsubscribe anytime.
Why does Claude Code say "Code Mode (experimental) isn't available"?
That line means the session started without Code Mode. The reason is printed on the same line, and /status shows it too. Here is what each reason means and the fix, from the troubleshooting table in the docs:
| Reason includes | What to do |
|---|---|
it isn't open to your account yet | Usually an old version. Update to v2.1.323+. If you are already there, check your network and try again; the docs say to try another day if it stays. |
it only works with the Anthropic API | Remove settings that route through a cloud provider, a gateway or a custom ANTHROPIC_BASE_URL. |
it doesn't work with an API key helper | Remove apiKeyHelper, ANTHROPIC_AUTH_TOKEN and auth headers in ANTHROPIC_CUSTOM_HEADERS, then sign in or set ANTHROPIC_API_KEY. |
it only works with Opus 5.5, Sonnet 5.5 and later models | Start with a supported model, for example --model opus. |
it needs settings that Claude Code downloads from Anthropic | Unset DISABLE_TELEMETRY or whichever variable turns off feature-flag fetching. |
OpenTelemetry is on | Unset CLAUDE_CODE_ENABLE_TELEMETRY and ENABLE_BETA_TRACING_DETAILED. |
it doesn't work in background jobs | Start in the foreground, without --remote-control. |
it doesn't yet work with the plugin | Run /plugin and disable the plugin it names. |
this launch's tool options | Drop --restricted, add REPL to --tools, and remove REPL from --disallowedTools and your deny rules. |
couldn't save your answer | Make ~/.claude.json writable. |
your organization's settings don't allow it | An admin set the variable to 0 in managed settings. You cannot override that locally. |
If there is no Code Mode line at all, the variable is not reaching Claude Code. Check that it is 1 in your shell or user settings and that no 0 sits in either place or in a --settings file. A 0 anywhere wins.
When is Code Mode worth turning on?
The docs point at three shapes of work:
- 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.
Think of a rename across forty files, a grep that returns thousands of lines when you need ten, or lint, type-check and unit tests that could all run at once. For a one-file fix, a script adds a step to something that was already a single round trip, so we would leave it off.
Does Code Mode save tokens?
It should cut what lands in Claude's context, because the script returns only the part of the output Claude needs. But Anthropic has not published a token number for Code Mode. The 37% figure you may see on X comes from a different feature: Programmatic Tool Calling on the Claude API, where Anthropic's November 24, 2025 engineering post reported average usage dropping "from 43,588 to 27,297 tokens, a 37% reduction on complex research tasks." Same idea, different product. If you want your own number, run the same prompt twice on the same model and branch, once with Code Mode off and once on, and compare /cost.
The idea is not unique to Anthropic either. Cloudflare published "Code Mode: the better way to use MCP" on September 26, 2025, arguing that models are better at writing code that calls tools than at calling the tools directly. Claude Code's version applies that to its own built-in tools.
Is Code Mode safe with auto mode and hooks?
Your guardrails still apply, but one thing changes. Every tool call inside a script still goes through your deny and ask rules and your PreToolUse hooks under its usual name, such as Bash. The difference is auto mode: its classifier reviews each piece of code before it runs, not each tool call, and it does not see values computed at run time, like a path pulled from search output. The docs' advice is to keep rules or hooks for any call you must control.
- Check your shell hooks. In Code Mode, a
git pushin a folder namedappcan reach your hook ascd 'app' && git push. A hook that only looks at the start of the string will miss it. - Inspect the script itself. Write a
PreToolUsehook that matchesREPL, the tool that runs the code, and read the JavaScript fromtool_input.code. - Block it for a team. Set
CLAUDE_CODE_EXPERIMENTAL_CODE_MODEto"0"in managed settings. Admins can block it this way but cannot switch it on for users.
What are the limits?
- Resuming: keep the variable at
1when you runclaude --continueor--resume. With it off, Claude Code refuses to resume a Code Mode session. - Time: code you wait on stops after ten minutes, and time spent at permission prompts counts. Code can run in the background for up to two hours if you started the session in auto or
bypassPermissionsmode. - Missing features: no Remote Control, no Claude in Chrome, no computer use. You also cannot move the session to the Desktop app or into a background session.
- It can change or disappear. The docs say so plainly. Since November 12 the changelog has already shipped Code Mode fixes in v2.1.325, v2.1.326 and v2.1.327, so update often if you use it.
What we'd do first
Turn it on in your shell only, not in settings, and give it the docs' broken-links prompt on a repo you know well. Open Ctrl+O and read the script before you trust the result. If your setup uses DISABLE_TELEMETRY or a gateway, expect it not to start, and decide whether that trade is worth it. If token use is the reason you are interested, our Headroom test covers another way to shrink what Claude reads, and the desktop themes guide and iPhone Duo guide cover the other Claude Code changes from this week.
Get the AI tools worth your time
Era of Minds by Salman Ahmed: one short email with the AI tools and news that actually matter. Free.
You're in. Check your inbox.
Confirm your email and your 50 AI prompts are on their way.
Free. Unsubscribe anytime.
FAQ: Claude Code Code Mode
What is Code Mode in Claude Code?
An experimental Claude Code feature, off by default, in which Claude writes a piece of JavaScript that makes several tool calls (such as Bash, Read and Edit) in one step. The code can run commands in parallel, pass one result into the next call and return only the part of the output Claude needs to read.
How do I enable Code Mode in Claude Code?
Update to Claude Code v2.1.323 or later, then start a terminal session with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude (in PowerShell, set $env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1" and run claude). Choose Yes, turn on Code Mode. To keep it on, add the variable to the env block of ~/.claude/settings.json. A project's settings file cannot turn it on.
Why does it say Code Mode (experimental) isn't available?
The session started without Code Mode, and the reason follows on the same line and in /status. Common causes are a version older than v2.1.323, a gateway or custom ANTHROPIC_BASE_URL, an API key helper, an unsupported model, DISABLE_TELEMETRY, OpenTelemetry export, or a 0 in your organization's managed settings.
Does Code Mode work in VS Code or the Claude Desktop app?
No. Code Mode needs an interactive claude session in a terminal. It does not work with -p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions, and you cannot use Remote Control, Claude in Chrome or computer use while it is on.
Which models support Code Mode?
Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2, on a Claude subscription or Console account. It does not work through a gateway, Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
Does Code Mode save tokens?
It is designed to keep intermediate output out of Claude's context, but Anthropic has not published a token figure for Code Mode. The 37% reduction often quoted comes from Programmatic Tool Calling on the Claude API (Anthropic, November 24, 2025). Run the same task with Code Mode off and on and compare /cost to get your own number.
Can I resume a Code Mode session?
Yes, but only in the terminal and only with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE still set to 1 when you run claude --continue or claude --resume. With Code Mode off, Claude Code refuses to resume that session.
How do I turn Code Mode off or block it for my team?
Remove the variable from your shell and ~/.claude/settings.json, or set it to 0, then start a new session. A 0 in one place keeps it off even if 1 is set in the other. Admins can set it to 0 in managed settings to block Code Mode for everyone, but cannot force it on.
Sources
- Claude Code docs: Run tool calls from code with Code Mode (how it works, requirements, setup, permissions, limits, troubleshooting)
- Claude Code changelog (v2.1.323, November 12, 2026, and later fixes) and environment variables reference
- Anthropic Engineering: Introducing advanced tool use (Nov 24, 2025) and Cloudflare: Code Mode, the better way to use MCP (Sep 26, 2025)
- On X: @ClaudeDevs Code Mode post (metrics via X API, November 18, 2026, about 10:30 Dubai time)
Get AI news decoded weekly.
Decoded is a free weekly email from Era of Minds. The AI stories that actually matter, in plain English. Five minutes, no hype.
You're in. Check your inbox.
Confirm your email and your 50 AI prompts are on their way.
Free. Unsubscribe anytime. Free gift: 50 AI prompts that actually work, sent the moment you join. More about Decoded