Claude Code Code Mode: 3 steps to enable JavaScript calls

Code Mode is experimental in Claude Code 2.1.323: Claude writes JavaScript to call many tools at once. How to enable it, and why the 37% figure is wrong.

18/11/2026 · 7 min read
Claude Code Code Mode: 3 steps to enable JavaScript calls
In this article (6)
  1. What Claude Code Code Mode is and how it differs
  2. How to enable Code Mode in 3 steps
  3. Code Mode vs one-at-a-time tool calls: a comparison
  4. Correcting the 37% figure and who should try Code Mode
  5. Conclusion
  6. Sources

What is Claude Code Code Mode? It's an experimental opt-in in Claude Code, shipped in version 2.1.323 on November 12, 2026. With it on, Claude writes JavaScript to call many tools in a single step. It no longer requests one tool at a time and waits for each result. In this guide, I'll show you how to enable Code Mode, explain its limits, and correct the 37% figure spreading online.

What Claude Code Code Mode is and how it differs

HTML code displayed on a computer screen in dark mode
Screen showing HTML code in a dark-mode editor. Photo: César Gaviria, Pexels 36571389.

Until now, Claude Code worked in a one-tool-at-a-time loop. Claude asked for one tool, such as Bash, Read, or Edit. Then it read the full result before deciding on the next step. That loop is clear, but it costs many round trips between the model and your tools.

Code Mode changes that exact point. Claude writes a piece of JavaScript that makes the tool calls, and Claude Code runs that code inside your session. One script can run commands in parallel. It can feed one result into the next call. It returns only the part of the output Claude needs to read. As a result, Claude reads fewer tokens in AI and uses less of your context window for the same task.

In a Code Mode session, you still describe your task in plain words. Claude then writes JavaScript to carry it out. In the conversation, you see the tool calls, such as the diff of an edit, and not the code itself. That keeps the interface familiar while the mechanism underneath has changed.

Code Mode gives the model just two tools, REPL and Poll. REPL runs the JavaScript, while Poll collects results. The other tools are described inside REPL as JavaScript functions in a shorter form. This design lets the model call many tools without sending a separate request for each one.

Anthropic is clear that this is experimental and off by default. Code Mode may change or be removed in any release. So you should treat it as a feature to try, not as a stable part of a critical workflow. Version 2.1.325, released on November 13, 2026, fixed several early Code Mode bugs. The fixes covered scripts that ignored a worktree and a case where Claude started working on its own after a session was resumed.

How to enable Code Mode in 3 steps

Source code displayed on a computer screen
Computer screen displaying source code being edited. Photo: Bibek ghosh, Pexels 14553730.

Step 1: check your version. Run claude --version in your terminal. Code Mode needs Claude Code v2.1.323 or later, on either release channel. If your version is older, run claude update to upgrade. If you are on the stable channel and the new version has not arrived yet, switch to latest or wait a while.

Step 2: set the environment variable, then launch. Run this command in your terminal:

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

You can also set the variable in your shell or in your user settings file, ~/.claude/settings.json. Note that Claude Code ignores this variable in a project's own settings files, so a cloned repository cannot enable Code Mode by itself.

Step 3: confirm Code Mode is on. When the session starts, you will see the line "Code Mode (experimental) is on" plus a note that this session can be resumed only with Code Mode on. If you see "Code Mode (experimental) isn't available" instead, Claude Code started without Code Mode. In that case, check your version and your environment variable again.

To turn Code Mode off, remove the variable from your shell and from ~/.claude/settings.json, then start a new session. A Code Mode session can only resume in the terminal with Code Mode still on, so you cannot resume it in the Desktop app or the VS Code panel.

Code Mode also needs a Claude subscription or a Console account. It runs only through Anthropic's API. You cannot use Code Mode through Amazon Bedrock, Google Cloud, Microsoft Foundry, or other gateways. Supported models are Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2.

Code Mode vs one-at-a-time tool calls: a comparison

Programming data displayed on a computer screen
Computer screen showing programming data being processed. Photo: Bibek ghosh, Pexels 14553707.
FeatureOne-at-a-time tool callsCode Mode
How tools are calledOne tool per requestOne JavaScript script calls many tools
Reading resultsFull result read each timeOnly the output Claude needs
Parallel runsNoYes, inside one script
Passing results alongAcross many turnsDirectly inside the code
Tools the model seesEach tool in fullREPL and Poll
Where it runsTerminal, Desktop, VS CodeInteractive terminal only
Supported modelsEvery Claude Code modelOpus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2

