AI News

Claude Code Launches Experimental Code Mode, Enabling Batch Tool Calls via a Single JS Snippet

Shao MengUpdated Nov 15 18:07

AI summary

Claude Code has launched an experimental feature called Code Mode, which is off by default and requires setting CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 to enable; once enabled, Claude first writes a piece of JavaScript to call multiple tools at once within the local session, rather than calling Bash, Read, or Edit one by one. The official example changes the retry limit from 3 to 5, allowing an operation that originally took four or five rounds to be completed in one step, and it supports parallel execution of independent commands, passing the result of the previous step directly to the next step, and filtering intermediate output in code before it enters the context. This feature is limited to interactive terminal sessions and does not support -p, the Agent SDK, the VS Code panel, desktop, or cloud sessions, nor can it go through gateways, Bedrock, Google Cloud, or Microsoft Foundry; it only supports Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2; in auto mode, the classifier instead reviews the entire code block, and the official recommendation is to use rules or hooks as a fallback for critical calls.

Why read this

SelectedAI score 77

The original article lists in full how to enable Code Mode, the applicable models, and its various limitations, so readers can judge whether their current environment can use it.

Topics

Tags

Body · AI translation

Claude Code Launches Experimental Code Mode: From Calling One Tool at a Time to Writing a JS Snippet to Call Tools in Batch

Code Mode is off by default and must be enabled manually. Once enabled, the way Claude calls tools changes: previously it called only one Bash, Read, or Edit at a time, then looked at the result before deciding the next step; now Claude first writes a JavaScript snippet that calls multiple tools at once, and Claude Code executes it in the local session.

https://t.co/3U7bRP0jgq

# How it works specifically

The official example is changing the retry limit from 3 to 5. Claude writes a piece of code: first use rg to find the file, then change the parameter, then run the relevant tests, and finally return only the file path and test output to itself. What originally took four or five back-and-forth rounds can now be done in one step.

This has three benefits. Several independent commands can run in parallel; the result of the previous step can be passed directly to the next step without going through the model; and the large amount of intermediate output can be filtered in the code first, with only the needed parts put into context. The officially recommended usages also revolve around these points: the same change needs to be made across many files, search results need to be filtered before reading, and several independent commands can run at the same time.

The conversation interface still shows each individual tool call, such as the diff of an edit. To see the underlying code, press Ctrl+O to open the transcript and expand the Code line.

# Requirements and limitations

To enable it, set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1, either temporarily in the shell or in ~/.claude/settings.json. Setting it in a project's settings file does not take effect, so a cloned repository cannot secretly enable it for you. The first time it is enabled, Claude Code will ask you to confirm.

There are quite a few limitations: · It can only be used in interactive terminal sessions; -p, the Agent SDK, the VS Code panel, desktop, and cloud sessions are not supported. · It cannot go through a gateway, Bedrock, Google Cloud, or Microsoft Foundry, and API key helper cannot be used. · Only Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2 are supported. · It cannot start when agent teams, OpenTelemetry export, or DISABLE_TELEMETRY is enabled. · Sessions opened with Code Mode must also have Code Mode enabled when resumed. · Code runs in the foreground for up to 10 minutes; in the background for up to 2 hours, but the session must be started in auto or bypassPermissions mode.

# How permissions are managed

Every tool call in the code still goes through your deny and ask rules and the PreToolUse hook. What really changes is auto mode: the classifier now reviews the entire code snippet instead of reviewing individual calls one at a time, and it cannot see values computed only at runtime, such as paths extracted from search results. The official guidance explicitly recommends that calls that must be controlled be backed up by rules or hooks. To review the code itself, you can write a hook that matches the REPL and reads the JS from tool_input.code. Enterprises can set this variable to 0 in managed settings to disable it for everyone.

Source

Shao Meng