Last updated: · Applies to: Claude Code v2.1.323+
Claude Code code mode: turn it on and fix it not working
To turn on Claude Code code mode, use v2.1.323 or later, set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1 in your shell or user settings, and start an interactive terminal session. Confirm the first-run prompt and look for the Code Mode banner. If code mode is not working, check /status and match the reason below.
This is an unofficial tutorial, not affiliated with or endorsed by Anthropic. It follows Anthropic's official Code Mode guide, Claude Code changelog and v2.1.323 GitHub release, checked November 15, 2026.
What is Claude Code code mode?
Code Mode is an experimental way for Claude to call its tools by writing JavaScript. It is off by default and may change or be removed in any release. The v2.1.323 changelog and GitHub release, dated November 12, 2026, introduced the opt-in.
Without Code Mode, Claude asks for tools such as Bash, Read or Edit directly and reads each result before deciding what to do next. With Code Mode, Claude writes JavaScript that calls those tools, and Claude Code runs it in the session. You still describe the task in a prompt.
One piece of code can run independent commands in parallel, pass a result to the next call, and return only the output Claude needs to read. The conversation shows the tool calls, including edit diffs; the JavaScript is available in the transcript viewer.
Use /feedback to send feedback about the experiment.
How do I turn on Claude Code code mode?
Check your version first:
claude --versionCode Mode requires v2.1.323 or later on either release channel. If your version is older, update:
claude updateIf the stable channel has not reached v2.1.323, wait for it to catch up or switch to latest. Then use one of the documented methods below to set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1 and start an interactive terminal session.
macOS, Linux or WSL
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claudeWindows PowerShell
$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
claudeWindows also requires Git for Windows. The official docs show PowerShell steps for Windows; they do not show Windows Command Prompt steps.
User settings
To use your user settings, add this env entry to ~/.claude/settings.json, then start claude:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
}
}Claude Code ignores this variable in a project's settings files. A repository you clone therefore cannot turn on Code Mode for you.
How do I confirm that Code Mode is on?
Before your first Code Mode session, Claude Code asks for confirmation. Select Yes, turn on Code Mode. Claude Code restarts and shows this exact line near the top:
Code Mode (experimental) is on · this session can be resumed only with Code Mode onPress Ctrl+O to open the transcript viewer. Each piece of JavaScript appears as a collapsed Code row with a hint explaining how to expand it. Press Ctrl+O again to return to the conversation.
The official docs suggest this sample task:
Read every Markdown file in this project and list the links that point to local files that don't exist.If the session says Code Mode (experimental) isn't available, the reason follows on the same line and also appears in /status. If that line is different or absent, use the troubleshooting checks.
How do I turn it off, resume sessions or block it for an organization?
Remove CLAUDE_CODE_EXPERIMENTAL_CODE_MODE from your shell and ~/.claude/settings.json, then start a new session. You can instead change the value to 0 in either place. A 0 in one keeps Code Mode off even if the other has 1.
To resume a Code Mode session, keep the variable set to 1 when running claude --continue or claude --resume. With Code Mode off, Claude Code refuses to resume it. A session started without Code Mode resumes without Code Mode, even when the variable is set.
Organization admins can set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 0 in managed settings to block it for everyone. Users already in Code Mode stay in that session until they exit or restart. They then start without it and cannot resume Code Mode sessions while the block remains. Managed settings cannot turn Code Mode on for users.
How does ordinary mode compare, and when should I try Code Mode?
| Mode | How Claude calls tools |
|---|---|
| Ordinary mode | Claude requests a tool call directly and reads its result before deciding the next step. |
| Code Mode | Claude writes JavaScript that can combine related calls, use earlier results and return the output it needs to read. |
The official guide recommends trying Code Mode for tasks with many related tool calls:
- A change repeated across many files.
- A search whose results need filtering before Claude reads them.
- Several independent commands that can run at the same time.
The docs do not publish a token-savings percentage, cost reduction or benchmark comparing the two modes.
What requirements and limitations apply to Code Mode?
| Requirement | Supported configuration |
|---|---|
| Version | Claude Code v2.1.323 or later on either release channel. Older versions start without Code Mode, with or without the reason it isn't open to your account yet. |
| Account and connection | A Claude subscription or Console account. Gateways, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform and Microsoft Foundry are unsupported. |
| Organization | No HIPAA configuration or zero data retention. |
| Model | Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2. |
| Surface | An interactive claude session in a terminal. No -p, Agent SDK, VS Code panel, Desktop app or cloud sessions. |
| Installation | The native build of Claude Code. |
| Windows | Git for Windows installed. |
| Settings | Some settings prevent startup, including an API key helper, agent teams, OpenTelemetry export or DISABLE_TELEMETRY. Match the reason in the troubleshooting table. |
Session and feature limits
- Code Mode sessions can resume only in the terminal with Code Mode on.
- Remote Control, Claude in Chrome and computer use are unavailable.
- You cannot move the session to Desktop or turn it into a background session.
/forkcannot start a background copy. - Code that cannot run in the background must finish before Claude answers. It stops after ten minutes, including time at permission prompts.
- Code that runs in the background can run for up to two hours while you keep talking to Claude. Start the session in
autoorbypassPermissionsmode for background code. - A
PreToolUsehook that cannot run or times out can cause a tool call to be refused. AUserPromptSubmithook can block code output.
Permissions and hooks
Each tool call from Claude's code goes through deny/ask permission rules and PreToolUse hooks. Existing rules and matchers for tools such as Bash do not need to change.
In auto mode, the classifier reviews each piece of code before it runs, rather than each tool call. It cannot see values computed at runtime; keep rules or hooks for calls you must control. In other permission modes, the code starts without a review, and you are prompted for each tool call that would prompt in that mode.
To inspect the JavaScript itself, use a PreToolUse hook matching REPL, the tool that runs the code, and read tool_input.code. The official docs warn that Bash rules match command text: with or without Code Mode, a denied command can be expressed in a form the rule does not match.
Why is Claude Code code mode not working?
If you see Code Mode (experimental) isn't available, the session started without Code Mode. Read the reason on that line or run /status, then match it to the official table:
| Reason includes | What to do |
|---|---|
it isn't open to your account yet | Update if older than v2.1.323. Otherwise check your network and start again. If the reason remains, try again another day. |
it only works with the Anthropic API | Remove settings routing requests through a cloud provider, gateway or custom ANTHROPIC_BASE_URL. |
it doesn't work with an API key helper | Remove 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 models | Start with a supported model, for example using --model opus. Haiku 5.5 and Fable 5.2 also work. |
it doesn't work in background jobs | Start in the foreground without --remote-control. |
it needs settings that Claude Code downloads from Anthropic | Unset the variable disabling feature-flag fetching, such as DISABLE_TELEMETRY. |
OpenTelemetry is on | Unset CLAUDE_CODE_ENABLE_TELEMETRY and ENABLE_BETA_TRACING_DETAILED if you can work without OpenTelemetry export. |
it doesn't yet work with an installed mod | Turn off the mod that checks tool calls. |
it can't be used together with agent teams yet | Unset CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS. |
this launch's tool options | Start without --restricted, add REPL to --tools, and remove REPL from --disallowedTools and deny rules. |
couldn't save your answer | Make ~/.claude.json writable. |
your organization's settings don't allow it | Ask your administrator about the managed setting. |
No line about Code Mode
Run claude --version and update if older than v2.1.323. Check that CLAUDE_CODE_EXPERIMENTAL_CODE_MODE is 1 in your shell or user settings. Remove any 0 from those locations and any --settings file.
Countdown prompts and hook failures
In auto mode, starting new code while earlier code is still running can show a permission prompt with a countdown. Answer before it ends or the call is refused. Hook-related refusals can report the hook failed or the hook did not finish. When code can run in the background, a UserPromptSubmit hook can withhold output, and its input source may be poll_event. See the official Code Mode guide for hook behavior and background-code recovery steps.
What else should I know about Claude Code code mode?
These answers follow the official Code Mode documentation.
Which version and environment variable enable Claude Code code mode?
Use Claude Code v2.1.323 or later and set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1 in your shell or user settings. Code Mode is experimental and off by default.
Can project settings enable Code Mode?
No. Claude Code ignores CLAUDE_CODE_EXPERIMENTAL_CODE_MODE in project settings files, so a cloned repository cannot turn it on for you. Use your shell or ~/.claude/settings.json.
Does Code Mode work in VS Code, Desktop, -p or cloud sessions?
No. Code Mode requires an interactive claude session in a terminal. The VS Code panel, Desktop app, -p, Agent SDK and cloud sessions are unsupported.
Do I need the variable set when I resume a Code Mode session?
Yes. Keep CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1 when running claude --continue or claude --resume. Sessions started without Code Mode resume without it, even when the variable is set.
Claude Code code mode vs Codex code mode: how do they compare?
They are different products. The official Claude Code docs do not compare them, so this guide does not claim that either is better or that they are equivalent.
Is there an official token-savings percentage for Code Mode?
No. The official docs publish no token-savings percentage, cost reduction or benchmark against ordinary mode. They describe combining tool calls in code and returning the output Claude needs to read.
Which models support Code Mode, including Fable 5.2?
The official supported models are Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2. The other account, installation, organization and terminal requirements still apply.
Can organization admins enable or block Code Mode in managed settings?
Admins can block Code Mode by setting CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 0 in managed settings, but cannot turn it on for users there. Existing Code Mode sessions continue until exit or restart; users then cannot start or resume Code Mode while the block remains.
Which official sources support this guide?
The feature guide documents setup, requirements and troubleshooting; the changelog and release record the introduction of Code Mode.