Code Mode does not work with the -p flag, the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions. While Code Mode is on, Remote Control, Claude in Chrome, and computer use do not work either. If your team uses agent teams, you need v2.1.326 or later.

Long-running code has limits too. Code that Claude waits on stops after ten minutes. Code allowed to run in the background can go for up to two hours. You should split a long task into smaller steps instead of handing over one script that runs too long.

Your permissions stay in place. Each tool call inside Claude's code still goes through your deny and ask rules and your PreToolUse hooks. Code Mode does not bypass your rules. In auto mode, however, the safety classifier reviews the code, not each tool call, and it cannot see values the script works out as it runs. So you should still review the diff before accepting it, especially when the code touches important files. That habit limits the risk from AI hallucinations or an unintended command.

You should also describe the task clearly from the start. A clear system prompt or instruction helps Claude write code in the right direction and cuts down on rework.

Correcting the 37% figure and who should try Code Mode

Developer working on a laptop in a workspace
Developer working with a laptop in a workspace. Photo: ThisIsEngineering, Pexels 3861969.

The 37% token savings figure is spreading alongside Code Mode news, but it is not from this feature. Anthropic's Code Mode documentation gives no savings figure at all. The widely shared 37% comes from Anthropic's November 2025 article on Programmatic Tool Calling in the API. That is a different feature, launched almost a year before Code Mode.

Two small independent tests measured 37% to 55% fewer tokens. Even so, neither test found a speed gain, and one run was slower. You should read that figure as an early signal, not as Anthropic's official result for Code Mode.

Code Mode fits best on tasks that take many related tool calls. For example, you apply the same change across many files, or you search and then filter results before editing. Those tasks gain the most from parallel runs and passing results inside the code.

You should wait if your work requires the Desktop app, the VS Code panel, or Bedrock. You should also wait if your workflow cannot accept an experimental feature that may change. In those cases, one-at-a-time tool calls remain the safer choice.

If you meet the requirements, you can enable Code Mode on a test repository and measure your real costs. Compare tokens and time against the same task run the old way. Your own measurement is worth more than any figure spreading online.

Conclusion

Học có chọn lọc. Làm có mục tiêu. Code Mode changes how Claude Code calls tools, from single requests one by one to a single JavaScript script. You enable it with one environment variable, run it in the terminal with a supported model, and always remember that the 37% figure is not from Code Mode.

Sources (9)
  • i10X News, Claude Code Code Mode: How It Works and What It Saves, accessed 2026-11-17: https://i10x.ai/news/claude-code-code-mode-javascript-tool-calls
  • AgenticFeed, Claude Code Code Mode lets Claude call tools from JavaScript, accessed 2026-11-17: https://agenticfeed.io/claude-code-code-mode-javascript-tool-calls/
  • Anthropic, Run tool calls from code with Code Mode, accessed 2026-11-17: https://code.claude.com/docs/en/code-mode
  • Top5Apps, What Is Claude Code's Code Mode? How to Turn It On, accessed 2026-11-17: https://top5apps.ai/news/what-is-claude-code-code-mode-how-to-turn-it-on-requirements-limits-permissions/
  • Cover Image: Pexels 16592498, Саша Алалыкин, accessed 2026-11-18: https://www.pexels.com/photo/software-source-code-program-code-code-on-a-computer-screen-the-developer-is-working-on-program-codes-in-the-office-photo-with-source-code-16592498/
  • Body Image 1: Pexels 36571389, César Gaviria, accessed 2026-11-17: https://www.pexels.com/photo/html-code-on-computer-screen-in-dark-mode-36571389/
  • Body Image 2: Pexels 14553730, Bibek ghosh, accessed 2026-11-17: https://www.pexels.com/photo/code-on-computer-screen-14553730/
  • Body Image 3: Pexels 14553707, Bibek ghosh, accessed 2026-11-17: https://www.pexels.com/photo/programming-data-on-a-computer-14553707/
  • Body Image 4: Pexels 3861969, ThisIsEngineering, accessed 2026-11-17: https://www.pexels.com/photo/woman-working-on-a-laptop-3861969/

Linh SEO Agent

Related guide: What is Qwen4-Max: 4 ways to use Alibaba cheap MoE API

Found it useful? Share it:
Facebook

More reading

Latest news

The ten most recent, scrolling sideways. Hover or tap to pause.