Anthropic has changed how Claude Code drives its own tools. The shipping implementation no longer asks for one tool call, reads the result, and decides the next step. It now writes JavaScript that makes the calls.
The feature, called Code Mode, shipped as an experimental, opt-in capability in Claude Code v2.1.323, with a dedicated documentation page published this week.
What actually changes
In a normal session, every Bash, Read, or Edit call round-trips through the model: call, result, reasoning, next call. In Code Mode, Claude writes one JavaScript program that chains several calls, can run independent commands in parallel, filters or processes intermediate results inside the code, and returns to the model only the output it needs.
Anthropic's own example, for a request to raise a retry limit, searches for the file with ripgrep, edits the matched line, runs the tests, and returns just the edited path and test output as a single object:
const files = await $`rg -l "function retryPolicy" src`.text();
const target = files.trim().split("\n")[0];
await edit(target, "maxAttempts: 3", "maxAttempts: 5");
({ edited: target, tests: $`npm test -- retryPolicy`.nothrow() });The stated use cases are tasks with many related calls: repeated changes across files, searches whose results need filtering before the model reads them, and batches of independent commands. The practical effect on a session is fewer round-trips and less context consumed by intermediate output. In the conversation view you see the underlying tool calls, such as an edit's diff, but not the code; expanding the JavaScript requires Ctrl+O into the transcript viewer.
The guardrails, and their limits
Anthropic is explicit that Code Mode is experimental and "may change or be removed in any release," and the permission story is where the details matter:
- Your existing
denyandaskrules andPreToolUsehooks still apply to each tool call inside the generated code. - In auto mode, a classifier reviews the code before it runs, but it does not see values computed at runtime, such as a file path taken from search output. Anthropic's docs advise keeping rules or hooks for any call you must control.
- Synchronous code is killed after ten minutes; background execution (auto or bypassPermissions mode) extends that to two hours.
- Organizations can force it off for everyone by setting
CLAUDE_CODE_EXPERIMENTAL_CODE_MODEto0in managed settings. Notably, project-level settings files cannot turn it on, so a cloned repository cannot enable Code Mode for you.
There are real functional limits: terminal sessions on the Anthropic API only (no -p mode, Agent SDK, VS Code panel, Bedrock, Vertex, or Foundry), supported models only (Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2), and no Remote Control, Claude in Chrome, or computer use while it runs.
The trade

A discrete tool call is inspectable before it executes. A generated program that makes twenty calls is a wider failure surface and a thinner audit trail, which is presumably why Anthropic shipped it off by default, gated behind an environment variable, with an org-level kill switch. The direction of travel, though, is clear: agent harnesses are moving tool orchestration from the model's reasoning loop into executable code, and Claude Code is the highest-profile place that has happened.
Sources:
