Anthropic added an experimental feature called Code Mode to Claude Code v2.1.323, released on November 12, 2026 (UTC). It is disabled by default. When enabled, Claude can call tools such as Bash and Edit from JavaScript that it generates. For example, a single script can cover an entire workflow: searching for files, choosing which one to edit, making the change, and running tests. Because each tool's output is processed inside the JavaScript, the amount of information Claude has to read is reduced. At the same time, when the edit target is only determined during execution, it becomes important to know at which stage permission checks take place.

AD

Code Mode chains multiple tools through JavaScript

In standard Claude Code, Claude calls tools such as Bash, Read, and Edit directly, reads the results, and decides what to do next. By contrast, according to Anthropic's official documentation, in Code Mode the user gives instructions interactively, Claude generates JavaScript suited to the task, and Claude Code runs it within the session. Because the script can extract the information it needs from one tool's output and pass it to the next tool, there is no need to load every intermediate result into Claude.

Anthropic's example is a task that raises a retry limit in a program. The JavaScript first searches for the file where the retry logic is defined and selects the path to edit from the results. It then passes that path to the edit tool to make the change and runs the related tests. The only things returned to Claude are the path of the edited file and the test output. The list of candidates from the search is handled inside the JavaScript, so Claude does not need to read it directly.

In a workflow like this, the edit target can't be decided until the search results come back, and the tests that verify the change must run after the edit is complete. On the other hand, steps that don't depend on each other's results, such as searches in different directories, can run in parallel. In Code Mode, a single script can run several independent searches at once and move on to editing and testing after all the results arrive.

The interactive screen shows the details of individual tool calls, such as edit diffs. Even when what is returned to Claude is limited to the edited path and the test results, users can still see which edits were actually made. To inspect the generated JavaScript itself, for example to see how the edit target was chosen from the search results, press Ctrl+O to open the transcript and expand the collapsed "Code" line.

Auto mode's pre-execution review and per-tool permission checks

In Code Mode, how generated JavaScript and individual tool calls are checked depends on the selected permission mode. According to Anthropic's official documentation, in Auto mode a classifier reviews the JavaScript before it runs. Meanwhile, deny and ask permission rules and PreToolUse hooks apply to the individual tool calls executed inside the JavaScript.

Stage What is checked Mechanism applied
Before execution The JavaScript generated by Claude Auto mode classifier
During execution Individual tool calls inside the JavaScript, such as Bash and Edit deny and ask permission rules and PreToolUse hooks configured for each tool

Take the file edit above as an example. The edit target path isn't determined until the search results come back. What the pre-execution classifier can examine is the flow of the process: selecting a path from the search results and passing it to the edit tool. The list of files the search finds and the path that is actually chosen only become known once the JavaScript runs. By the time the edit tool is called, a concrete path has been set as its argument, so controlling behavior based on the edit target means relying on the permission rules and hooks that apply to that tool call.

deny is a permission rule that rejects a specified operation, and ask is one that asks the user for confirmation. A PreToolUse hook runs immediately before a tool is executed. For example, if you have a setting that asks for confirmation before a particular file is edited, all that needs to be checked is whether the Edit call containing the path chosen from the search results matches that setting. Outside Auto mode, there is no advance classifier review of the JavaScript; instead, the user is asked for permission at the point of each tool call that requires confirmation, according to the permission settings of each mode.

AD

Requirements and how to resume sessions

According to Anthropic's official documentation, using Code Mode requires the native version of Claude Code v2.1.323 or later, a Claude subscription or Console account, and an interactive terminal session. Supported models are Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2, and on Windows, Git for Windows must also be installed.

To enable Code Mode, set the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1. On macOS, Linux, and WSL, for example, you can launch it with the following command.

plaintext
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

The first time you start a Code Mode session, a confirmation prompt for enabling it appears. You can also enable it from the user settings file, but specifying it in a project settings file has no effect. This prevents settings included in a repository from turning on Code Mode against the user's intentions.

Code Mode is limited to interactive terminal sessions. It does not support non-interactive execution with -p, the Agent SDK, the VS Code panel, Claude Desktop, or cloud sessions. It is also unavailable when used through a gateway or through external cloud providers listed in the official documentation, and organizations using HIPAA-oriented configurations or zero data retention are likewise excluded.

To resume a session that was started in Code Mode, you need to open it from the terminal with Code Mode enabled. If an organization administrator disables Code Mode, Code Mode sessions that are already open remain usable until Claude Code is quit or restarted. After that, as long as it is disabled in the managed settings, users can neither use Code Mode in a new session nor resume an existing Code Mode session.

When used together with Agent Teams, Claude Code v2.1.326 or later is required. In the default display mode that runs within a single process, teammates also operate in Code Mode. When split panes are used, however, teammates are not covered by Code Mode.

When running long tests or builds, if Claude waits for the process to finish, execution stops after 10 minutes, including time spent on permission checks. If the conditions are met and the JavaScript can run in the background, processing can continue for up to 2 hours, and the user can keep interacting with Claude in the meantime. Note, however, that what runs in the background is JavaScript within an open interactive session; moving the session itself to a background session is not supported.

How it differs from the earlier API feature Programmatic Tool Calling

On November 24, 2025, Anthropic announced Programmatic Tool Calling for its API. In that system, the developer specifies in advance which tools can be called from generated code. Python code generated by Claude runs on the Code Execution tool and receives tool results returned through the API. Python can use those intermediate results in later steps as needed and returns the final result to Claude.

Code Mode shares the approach of combining multiple tools, processing intermediate results within generated code, and narrowing what is returned to Claude. However, in Programmatic Tool Calling the developer specifies which tools the code may call. In Claude Code's Code Mode, JavaScript calls tools within an interactive session, so the operations actually performed are controlled through existing permission rules and hooks.

Code Mode is still experimental, and Anthropic says it may change the specification or remove the feature in future versions. No timeline for general availability has been disclosed.

A good way to try it is with a task such as choosing one file from search results, editing it, and running the related tests. You can check whether work proceeds when only the edited path and the test results are returned to Claude, and whether the intended permission checks still occur when the edit target is determined by a search. Understanding these basics provides a foundation for deciding whether to extend it to processing that spans multiple files.