Video walkthroughs

Claude Code Code Mode: Turn It On and Test It in 10 Minutes

12 minute readUpdated November 2026Explore more

TL;DR

Code Mode is an experimental, off-by-default setting in Claude Code (version 2.1.323 or newer, terminal only). Instead of making every tool call one at a time and reading every result, Claude writes a short JavaScript program that makes the calls and reports back. Anthropic's own guide gives no savings number, and the big percentages you may have seen belong to other products, so the only number that counts is yours. This guide gives you the exact launch commands, a copy-paste test task, a results sheet to fill in, and the real limits to know before you switch.

The whole guide is on this page. Want a copy to keep? Grab the standalone file.

Download the guide

Anthropic added a setting to Claude Code called Code Mode, and it is off by default, so most people never see it. The pitch is that it can make your usage limits go further on long sessions. The honest version is that nobody has proven how much it saves on your kind of work, and that is exactly why this guide is built around a test you run yourself. Ten minutes, one task, two sessions, and you have your own answer.

This is the written companion to the video. You get the plain-English explanation, the exact commands, the test, a sheet for your results, and the limits that matter. If you have never touched the terminal version of Claude Code, you can still follow every step.

Watch the video: Claude Code Just Dropped Code Mode (Master it in 7 Minutes)

What Code Mode is, in one picture

Normally, Claude Code works one step at a time. It reads a file, and the whole file lands in its working memory, which is called the context window. It runs a command, and the full output lands there too. It uses a connector to an app like Notion or Google Drive (the technical name for those connectors is MCP), and every result lands there as well. Then it decides what to do next.

Anthropic's engineering team gave an example of why that gets expensive. Say you ask Claude to download a meeting transcript from Google Drive and attach it to a lead in your CRM, the app where you track customers. Claude pulls the whole transcript into its memory, then has to write the whole transcript back out again to save it. The same transcript passes through its memory twice. That is a big part of why long sessions burn through limits.

With Code Mode on, Claude writes a small JavaScript program instead. The program grabs the transcript, drops it into the CRM, and reports back with a short note saying it is done. The heavy material never has to pass through Claude's memory.

Two details are worth knowing. First, it covers all of Claude's tools, not only connectors: your files, your commands and the web too. Second, you do not see the code by default. In the conversation you still see the tool calls, such as the diff of an edit, but not the program behind them. If you are curious, press Ctrl+O to open the transcript viewer and read exactly what Claude wrote. Each piece of code shows up there as a collapsed row.

Is this a new idea or a new feature?

The idea is not new. Cloudflare named it Code Mode in September 2025, arguing that AI models have read a huge amount of real code and far fewer examples of tool calls, so they are better at writing a small program than at calling tools one by one. Anthropic's engineers wrote about the same approach for connectors in November 2025. Other coding tools, including Goose, Pi, OpenCode and Codex, have their own versions.

What is new is that it now ships inside Claude Code. Anthropic added it in version 2.1.323 on November 12, 2026, as an experimental opt-in, and the changelog shows fixes and improvements to it in every release since. Treat it as a feature that is actively being worked on, which is a good sign and also a warning that details can change.

Who should turn it on, and who should skip it

Code Mode is a bet that your work involves a lot of tool results that Claude does not need to read in full. That bet pays off for some people and not for others. Use these tells.

  • Turn it on and test it if you work in Claude Code in the terminal most days and you keep running into your usage limits.
  • Turn it on and test it if your tasks touch lots of files or lots of connected apps at once, such as scanning a whole folder, checking many pages, or moving data between tools.
  • Skip it for now if you mostly use the Claude desktop app or the VS Code panel, because it does not work in either.
  • Skip it for now if your work is mostly quick one-step questions. There is little for a program to batch.
  • Skip it if you run Claude through Amazon Bedrock, Google Cloud or Microsoft Foundry, because it is not supported there.
  • Skip it if you rely on Claude in Chrome, computer use or remote control, because Code Mode cannot be combined with them.

If you are on the fence, the test below costs you about ten minutes, which is cheaper than arguing about it.

Before you start: check your version

Code Mode needs Claude Code version 2.1.323 or newer, on either release channel. Open your terminal and run this.

bashclaude --version

If the number is older than 2.1.323, update, then check again.

bashclaude update

You also need a Claude subscription or an Anthropic Console account. Code Mode only works in an interactive Claude Code session in a terminal.

Turn it on: the exact commands

Code Mode is switched on with an environment variable, which is just a setting you hand to a program when it starts. Pick the line for your computer.

On a Mac, Linux, or Windows Subsystem for Linux (WSL), one line:

bashCLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

On Windows in PowerShell, two lines, one after the other:

powershell$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
claude

The first time you do this, Claude Code asks you to confirm. Pick Yes, turn on Code Mode. It restarts, and near the top of the session you will see this line, which is how you know it worked:

textCode Mode (experimental) is on · this session can be resumed only with Code Mode on

Keep it on for every session, or switch it off

