Claude Code's Code Mode has the agent write JavaScript to use tools

The experimental opt-in in Claude Code 2.1.323 replaces one-at-a-time tool calls with short scripts, a pattern Anthropic and Cloudflare have tested elsewhere.

Illustration of an orange robot at a terminal writing a short glowing script whose lines branch out to several tool icons, a folder, a magnifying glass and a test tube, all at once. Image: AgenticFeed illustration

Anthropic has added Code Mode to Claude Code, an experimental setting in which Claude writes JavaScript that calls its tools instead of requesting each tool call separately. The feature shipped in version 2.1.323 on Nov. 12, according to the project's changelog and GitHub release history, and is off by default. Developers testing it have been trading notes on X since the release.

Without Code Mode, Claude asks for a tool such as Bash or Edit and reads each result before deciding on the next step, Anthropic's documentation says. With Code Mode, Claude writes a piece of code that makes the calls, and Claude Code runs it inside the session. One script can run commands in parallel and pass one result into the next call, so Claude reads only the part of the output it needs.

The documentation gives the example of raising a retry limit. Claude writes a few lines that change the value in the right file and then run the matching tests, returning the file path along with the test output. Users see the individual tool calls in the conversation and can press Ctrl+O to read the JavaScript behind them, the documentation says.

Who can turn it on

Anthropic recommends Code Mode for jobs with many related tool calls, such as a change repeated across many files or a search whose results need filtering. According to the documentation, it is switched on with the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE environment variable, which Claude Code ignores in a project's own settings files so that a cloned repository cannot enable it. Administrators can block it for an organization by setting the variable to 0 in managed settings.

Anthropic lists narrow requirements for now. Code Mode needs an interactive terminal session with a Claude subscription or Console account, running Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2. It is not available through cloud gateways such as Amazon Bedrock and Microsoft Foundry, and it does not run with the Agent SDK or in the Desktop app, according to the documentation.

Permission checks change shape

Each tool call made from Claude's code still passes through the user's deny and ask rules and PreToolUse hooks, according to the documentation. In auto mode, though, the safety classifier reviews each piece of code before it runs rather than each tool call, and it does not see values computed at run time, such as a file path pulled from search output. Anthropic advises keeping rules or hooks for any calls that must stay under control.

Code that Claude waits on stops after ten minutes, while code allowed to run in the background can go for up to two hours, Anthropic says. Version 2.1.325, released on Nov. 13, fixed several early Code Mode bugs, according to the changelog, including scripts that ignored a worktree and a case where Claude started working on its own after a session was resumed.

A pattern spreading across agent tools

The approach mirrors Programmatic Tool Calling, which Anthropic introduced on its developer platform in November 2025. In that post, Anthropic said letting Claude orchestrate tools through code cut average token use from 43,588 to 27,297, a 37% reduction on complex research tasks, and lifted its internal knowledge retrieval score from 25.6% to 28.5%. Some posts on X have applied the 37% figure to Claude Code, but Anthropic has not published Code Mode benchmarks for Claude Code itself.

Cloudflare made a similar case in September 2025 with its own Code Mode for MCP servers, which turns MCP tools into a TypeScript API that the model writes code against. Cloudflare said agents could handle more tools, and more complex ones, when the tools were presented that way, and that the gains were largest when an agent had to string several calls together.

Source: Claude Code Docs, “Run tool calls from code with Code Mode”

Additional sources: Claude Code on GitHub, “Claude Code changelog, versions 2.1.323 and 2.1.325”; Anthropic, “Introducing advanced tool use on the Claude Developer Platform”; Cloudflare, “Code Mode: the better way to use MCP”

Get the AgenticFeed newsletter

A free, regular roundup of the agent stories that matter. No spam, and you can unsubscribe at any time.

Want to reach readers following AI agents? Advertise with AgenticFeed

Next event · 19 Nov, 2026

MCP Dev Summit Nairobi

The Linux Foundation’s Nov. 19 and 20 summit brings Model Context Protocol developers to Kenya, with keynotes from OpenAI, GitHub and the Gates Foundation.

The AgenticFeed newsletter

A free, regular roundup of the agent stories that matter. No spam.