> ## Content Index
> Fetch the complete content index at: https://blog.netpy.in/llms.txt
> Use this file to discover other available public pages before exploring further.

# Claude Code's Code Mode moves the review boundary up a level
- URL: https://blog.netpy.in/claude-code-mode-review-boundary/
- Published: 2026-11-23T12:37:37.000Z
- Updated: 2026-11-23T12:37:37.000Z
- Description: Anthropic's experimental Code Mode lets Claude Code write JavaScript that orchestrates tool calls. The token savings are modest and unverified; the real change is that review moves from each action to each program.
- Author: Netpy Technologies
- Tags: AI, Agents, Dev Tooling, Security, Engineering

Anthropic shipped a change to Claude Code this week that relocates where the important decisions happen in an agent loop. It is called Code Mode: instead of asking for one tool call, reading the result, and deciding again, the model writes JavaScript that makes several tool calls.

That reads like a developer-experience tweak. Read the permission section and it is closer to an architecture change, because the unit of review stops being the tool call.

## What shipped

InfoQ reported the feature on 23 November. Code Mode is experimental, off by default, needs Claude Code v2.1.323 or later, and turns on with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`. The documentation warns it "may change or be removed in any release."

The scope restrictions are informative: it works only in an interactive terminal session on the native build, on Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2, through a Claude subscription or Console account — not with `-p`, the Agent SDK, the VS Code panel, the Desktop app, Bedrock, gateways, or zero-data-retention organisations. Project settings cannot enable it, and managed settings can pin it to `0` but cannot force it on. That scope says it is for a human at a terminal, not a CI pipeline.

## The mechanical change

The current loop is chatty by construction. The model requests a Bash call, waits, receives the whole result, then decides again. Every call costs a model turn, and every byte of every result — a 400-line test log, a directory listing, an edit diff — crosses the context window even when five percent of it matters.

Code Mode collapses that. The documentation's example raises a retry limit:

```javascript
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 model gets a path and the test output, not the file contents or the full log; the conversation still shows each call and diff, with the code collapsed behind `Ctrl+O`. Anthropic recommends it for changes repeated across many files, searches whose results need filtering, and independent commands that can run at once.

## What the numbers say

Anthropic published no token or latency figures. The only public measurement is from George (@bolyki), across eight interactive Sonnet 5.5 runs: same results every time, context 20-25% smaller, and on the larger task 37% fewer tokens at 19% lower cost — but not faster, and on a tiny task more expensive.

Eight samples are not a benchmark, but the mechanism explains the shape: fewer tokens get written, while the tool calls still execute, so the latency floor is your slowest command.

## The review boundary moved

![Diagram comparing a per-call agent loop with Code Mode: four stages each, showing that only the REPL review stage is reviewed, and noting that sandboxing covers shell commands only](https://blog-minio-api.netpy.in/blog/content/images/2026/11/code-mode-review.png)

Each call inside the script still passes your `deny` and `ask` rules and `PreToolUse` hooks under the tool's usual name — `Bash`, or an MCP tool's. What changes is auto mode: the classifier reviews the code before it runs, not each call, and it cannot see values computed at run time, such as a path taken from search output. A rule written against a literal target still catches the literal form and may miss the computed one.

Hooks get harder. The docs warn that a `git push` inside a folder named `app` can reach your hook as `cd 'app' && git push`, so a hook must check every part of a command. To review the script itself, match `REPL` and read the JavaScript from `tool_input.code`, or set `{"permissions":{"ask":["REPL"]}}` so Claude Code asks before each piece of code starts.

Two changelog entries show the surface still moving. Since v2.1.328, `UserPromptSubmit` hooks no longer receive script output — redaction moved to a `PostToolUse` hook on `REPL`, which returns `updatedToolOutput`. Since v2.1.329, a `PreToolUse` hook that errors no longer refuses a script's tool call; you must set `"onFailure": "block"`. If your redaction lived in `UserPromptSubmit`, it has been silently off for the calls that matter most.

Telemetry has a matching trap: events still carry each tool's normal name, so existing queries under-count instead of breaking. Calls from code carry `tool_use_id` values starting with `repl_` or `toolu_cc_`. Leave `OTEL_LOG_TOOL_DETAILS` unset — code can read a token from a file and hand it to another call.

## The asymmetry nobody mentions

Sandbox settings apply to the shell commands the code runs. The JavaScript itself, and its file, web and MCP tool calls, run outside the sandbox; to isolate those, the docs say to run Claude Code in a container or virtual machine.

Code Mode is a batching layer, not a containment boundary. If your threat model depended on a human eyeballing each call, one approved script can now contain thirty.

## Operating notes

Code Claude waits on stops after ten minutes; sessions started in auto or `bypassPermissions` mode can push it to the background for up to two hours, which is the only way to survive a full test suite. Resuming requires the environment variable to stay set.

For delivery work the useful pattern is a function call tree instead of a conversation: change forty files, run the suite, read only the failures — a codemod with a review gate, and a better fit for [our engineering engagements](https://netpy.in/?ref=blog.netpy.in) than exploratory debugging.

## Checklist before you turn it on

1. Pin the version and record the environment variable per repo; the feature can be removed in any release.
2. Move secret redaction from `UserPromptSubmit` to `PostToolUse` on `REPL`, handling a null `result`.
3. Audit `PreToolUse` hooks for multi-segment commands (`cd X && cmd`) and computed paths.
4. Add `{"permissions":{"ask":["REPL"]}}` wherever you want to read the script first, and `"onFailure": "block"` on any hook that must refuse.
5. Leave `OTEL_LOG_TOOL_DETAILS` unset; filter traces by `repl_` so dashboards count code-made calls.
6. Keep container isolation for the JavaScript and its file, web and MCP calls, not only Bash.
7. Budget for the ten-minute cap: short test targets, or start in auto mode for background runs.
8. Re-measure on your own load before quoting the savings internally.

The feature is not the interesting part. As agents move from one call at a time to code that orchestrates calls, every control built around "review each action" needs a plan for "review each program" — and most hook configurations in the wild still assume the first model. That gate is the piece to budget first; the rest is [engineering we can help with](https://netpy.in/?ref=blog.netpy.in).