Claude Code shipped a new feature called Code Mode recently. The idea comes from Cloudflare's Code Mode for MCP and Anthropic's write-up from last year.

I wanted to know three things:

  1. How it works under the hood?

  2. Does it make Claude Code more efficient (reduced token usage, save money)

  3. Any impact on quality of results?

How Claude Code works

Claude Code is a loop.

Say you ask it to fix a bug in your login code:

  1. Claude Code sends your prompt to Claude.

  2. Claude sends back a tool to use: search for def login.

  3. Claude Code runs the search on your laptop and sends the result to Claude.

  4. Claude sends back the next tool: read src/auth.py.

  5. Claude Code runs it and sends the result back. And so on.

Each send-and-reply counts as one round trip. This fix takes 5: search, read, edit, run the tests, and the final reply.

Code Mode off, trip by trip. Claude Code sends the conversation, Claude sends back one tool (Grep, Read, Edit, Bash), Claude Code runs it and adds the result. 5 trips. Illustrative example.

Illustrative example.

What Code Mode changes

With Code Mode, Claude writes a small script that uses several tools at once. Claude Code runs the script locally on your laptop, and then sends the output back to Claude for the next step.

Same bug:

  1. Claude Code sends your prompt to Claude.

  2. Claude sends back a script: search for def login, read the file, and return the login function.

  3. Claude Code runs it and sends back just the login function.

  4. Claude sends back a second script: fix the line, and run the tests.

  5. Claude Code runs it and sends back "12 passed."

  6. Claude replies.

That's 3 round trips instead of 5.

Code Mode on, same fix. Claude sends back a script, Claude Code runs the grep and the read inside it and returns only the login function. A second script edits the file and runs the tests. 3 trips. Illustrative example.

Illustrative example.

Code Mode also makes each trip smaller. Claude sees two tools instead of dozens: REPL runs a script, and Poll collects the results of a slow one. Every other tool becomes a function inside the script, and MCP tools (plugins that give Claude extra tools) shrink to a list of names. In my setup, the first request went from 84,655 tokens to 57,158.

Does it save money?

Code Mode reduces token usage. Instead of sending all of your tools, Claude only sees two tools: REPL runs a script, and Poll collects the results of a slow one. Every other tool becomes a function inside the script.

(In my setup, the first request on average went from ~85k tokens to ~57k tokens).

I ran a couple of tasks from my real sessions with code mode enabled & disabled. These are the results I saw:

  • ~40-60% fewer tokens sent

  • ~40% faster (because it makes fewer calls to Claude)

  • ~20% cheaper

Even though Code Mode sends ~40-60% fewer tokens, the total cost only reduced by ~20% because most of the cost comes from output tokens which doesn’t get impacted by Code Mode.

Fewer round trips means less re-reading of the entire context (which is already cached). So even though we send fewer tokens, total cost doesn’t reduce by the same amount.

R2 cost split. Tokens sent fell from 2.0M to 695K. Cost fell from $1.10 to $0.82: cache reads dropped, cache writes stayed the same.
Pikachu meme: tokens sent to the model drop 65%. The bill only drops 25% because cache writes never left.

Does Claude get worse at the task?

This was my main worry. Without Code Mode, Claude sees each result before it picks the next step. With it, Claude plans a few steps at once.

I didn't see a drop. I ran a bunch of my old claude sessions again with code mode enabled. It seemed to give the same results as the session without code mode. I am still keeping an eye on this since I have only used it for a day or two.

When not to use Code Mode

Code Mode only runs in the interactive terminal. Per the docs, it doesn't run in VS Code, the desktop app, cloud sessions, or through an LLM gateway. It turns off Remote Control, Claude in Chrome and computer use. In my tests it also didn't run in claude -p.

How to enable it

Add this to ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
  }
}