{"slug": "codemode-in-claude-code", "title": "Codemode in Claude Code", "summary": "Anthropic shipped Code Mode in Claude Code v2.1.323, an experimental, off-by-default feature that has Claude write JavaScript to make tool calls instead of issuing Bash, Read, or Edit calls one at a time. The mode lets one script run commands in parallel, chain results into later calls, and return only the needed output, but it is limited to interactive terminal sessions on the native build with Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2, and it disables Remote Control, Claude in Chrome, computer use, and background sessions. Anthropic warns Code Mode may change or be removed in any release, and long-running code stops after ten minutes unless it runs in the background.", "body_md": "[tools](https://code.claude.com/docs/en/tools-reference). Without Code Mode, Claude asks for tool calls such as Bash, Read, or Edit directly and reads each result before it decides what to do next. With Code Mode, Claude writes a piece of JavaScript that makes the tool calls, and Claude Code runs that code in your session.\n\nCode Mode is experimental and off by default. It may change or be removed in any release. To share feedback, run \n\n`/feedback`.\n## \n\nIn 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.\nFor 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:\n`Ctrl+O` to open the [transcript viewer](https://code.claude.com/docs/en/interactive-mode#transcript-viewer). Each piece of code appears there as a collapsed\n\n**Code** row, with a hint for how to expand it.\n\n### \n\nTry Code Mode on tasks that take many related tool calls, such as:\n- A change that repeats across many files\n- A search whose results need filtering before Claude reads them\n- Several independent commands that can run at the same time\n\n### \n\nBefore you turn on Code Mode, check that you can accept these limits:\n- **Resuming** : you can resume a Code Mode session only in the terminal, with Code Mode on\n- **Auto mode** : auto mode’s classifier[reviews the code, not each tool call](#permission-checks)\n- **Long-running code** : unless[code can run in the background](#long-running-code) , you wait for it to finish, and it stops after ten minutes\n- **Hooks** : you can see[tool calls refused](#tool-call-refused-by-a-hook) when a`PreToolUse` hook can’t run or times out, and[code output blocked](#code-output-withheld-by-a-hook) by a`UserPromptSubmit` hook\n- **Unavailable features** : you can’t use[Remote Control](https://code.claude.com/docs/en/remote-control) ,[Claude in Chrome](https://code.claude.com/docs/en/chrome) , or[computer use](https://code.claude.com/docs/en/computer-use)\n- **Moving the session** : you can’t move the session to the Desktop app or turn it into a[background session](https://code.claude.com/docs/en/agent-view) , and`/fork` can’t start a background copy\n\n## \n\n- **Version** : Claude Code v2.1.323 or later, on either[release channel](https://code.claude.com/docs/en/setup#configure-release-channel) . An older version starts without Code Mode, with or without the reason`it isn't open to your account yet`\n- **Account** : a Claude subscription or Console account. You can’t use Code Mode through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry\n- **Organization** : your organization doesn’t use the[HIPAA configuration](https://code.claude.com/docs/en/hipaa-setup) or[zero data retention](https://code.claude.com/docs/en/zero-data-retention)\n- **Model** : Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2\n- **Surface** : an interactive`claude` session in a terminal. Code Mode doesn’t work with`-p` , the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions\n- **Installation** : the[native build](https://code.claude.com/docs/en/setup) of Claude Code\n- **Windows** :[Git for Windows](https://git-scm.com/downloads/win) is installed\n\n`DISABLE_TELEMETRY`. For the fix for each, see [Code Mode doesn’t start](#code-mode-doesnt-start).\n\n## \n\nTurn on Code Mode, give Claude a task, and look at the code that Claude wrote.\n1\n\nCheck your version\n\nRun \n\n`claude --version`. If the version is older than v2.1.323, run `claude update`. If you’re on the `stable` channel and the update doesn’t reach v2.1.323, wait for `stable` to catch up or [switch to](https://code.claude.com/docs/en/setup#configure-release-channel).`latest`\n2\n\nStart Claude Code with Code Mode on\n\nSet the \n\n[environment variable to](https://code.claude.com/docs/en/env-vars#variables)`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`` 1`. To try Code Mode, set it in your shell. To turn on Code Mode for every new session, set it in your user settings.\n- macOS, Linux, WSL\n- Windows PowerShell\n- settings.json\n\n3\n\nConfirm that you want Code Mode\n\nClaude Code asks you to confirm before your first Code Mode session. Select If you see a different line or none, see \n\n**Yes, turn on Code Mode**. Claude Code restarts and shows this line near the top of the session:[Code Mode doesn’t start](#code-mode-doesnt-start).\n4\n\nGive Claude a task with many tool calls\n\nIn a project you know, send a prompt such as this one:\n\n5\n\nRead the code Claude wrote\n\nPress \n\n`Ctrl+O` and expand a **Code** row to see the JavaScript behind the tool calls. Press`Ctrl+O` again to return to the conversation.\n### \n\nRemove `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` from your shell and from `~/.claude/settings.json`, then start a new session. You can also keep the variable and change its value to `0` in either place. With a `0` in one place, Code Mode stays off even if you set `1` in the other.\n### \n\nAdd `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` with the value `0` to your [managed settings](https://code.claude.com/docs/en/managed-settings)so that nobody in your organization can use Code Mode:\n\n`0` is in place. You can’t turn on Code Mode for your users from managed settings.\n## \n\nYour permission mode decides how Claude’s code is checked and whether you can talk to Claude while the code runs.\n### \n\nEach tool call that Claude’s code makes goes through your `deny` and `ask` [permission rules](https://code.claude.com/docs/en/permissions)and your\n\n[. You don’t need to change a rule or matcher for a tool such as](https://code.claude.com/docs/en/hooks#pretooluse)\n\n`PreToolUse` hooks`Bash`. Beyond rules and hooks, a classifier reviews the code in auto mode, and you answer prompts in the modes that ask:\n- **[Auto mode](https://code.claude.com/docs/en/permission-modes#eliminate-prompts-with-auto-mode)** : the classifier reviews each piece of code before it runs, not each tool call. It doesn’t see values computed at run time, such as a path taken from search output, so keep rules or hooks for calls you must control. You can still be[prompted when new code starts while earlier code runs](#permission-prompt-with-a-countdown)\n- **Other [permission modes](https://code.claude.com/docs/en/permission-modes)** : the code starts without a review, and you’re prompted for each tool call that would prompt you in that mode\n\n`PreToolUse` hook that matches `REPL`, the tool that runs Claude’s code, and read the JavaScript from `tool_input.code`.\n### \n\nWhile code runs a long build or test, Claude either waits for it or lets it continue in the background:\n- **Waiting** : Claude answers after the code finishes, and the code stops after ten minutes, including time you spend at permission prompts\n- **Background** : you can keep talking to Claude, and the code can run for up to two hours\n\n`bypassPermissions` mode. If Claude still waits, check your current mode and how you started the session:\n- **You switched to another mode** : press`Shift+Tab` until you’re back in the mode you started in\n- **You started in another mode, or picked the session from the `claude --resume` list** : if[auto mode is available](https://code.claude.com/docs/en/permission-modes#eliminate-prompts-with-auto-mode) to you, exit, then run`claude --continue --permission-mode auto` with Code Mode on\n- **You passed tool names to `--tools`** : start again in auto mode without that flag\n\n## \n\n### \n\n`Code Mode (experimental) isn't available` near the top of the session means that Claude Code started without Code Mode. The reason follows on the same line, and `/status` shows it too. Find the reason in this table, make the change, and start a new session. For a reason that isn’t listed, check the [requirements](#requirements).\n\nIf you see no line about Code Mode, run \n\n`claude --version`. If your version is older than v2.1.323, update. Then check that `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` is `1` in your shell or user settings, and remove any `0` from those and from any `--settings` file.\n### \n\nWhen Claude starts more code in auto mode while earlier code is still running, the earlier code loses its classifier review. Claude Code then asks you about the earlier code’s remaining calls that would need a review. With no IDE connected, the prompt shows a countdown:\n### \n\nIf Claude reports a refused tool call, ask it for the error text. These errors mean that a `PreToolUse` hook didn’t give a decision, which refuses the call even when [is unset:](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails)\n\n`onFailure`\n- **`the hook failed`** : on a call from Claude’s code, your hook couldn’t start, was killed, exited with 126, 127, or a code above 128, or returned an HTTP error or invalid output. Fix the hook\n- **`the hook did not finish`** : your hook timed out on a call from Claude’s code, or on any other tool call once Claude has run code in the session. Raise the hook’s[`timeout`](https://code.claude.com/docs/en/hooks#common-fields)\n\n`command` or `http` hook fails or times out, set `\"onFailure\": \"continue\"` on it. If a `command` hook exits with an ordinary code such as 1, the call goes ahead unless you set `\"onFailure\": \"block\"`.\n### \n\nIf Claude reports a hook’s block reason where you expected output from Claude’s code, check your [hooks. When](https://code.claude.com/docs/en/hooks#userpromptsubmit)\n\n`UserPromptSubmit`\n[code can run in the background](#long-running-code),\n\n`command`, `http`, and `mcp_tool` hooks on that event also run on code output. To let the output through, change the hook so that it doesn’t block when `source` in its input is `poll_event`.\n## \n\n- [Permission modes](https://code.claude.com/docs/en/permission-modes) : compare auto mode with the modes that prompt you\n- [Hooks reference](https://code.claude.com/docs/en/hooks) : write`PreToolUse` and`UserPromptSubmit` hooks\n- [Managed settings](https://code.claude.com/docs/en/managed-settings) : apply one configuration across an organization", "url": "https://wpnews.pro/news/codemode-in-claude-code", "canonical_source": "https://code.claude.com/docs/en/code-mode", "published_at": "2026-11-15 12:08:39+00:00", "updated_at": "2026-11-15 12:23:09.942731+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Anthropic", "Claude Code", "Code Mode", "Claude Opus 5.5", "Claude Sonnet 5.5", "Claude Haiku 5.5", "Claude Fable 5.2", "Git for Windows"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/codemode-in-claude-code", "markdown": "https://wpnews.pro/news/codemode-in-claude-code.md", "text": "https://wpnews.pro/news/codemode-in-claude-code.txt", "jsonld": "https://wpnews.pro/news/codemode-in-claude-code.jsonld"}}