Claude Code Just Got Code Mode: Save a Ton of Tokens
TL;DR
Code Mode lets Claude Code write JavaScript that makes all its tool calls at once and returns only what it needs. A real run: 11 tool calls in one 6 second step.
Last updated: November 23, 2026
Watch the Short on YouTube: https://youtube.com/shorts/nIqbdU7mtlc
Claude Code just got a setting that can save you a ton of tokens. It is called Code Mode, and it lets Claude write code instead of calling tools one at a time. This post covers what the Short shows. For the full setup, requirements, permissions and troubleshooting, read the Claude Code Code Mode guide.
What it does#
Today, Claude calls one tool, reads the whole result, then decides the next one. Every step lands in your context window.
With Code Mode, added in Claude Code v2.1.323 on November 12, 2026, Claude writes a bit of JavaScript that makes those calls for it. Per the Code Mode docs, one piece of code can run commands in parallel, use one result in the next call, and return only the part of the output Claude needs to read.
A real run#
For the Short, I ran it on Claude Code 2.1.330 with Sonnet 5.5 on November 22, 2026. The prompt: audit the .mjs files in a scripts/ folder.
Claude wrote one step: 11 lines of JavaScript that made 11 tool calls, 1 Bash and 10 Read. Instead of pulling every file into context, it returned a small object: 9 files, 736 lines, 29 process.exit calls, and a top 5 table. The largest file was render.mjs at 176 lines. The whole step finished in 6 seconds.
That is the point of the feature. The file contents stayed inside the script. Only the summary came back to the model.
Why it works#
This is not a hunch. Several teams landed on the same idea independently:
- Cloudflare published "Code Mode: the better way to use MCP" in September 2025.
- Anthropic wrote up code execution with MCP on November 4, 2025. In its example, token usage dropped from 150,000 tokens to 2,000, a 98.7% saving.
- Cursor reported 46.9% fewer agent tokens in January 2026.
The shared insight: models are good at writing code, and code is a cheap place to filter, loop and join results before anything reaches the context window. If you have been tracking where your tokens go, as in Claude Code Token Burn Is an Observability Problem, intermediate tool output is often the biggest line item. Harness Engineering Makes Tokens a Systems Budget covers the same tradeoff from the harness side.
Turn it on#
Code Mode is experimental and off by default.
- Update to Claude Code v2.1.323 or later.
- Start Claude in your terminal with the flag set:
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude
- Press
Ctrl+Oto open the transcript viewer and see the code Claude actually ran.
One limit worth knowing from the docs: code stops after 10 minutes unless it runs in the background, where it can go for up to 2 hours. Permissions still matter, because each tool call inside the script goes through your rules. The Code Mode guide and Claude Code Auto Mode Explained cover how that interacts with auto mode.
The takeaway#
The best agents are not the ones with the most tools. They are the ones that write the code to use them. If your sessions are full of many small, related tool calls, such as reading a folder, filtering search results or running independent commands, Code Mode is worth a try.
Sources#
- Claude Code docs: Code Mode - how it works, the flag,
Ctrl+O, and run time limits. - Claude Code v2.1.323 release - November 12, 2026, where Code Mode was added.
- Anthropic: Code execution with MCP - November 4, 2025, the 150,000 to 2,000 token example.
- Claude Code Just Got Code Mode - the Developers Digest Short, including the November 22, 2026 run.
Continue Reading#
- Claude Code Code Mode: How to Turn It On and What It Changes - the full guide: requirements, settings, permissions and troubleshooting.
- Claude Code Auto Mode Explained - the classifier that reviews each piece of Code Mode code.
- Claude Code Token Burn Is an Observability Problem - measure where your tokens actually go.
- Harness Engineering Makes Tokens a Systems Budget - why context is a budget you design, not a cost you accept.
- Claude Code tool page - what the CLI does, pricing and setup links.
- AI API Cost Calculator - estimate per-request and monthly API cost before and after a token cut.
Get the next deep dive like this in your inbox
One email a week on Claude Code and the rest of the AI dev stack. Free.
Read next on Claude Code
Claude Code Code Mode: How to Turn It On and What It Changes
Claude Code Code Mode lets Claude write JavaScript that makes several tool calls in one step. Turn it on with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 on v2.1.323+.
8 min readClaude Code Auto Mode Explained: Permissions Without Prompts
Claude Code auto mode swaps permission prompts for a background safety classifier. How the Shift+Tab cycle, hard_deny rules and glob deny patterns fit together.
8 min readClaude Code Token Burn Is an Observability Problem
Claude Code token burn is an observability problem. Why coding agents need cache-hit telemetry, spend ceilings and repro-grade usage logs, not a quota bar.
8 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.






