Anthropic added Code Mode to Claude Code in v2.1.323 (published on GitHub on November 12) and shipped an official docs page for it. With it on, Claude stops requesting tools such as Bash, Read and Edit one at a time; instead it writes a piece of JavaScript that runs commands in parallel, feeds one result into the next call, and returns only the output the model needs. The feature is off by default and turned on with the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1. It works only in an interactive claude session in a terminal, on the native build, with models such as Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2. v2.1.325 on November 13 fixed a batch of Code Mode bugs.

Key Takeaways

  • ✓How to turn it on: set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in your shell or ~/.claude/settings.json and confirm on first launch; the variable is ignored in project settings, so a cloned repo can't turn it on for you (official docs)
  • ✓How it works: Claude writes JavaScript that calls its tools; one piece of code can run commands in parallel and chain results, while the UI still shows the tool calls and Ctrl+O reveals the code
  • ✓Limits: interactive terminal sessions only; not -p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions, and not through a gateway, Bedrock, Google Cloud's Agent Platform or Foundry; unavailable to HIPAA and zero-data-retention organizations
  • ✓Permissions: every tool call still goes through deny/ask rules and PreToolUse hooks; in auto mode the classifier reviews the whole code, not each call; foreground code stops after 10 minutes, background code can run up to 2 hours
  • ✓Admins can set the variable to 0 in managed settings to block it org-wide; v2.1.325 fixed Code Mode bugs around worktrees, lost input at permission dialogs and resumed sessions starting work by themselves (changelog)
🧭

Heavy Claude Code use: compare subscription limits and API bills

Compare 40 dev plans & simulate token costs vs $20/mo subscriptions

🔬

In-Depth Technical Analysis

Background

A coding agent often needs dozens of tool calls in a row for one task: search files, read, edit, run tests, sending every result back to the model before the next step. That is slow and eats context. Letting the model write code that calls tools has appeared before, for example in Cloudflare's MCP Code Mode; now Anthropic has built it into Claude Code itself.

How it works

With Code Mode on, Claude submits JavaScript through a tool called REPL, and Claude Code runs it in the session. The code can run shell commands with $..., call functions such as edit, run several commands in parallel, and filter search output before the model reads it. The docs show one piece of code that finds a file, raises a retry limit and runs the tests, returning only the path and test output. Every tool call still passes deny/ask rules and PreToolUse hooks; in auto mode the classifier reviews the whole code and can't see values computed at run time, so critical calls should still be guarded by rules or hooks.

Numbers

Anthropic has not published speed or token-savings benchmarks. The only hard numbers in the docs: v2.1.323 or later is required; foreground code stops after 10 minutes, and background code can run up to 2 hours.

Getting started

Check claude --version and run claude update if needed, then start with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude and confirm. It suits repeated cross-file edits, searches that need filtering before reading, and independent commands run in parallel. A Code Mode session can only be resumed in a terminal with Code Mode on, and it won't start with an API key helper, agent teams, OpenTelemetry export or DISABLE_TELEMETRY. The feature is experimental and may change or be removed in any release.

Action HubReady to adopt this in production?

Benchmark side-by-side against alternatives, or calculate monthly token cost vs subscription break-even.

Up NextX Debate: AI Commentator Chubby Says Claude Code and Opus 5.5 Have Been His Daily Driver for Two Months and GPT Is "Not Close," but Concedes Computer Use Is Still GPT's Edge; 150+ Replies Focus on Splitting Work by Task and the Same-Day Claude Login Outage
Read Now→