Skip to content
Code Mode skips the round trip through the context window A split diagram. On the left, direct tool calls send two full results back through Claude's context, shown as a stack of bars growing taller with each call. On the right, Code Mode has Claude write one short JavaScript block that calls both tools itself inside a sandbox, and only a short result bar returns to context. The round trip Code Mode skips Claude writes the glue code once; the raw data never re-enters the prompt. Direct tool calls Claude Drive.getDocument CRM.updateRecord Context window call 1 result transcript text, written out twice two round trips, full data both times Code Mode sandbox.js const doc = await drive.getDocument(id); await crm.updateRecord({ notes: doc.text }); // both calls run inside the sandbox // Claude never re-reads the transcript result only one short line back to the model one script, one result, no transcript round trip
Guideintermediate

Claude Code's Code Mode: what it is and whether to turn it on

Published November 13, 2026 · by

The short version

Claude Code 2.1.323 adds an experimental Code Mode where Claude writes JavaScript to drive its own tools. Here is the mechanism, who can enable it today, and why the docs link in the changelog currently 404s.

Table of Contents

Claude Code's Code Mode: what it is and whether to turn it on

Claude Code 2.1.323 shipped on November 12, 2026 with one line in the changelog that matters more than the other 47 in that release: an experimental, opt-in "Code Mode," where Claude writes JavaScript to call its own tools instead of issuing them one at a time, per the official changelog. We checked the docs page that entry links to the next morning. It 404s.

That is not a knock on Anthropic's release process. It is the actual state of this feature today, and it is the first thing to know before you go looking for the switch.

What Code Mode changes

Every Claude Code session normally runs on direct tool calls. Claude asks for a tool, the result comes back into the conversation, Claude reads it, and it asks for the next tool. Each of those results has to pass through the model's context window to get from one call to the next. Pull a two-hour meeting transcript from Google Drive and hand it to a CRM tool, and the model ends up holding that transcript in context twice: once when it reads the result, once when it writes it back out as an argument to the next call.

Code Mode changes where that round trip happens. Instead of two separate tool calls, Claude writes a short script that calls both tools itself, inside a sandboxed execution environment. The transcript moves from one function straight into the next inside that sandbox. Only the part Claude actually needs to see, a status line, a row count, a confirmation, comes back into the model's context.

This is not a new idea Anthropic invented for Claude Code. It is the same pattern Anthropic described in its own engineering writeup on code execution with MCP, published November 4, 2025: present MCP servers as code APIs instead of a flat list of tool-calling schemas, and let the model write code against them. Anthropic's worked example takes a Google Drive-to-Salesforce handoff from 150,000 tokens down to roughly 2,000, a 98.7% drop, by keeping the document body inside the execution environment instead of routing it through the model twice. Cloudflare had already shipped and named the same pattern "Code Mode" in its own agents framework the previous September, per Cloudflare's blog. Claude Code's 2.1.323 release is Anthropic building that pattern directly into the product, not a brand-new mechanism.

Direct tool calls versus Code Mode

Direct tool calls (default)Code Mode (experimental)
Who writes the call sequenceClaude, one call at a timeClaude, as a single script
Where intermediate data livesPasses through the model's context each hopStays inside the execution sandbox
Token cost on multi-tool chainsScales with every result's sizeScales with the result Claude actually returns
Maturity in Claude CodeDefault behavior todayExperimental, opt-in, shipped November 12, 2026
How to turn it onN/AChangelog points to a docs page; that page returns 404 as of November 13, 2026
Org-level controlN/AAdmins can turn it off organization-wide, per the changelog

A concrete example of the pattern

Anthropic's own writeup lays out the shape of what Code Mode's tool-calling style replaces. The direct-call version of "attach my meeting transcript to this Salesforce lead" looks like two tool calls, with the full transcript text sitting in the model's context after each one:

TOOL CALL: gdrive.getDocument(documentId: "abc123")
  -> returns "Discussed Q4 goals...[full transcript]" (loaded into context)

TOOL CALL: salesforce.updateRecord(
  objectType: "SalesMeeting",
  recordId: "00Q5f000001abcXYZ",
  data: { Notes: "Discussed Q4 goals...[transcript written out again]" }
)

