SI Agent News
DevelopingClaude

Claude Code introduces experimental Code Mode for multi-tool tasks

The new feature allows Claude to write and execute JavaScript to handle complex, multi-step programming tasks in the terminal.

Blueprint drawing: picture for the story 'Claude Code introduces experimental Code Mode for multi-tool tasks'
AI-made blueprint drawing for this story. No real people or products are shown.
v2.1.323Minimum required Claude Code version

The short version

Why it matters

This changes how developers interact with AI by moving from a 'one-step-at-a-time' tool execution to a more autonomous scripting model. It allows the AI to handle complex logic, like loops and parallel processing, more efficiently within a single prompt.

How Code Mode functions

Code Mode is an experimental feature for Claude Code that enables the AI to write and execute JavaScript directly in the terminal. Instead of Claude making a series of individual tool calls to complete a task, it can now write a single script to handle the logic. This allows the model to perform actions like running commands in parallel or using the output of one command as the input for the next.

When a user provides a prompt, Claude generates the necessary JavaScript to carry out the request. For example, if a user wants to update a retry limit across a project, Claude might write code to find the specific files, edit them, and then run tests to verify the changes. The script then returns only the specific parts of the output that the model needs to read to continue the conversation.

Users can view the underlying JavaScript by pressing Ctrl+O to open a transcript viewer. This viewer shows each piece of code as a collapsed row, providing a clear way to inspect the AI's logic. This transparency helps users understand exactly how the model is interacting with their files and system commands without cluttering the main chat interface.

Ideal use cases for users

The developers designed Code Mode specifically for tasks that involve many related tool calls. It is particularly useful when a change needs to be repeated across many different files in a repository. By using a script, Claude can iterate through these files more efficiently than it could by manually identifying and editing each one individually.

Another primary use case involves searching for information that requires filtering before the model can process it. Instead of Claude reading a massive list of search results, it can write a script to filter the data down to the relevant pieces. This reduces the amount of information the model has to process at once and helps prevent it from getting overwhelmed by irrelevant data.

Code Mode is also beneficial for executing several independent commands simultaneously. Because the JavaScript can run commands in parallel, it can speed up workflows that do not have sequential dependencies. This makes it a powerful tool for developers who need to perform bulk actions or complex environment setups quickly within a terminal session.

Technical requirements and limits

To use this feature, users must have Claude Code v2.1.323 or later and a valid Claude subscription or Console account. It is currently available for models including Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2. However, it is not available through certain gateways like Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry.

There are specific limitations to keep in mind before enabling the feature. Users cannot use Remote Control, Claude in Chrome, or computer use while Code Mode is active. Additionally, the session cannot be moved to the Desktop app or turned into a background session using the /fork command. The feature is also restricted from organizations using the HIPAA configuration or zero data retention settings.

The feature is off by default and must be enabled by setting the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE environment variable to 1. If a user wants to disable it, they can set the variable to 0. Organizations can also block the feature for all members by setting the variable to 0 in their managed settings, as code.claude.com reported.

Permissions and execution

Security and permissions are handled through a variety of modes that determine how Claude’s code is reviewed. In auto mode, a classifier reviews the code before it runs rather than reviewing every individual tool call. This allows for smoother execution but means the classifier does not see values computed at runtime, such as specific file paths generated during a search.

In other permission modes, the code may start without a review, and the user is prompted for every individual tool call that requires permission. Users can also use PreToolUse hooks to manage how the REPL, the tool that runs the code, handles specific JavaScript inputs. These hooks can be configured to allow, block, or prompt the user based on the content of the tool_input.code.

Long-running code behaves differently depending on the selected mode. In waiting mode, Claude waits for the code to finish, but the process will stop after ten minutes. In background mode, users can continue talking to Claude while the code runs for up to two hours. This is useful for long builds or tests where the user does not need to wait for the completion to continue the conversation.

Troubleshooting and setup

If Code Mode does not start, the terminal will usually display a reason near the top of the session. Users can also run the /status command to see the current status of the feature. If no reason is provided, users should first verify that they are running at least version v2.1.323 by checking the version with the claude --version command.

Setting up the environment variable is the primary way to activate the feature. On macOS, Linux, and WSL, this is done in the shell, while Windows users can set it in their settings.json file. Once the variable is set to 1, Claude Code will ask for confirmation before the first session where Code Mode is used.

If a tool call is refused by a hook, users should ask Claude for the specific error text. These errors often occur when a hook fails to start, times out, or returns an invalid output. Fixing these issues typically involves raising the timeout command or adjusting the onFailure setting to allow the call to proceed even if the hook encounters an issue.

What to watch next

The feature is currently experimental, which means it may change or be removed in future releases. Users are encouraged to provide feedback by running the /feedback command within the terminal. This feedback will likely influence how the tool is refined for broader use or integrated into other parts of the Claude ecosystem.

Watch for updates regarding the availability of Code Mode on different platforms. Currently, it is restricted to interactive terminal sessions and does not work with the VS Code panel or the Desktop app. Future updates may expand these capabilities or refine the requirements for organization-level access.

Keep an eye on the performance of the auto mode classifier. Since it does not see runtime values, developers may need to experiment with how they write rules and hooks to ensure they maintain control over sensitive actions. The balance between automation and user oversight will be a key area for development.

Try it

Set the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE environment variable to 1 in your shell and prompt Claude to perform a task that requires editing multiple files at once.

What to watch

Try it

Set the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE environment variable to 1 in your shell and prompt Claude to perform a task that requires editing multiple files at once.

Sources and links

Liked it? Say why

Add a line for other readers.

No account needed. We never show your email. Comments with links, ads or abuse are held and not shown. Your comment shows after a quick check.

Listen to the AI Wire headlines

Listen to the AI Wire

Listen to our daily AI shows every morning: on your commute, in the shower, wherever you are

Listen to the daily shows

First reported by code.claude.com · Read the original. Written by the SI Agent News Desk from the reporting above.Written with AI from the source above. Every number is checked against the source. Spot a mistake? Corrections.

More AI news