Back to Blog

Claude Code Code Mode: what it changes and when to turn it on

Alex Kim
7 min read
Claude Code Code Mode: what it changes and when to turn it on

Last updated: November 24, 2026

TL;DR

Code Mode changes how Claude Code uses its tools: instead of asking for each tool call and reading each result, Claude writes a piece of JavaScript that makes the calls, and Claude Code runs it in your session. Turn it on for tasks with many related tool calls, such as a change repeated across many files or a search whose results need filtering. It is experimental, off by default, and may change or be removed in any release, so check three things first: it needs Claude Code 2.1.323 or later in a terminal session, a session started in Code Mode resumes only in Code Mode, and in auto mode the classifier reviews the code rather than each call. Everything below comes from Anthropic's Code Mode docs.

What Code Mode changes

Without Code Mode, Claude asks for tool calls such as Bash, Read or Edit one at a time and reads each result before deciding the next step. With it, one piece of code can:

  • โšก run commands in parallel,
  • ๐Ÿ”— feed one result into the next call, and
  • โœ‚๏ธ return only the part of the output Claude needs to read.

Anthropic's own example raises a retry limit in one step: the code finds the file with rg, makes the edit, runs the tests, and returns the file's path and the test output.

In the conversation you still see the tool calls, such as the edit's diff, not the code. To read the code, press Ctrl+O to open the transcript viewer and expand the Code row.

When to turn it on

The docs point to tasks that take many related tool calls:

TaskWhy code helps
A change that repeats across many filesOne loop instead of a call per file
A search whose results need filteringClaude reads the filtered result, not all of it
Several independent commandsThey run at the same time

For a quick question or a single edit, there is little to gain. Our token usage guide covers the other ways to keep a session lean.

What to accept before you try it

Code Mode comes with limits the docs list up front:

  • Resuming. A Code Mode session resumes only with Code Mode on. Keep the variable set when you run claude -c or claude -r; with Code Mode off, Claude Code refuses to resume it.
  • Where it runs. Only an interactive claude session in a terminal. It doesn't work in the VS Code panel, the Desktop app or cloud sessions, and you can't use Remote Control, Claude in Chrome or computer use alongside it.
  • Long-running code. Unless the code runs in the background, you wait for it, and it stops after ten minutes. Background code, which needs a session started in auto or bypassPermissions mode, can run for up to two hours.
  • Requirements. Claude Code 2.1.323 or later on the native build; a Claude subscription, a Console account or a cloud provider (2.1.331 or later for Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry), but not through a gateway; and Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2. Organizations on the HIPAA configuration or zero data retention can't use it.

Permissions work on the calls, and in auto mode on the code

Your deny and ask rules and PreToolUse hooks still apply under each tool's usual name, such as Bash. Two things change:

  • Auto mode reviews the code, not each call. The classifier doesn't see values computed at run time, such as a path taken from search output, so keep rules or hooks for calls you must control.
  • Shell commands can arrive combined. A git push in a folder named app can reach your hook as cd 'app' && git push, so a hook that allows or blocks commands should check each part.

To read and approve every piece of code before it runs, add an ask rule for REPL, the tool that runs the code, in ~/.claude/settings.json:

{
  "permissions": {
    "ask": ["REPL"]
  }
}

Your sandbox settings apply to the shell commands the code runs, but the JavaScript itself and its file, web and MCP tool calls run outside the sandbox; for full isolation, run Claude Code in a container or virtual machine. Our permissions guide covers rule syntax, and the sandbox guide covers what the sandbox does and doesn't contain.

How to turn it on, and off

  1. Check your version and run claude update if it is older than 2.1.323.
  2. Start with the variable set: CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude. To keep it on for every new session, put it in the env block of ~/.claude/settings.json. A project's settings files can't turn it on, so a repository you clone can't switch it on for you.
  3. Confirm by selecting Yes, turn on Code Mode. Claude Code restarts and shows "Code Mode (experimental) is on" near the top of the session.
  4. Give it a task with many tool calls, such as listing the links in every Markdown file that point to local files that don't exist, then press Ctrl+O to read the code it wrote.

To turn it off, remove the variable or set it to 0; a 0 anywhere wins over a 1 elsewhere. An organization can block it for everyone by setting the variable to 0 in managed settings. If it doesn't start, the line near the top of the session and /status give the reason.

Frequently asked questions

What is Code Mode in Claude Code?

Code Mode is an experimental Claude Code feature in which Claude writes JavaScript that makes several tool calls in one step, and Claude Code runs that code in your session. Without it, Claude asks for each tool call and reads each result before the next.

How do I turn on Code Mode in Claude Code?

Start Claude Code with the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1, in your shell or in the env block of ~/.claude/settings.json, then confirm when asked. You need Claude Code 2.1.323 or later.

Can I resume a Code Mode session without Code Mode?

No. A session started in Code Mode resumes only with Code Mode on, so keep the variable set to 1 when you continue or resume it. Sessions started without Code Mode resume without it.

Does Code Mode work in VS Code?

Not in the VS Code panel. Code Mode works only in an interactive claude session in a terminal, and not in the Desktop app or cloud sessions.

Is Code Mode safe to use with auto mode?

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. Keep deny and ask rules or PreToolUse hooks for calls you must control, or add an ask rule for REPL to approve every piece of code yourself.

Keep the guardrails where the calls are

Code Mode moves the decisions into code, so the rules that matter are the ones written against tool names. Before you turn it on for real work, set the deny and ask rules you rely on; our permissions guide shows how.

#claude-code#Code Mode#Tools#permissions#ai-agents
Free assessment

Stop guessing. Score your first workflow.

Score one workflow in about five minutes. Nine questions, a grade, and the specific gap holding it back - no call required.