How to Turn On Code Mode in Claude Code (and When It’s Worth Using)

Claude Code’s new experimental Code Mode lets Claude write JavaScript that runs many tool calls in one step. Here is how to switch it on, test it and turn it off.

Reviewed by Mindloop Editorial on . Every link in the Sources section at the end was re-checked that day.

Graphic of a terminal with one code block branching into several tool icons, for a guide to Code Mode in Claude Code

Claude Code normally asks for each tool call directly and reads the result before deciding what to do next. Code Mode, added in version 2.1.323 on 12 November 2026, lets Claude write a short piece of JavaScript that makes several tool calls in one step. This guide shows you how to turn it on, try it on a real task, read the code Claude wrote, and turn it off again.

As of 15 November 2026, Code Mode is experimental and off by default. Anthropic’s docs say it may change or be removed in any release.

What Code Mode does

In a normal session, Claude asks for tools such as Bash, Read or Edit directly and reads each result before the next step. In a Code Mode session you still type a prompt in plain language, but Claude writes JavaScript to carry it out. 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.

Anthropic’s Code Mode documentation gives this example of what Claude might write when asked to raise a retry limit. It finds the file, edits it and runs the tests:

Code
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() });

You don’t write this code and you don’t see it by default. The conversation shows the tool calls, such as the edit’s diff.

The docs suggest trying it on tasks that take 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.

Read the limits first

Code Mode comes with real trade-offs. Check that you can live with these before you switch it on:

  • Resuming: a Code Mode session can be resumed only in the terminal, with Code Mode on.
  • Long-running code: unless the code can run in the background (see Step 6), you wait for it, and it stops after ten minutes.
  • Missing features: Remote Control, Claude in Chrome and computer use don’t work in a Code Mode session, and you can’t move the session to the Desktop app.

What you need

  • Claude Code v2.1.323 or later, installed with the native build.
  • A Claude subscription or a Claude Console account. Code Mode doesn’t work through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform or Microsoft Foundry.
  • One of these models: Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2.
  • An interactive claude session in a terminal. It doesn’t work with -p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions.
  • On Windows, Git for Windows installed.
  • An organization that doesn’t use the HIPAA configuration or zero data retention.

Step 1: Check your version

Code
claude --version

If the number is lower than 2.1.323, update:

Code
claude update

If you’re on the stable release channel and the update doesn’t reach 2.1.323 yet, the docs say to wait for stable to catch up or switch to latest.

Step 2: Start Claude Code with Code Mode on

Code Mode is controlled by one environment variable, CLAUDE_CODE_EXPERIMENTAL_CODE_MODE. To try it once, set the variable for a single launch.

macOS, Linux or WSL:

Code
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

Windows PowerShell:

Code
$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
claude

To turn it on for every new session, add an env block to your user settings file at ~/.claude/settings.json:

Code
{
  "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 switch Code Mode on for you.

Step 3: Confirm the prompt

Before your first Code Mode session, Claude Code asks you to confirm. Select Yes, turn on Code Mode. Claude Code restarts and shows this line near the top of the session:

Code
Code Mode (experimental) is on · this session can be resumed only with Code Mode on

If you see a different line, or none, jump to the errors section below.

Step 4: Give Claude a task with many tool calls

In a project you know well, try the prompt from the docs:

Code
Read every Markdown file in this project and list the links that point to local files that don't exist.

Another prompt that fits the pattern:

Code
Run the linter, the type checker and the unit tests at the same time, then summarize only the failures.

Expected result: Claude answers as usual, and you see the tool calls it made.

Step 5: Read the code Claude wrote

Press Ctrl+O to open the transcript viewer. Each piece of code appears as a collapsed Code row. Expand one to see the JavaScript behind the tool calls, then press Ctrl+O again to return to the conversation.

Step 6: Handle permissions and long jobs

Your existing safety settings still apply. Each tool call that the code makes goes through your deny and ask permission rules and your PreToolUse hooks, and you don’t need to change a rule for a tool such as Bash.

What changes is how the code is reviewed:

  • In auto mode, a classifier reviews each piece of code before it runs, not each tool call. It can’t see values worked out while the code runs, such as a path taken from search output. Keep rules or hooks for anything you must control.
  • In other permission modes, the code starts without a review, and you get a prompt for each tool call that would normally prompt you.

For long builds or test runs, Claude either waits for the code, which stops after ten minutes, or lets it continue in the background, where it can run for up to two hours while you keep talking. Background code needs a session started in auto or bypassPermissions mode. If auto mode is available to you, the docs give this way to restart into it:

Code
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude --continue --permission-mode auto

To check the code itself with your own script, write a PreToolUse hook that matches REPL, the tool that runs Claude’s code, and read the JavaScript from tool_input.code.

Step 7: Resume, or turn it off

To come back to a Code Mode session later, keep the variable set when you resume:

Code
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude --continue

With Code Mode off, Claude Code refuses to resume that session. Sessions you started without Code Mode resume without it, even with the variable set.

To turn Code Mode off, remove CLAUDE_CODE_EXPERIMENTAL_CODE_MODE from your shell and from ~/.claude/settings.json, then start a new session. You can also set its value to 0. A 0 in one place keeps Code Mode off even if the other place says 1.

Administrators can block it for a whole organization by putting the same env block, with the value "0", in managed settings. Managed settings can only block Code Mode. They can’t turn it on for users.

Common errors and fixes

If the session starts with Code Mode (experimental) isn't available, the reason follows on the same line, and /status shows it too. Fix the cause and start a new session. The table covers several reasons; the docs list the rest.

Reason shownFix
it isn't open to your account yetUpdate if you’re below v2.1.323. Otherwise check your network and start again. If it stays, try another day
it only works with the Anthropic APIRemove settings that route requests through a cloud provider, a gateway or a custom ANTHROPIC_BASE_URL
it doesn't work with an API key helperRemove apiKeyHelper, ANTHROPIC_AUTH_TOKEN and any Authorization or X-Api-Key header in ANTHROPIC_CUSTOM_HEADERS, then sign in or set ANTHROPIC_API_KEY
it only works with Opus 5.5, Sonnet 5.5 and later modelsStart with a supported model, for example claude --model opus
it needs settings that Claude Code downloads from AnthropicUnset the variable that turns off feature-flag fetching, such as DISABLE_TELEMETRY
your organization's settings don't allow itAsk your administrator about the managed setting

Other problems:

  • No line about Code Mode at all: check the version, check that the variable is 1 in your shell or user settings, and remove any 0.
  • A permission prompt with a countdown: in auto mode, when Claude starts more code while earlier code is still running, you may be asked about the earlier code’s remaining calls. Answer before the countdown ends, or that call is refused.
  • Claude reports a refused tool call: a PreToolUse hook failed or timed out. Fix the hook or raise its timeout.

Wrap-up

Code Mode is worth a try if your sessions involve lots of repeated searches, edits and test runs. Start it for one session with the environment variable, give it a many-step task, and read the code with Ctrl+O. Expect changes while it is experimental.

If you’re building out your Claude Code setup, our guides to agent skills in Claude Code and giving your agent a real browser with Chrome DevTools MCP are good next reads.

Sources

Links last checked on 15 November 2026.

Written by Mindloop Editorial

The Mindloop Experience editorial team writes clear, carefully sourced explainers and how-tos on AI and technology, software and the business of tech, for anyone who likes to know how things actually work.

Meet the editorial team

Responses

Write a response

More from Mindloop Experience

See all from Mindloop Experience

You can clap up to 50 times.