The code-execution version Anthropic documents collapses that into one script. Claude discovers the available tools as files on a virtual filesystem (./servers/google-drive/getDocument.ts, ./servers/salesforce/updateRecord.ts), then writes code against them directly:

// Read transcript from Google Docs and add to Salesforce prospect
import * as gdrive from './servers/google-drive';
import * as salesforce from './servers/salesforce';

const transcript = (await gdrive.getDocument({ documentId: 'abc123' })).content;
await salesforce.updateRecord({
  objectType: 'SalesMeeting',
  recordId: '00Q5f000001abcXYZ',
  data: { Notes: transcript }
});

The transcript variable never leaves the sandbox. Claude's context only needs to hold the fact that the update succeeded. That is the mechanism Code Mode operationalizes inside Claude Code specifically: Claude writes code like this itself, the sandbox executes it, and the model sees whatever the script chooses to log back.

One caveat on the numbers: the 98.7% figure comes from Anthropic's own benchmark of the general code-execution pattern against a hypothetical Drive-to-Salesforce workflow, not a measurement of Claude Code's 2.1.323 implementation specifically. Treat it as the mechanism's ceiling, not a guaranteed result on your own repo.

Who can turn it on, and how

Here is where the honesty matters more than the hype. The changelog entry says to visit the Code Mode docs page "to turn it on, or to turn it off for an organization." We fetched that page on November 13, 2026, the day after ship, and it returns a plain 404.

The Claude Code docs page for Code Mode returning a Page Not Found error on November 13, 2026, one day after the feature shipped Source: code.claude.com/docs/en/code-mode, captured November 13, 2026.

We also checked Claude Code's published settings reference for anything resembling a codeMode key or a CLAUDE_CODE_* environment variable. Nothing. Past experimental toggles in this product have shipped as either a settings.json field or an environment variable, the same release's own CLAUDE_CODE_DISABLE_1M_CONTEXT is an example of the latter pattern, but Code Mode's specific switch is not documented anywhere public yet.

Claude Code changelog entry for version 2.1.323, November 12, 2026, showing the new experimental Code Mode feature Source: code.claude.com/docs/en/changelog, captured November 13, 2026.

The phrase "opt-in" plus "turn it off for an organization" implies the intended shape: individual users will eventually flip a flag per session or per account, and Enterprise admins get a kill switch above that. Until the docs page resolves, there is no publicly confirmed way to actually flip it. Run claude --version to confirm you are on 2.1.323 or later; that is a prerequisite, not a guarantee you will find the toggle today.

Limits and caveats

A handful of things are worth tracking before this becomes part of anyone's default workflow.

It is explicitly experimental, which in Anthropic's own release language usually means behavior can change across point releases without a deprecation notice. Anyone building automation on top of it now is building on a surface that is not yet stable. The organization-level off switch also means admins on Enterprise plans can block Code Mode account-wide once it does roll out broadly, which matters if your team's security policy treats "Claude executes self-written code" differently than "Claude calls a pre-defined tool," a reasonable distinction, since a sandboxed script has more surface area than a single schema-validated call. And the token-savings case for Code Mode is strongest exactly where direct tool calls are worst: long chains with large intermediate payloads. A two-step workflow moving a short string around will not show the same gap Anthropic's transcript example does.

The verdict

Don't build a workflow around Code Mode this week. There is no documented way to enable it, the reference docs page returns a 404 error, and "experimental opt-in" from Anthropic has historically meant the interface can shift before it stabilizes. That is a different statement from "skip it." The mechanism behind it, code execution replacing chained tool calls, already has a year of public validation from both Anthropic's and Cloudflare's own engineering teams, and an agent with access to more than a handful of MCP tools is exactly the workload where this pays off.

The practical move: bookmark the changelog and the Code Mode docs URL, and check back once the second one stops returning a 404. If your Claude Code usage is mostly single-tool lookups or a short agent loop, the current direct-call behavior is not costing you much and there is nothing to chase yet. If you are running MCP-heavy agents today, across a dozen servers, moving large documents between tools, Code Mode is the lever to watch, and it is worth the five minutes it takes to re-check that docs link next week.