Skip to content
Source: InfoQ

🧠Anthropic Adds Experimental Code Mode to Claude Code, Cuts Context 20-25%

Your Claude Code sessions could get cheaper, but test first

TL;DR

Anthropic added an opt-in Code Mode to Claude Code that lets the model write one JavaScript script to run many tool calls. One tester saw 37% fewer tokens and 19% lower cost on a larger task. Worth a trial, but it's experimental and can change anytime.

Anthropic just added Code Mode to Claude Code, and it changes how the model drives its tools. Instead of asking for one Bash, Read, or Edit call at a time, Claude can write a JavaScript script that runs commands in parallel, pipes one result into the next call, and returns only what it needs. It's off by default and needs v2.1.323 or later. Why you should care: if you do big multi-file edits, filtered searches, or independent test runs, this can cut the noise. The context stays smaller because intermediate output never hits the model window. Anthropic recommends it for exactly those cases. Ravi Madabhushi's point is worth keeping in mind: auth, authorization, and audit still happen on every MCP call, so this changes context management, not security. The numbers so far come from community testing. George ran eight interactive Sonnet 5.5 sessions and got identical results, with 20-25% smaller context and, on the bigger task, 37% fewer tokens and 19% lower cost. But it wasn't faster, and on a tiny task it cost more. Anthropic has published no official token or latency figures. Watch the permission model. Auto-mode classifiers review the whole script before it runs, not each call, so values computed at runtime slip past them. Anthropic says the feature may change or be removed in any release, so don't build workflows on it yet.

Anthropic Adds Experimental Code Mode to Claude Code, Cuts Context 20-25% — InfoQ

Key Points

1

Code Mode requires Claude Code v2.1.323 or later and is enabled by setting the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 environment variable, and it is off by default in every session.

Keep reading — it's free

Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.

Also get
or

Already a member? Sign in

Claude CodeAnthropicCode ModeMCPdeveloper tools

Comments

Subscribe to join the conversation...

Be the first to comment