Claude Code gets Code Mode: Claude writes JavaScript to batch tool calls

Anthropic has launched Code Mode, an experimental feature in Claude Code that changes how the coding agent uses its tools. Instead of requesting one call at a time — Bash, Read or Edit — and reading the result before deciding the next step, Claude writes a piece of JavaScript that makes several calls at once, and Claude Code runs that code inside the session. The feature arrived in version 2.1.323, on November 12, 2026, switched off by default.

How Code Mode works

In practice, the user keeps describing the task in plain language. Claude then writes the code: a single script can run commands in parallel, feed one result into the next call, and return only the part of the output Claude needs to read. One example from the documentation is asking to raise a retry limit: the code finds the file, makes the edit and runs the tests, returning the file's path and the test output.

In the conversation, the user sees the tool calls — such as an edit's diff — and not the code. To read the code Claude wrote, press Ctrl+O to open the transcript viewer, where each piece of code appears as a collapsed Code row.

When to use it

Anthropic recommends Code Mode for tasks with many related tool calls: a change repeated across many files, a search whose results need filtering before Claude reads them, or several independent commands that can run at the same time. The idea targets a known cost of the agent: each tool call requires a model response in between, and batching the calls cuts down on those round trips.

How to turn it on

To enable it, start Claude Code with the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1. You can also set the value in user settings (~/.claude/settings.json); with 0 in either place, the mode stays off. Organizations can block the feature for all users through managed settings.

Requirements and limits

Code Mode requires Claude Code 2.1.323 or later, the native build, in an interactive terminal session, with a Claude subscription or Console account — and one of the models Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2. It does not work through gateways such as Amazon Bedrock, Google Cloud, Microsoft Foundry or Claude Platform on AWS, nor with -p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions. On Windows, Git for Windows must be installed.

Some features are also unavailable while the mode is on: Remote Control, Claude in Chrome and computer use. The session cannot be moved to the Desktop app or turned into a background session, and /fork cannot start a background copy. A Code Mode session can only be resumed in the terminal, with the mode on.

Permissions and long-running code

Each call made by Claude's code still goes through the user's permission rules (deny and ask) and PreToolUse hooks — there is no need to change rules for tools such as Bash. In auto mode, a classifier reviews the code before it runs, not each individual call, so the documentation recommends keeping rules or hooks for the calls that need control. Anyone who wants to audit the code can write a PreToolUse hook for the REPL tool, which runs the JavaScript, and read the code in tool_input.code.

While the code runs a long build or test, Claude either waits or lets the code continue in the background: when waiting, the code stops after ten minutes; in the background, it can run for up to two hours, as long as the session started in auto mode or with bypassPermissions.

Version 2.1.325, from November 13, already fixed the first bugs in the feature, including scripts that ignored a worktree and a case where Claude started working on its own after a session was resumed. The feature arrives a week after Claude Code 2.1.319, which moved MCP tasks to the background, as we covered in this Geekiki article. Anthropic makes clear that Code Mode is experimental and may change or be removed in any release — the official documentation is the reference for current behavior.

For context, Code Mode brings to Claude Code an idea Anthropic had already introduced for the API in November 2025, programmatic tool calling: instead of the model requesting each tool separately, it writes code that orchestrates the calls. The Code Mode documentation promises no savings figure — it is worth testing with your own tasks before adopting the mode day to day.

Image credit: Claude logo, by Anthropic, via the LobeHub icon library (lobe-icons).

Sources

Transparency note: this article was produced with the assistance of artificial intelligence, based on public posts and internet sources, and reviewed editorially. Please consult the original sources to confirm the information.

By Muse