R214 · Harness tips › Harness tips

Claude Code Code Mode: the agent writes a script instead of calling tools one at a time

Read the original

Authors Addy Osmani (shared)

claude-codeharnesscontext-engineeringpermissionsvendor

Source: Claude Code documentation, Run tool calls from code with Code Mode (code.claude.com/docs/en/code-mode), announced by Addy Osmani of the Claude Code team, Nov 2026. Experimental and off by default; may change or be removed.

The idea

A standard coding-agent loop is one tool call per model turn: run a search, read the full result into context, decide, run the next call. For work with many related calls, that wastes model turns and context on raw output the model only needs to filter.

In Code Mode the model writes a short JavaScript program that makes the tool calls itself: run commands in parallel, feed one result into the next call, and return only the part the model needs to read. The docs' example finds a file with ripgrep, edits a constant and runs the matching tests, then returns just the path and test output.

This is the "code as the action space" pattern applied to a production coding harness: the tools become functions in a scripting environment, and the model's action is a program, not a single call.

How it fits the harness

Requirements and limits

It runs in an interactive terminal session only, on the native build of a recent version, against the direct API with a subscription or Console account, on the current model families. It is not available through cloud providers or gateways, with API key helpers, with OpenTelemetry export, under HIPAA or zero-data-retention configurations, in the IDE panel, the desktop app or cloud sessions. It is incompatible with remote control, browser control and computer use. A Code Mode session can only be resumed with Code Mode on. Administrators can block it in managed settings, and a project's own settings file cannot turn it on.

Tradeoffs

Failure modes

Review checklist

Cited in field guides

Connections

See R214 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.