Anthropic has added an experimental Code Mode to Claude Code that lets the model write JavaScript to run tools such as Bash, Read and Edit. In a standard session, Claude reads the full result of each tool call before deciding what to do next. With Code Mode, a local script can run independent commands in parallel, pass results from one call to the next and return only the output the model needs.
In an example from Anthropic’s documentation, a script uses rg to locate a file, raises a retry limit and runs tests. Only the file path and test output go back to the model. The developer can still see each tool call and diff in the conversation and inspect the generated JavaScript in the session transcript viewer. Anthropic suggests using the feature for edits across multiple files, searches whose results need filtering and tasks with several independent commands.
What changes for permission checks
Each tool call inside a script still passes through deny rules, ask rules and PreToolUse hooks. In auto mode, however, the classifier reviews the whole script before execution rather than reviewing each call separately. It cannot see values the script calculates at runtime.
That distinction matters for developers who maintain hooks. A hook that previously received git push might now receive cd 'app' && git push, so it needs to inspect each part of a compound command. Hooks that match the REPL tool can read the JavaScript from tool_input.code. Project settings cannot enable Code Mode, so cloning a repository cannot turn it on. Administrators can disable it through managed settings.
Availability and execution limits
Code Mode is off by default. It requires Claude Code v2.1.323 or later and can be enabled by setting CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1. Agent teams need v2.1.326. Anthropic warns that it may change or remove the experiment in any release.
The feature runs only in native interactive terminal sessions. It supports Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 with a Claude subscription or Console account. It does not support the -p flag, the Agent SDK, the VS Code panel, the desktop app, Amazon Bedrock, gateways or organizations using zero data retention.
Claude can wait up to 10 minutes for a script to finish. In sessions started in auto mode or permission-bypass mode, a task can instead run in the background for up to two hours while the conversation continues.
Less context does not necessarily mean faster runs
Anthropic has not published token-use or latency figures for Claude Code’s implementation. George (@bolyki) reported that eight interactive comparisons using Sonnet 5.5 produced the same outcomes in both modes, with 20% to 25% less context in Code Mode. On larger tasks, he reported 37% lower token use and 19% lower cost, but no speed improvement. Smaller tasks cost more with Code Mode in his comparisons.
Code Mode also does not make the Model Context Protocol (MCP) obsolete, argued Ravi Madabhushi, who develops authentication infrastructure for agents. He said an agent still makes the same MCP calls with the same authentication tokens and context. In his assessment, the material change is how much tool output reaches the model’s context window, not how authentication, authorization or auditing works.
Cloudflare had previously used the Code Mode name for an MCP implementation that exposes tools as TypeScript APIs inside a sandboxed Worker, with bindings keeping API keys separate from generated code. The Claude API also offers programmable tool calls in a remote execution container. Claude Code’s experiment differs in where the script runs: it uses the developer’s local session, built-in tools and existing permission system.