Claude Code Code Mode: run many tool calls from one piece of code

Code Mode is an experimental Claude Code feature where Claude writes JavaScript that makes several tool calls in one step. Requirements, setup, permissions.

By the Kipt team · Updated 24 November 2026 · 7 min read

What is Code Mode in Claude Code?

Code Mode is an experimental Claude Code feature in which Claude writes a piece of JavaScript that makes several tool calls in one step. Without it, Claude asks for tool calls such as Bash, Read or Edit one at a time and reads each result before deciding what to do next. With it, Claude Code runs the code in your session.

Status, checked 24 November 2026 on the official Code Mode page: "Code Mode is experimental and off by default. It may change or be removed in any release." Feedback goes through /feedback. Plan around that: do not build a team routine on it without a fallback.

You still describe your task in a normal prompt. The docs show an example for "raise a retry limit", where Claude finds the file, edits it and runs the tests in one block:

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, not the code. To read the code, press Ctrl+O to open the transcript viewer. Each piece of code appears as a collapsed Code row.

Can I use Code Mode? A checklist

Check every line. The requirements below come from the docs page, checked 24 November 2026.

Requirement What the docs say
Version Claude Code v2.1.323 or later, on either release channel
Account A Claude subscription or Console account
Provider Not through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, Microsoft Foundry, or Claude Models on Google Cloud (Anthropic managed)
Organization Not on the HIPAA configuration or zero data retention
Model Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2
Surface An interactive claude session in a terminal. Not the VS Code panel, the Desktop app or cloud sessions
Install The native build of Claude Code
Windows Git for Windows installed

Some features need newer versions. Agent teams with Code Mode need v2.1.326 or later, mods that hook tool calls need v2.1.327 or later, and OpenTelemetry events and metrics, or feature-flag fetching turned off, need v2.1.329 or later. The docs say to keep OpenTelemetry tracing off on any version. You also cannot start Code Mode with some settings on, such as an API key helper.

How do I turn on Code Mode?

Start with claude --version. If it is older than v2.1.323, run claude update. Then set the environment variable.

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

On Windows PowerShell:

$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
claude

To turn it on for every new session, save this in ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
  }
}

Claude Code ignores this variable in a project's settings files, so a repository you clone cannot turn on Code Mode for you. See Claude Code environment variables for how the env block works in general.

Before your first Code Mode session Claude Code asks you to confirm. Select Yes, turn on Code Mode. It restarts and shows this line near the top:

Code Mode (experimental) is on · this session can be resumed only with Code Mode on

Try a task with many related calls:

Read every Markdown file in this project and list the links that point to local files that don't exist.

Then press Ctrl+O, expand a Code row and read the JavaScript. Press Ctrl+O again to go back.

To turn it off, remove the variable from your shell and from ~/.claude/settings.json, then start a new session. You can also set the value to 0 in either place. A 0 in one place wins over a 1 in the other.

When should I use Code Mode, and when not?

The docs suggest trying it on tasks that take many related tool calls:

  • 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

One piece of code can run commands in parallel, use one result in the next call, and return only the part of the output Claude needs to read.

Skip it, or think twice, when any of these limits matter to you:

  • Resuming: you can resume a Code Mode session only in the terminal, with Code Mode on.
  • Auto mode: the classifier reviews the code, not each tool call.
  • Long code: unless it runs in the background, you wait, and it stops after ten minutes.
  • Unavailable features: Remote Control, Claude in Chrome and computer use do not work with it.
  • Moving the session: you cannot move it to the Desktop app or turn it into a background session, and /fork cannot start a background copy.

If you are new to how Claude Code picks and calls tools, read Claude Code tools first.

How do permissions work with Code Mode?

Each tool call in the code still goes through your deny and ask permission rules and PreToolUse hooks, under the tool's usual name such as Bash or an MCP tool's name. What differs is the extra layer on top, which depends on your mode. Read more on Claude Code permissions.

  • Auto mode: a classifier reviews each piece of code before it runs, not each tool call. The docs warn it does not see values computed at run time, such as a path taken from search output. Keep rules or hooks for calls you must control. See Claude Code auto mode.
  • Other modes: you are prompted for each tool call that would prompt you in that mode.

To see a prompt for a specific command in auto or bypassPermissions mode, add an ask rule. For example, in ~/.claude/settings.json:

{
  "permissions": {
    "ask": ["Bash(git push *)"]
  }
}

To read and approve each piece of code before it starts, add an ask rule for REPL, the tool that runs the code:

