Claude Code's experimental Code Mode, explained

Claude Code's new Code Mode is a way to make coding agents more efficient by reducing unnecessary back-and-forth with the AI model.
Claude Code just added experimental Code Mode.
Normally, Claude works like this:
- Search for a file
- Read the result
- Edit the file
- Read the result
- Run tests
- Read the result
Each step involves another conversation with the model.
With Code Mode, Claude can write a small JavaScript program that handles those steps together.
It can run independent tasks in parallel, pass results between steps, and return only the information the model actually needs.
The benefits:
- Fewer model round trips
- Less wasted context
- Potentially faster execution
- Lower token usage on some tasks
It's not a new coding model. It's a smarter way for Claude to use its existing tools.
How to try it
Requires Claude Code 2.1.323 or newer. Start a terminal session with:
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude
It's experimental, off by default, and currently limited to supported interactive terminal sessions.
Comments (7)
Checking profile…
One detail I almost missed: foreground Code Mode runs stop after 10 minutes, but eligible background code can run up to two hours while you keep chatting. That requires starting in auto or
bypassPermissionsmode. It's not the same as moving the whole Claude session into a background session, which Code Mode doesn't support.Want a fair A/B test instead of “feels faster”? Anthropic suggests: “Read every Markdown file in this project and list the links that point to local files that don't exist.” Try it with Code Mode on and off; compare tokens, wall time, and correct results. That's an ideal task for filtering a mountain of tool output.
A small but important security detail: Code Mode's auto classifier reviews the JavaScript block before it runs, not every individual tool call. Your
deny/askrules andPreToolUsehooks still check each tool invocation. If you guard shell commands, test compound commands likecd app && git pushrather than assuming the hook sees onlygit push.My favorite example from the docs: Claude can find
retryPolicy, changemaxAttemptsfrom 3 to 5, run the relevant tests, and return just the file path and test result. The win isn't simply “parallel tools”—it's chaining work without dumping every intermediate result into context. You can inspect the generated JS withCtrl+O.One catch worth mentioning: Code Mode is terminal-only, doesn't support gateways or Bedrock, and foreground execution has a 10-minute limit. Useful experiment, but not yet a drop-in replacement for existing agent workflows. Anyone hit these limits?
Interesting that Pi already had a feature called
codemodethat runs JavaScript to orchestrate tools. Curious how Claude Code's implementation compares. Anyone tried both? Are there meaningful differences beyond the name?Seeing mixed reports on Code Mode performance. Some say it keeps tool output out of the main context; others see no improvement. Has anyone compared the same task with Code Mode on and off, measuring tokens, cost, and execution time?