In this piece
How many tokens does Claude Code’s Code Mode save?
Which three customers spent the most? To answer that question across 40 order files, Claude Code used 55,705 fewer input tokens with Code Mode on. It found the same three customers. The ordinary session returned the answer in 15 seconds. With Code Mode on, it took 37. Juan Andrés Núñez’s paired terminal runs
What does Claude Code do differently in Code Mode?
Code Mode lets Claude write JavaScript that calls its tools and chooses which results to send back to the model. Take a Markdown link check. The script can read each file, resolve paths and keep a list of failures. Claude can write the report from that list without reading every successful lookup. Anthropic’s guide to Code Mode
A tool call might read a file. A model turn is a chance for Claude to see the evidence and decide what to do next. Several file reads can fit in one turn. Keeping the successful reads out of the conversation leaves room for a follow-up, such as finding which commit moved the missing file. Returning entire files would use that space again.
Ordinary Claude Code can already write a script through Bash. That matters when you compare modes. In the orders test, the ordinary session used Python, and both sessions made four model requests. The author traced much of the difference to the smaller tool descriptions sent with those requests. You can also reduce large tool results with a separate proxy, as our Caveman input-compression review explains.
Where did the 55,705-token saving come from?
In Núñez’s November 2026 test, Opus 5.5 at medium effort ranked customers by paid orders in 40 JSON files. He ran each setting once on Claude Code 2.1.323. The input total includes cached tokens across all four requests. Each run identified the same customers in the same order. Test setup and session totals
| Measurement | Code Mode off | Code Mode on |
|---|---|---|
| Input tokens, including cache | 150,364 | 94,659 |
| Output tokens | 1,172 | 1,213 |
| Model requests | 4 | 4 |
| Elapsed time | 15 s | 37 s |
The difference comes to 37.0% of the baseline input. Cache reads carry a different price from fresh input, and output rose slightly. To budget for recurring work, track what it costs to get a correct answer. Our guide to cost per completed task explains how to include retries.
Did the broken-link demo go from 13 turns to two?
Daniel San reported 13 tool calls in two model turns on Fable 5.2. The run found all three broken Markdown links. Both counts describe the same session. His post gives no turn count for the job with Code Mode disabled, so it leaves the size of any speedup open. Daniel San’s terminal demo
Anthropic’s 150,000 to 2,000 tokens figure dates to November 2025. In its Model Context Protocol (MCP) example, an agent moving a transcript from Google Drive to Salesforce loaded only the tool definitions it needed. That saves 98.7% in the example. For a measured Claude Code CLI comparison, use the orders table above. Anthropic’s MCP example and token calculation
How do you enable Code Mode in the terminal?
Start an interactive session with the native Claude Code CLI, version 2.1.323 or later. Anthropic introduced the experimental feature on 12 November 2026 and leaves it off by default. On macOS, Linux or WSL, these commands check the version and enable Code Mode for one launch. Claude Code v2.1.323 release notes
claude --version
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claudeAccept the first-run prompt and check the startup banner for confirmation. Press Ctrl+O and expand a Code row to inspect the JavaScript. If the banner says the feature is unavailable, /status gives the reason. Check the account and surface first. Anthropic supports direct Claude subscriptions and Console accounts on eligible models. Gateways, cloud-provider accounts, zero-data-retention and HIPAA configurations are excluded as of 16 November 2026. Current requirements and troubleshooting
How can you test Code Mode on your own Markdown files?
Give both modes the same files and a question with a known answer. A short report is cheap to produce if it silently skips a broken link. This small example checks two common mistakes in a link audit. One filename contains an encoded space, and one apparent link is an example inside inline code.
In an empty test directory, create these two files. The shell commands work on macOS, Linux and WSL.
printf '# Guide\n' > guide.md
cat > links.md <<'MD'
[Guide](guide.md)
[Install](install.md)
[Release notes](Release%20Notes.md#changes)
`[Example](sample.md)`
MDStart a fresh session in that directory. Give it this prompt in each mode.
Check local file links in links.md. Resolve each path relative to the file, decode URL escapes and ignore fragments and inline code. Report the source line and decoded path for each missing file. Leave the files as they are.
The expected report has two rows. Line 2 points to install.md. Line 3 points to Release Notes.md. A report that flags sample.md has counted an example as a link. This is a correctness check you can repeat. The published timing and token figures above come from their respective authors.
- Use the same checkout, model, effort level and permissions. Start one fresh session with
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=0 claudeand another with the value set to1. Confirm the setting in each. - Check the two expected rows first. Then open
/usageand record session input, cache reads, cache writes and output separately. Record elapsed time and the number of model requests. Anthropic’s guide to session usage - Repeat on a real documentation change, alternating which mode runs first. If a reviewer has to reopen the files to locate a failure, include that time. A path and line number can be worth a few extra tokens.
When is Code Mode worth enabling?
I’d try Code Mode for a release check that reads many files and produces a small list someone can act on. Keep it for that job if it finds the same failures and the measured savings justify the wait. For a one-file fix, I’d start in the ordinary session until the extra tool traffic shows up in the numbers.
Claude Code Mode questions
Can I enable Code Mode for every project?
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to "1" in the env block of ~/.claude/settings.json and start a new terminal session. Claude Code ignores this variable in project settings. An organization can block it through managed settings.How do I enable it in Windows PowerShell?
$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = '1' in PowerShell, then run claude in the same shell. Accept the first-run prompt and check the banner.Can I run the experiment in CI or in the VS Code panel?
claude -p fall outside the supported surfaces. Use a regular terminal for both halves of the comparison.Can I resume the same conversation with Code Mode switched off?
0.Does one script get permission for every tool call?
PreToolUse hooks. In auto mode the classifier reviews the script before execution. Values computed later, such as a filename discovered by a search, are outside that review.