Claude Code normally runs one tool at a time, such as a search, an edit, or a test command, and reads each result before choosing the next step. Code Mode changes that. Claude instead writes a short JavaScript program that makes several of those calls in one go, and Claude Code runs it in your session. Anthropic’s docs describe it as experimental, off by default, and subject to change or removal in any release.
The docs suggest it for work with many related steps: a change repeated across many files, a search whose results need filtering before Claude reads them, or several independent commands that can run at once. In the docs’ example, Claude finds a file, changes a retry limit, and runs the tests in one script, then reads only the result it needs.
You see the results, not the script
In the conversation you see the individual tool calls, such as the diff of an edit. You do not see the code. Press Ctrl+O to open the transcript viewer, where each script appears as a collapsed Code row you can expand.
What changes for permissions
Each tool call the script makes still goes through your deny and ask permission rules and your PreToolUse hooks, which are checks that run before a tool does. The difference is in auto mode, where a separate classifier decides what runs without asking you. Under Code Mode it reviews each piece of code before it runs, not each tool call. Anthropic says it cannot see values computed while the script runs, such as a file path taken from search output. So keep rules or hooks for calls you must control.
Two more limits matter for unattended work:
- A script that waits for a build or tests stops after ten minutes, including time spent at permission prompts. Background scripts can run up to two hours, but Anthropic says to start in auto or
bypassPermissionsmode for that. - If you start new code in auto mode while earlier code is still running, the earlier code loses its classifier review. Claude Code then asks about its remaining calls, and refuses them if you do not answer before the countdown ends.
Bash rules match command text, so a denied command written in a different form can slip past them, with or without Code Mode. For limits that do not depend on text matching, Anthropic points to sandboxing.
Requirements and how to turn it on
You need Claude Code 2.1.323 or later and an interactive terminal session on the native build. It works with Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2. It does not work through Amazon Bedrock, a gateway, the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions. It is also unavailable to organizations on zero data retention or the HIPAA configuration, and with settings such as OpenTelemetry export or DISABLE_TELEMETRY.
To try it, start Claude Code with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 set, then confirm the prompt. You can only resume a Code Mode session with the variable still set. A project’s own settings file cannot turn it on, so a repository you clone cannot enable it for you. Setting the variable to 0 turns it off, and administrators can set 0 in managed settings to block it for an organization.
A reasonable first job is the docs’ own example: ask Claude to list the broken local links across every Markdown file in a project, then expand the Code row to confirm it only read files.
End of article