If you want Code Mode every time, put the same setting in your user settings file, which lives at ~/.claude/settings.json. If the file already has other settings in it, add the env block next to them and keep everything that is already there.

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

Not comfortable editing a settings file? Open Claude Code the normal way and ask it to do the edit for you: "Add CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1 in the env section of my user settings file at ~/.claude/settings.json, and keep every other setting exactly as it is." Then read what it changed before you accept it.

It has to be your user file. According to the docs, Claude Code ignores this variable in a project's settings files, so a repository you clone cannot turn Code Mode on for you.

To turn it off, remove CLAUDE_CODE_EXPERIMENTAL_CODE_MODE from your shell and from ~/.claude/settings.json if you added it there, then start a new session. If you only used the launch line, starting Claude the normal way is enough.

The 10-minute test

Pick a task that touches a lot of files or apps at once, because that is where Code Mode has the best chance of helping. Anthropic's own guide uses a simple one, and it works well because you can verify the answer. Point it at a folder of notes or documents with at least a couple dozen files and a few links you know are broken.

The test task, copy and paste it exactly:

textRead every Markdown file in this project and list the links that point to local files that don't exist.

Run it as two sessions, and keep everything else identical.

  1. 1Open your terminal in the folder you want to test, and start Claude the normal way, with Code Mode off. Use the same model and the same effort setting you always use.
  2. 2Paste the test task and let Claude finish. Write down how long it took, roughly, with a clock or a phone timer.
  3. 3When it finishes, type /context to see how full its working memory is, then type /usage to see what the session cost you. Fill in the first column of the sheet below.
  4. 4Save the list of broken links Claude found, so you can compare the answers.
  5. 5Type /exit, then start Claude again with Code Mode on, using the launch line for your computer from above. Same folder, same model, same effort.
  6. 6Paste the exact same task. Time it again.
  7. 7Run /context and /usage again and fill in the second column.
  8. 8Compare the two lists of broken links. If they differ, open the files and check which one is right.

Fill in this sheet as you go. Copy it into a note or a spreadsheet.

textRESULTS SHEET                       CODE MODE OFF     CODE MODE ON
------------------------------------------------------------------
Task (same both times):             ______________    ______________
Model and effort:                   ______________    ______________
Time to finish:                     ______________    ______________
/context after finishing:           ______________    ______________
/usage after finishing:             ______________    ______________
Broken links found:                 ______________    ______________
Answers match? (yes / no / which
was right):                         ______________

My verdict (keep on / turn off / test a bigger task):
______________________________________________________________

Look at three things: how much it used, how long it took, and whether the answer was just as good. A saving that comes with a worse answer is not a saving.

How to read your results

There is no official threshold, so decide your own rule before you look at the numbers. Here is a reasonable one.

  • Usage clearly lower, answer just as good, time about the same or faster: keep it on for tasks that look like this one.
  • Usage lower, answer just as good, but the task took much longer: you are trading time for limits. Keep it on for long background work, and leave it off when you are waiting for the answer.
  • No real difference: your task did not give it much to batch. Try a heavier task before you give up on it, such as one that touches many files or several connected apps.
  • Usage higher or the answer worse: turn it off for this kind of work and move on.

One public write-up shows why the time column matters. Someone who ran the same task with and without Code Mode measured total input tokens falling from 150,364 to 94,659, and the time going from 15 seconds to 37 seconds. That is one person on one task, and it is the reason the guide asks you to time it. Savings can come with a slower run.

The real limits, before you switch it on

These are all from Anthropic's own docs. None of them are reasons to avoid the test, but you should know them first.

  • It is experimental and off by default. Anthropic says it may change or be removed in any release.
  • A session you start with Code Mode on can be resumed only with Code Mode on, and only in the terminal.
  • Code that runs in the foreground stops after ten minutes. Code can run in the background for up to two hours, but only if the session started in auto or bypassPermissions mode.
  • It does not work with Claude in Chrome, computer use or remote control, and you cannot move the session over to the desktop app.
  • It does not work in the VS Code panel, the desktop app or cloud sessions. It is terminal only.
  • You need a Claude subscription or a Console account. It is not available through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Microsoft Foundry.
  • In auto mode, the safety check reviews each whole script before it runs, not each tool call inside it, and it cannot see values that are only computed while the script runs.

What the numbers you have seen actually are

This is the part that gets mixed up online, so here it is straight. Anthropic's Code Mode guide does not give a saving number at all. The big figures floating around belong to other products and other features.

  • Cloudflare: its API has over 2,500 endpoints, and describing them all as normal tools would take far more than a model's whole working memory. Cloudflare gave its AI two tools instead, one to search and one to run code, and says that cut the input tokens by 99.9%. That is Cloudflare's own server, not Claude Code.
  • Datadog: it ran 25 observability tasks, three runs per model, across four models. With code execution the agents sent 73% fewer input tokens, got the right answer 90% of the time instead of 74%, and made 40% fewer tool calls. That is Datadog's own server and a mix of models, not Claude Code's Code Mode.
  • Browser Use: it rebuilt its agent around one code tool, and its tasks came out 2.7x to 5.2x cheaper. Browser Use says that covers the whole release, so other changes helped too and the tool change cannot take all the credit. It is its own agent, not Claude Code.
  • The 37% fewer tokens figure: that comes from a different Anthropic feature, programmatic tool calling on the API, announced in November 2025. It is not a measurement of Code Mode in Claude Code. A viral post mixed the two up.

