Add Code Mode
CHANGELOG · original
Added Code Mode, an experimental opt-in in which Claude writes JavaScript to call its tools; see https://code.claude.com/docs/en/code-mode to turn it on, or to turn it off for an organization Open official changelog ↗ Documentation
Documentation excerpt
How Code Mode works
In a Code Mode session, you still describe your task in a prompt, and Claude writes JavaScript to carry it out. One piece of code can run commands in parallel, use one result in the next call, and return the part of the output that Claude needs to read.
For example, if you ask Claude to raise a retry limit, Claude might write this code to find the file, edit it, and run the tests. The last line returns the file's path and the test output to Claude:
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() });
In the conversation, you see the tool calls, such as the edit's diff, and not the code. To read the code, press Ctrl+O to open the transcript viewer. Each piece of code appears there as a collapsed Code row, with a hint for how to expand it.
When to use Code Mode
Try Code Mode on tasks that take many related tool calls, such as:
- A change that repeats across many files
- A search whose results need filtering before Claude reads them
- Several independent commands that can run at the same time
Code Mode limitations
Before you turn on Code Mode, check that you can accept these limits:
- Resuming: you can resume a Code Mode session only in the terminal, with Code Mode on
- Auto mode: auto mode's classifier reviews the code, not each tool call
- Long-running code: unless code can run in the background, you wait for it to finish, and it stops after ten minutes
- Hooks: you can see tool calls refused when a
PreToolUsehook can't run or times out - Unavailable features: you can't use Remote Control, Claude in Chrome, or computer use
- Moving the session: you can't move the session to the Desktop app or turn it into a background session, and
/forkcan't start a background copy
Documentation snapshot · 2026-11-20