{
  "permissions": {
    "ask": ["REPL"]
  }
}

The prompt does not include the code. Press Ctrl+O, expand the Code row, read it, then press Ctrl+O to return. The docs note that approving in auto mode starts the code even when the classifier would have blocked it. Sandbox settings apply to the shell commands the code runs, but the JavaScript itself and its file, web and MCP calls run outside the sandbox.

How do I check or redact what the code returns?

Use hooks, covered in our Claude Code hooks guide. A PreToolUse hook that matches REPL can read the JavaScript from tool_input.code. A PostToolUse hook that matches REPL can read the output from tool_response and replace it with updatedToolOutput. This example from the docs hides a deploy token:

{
  "hookSpecificOutput": {
    "hookEventName": "PostToolUse",
    "updatedToolOutput": {
      "code": "(await $`cat notes.txt`.text())",
      "result": "deploy token: REDACTED",
      "stdout": "",
      "stderr": "",
      "toolsUsed": ["Bash"]
    }
  }
}

Keep the shape: return code, stdout and stderr as strings, and error as a string or leave it out. If you break the shape, Claude gets the original output. If your hook crashes, times out or prints invalid JSON, Claude also gets the original output.

For guard hooks, the docs say to set "onFailure": "block" on a command or http hook, so a call from code stops after a timeout or failure. On v2.1.329 or later, a call from code runs by default after a hook failure other than "the hook did not finish". From v2.1.328, UserPromptSubmit hooks no longer receive code output, so move any check of code output to a PostToolUse hook.

Why does Claude Code say Code Mode isn't available?

If you see Code Mode (experimental) isn't available, Claude Code started without it. The reason follows on the same line, and /status shows it too. Fix it, then start a new session. A selection from the docs table:

Reason includes What to do
it isn't open to your account yet If your version is older than v2.1.323, update. Otherwise check your network and start again
it only works directly with the Anthropic API Remove settings that route requests through a cloud provider, a gateway or a custom ANTHROPIC_BASE_URL
it doesn't work with an API key helper Remove apiKeyHelper, ANTHROPIC_AUTH_TOKEN and any Authorization or X-Api-Key header in ANTHROPIC_CUSTOM_HEADERS, then sign in or set ANTHROPIC_API_KEY
it only works with Opus 5.5, Sonnet 5.5 and later models Start with a supported model, for example --model opus
it doesn't work in background jobs Start in the foreground, without --remote-control
your organization's settings don't allow it Ask your administrator about the managed setting

If you see no Code Mode line at all, check claude --version, then confirm the variable is 1 in your shell or user settings and remove any 0 from those and from any --settings file.

How do admins block Code Mode?

Add the variable with the value 0 to your managed settings so nobody in the organization can use it:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"
  }
}

People already in a Code Mode session stay in it until they exit or restart. After that they start without Code Mode and cannot resume Code Mode sessions while the 0 is in place. You cannot turn Code Mode on for users from managed settings. If you collect OpenTelemetry events, calls made from code appear under each tool's usual name, and you can find them by tool_use_id values that start with repl_ or toolu_cc_.

If you reuse the same Code Mode starter prompts, a prompt library such as Kipt can keep them in one place, tagged by project.

Questions

Code Mode is an experimental feature in which Claude writes JavaScript that makes several tool calls in one step, instead of asking for each Bash, Read or Edit call directly and reading each result first. Claude Code runs that code in your session.

Set the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE environment variable to 1, for example CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude, or add it to the env block of ~/.claude/settings.json. Then select Yes, turn on Code Mode at the first prompt.

It means Claude Code started without Code Mode, and the reason follows on the same line. /status shows it too. Common causes are an old version, a gateway or cloud provider, an API key helper, or an unsupported model. The table in this guide lists the fixes.

No. Keep CLAUDE_CODE_EXPERIMENTAL_CODE_MODE set to 1 when you run claude --continue or claude --resume. With Code Mode off, Claude Code refuses to resume the session.

Add CLAUDE_CODE_EXPERIMENTAL_CODE_MODE with the value 0 to the env block of managed settings. Admins cannot turn Code Mode on for users from managed settings.

More in Claude Code

All guides

Your prompts and skills, one keystroke away.

Explore

Use it from your agent.

Save it to Kipt, in your own GitHub, then ask your agent for it by name while you work.

  • Claude Code
  • Codex
  • Cursor
  • VS Code
  • Claude
  • ChatGPT
  • Gemini CLI
  • Windsurf
  • and any MCP client
Get started