None of these are proof that Code Mode will save you money, and none are proof it will not. They show the approach can work in the right setup. Whether Claude Code's version saves you anything on your work is the one question only your test can answer.

Troubleshooting

  • The banner never appears: check claude --version first. Anything older than 2.1.323 does not have the feature, so run claude update.
  • The settings file change does nothing: make sure you edited the user file at ~/.claude/settings.json, not a settings file inside a project. Project files are ignored for this setting.
  • You turned it on in settings and now cannot turn it off: remove the setting from ~/.claude/settings.json as well as from your shell, then start a new session.
  • Resume says it cannot continue an old session: a session started in Code Mode resumes only with Code Mode on, so relaunch with the setting on and resume from there.
  • A long job stopped around ten minutes: that is the foreground limit. Background code can run longer, but only in sessions that started in auto or bypassPermissions mode.
  • You want to see what it did: press Ctrl+O to open the transcript viewer and expand the code rows.

Your reading-to-doing path

  1. 1Decide if you are in the group that should test it, using the tells above.
  2. 2Run claude --version, and claude update if you are behind 2.1.323.
  3. 3Pick a folder with a couple dozen files and a few broken links.
  4. 4Run the test task with Code Mode off, then record time, /context and /usage.
  5. 5Relaunch with the Code Mode line for your computer, run the exact same task, and record the same three things.
  6. 6Compare the answers as well as the numbers, and write your verdict on the sheet.
  7. 7If it helped, add the setting to ~/.claude/settings.json, keep your permission rules, and re-test on a different task in a week, since the feature is changing fast.

If you want a second pair of eyes on your results, or you want to see how other members are using the terminal version of Claude Code day to day, that is what the Claude Code Club is for. Everything above is enough to run on your own today.

Code Mode (Claude Code docs)

Anthropic's own page: requirements, launch commands, limits and how auto mode treats scripts.

Claude Code changelog

Version 2.1.323 (November 12, 2026) added Code Mode, and later releases keep improving it.

Code execution with MCP (Anthropic engineering)

The meeting transcript example and why tool results cost so much memory.

Code Mode: the better way to use MCP (Cloudflare)

Where the name Code Mode came from, September 2025.

Code Mode for the Cloudflare API (Cloudflare)

The 2,500 endpoints and the 99.9% input token reduction, February 2026.

Datadog code execution results

25 tasks, 73% fewer input tokens, 90% correct versus 74%.

Browser Use 1.0

One code tool instead of 24 actions, with the caveat that the release changed other things too.

Advanced tool use (Anthropic engineering)

Where the 37% token reduction figure actually comes from.

Claude Code Code Mode turn-on walkthrough (wmedia)

One public side-by-side: 150,364 to 94,659 input tokens, 15 s to 37 s.

Common questions

  • What is Claude Code's Code Mode?

    It is an experimental, off-by-default setting in Claude Code. With it on, Claude writes a short JavaScript program that makes its tool calls and reports back, instead of making each call one at a time and reading every result into its working memory.

  • How do I turn on Code Mode in Claude Code?

    Update to version 2.1.323 or newer, then start Claude with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1. On a Mac or Linux that is one line, CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude. In Windows PowerShell it is two lines, setting $env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to "1" and then running claude. Confirm Yes, turn on Code Mode when asked.

  • Does Code Mode save tokens?

    Anthropic's Code Mode guide does not give a saving number. Other companies report large savings with their own code-based tools, and one public Claude Code test showed fewer tokens but a slower task, so the only reliable answer is to run the 10-minute test on your own work.

  • Does Code Mode work in the desktop app or the VS Code panel?

    No. It works only in an interactive Claude Code session in a terminal. It does not work in the VS Code panel, the Desktop app or cloud sessions.

  • How do I turn Code Mode off?

    Remove CLAUDE_CODE_EXPERIMENTAL_CODE_MODE from your shell, and from ~/.claude/settings.json if you added it there, then start a new session.

  • Is the 37% fewer tokens figure about Code Mode?

    No. That number comes from Anthropic's programmatic tool calling on the API, announced in November 2025. It is a different feature from Code Mode in Claude Code.

  • Can I see the code Claude writes in Code Mode?

    Yes. By default you see the tool calls and results, not the code. Press Ctrl+O to open the transcript viewer, where each piece of code appears as a collapsed row you can expand.

Want help reading your Code Mode results?

Get the other 6 in the cost-cutting stack, plus 8,000+ members - $9/mo, cancel anytime.

Join the Club