Changes on
75 changes detected
Show diff (116 lines)
--- a/admin.md
+++ b/admin.md
@@ -28,7 +28,7 @@
With the option set in managed settings:
* **No mod a user brings runs its hooks** : that covers a mod in a plugin the user installed, a mod loaded with `--plugin-dir`, and a mod [Claude wrote during a session](</docs/en/plugins/mods/create#ask-claude-for-a-mod>)
- * **Your organization’s mods still run** : a mod that counts as your organization’s isn’t checked. Every other mod counts as a user’s and is refused. That includes a mod in a plugin you enable from a GitHub or other remote marketplace, and one your organization turns on for its members on claude.ai. If none counts as yours, no installed mod runs its hooks.
+ * **Your organization’s mods still run** : a mod that counts as your organization’s isn’t checked. Every other mod counts as a user’s and is refused. That includes a mod your organization turns on for its members on claude.ai. If none counts as yours, no installed mod runs its hooks.
* **Users can’t undo it** : the guard reads the option from managed settings only, so the same entry in a user, project, or local settings file, or in a file passed with `--settings`, changes nothing
* **A file or MDM policy covers every provider** : when you deliver the option as a file or through MDM, it works the same way on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry. For delivery from the claude.ai admin console, see [Platform availability](</docs/en/server-managed-settings#platform-availability>)
* **Users’ other customizations keep working** : their [hooks in settings files](</docs/en/hooks>) and in plugins’ `hooks/hooks.json`, status lines, and `/goal` aren’t affected
@@ -45,8 +45,9 @@
* The machine has managed settings or a [`managed-mcp.json`](</docs/en/managed-mcp#deploy-managed-mcp-json>) file
* The session runs on [`/login` credentials](</docs/en/authentication#authentication-precedence>) for a Team or Enterprise plan
A user with an API key, or on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, gets the guard only on a machine with managed settings or `managed-mcp.json`. A session that runs on a long-lived [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/authentication#generate-a-long-lived-token>) doesn’t count as that login either, even when a Team or Enterprise login is stored on the machine.
- * **The guard protects what you manage.** A user’s mod can’t change what your managed hooks receive or decide, the system prompt, your managed `CLAUDE.md` and other managed instructions, what any mod reads as settings, or the tools and descriptions of your managed MCP servers.
- * **Outside what you manage, a user’s mod acts as that user.** The mod keeps that user’s permissions: it can still read and write files, start processes, and make network requests. It can also rewrite tool calls and prompts, deny a tool call, and draw in the interface.
+ * **The guard protects what you manage.** A user’s mod can’t change what your managed hooks receive or decide, the system prompt, or your managed `CLAUDE.md` and other managed instructions. It also can’t change what any mod reads as settings, or the tools and descriptions of your managed MCP servers once they connect.
+ * **On v2.1.323 or later, a user’s mod can keep a managed MCP server from connecting.** In that user’s session, `/mcp` lists the server as held by that mod. To prevent it, stop user-installed mods from loading.
+ * **Outside what you manage, a user’s mod acts as that user.** The mod keeps that user’s permissions: it can still read and write files, start processes, and make network requests. It can also rewrite tool calls and prompts, deny a tool call, add or remove tools, and draw in the interface.
* **Permission rules and`PreToolUse` hooks take precedence over a user’s mod.** With the guard loaded, by default a user’s mod can’t approve a call that a `deny` rule refuses or an `ask` rule prompts for, whichever settings file holds the rule. The mod can’t approve a call that any `PreToolUse` hook blocked, either. Permission rules and `PreToolUse` hooks apply to Claude’s tool calls, not to a mod’s [`$.fs` and `$.process` calls](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>). With `Read(.env)` denied, a mod can still read that file with `$.fs.read` or start a program that does. To limit a mod’s own `$.fs` and `$.process` calls, keep the mod from loading or handle them in a policy mod.
* **A user’s mod can still skip some prompts.** In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), a call the mod approves runs without a classifier check, unless the guard is loaded and the session runs with [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) or an Agent SDK [`canUseTool` callback](</docs/en/agent-sdk/user-input#handle-tool-approval-requests>). There the classifier checks the call first. For the prompts a mod’s approval doesn’t skip, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).
@@ -97,7 +98,7 @@
To let these hooks run, change managed settings in one of two ways:
- * **Run the mod as your organization’s** : install the mod so that it counts as yours. Its hooks on these events then run, and the guard stays loaded for every other mod. The mod turns on for everyone who receives these settings, and it has to sit in a directory you place on each machine. If you list it in `prependPlugins`, keep `sec-default@builtin` in the list.
+ * **Run the mod as your organization’s** : install the mod so that it counts as yours. Its hooks on these events then run, and the guard stays loaded for every other mod. The mod turns on for everyone who receives these settings. If you list it in `prependPlugins`, keep `sec-default@builtin` in the list.
* **Remove the guard** : leave `sec-default@builtin` out of `prependPlugins`. An empty list, `"prependPlugins": []`, is enough. You lose the whole guard, not only these events. A user’s mod can then do what the guard otherwise stops it from doing, and the guard’s options don’t apply.
If you deliver a list without the guard through [server-managed settings](</docs/en/server-managed-settings#fetch-and-caching-behavior>), the guard stays loaded until the server confirms the settings for the session. To confirm either change on a machine that runs v2.1.299 or later, open `/plugin` in a session there and check that the note is gone. A `session.append` hook with no `door` filter still runs and gets no note, but the stored rows in the table don’t reach it.
@@ -122,10 +123,13 @@
The `hooks:` and `calls:` lines in the output describe the mod’s code:
- ❯ ./register.js hooks: session.start, tool.call, ui.render{component=Pane}
+ ❯ ./register.js hooks: session.start, tool.call, ui.render{component=Pane} (default matcher key: plugin)
❯ ./register.js calls: $.fs.read, $.http.fetch, $.store.set, $.ui.open
-The `hooks:` line lists the events the mod receives. The `calls:` line lists the mods API methods its code calls. The [mods API](</docs/en/plugins/mods/api>), written `$` in a mod’s code, is how a mod reaches files, processes, and the network. Claude Code refuses to load a mod that uses the mods API in a way this command can’t read. Look at the `calls:` line for these:
+ * **`hooks:`** : the events the mod receives. A `default matcher key: plugin` note means the hook before it [skips other mods’ controls and drawings](</docs/en/plugins/mods/events#hook-other-mods-drawings-and-controls>).
+ * **`calls:`** : the mods API methods its code calls
+
+The [mods API](</docs/en/plugins/mods/api>), written `$` in a mod’s code, is how a mod reaches files, processes, and the network. Claude Code refuses to load a mod that uses the mods API in a way this command can’t read. Don’t approve a mod that fails this command, because some failures don’t stop it from loading. Run the command on Claude Code v2.1.323 or later, where a long list continues on more lines with the same label, and read every `hooks:` and `calls:` line. In the `calls:` lines, look for these:
Call| What it means
---|---
@@ -134,7 +138,7 @@
`$.http.fetch`| Makes network requests
`$.env.get`, `$.settings.read`| Reads environment variables and settings, which can hold API keys. An `env reads:` line in the output names each variable.
`$.env.set`| Sets an environment variable for Claude Code and for every command and MCP server it starts afterward, which can change what those programs run. An `env writes:` line names each variable.
-`$.mcp.call`| Calls a tool on a connected MCP server, under the session’s permission rules
+`$.mcp.call`| Calls a tool on a connected MCP server, with no permission prompt. Claude Code refuses the call under a deny rule or a managed ask rule. It also refuses a call to a tool marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), or to one your organization [set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) where that setting reaches Claude Code.
`$.model.complete`| Uses the user’s plan or API key for model calls
`$.prompt.submit`| Submits a prompt, and can send it as the user’s own words
`$.session.send`| Sends a message that another session’s, subagent’s, or [teammate’s](</docs/en/agent-teams>) Claude reads
@@ -207,7 +211,7 @@
* **Give one group a different policy, such as a pilot** : [Plan for what managed settings can’t enforce](</docs/en/plugins/org#plan-for-what-managed-settings-can%E2%80%99t-enforce>)
* **Check which apps and session kinds apply the plugin keys** : [When each surface applies the plugin keys](</docs/en/plugins/org#when-each-surface-applies-the-plugin-keys>)
* **Set up CI and containers** : [Seed containers and CI](</docs/en/plugins/org#seed-containers-and-ci>)
- * **Offer mods your users may install** : [Host a marketplace](</docs/en/plugins/host-marketplace>). A mod that Claude Code copies from a GitHub, git, URL, or npm source counts as a user’s, not as your organization’s.
+ * **Offer mods your users may install** : [Host a marketplace](</docs/en/plugins/host-marketplace>). A mod that Claude Code copies from a GitHub, git, URL, or npm source counts as a user’s unless you install it as your organization’s.
### Set options on the built-in guard
@@ -233,7 +237,13 @@
### Install your organization’s mods and set the order
-Your organization’s mods load where users’ mods don’t and can run ahead of them, so Claude Code has to be able to tell that a mod came from you. It treats a mod as your organization’s only when all of these are true:
+Your organization’s mods load where users’ mods don’t and can run ahead of them, so Claude Code has to be able to tell that a mod came from you. To make a mod from a remote marketplace, such as a GitHub repository, count as yours on v2.1.324 or later, do all of these in managed settings:
+
+ * Set the mod’s plugin to `true` in `enabledPlugins`
+ * Declare the marketplace in `extraKnownMarketplaces`. To control when the mod’s code changes, [pin the marketplace and the mod’s entry](</docs/en/plugins/marketplace-reference#fields-by-type>).
+ * List the mod’s id, such as `acme-guard@acme-tools`, in [`prependPlugins`](</docs/en/settings-reference#prependplugins>) or [`appendPlugins`](</docs/en/settings-reference#appendplugins>). With `prependPlugins`, also list `sec-default@builtin` to keep the built-in guard.
+
+A mod in a directory on the user’s machine counts as yours only when all of these are true:
* Managed `enabledPlugins` sets the mod’s plugin to `true`
* Managed settings name the plugin’s [marketplace](</docs/en/plugins/create-marketplace>) as a directory on the user’s machine, by absolute path. An `extraKnownMarketplaces` entry does that and registers the marketplace for the user too.
@@ -264,9 +274,9 @@
]
}
-A plugin that Claude Code copies into its cache counts as a user’s, even when managed `enabledPlugins` enables it. That covers every plugin from a GitHub, git, URL, or npm source. Its mod runs among users’ mods, `prependPlugins` and `appendPlugins` skip it, `allowManagedModsOnly` refuses it, and `allowManagedHooksOnly` keeps it from loading. The user’s debug log has a line that starts with the plugin’s id and `is enabled by managed settings, but`. Claude Code fires an event each time it’s about to act, such as run a tool, and passes it to each mod in turn. A mod that counts as yours [runs before users’ mods](</docs/en/plugins/mods/events#the-order-mods-run-in>) even when you list it nowhere. To set its place, list its id in one of two settings. The id is the plugin’s name, `@`, and the marketplace’s name, such as `acme-guard@acme-tools`.
-
- * **`prependPlugins`** : your mod sees every event before any user’s mod and every result after. It can change the event, refuse it, or skip the users’ mods.
+An installed plugin that meets neither set of conditions counts as a user’s, even when managed `enabledPlugins` enables it. Its mod runs among users’ mods, `prependPlugins` and `appendPlugins` skip it, `allowManagedModsOnly` refuses it, and `allowManagedHooksOnly` keeps it from loading. When managed settings enable it, the user’s debug log has a line that starts with the plugin’s id and `is enabled by managed settings, but`. Claude Code fires an event each time it’s about to act, such as run a tool, and passes it to each mod in turn. A mod that meets the directory conditions [runs before users’ mods](</docs/en/plugins/mods/events#the-order-mods-run-in>) even when you list it nowhere. To set its place, list its id in one of two settings. The id is the plugin’s name, `@`, and the marketplace’s name, such as `acme-guard@acme-tools`.
+
+ * **`prependPlugins`** : your mod sees an event before any user’s mod, and the event’s result after them. It can change the event, refuse it, or skip the users’ mods. On v2.1.323 or later, check that your hooks still [reach other mods’ controls and drawings](</docs/en/plugins/mods/events#hook-other-mods-drawings-and-controls>).
* **`appendPlugins`** : your mod runs after every user’s mod, so it sees only the events those mods pass on, in the form they pass them
This example declares the `acme-tools` marketplace at `/opt/acme/claude-plugins`, enables `acme-guard` from it, and runs that mod first, with the built-in guard after it:
@@ -303,7 +313,11 @@
### Enforce a policy with a mod of your own
-To keep every user’s mod out, you don’t need a mod of your own. Set `allowManagedModsOnly`. Write a policy mod when you want to allow some users’ mods and refuse others, or to record what mods do. Each time another mod is about to load, your mod receives the list that `claude plugin validate` prints, in an event named [`plugin.register`](</docs/en/plugins/mods/reference#other-mods>). A mod in `prependPlugins` can read that list and refuse the mod. It can also [handle any mods API call by name](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>) to record or refuse that call for every other mod. The name is the method without the `$.`, so a hook on `fs.write` sees every `$.fs.write` call. This policy mod refuses any user’s mod whose own code calls `$.process.run` or `$.process.spawn`. It also keeps an audit log, writing each tool call and each file a mod writes to the debug log. Because it runs first, the log records what was requested, before any user’s mod changes it. Save it as `acme-guard/hooks/register.js`:
+To keep every user’s mod out, you don’t need a mod of your own. Set `allowManagedModsOnly`. Write a policy mod when you want to allow some users’ mods and refuse others, or to record what mods do. Each time another mod is about to load, your mod receives the list that `claude plugin validate` prints, in an event named [`plugin.register`](</docs/en/plugins/mods/reference#other-mods>). A mod in `prependPlugins` can read that list and refuse the mod. It can also [handle any mods API call by name](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>) to record or refuse that call for every other mod. The name is the method without the `$.`, so a hook on `fs.write` sees every `$.fs.write` call.
+
+On v2.1.323 or later, a `ui.focus` hook needs a wider matcher to receive other mods’ `$.ui.focus` calls. See [Hook other mods’ drawings and controls](</docs/en/plugins/mods/events#hook-other-mods-drawings-and-controls>).
+
+This policy mod refuses any user’s mod whose own code calls `$.process.run` or `$.process.spawn`. It also keeps an audit log, writing each tool call and each file a mod writes to the debug log. Because it runs first, the log records what was requested, before any user’s mod changes it. Save it as `acme-guard/hooks/register.js`:
acme-guard/hooks/register.js
@@ -347,7 +361,7 @@
* **`e.tier`** : where the mod would run, one of `prepend`, `user`, `append`, or `builtin`. Every mod a person installs is `user`.
* **`e.uses.calls`** : the mods API methods the mod calls, each written `namespace.method` such as `process.run`, without the `$.` that `claude plugin validate` prints
-When a user installs a mod that calls `$.process.run`, the mod doesn’t load, and their debug log has a line that ends with `refused by acme-guard:` and your reason. The refusal also reaches the transcript in a [session that hot-reloads a plugin directory](</docs/en/plugins/mods/troubleshoot#find-out-why-a-mod-does-nothing>). To block a call without refusing the whole mod, return `{ deny: 'your reason' }` from a hook on that call’s name. To send the audit lines somewhere other than the debug log, call `$.http.fetch` from the same hooks. A session can run without your mod. If the worker thread that runs installed mods [crashes three times](</docs/en/plugins/mods/troubleshoot#mods-that-run-in-the-hooks-worker-are-off-for-this-session>), Claude Code unloads every mod that isn’t built in, including yours, until the user runs `/reload-plugins` or starts a new session. And a user who starts Claude Code with `--safe-mode` runs without installed mods, yours included. [Create a mod](</docs/en/plugins/mods/create>) covers the files a mod needs. [Test a policy mod](</docs/en/plugins/mods/test#test-a-mod-that-judges-other-mods>) has a test file for this policy mod.
+When a user installs a mod that calls `$.process.run`, the mod doesn’t load, and their debug log has a line that ends with `refused by acme-guard:` and your reason. The refusal also reaches the transcript in a [session that hot-reloads a plugin directory](</docs/en/plugins/mods/troubleshoot#find-out-why-a-mod-does-nothing>). To block a call without refusing the whole mod, return `{ deny: 'your reason' }` from a hook on that call’s name, after you [check who made the call](</docs/en/plugins/mods/reference#mods-api-calls>). To send the audit lines somewhere other than the debug log, call `$.http.fetch` from the same hooks. A session can run without your mod. If the worker thread that runs installed mods [crashes three times](</docs/en/plugins/mods/troubleshoot#mods-that-run-in-the-hooks-worker-are-off-for-this-session>), Claude Code unloads every mod that isn’t built in, including yours, until the user runs `/reload-plugins` or starts a new session. And a user who starts Claude Code with `--safe-mode` runs without installed mods, yours included. [Create a mod](</docs/en/plugins/mods/create>) covers the files a mod needs. [Test a policy mod](</docs/en/plugins/mods/test#test-a-mod-that-judges-other-mods>) has a test file for this policy mod.
#### Refuse mods when your check fails
--- a/advisor.md
+++ b/advisor.md
@@ -1,4 +1,4 @@
-The advisor tool is experimental and requires the Anthropic API or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Claude Platform on AWS, it requires Claude Code v2.1.300 or later. It isn’t available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. Behavior, pricing, and availability may change.
+The advisor tool is experimental and requires the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>). On Claude Platform on AWS or Claude Models on Google Cloud (Anthropic managed), it requires Claude Code v2.1.300 or later. It isn’t available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. Behavior, pricing, and availability may change.
The advisor tool lets Claude consult a second, typically stronger model at key moments during a task, such as before committing to an approach, when stuck on a recurring error, or before declaring a task complete. The advisor receives the full conversation, including every tool call and result, and returns guidance that Claude applies before continuing. The advisor runs server-side on Anthropic’s infrastructure as a [server tool](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/advisor-tool>), available to both subscription and API-billed accounts. You choose which model acts as the advisor, and Claude decides when to call it. This page covers how to enable the advisor, which model pairings are accepted, what Claude shows during a consultation, and how advisor usage is billed.
@@ -122,10 +122,10 @@
## Requirements
- * **Provider** : the Anthropic API or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), not Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. On Claude Platform on AWS, the advisor requires Claude Code v2.1.300 or later.
+ * **Provider** : the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>), not Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. On Claude Platform on AWS or Claude Models on Google Cloud (Anthropic managed), the advisor requires Claude Code v2.1.300 or later.
* **LLM gateway** : through an [LLM gateway](</docs/en/llm-gateway>) configured with `ANTHROPIC_BASE_URL`, availability depends on whether the gateway forwards the request intact to the Anthropic API. If the gateway or its upstream doesn’t recognize the advisor tool, see [Automatic retry and error forwarding](</docs/en/llm-gateway-protocol#automatic-retry-and-error-forwarding>) for how Claude Code responds.
* **Supported main model** : Fable, Opus 4.6 or later, Sonnet 4.6 or later, Haiku 4.5, or Haiku 5.5. See Choose an advisor model for which advisors each accepts.
- * **Feature-flag fetching** : unless you’re on Claude Platform on AWS, the advisor needs a feature flag fetched from Anthropic. A session with a variable that turns fetching off, such as `DISABLE_TELEMETRY`, doesn’t have that flag. To check your session, see [which sessions skip the fetch or start without the flag](</docs/en/env-vars#features-that-need-feature-flag-fetching>).
+ * **Feature-flag fetching** : unless you’re on Claude Platform on AWS or Claude Models on Google Cloud (Anthropic managed), the advisor needs a feature flag fetched from Anthropic. A session with a variable that turns fetching off, such as `DISABLE_TELEMETRY`, doesn’t have that flag. To check your session, see [which sessions skip the fetch or start without the flag](</docs/en/env-vars#features-that-need-feature-flag-fetching>).
## Turn the advisor off
--- a/agent-teams.md
+++ b/agent-teams.md
@@ -72,20 +72,45 @@
`tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`.
-The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. Set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`:
+With agent teams enabled, follow these steps to give each teammate its own pane:
+
+1
+
+Install tmux or set up iTerm2
+
+Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). Set up the one you’ll run Claude Code in:
+
+ * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions.
+ * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 > Settings > General > Magic > Enable Python API**.
+
+2
+
+Turn on split panes
+
+Teammates run in-process until you change the [`teammateMode`](</docs/en/settings-reference#teammatemode>) setting.Set it to `"auto"` in `~/.claude/settings.json`:
{
"teammateMode": "auto"
}
+With `"auto"`, teammates open in split panes when you run Claude Code inside tmux or iTerm2, and run in-process in other terminals.
+
+3
+
+Start Claude Code and spawn teammates
+
+Run `claude` inside tmux or in iTerm2, then ask Claude to spawn teammates.If a setup prompt for `it2` appears in iTerm2, select **Install it2 now** to open the panes in your iTerm2 window.
+
+If you run Claude Code outside tmux and iTerm2, or the panes don’t open in your iTerm2 window, change `teammateMode` again:
+
+ * **Outside tmux and iTerm2** : with tmux installed, set `teammateMode` to `"tmux"`. The panes open in a separate tmux session. To watch them, copy the command from the `View teammates` line at the Claude Code prompt and run that command in a second terminal.
+ * **Panes don’t open in your iTerm2 window** : set `teammateMode` to `"iterm2"` to use iTerm2’s own panes. Teammates then start only when you run Claude Code in iTerm2 with `it2` set up.
+
To set the mode for a single session, pass it as a flag:
claude --teammate-mode auto
-The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`. Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually:
-
- * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions.
- * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**.
+The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`.
### Specify teammates and models
@@ -379,7 +404,7 @@
* **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>).
* **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership.
* **No per-teammate permission modes at spawn** : teammates start with the permission mode described under Permissions.
- * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
+ * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal.
## Next steps
Show diff (203 lines)
--- a/agent-view.md
+++ b/agent-view.md
@@ -116,7 +116,7 @@
Shape| What it means
---|---
`✻` or animated `✽`| The session process is running, or the session needs your input
-`∙`| The process has exited. You can still peek at the row, and when you reply or attach, Claude restarts it from its saved conversation
+`∙`| The process has exited. You can still peek at the row, and when you reply or press `Enter`, Claude restarts it from its saved conversation
`✢`| A [`/loop`](</docs/en/scheduled-tasks>) session sleeping between iterations. The row shows its run count and a countdown
The `#N` or `!N` label that can appear at the right edge of a row is a link to the session’s pull request or merge request, not part of the state icon. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. To read session state from a script or another program, use `claude agents --json` rather than the files under `~/.claude/jobs/`. While agent view is open, Claude Code also sends a notification through your configured [terminal notification channel](</docs/en/terminal-config#get-a-terminal-bell-or-notification>) when a local background session starts needing your input, finishes, or fails. Sessions that run on a schedule, such as [`/loop`](</docs/en/scheduled-tasks>) sessions, notify only when they need your input. Notifications use the same [`preferredNotifChannel` setting](</docs/en/settings-reference#preferrednotifchannel>) as the rest of Claude Code and fire the [`Notification` hook](</docs/en/hooks#notification>) with the `agent_needs_input` or `agent_completed` type. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed or stopped after shutdown for how to recover them. A session that was mid-response when the machine slept can come back unresponsive. When you open a session that has stopped responding, the supervisor restarts its process and the session continues the interrupted response from where it left off.
@@ -222,7 +222,7 @@
* Press `Enter` on a group header to collapse it, except while a filter is active, when every group stays expanded
* Press `Ctrl+X` to stop a session and `Ctrl+X` again within two seconds to delete it from the list, or `Esc` to dismiss the confirmation without deleting. The second press deletes the session even when the stop attempt fails, for example because the background service isn’t responding. In that case the confirmation stays active for another two seconds, and the delete ends the session’s process itself
-Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Except in the kept cases covered in What deleting a session removes, deleting removes the session from the list. A worktree Claude created for it is removed, kept, or left in place depending on how you delete and what the worktree holds. The conversation transcript stays on your local machine, available through `claude --resume`. Completed sessions that don’t fit on screen fold into a `… N more` row. The `Completed` group fills the vertical space left after the live groups. On a short terminal, the header compacts to a single summary line so sessions that are working or need input stay visible.
+Press `Ctrl+X` on a group header to delete every session in that group after confirmation, except any that Claude Code refuses to delete. See What deleting a session removes for what happens to each session’s worktree. The conversation transcript stays on your local machine, available through `claude --resume`. Completed sessions that don’t fit on screen fold into a `… N more` row. The `Completed` group fills the vertical space left after the live groups. On a short terminal, the header compacts to a single summary line so sessions that are working or need input stay visible.
#### Bring back a past session
@@ -275,7 +275,8 @@
`Ctrl+J`| Insert a newline in the dispatch input
`Ctrl+X`| Stop the session; press again within two seconds to delete it
`Shift+↑` / `Shift+↓`| Reorder the selected session
-`Esc`| Close the peek panel, clear the input, or exit. When you opened agent view by backgrounding your session with `←`, the final `Esc` returns to that conversation instead of exiting. With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `Esc` in the input switches from INSERT to NORMAL mode and keeps your text, as in the main prompt
+`Esc`| Close the peek panel, clear the input, or exit. On Claude Code v2.1.323 or later, clearing a prompt takes two presses. When you opened agent view by backgrounding your session with `←`, the final `Esc` returns to that conversation instead of exiting. With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `Esc` in the input switches from INSERT to NORMAL mode and keeps your text, as in the main prompt
+`Ctrl+Y`| In the dispatch input, restore the text you last cleared, or removed with `Ctrl+K`, `Ctrl+U`, or `Ctrl+W`. When agent view exits, that text is gone
`Ctrl+C`| Clear the input; press twice to exit. While text on screen is selected, the press clears the selection instead, copying it first unless [selecting already copied it](</docs/en/settings-reference#copyonselect>)
`?`| Show shortcuts
@@ -355,7 +356,7 @@
When you background the session, each kind of in-flight background work either carries over to the background session, continues only when Claude relaunches it there, or stops:
- * **Carries over** : running background shell commands, backgrounded subagents, scheduled tasks you created with [`/loop`](</docs/en/scheduled-tasks>), and Claude’s [automatic replies to artifact comments](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) keep running in the background session. A subagent moves together with everything it started, so it carries over only when all of that work can move too.
+ * **Carries over** : running background shell commands, backgrounded subagents, and scheduled tasks you created with [`/loop`](</docs/en/scheduled-tasks>) keep running in the background session. A subagent moves together with everything it started, so it carries over only when all of that work can move too.
* **Continues only when Claude relaunches it** : a running [dynamic workflow](</docs/en/workflows>). If the workflow hasn’t continued when you check on the background session, ask Claude to relaunch it.
* **Stops** : work that can’t move to the background session, such as a running [monitor](</docs/en/tools-reference#monitor-tool>). When any such work is running, Claude Code shows the `Background this session?` dialog so you can confirm before it stops the work. A backgrounded subagent that owns a monitor stops along with the monitor.
@@ -446,31 +447,33 @@
#### What deleting a session removes
-Delete a session with `Ctrl+X` twice in agent view or with `claude rm`. Except in the kept cases below, the session leaves the list. Its transcript stays on your machine through `claude --resume`, and the removal survives supervisor restarts. What happens to a worktree Claude created for the session:
+Delete a session with `Ctrl+X` twice in agent view or with `claude rm`. The session disappears from the list, unless Claude Code refuses to delete it. Its transcript stays on your machine, available through `claude --resume`. What happens to a worktree Claude created for the session:
* Agent view removes it, including uncommitted changes, so commit what you want to keep first.
* `claude rm` keeps it, along with the session row, when it has uncommitted changes.
- * Neither agent view nor `claude rm` removes a worktree that another running session is using or has locked, and deleting again doesn’t change that. Claude Code keeps the worktree and the session, and names the kept directory and the reason; in agent view, the session’s row shows `not deleted`. Close the other session, then delete again.
- * When you delete a session whose worktree has commits that Claude Code can’t confirm are saved elsewhere, Claude Code keeps the worktree and the session, and the message names the worktree’s branch and how many commits are unpushed. The message also offers the two ways forward: push the commits, or delete again to discard them. Commits on a remote don’t block the delete. Neither do commits on the local copy of your `origin` remote’s default branch, as long as that branch is checked out in your main checkout, the repository directory itself rather than a worktree. After that refusal, you choose:
- * To keep the commits, push them, or merge them into that default branch, then delete the session again.
- * To discard them, delete the session again without pushing: press `Ctrl+X` twice on its row in agent view, or run the `claude rm <id> --discard-unpushed` command the refusal printed. This removes the session and the worktree along with its branch, discarding the unpushed commits and any uncommitted changes.
-When you delete again, Claude Code discards only what the refusal showed: if the worktree has gained a commit since, Claude Code keeps it again and shows the updated state. When another finished session’s records also name the worktree, it stays when you delete again; push the commits, then delete again.
- * A worktree git no longer recognizes, for example after `git worktree prune`, doesn’t block the delete. Claude Code deletes the session and leaves the directory on disk.
- * When git or your [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>) fails to remove the worktree, Claude Code keeps the worktree and the session, and the message names the cause. For a hook, the message says how it ended, such as `exited 1`, and quotes the start of its stderr. The message also tells you which of these to do next:
- * Delete the session again to remove the directory anyway, by pressing `Ctrl+X` twice on its row in agent view or running the `claude rm <id> --force-remove-worktree <worktree-id>` command that the `claude rm` refusal printed. The worktree’s branch stays in the repository. Claude Code offers this only when it can confirm all of the following:
- * The directory is one of the repository’s linked worktrees under `.claude/worktrees/`
- * Neither the worktree nor a checked-out submodule has uncommitted changes to tracked files
- * No other session’s record names it
-When Claude Code can’t verify a submodule checkout’s state, such as one replaced by a separate git repository, it doesn’t offer this either.
- * Fix what stands in the way, such as committing or stashing the uncommitted changes, moving a separate git repository out of the worktree, closing whatever is using the directory, or fixing the hook, then delete the session again.
- * Remove the directory yourself, then delete the session again.
-
-A worktree you created yourself and started the session inside is left in place either way. A session whose worktree directory belongs to no git repository, because the repository was deleted or a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) created the directory elsewhere, can still be deleted. While files remain in the directory:
-
- * Agent view asks for the same `Ctrl+X` double-press before discarding them. For a hook-created directory it runs your [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>) instead, and without one it refuses the delete and keeps the session.
- * `claude rm` keeps the session and worktree, and names the reason.
-
-Either path keeps a directory that another finished session’s records name.
+
+One reason Claude Code refuses to delete a session is [unpushed commits in its worktree](</docs/en/errors#worktree-has-commits-that-are-not-pushed-anywhere>). To keep those commits, push them before you delete the session. Some worktrees stay on disk, whether you use agent view or `claude rm`:
+
+ * If you created a worktree yourself and started the session from inside it, the worktree stays on disk for you to keep or remove.
+ * If a worktree directory Claude created inside your repository no longer has its `.git` file, the directory stays on disk for you to remove. The worktree’s branch stays in the repository, so you keep the commits on that branch.
+
+##### Delete a session after Claude Code refuses
+
+When Claude Code refuses to delete a session because of its worktree, follow the message it shows. If the message names unpushed commits, see [Worktree has commits that are not pushed anywhere](</docs/en/errors#worktree-has-commits-that-are-not-pushed-anywhere>).
+
+##### Resolve a `Worktree not removed` message
+
+A `Worktree not removed` message means Claude Code or your [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>) didn’t finish removing the session’s worktree. Push any commits and copy out any files you want to keep, then follow the message.
+
+##### Resolve a `files that weren't checked against a repository` message
+
+This message from `claude rm` means files remain in a worktree directory that isn’t inside any git repository or that a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) manages. Copy out any files you want to keep, then take the step for your case:
+
+Your case| What to do
+---|---
+No `WorktreeCreate` hook manages the directory| To discard the files, press `Ctrl+X` twice on the session’s row in agent view. Or remove the directory yourself, then run `claude rm <id>` again
+A `WorktreeCreate` hook manages the directory, and you have a [`WorktreeRemove` hook](</docs/en/hooks#worktreeremove>)| To try removing the directory with your hook, press `Ctrl+X` twice on the session’s row in agent view. Or remove the directory yourself, then run `claude rm <id>` again
+A `WorktreeCreate` hook manages the directory, and you have no `WorktreeRemove` hook| Remove the directory yourself, then run `claude rm <id>` again
### Set the model, effort, and fast mode
@@ -547,7 +550,7 @@
[`--add-dir <path>`](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>)| Grant file access to an additional directory
[`--plugin-dir <path>`](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>)| Load a plugin from a local directory
[`--mcp-config <file-or-json>`](</docs/en/mcp>)| Load MCP servers from a config file or JSON string
-`--strict-mcp-config`| Use only the MCP servers from `--mcp-config`, ignoring other MCP configuration. See [Exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for what the flag does under a managed MCP file
+`--strict-mcp-config`| Skip the MCP servers configured in places such as `.mcp.json`, and load the ones you pass with `--mcp-config`. See [Exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for what the flag does under a managed MCP file
Repeat `--add-dir`, `--plugin-dir`, or `--mcp-config` once per value. `claude agents` doesn’t support the space-separated form, such as `--add-dir a b c`. You can place `--settings`, `--setting-sources`, and `--plugin-dir` before or after `agents`. Keep `--add-dir` and `--mcp-config` after `agents`: if you place either before `agents`, `claude agents --json` fails with an `unknown option` error. The following example opens agent view with a settings override and one extra directory:
@@ -569,9 +572,9 @@
`claude stop <id>`| Stop a session. Also accepts `claude kill`
`claude respawn <id>`| Restart a session, running or stopped, for example to pick up an updated Claude Code binary. A session that has a saved conversation resumes it
`claude respawn --all`| Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once
-`claude rm <id>`| Remove a session from the list, along with a worktree Claude created for it when that’s safe to delete; see What deleting a session removes. The conversation transcript stays on your local machine and remains available through `claude --resume`
-`claude rm <id> --discard-unpushed <commit>@<worktree-id>`| Delete a session whose delete was refused over unpushed commits, discarding the worktree along with its branch and commits. Pass the exact value that refusal printed; see What deleting a session removes. Requires v2.1.260 or later
-`claude rm <id> --force-remove-worktree <worktree-id>`| Delete a session whose delete was refused because git or the `WorktreeRemove` hook couldn’t remove its worktree, deleting the worktree directory anyway and leaving its branch in the repository. Pass the exact value that refusal printed; see What deleting a session removes. Requires v2.1.268 or later
+`claude rm <id>`| Remove a session from the list, along with a worktree Claude created for it when that’s safe to delete. If Claude Code refuses to delete the session because of its worktree, see Delete a session after Claude Code refuses. The conversation transcript stays on your local machine and remains available through `claude --resume`
+`claude rm <id> --discard-unpushed <commit>@<worktree-id>`| Try again to delete a session and discard its worktree, after Claude Code refused because of unpushed commits. Copy the command from the `claude rm` message that offers it; see [Worktree has commits that are not pushed anywhere](</docs/en/errors#worktree-has-commits-that-are-not-pushed-anywhere>). Requires v2.1.260 or later
+`claude rm <id> --force-remove-worktree <worktree-id>`| Try again to delete a session and remove its worktree directory anyway, after Claude Code refused because it couldn’t remove the worktree. Copy the command from the `claude rm` message that offers it; see Resolve a `Worktree not removed` message. Requires v2.1.268 or later
`claude daemon status`| Print the supervisor’s state, version, socket directory, and worker count
`claude daemon logs`| Follow the supervisor’s log file, `~/.claude/daemon.log`, printing new lines as they arrive until you press `Ctrl+C`
`claude daemon stop --any`| Stop the supervisor process and the background sessions it hosts. Pass `--keep-workers` to leave background sessions running for the next supervisor to reconnect to. The next `claude agents` or `claude --bg` starts a fresh supervisor
@@ -657,11 +660,11 @@
### Backgrounding shows a `Background this session?` dialog
-When you press `←` to background a session, a `Background this session?` dialog means the session has in-flight background work that would stop, be interrupted, or keep running unattended:
+When you press `←` to background a session, a `Background this session?` dialog means the session has in-flight background work that would stop or be interrupted:
* **Work that can’t move** : the session has work that can’t move to the background session, such as a running [monitor](</docs/en/tools-reference#monitor-tool>). The dialog names the background work Claude Code would stop and, separately, counts the tasks that carry over.
* **A workflow with running subagents** : a [dynamic workflow](</docs/en/workflows>) still has subagents running. Those subagents stop if you background anyway, and the dialog says how many. They start over from the beginning when Claude relaunches the workflow in the background session.
- * **Automatic artifact replies** : Claude is [replying to comments on an artifact on its own](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Those replies continue in the background session, and the dialog says so.
+ * **Automatic artifact replies** : Claude is [replying to comments on an artifact on its own](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Those replies stop if you background anyway.
Run `/tasks` to see everything that’s running, then confirm to background anyway or choose `Stay` to let the work finish first. See What carries over when you background for which kinds of work carry over and which Claude Code stops.
@@ -678,16 +681,16 @@
Shutting down or restarting your machine stops running background sessions. A session that was waiting on your input stays under `Needs input` when you come back. For any other running session, what agent view shows depends on how long ago it last made progress:
* Within 48 hours, the session shows as failed. Attach or reply to it and it restarts from its saved conversation. To pick the interrupted work back up, send it a reply asking it to continue.
- * Past 48 hours, such as after the machine was off for days, the session shows as stopped with `ended while the background service was off`. Press `Enter` on the row and the footer shows `Press enter again to resume this session (it ended while the background service was off), or ctrl+x to delete it.` Press `Enter` on the same row again to resume its saved conversation. A reply, or `claude attach <id>`, resumes it without that footer prompt.
-
-When [transcript cleanup](</docs/en/settings-reference#cleanupperioddays>) has removed a stopped session’s saved conversation, Claude Code refuses to open the row: the message says there is nothing to resume. `claude rm <id>` deletes the row, except in the kept cases described above, and `claude respawn <id>` runs its original prompt again. See [This session’s saved conversation is no longer on disk](</docs/en/errors#this-sessions-saved-conversation-is-no-longer-on-disk>). Sleep alone doesn’t stop sessions. Sessions are preserved across sleep and the supervisor reconnects to them on wake.
+ * Past 48 hours, such as after the machine was off for days, the session shows as stopped with `ended while the background service was off`. Press `Enter` on the row and the footer shows `Press enter again to resume this session (it ended while the background service was off), or ctrl+x to remove it.` Press `Enter` on the same row again to resume its saved conversation. A reply, or `claude attach <id>`, resumes it without that footer prompt.
+
+When [transcript cleanup](</docs/en/settings-reference#cleanupperioddays>) has removed a stopped session’s saved conversation, Claude Code refuses to open the row: the message says there is nothing to resume. `claude rm <id>` deletes the row, unless Claude Code refuses, and `claude respawn <id>` runs its original prompt again. See [This session’s saved conversation is no longer on disk](</docs/en/errors#this-sessions-saved-conversation-is-no-longer-on-disk>). Sleep alone doesn’t stop sessions. Sessions are preserved across sleep and the supervisor reconnects to them on wake.
### Opening a session says the conversation is already open
-Two processes can’t write to the same transcript. When a stopped session’s saved conversation is already open in another live Claude Code process, Claude Code refuses to start the session’s own process. What you see depends on what holds the conversation:
-
- * A terminal where you resumed the conversation, for example with `claude --resume` or `/resume`: the row shows `Open in a terminal` with a hint to continue it there, and opening the row shows `Can't open — this session is running in another terminal`. Continue in that terminal, or exit it and open the row again.
- * Another non-interactive Claude Code process, for example a background session process for the same conversation that hasn’t exited yet: opening the row shows `This conversation is already open in another running Claude session`. Use that process, or wait for it to exit and open the row again.
+These messages mean another Claude Code process on this machine has the stopped session’s saved conversation open, so agent view and `claude attach` won’t open the session:
+
+ * `Can't open — this session is running in another terminal`: another process has the conversation open, such as a `claude -p` run or a terminal where you resumed it. Continue in that terminal, or exit that process or let it finish, then open the session again.
+ * `This conversation is already open in another running Claude session`: another background session has the conversation open. Use that session, or stop it and open this session again.
Claude Code saves a reply you typed with the refused attempt, except one prefixed with `!` or `/`, and sends it the next time the session starts.
@@ -706,7 +709,11 @@
### A session fails before starting with a `possibly low memory` note
-When a background session’s process exits before it finishes starting and the host is low on memory, the row’s status names the exit and adds `possibly low memory — free some up and retry`. The note is a hypothesis, not a confirmed cause. Claude Code adds it only when the process exited silently, without writing an error and without being stopped by a signal, and the host reported low memory at that moment. When the process did write an error before exiting, the row shows that error instead. Free up memory on the machine, then attach or reply to the row and the supervisor starts a fresh process for the session. When memory stays low, the supervisor also stops idle sessions to free resources on its own, and stops idle pinned sessions too if stopping the others freed nothing.
+When a background session’s process exits before it finishes starting and the host is low on memory, the row’s status names the exit and adds `possibly low memory — free some up and retry`.
+
+The note is a hypothesis, not a confirmed cause. Claude Code adds it only when the process exited silently, without writing an error and without being stopped by a signal, and the host reported low memory at that moment. When the process did write an error before exiting, the row shows that error instead.
+
+Free up memory on the host, then press `Enter` on the row, and press it again if the footer asks. The supervisor starts a new process for the session. When memory stays low, the supervisor also stops idle sessions to free resources on its own, and stops idle pinned sessions too if stopping the others freed nothing.
### Agent view says the background service did not respond
@@ -753,7 +760,7 @@
### `.claude/worktrees/` is filling up
-Deleting a session in agent view removes the worktree Claude created for it, but some deletes keep the worktree or leave its directory on disk, so leftover directories can accumulate. Directories git no longer recognizes don’t appear in `git worktree list`, so remove those by hand. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. See [Clean up worktrees](</docs/en/worktrees#clean-up-worktrees>).
+Deleting a session in agent view removes the worktree Claude created for it, but some worktree directories stay on disk. Directories git no longer recognizes don’t appear in `git worktree list`, so remove those yourself. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. If git refuses, see [Clean up subagent and background-session worktrees](</docs/en/worktrees#clean-up-subagent-and-background-session-worktrees>).
## Limitations
@@ -761,7 +768,7 @@
* **Rate limits apply** : background sessions consume your subscription usage the same as interactive sessions, so running ten agents in parallel uses quota roughly ten times as fast as running one.
* **Sessions are local** : background sessions run on your machine. They are preserved across sleep but stop if the machine shuts down.
- * **Claude-created worktrees are deleted with the session in agent view** : commit changes before deleting a session that edited files in its own worktree. Some deletes keep the worktree instead.
+ * **Claude-created worktrees are deleted with the session in agent view** : commit changes before deleting a session that edited files in its own worktree. Some worktrees stay on disk.
## Related resources
@@ -779,6 +786,7 @@
Version| Change
---|---
+v2.1.323| In agent view’s input, `Ctrl+Y` restores cleared text.
v2.1.299| `/effort` and `/fast` in the dispatch input set the effort level and fast mode for the sessions you dispatch next. `/model`, `/effort`, or `/fast` typed with no value opens a picker.
v2.1.299| Claude Code reads `--bg` and `--background` as the flag only before any bare `--` separator and outside another flag’s value, and refuses an ambiguous position instead of guessing. Before this release, a prompt or reply of `--bg` or `--background` to a background session could be taken for the flag. That could start new background sessions over and over instead of delivering the text.
v2.1.296| A prompt or `!` shell command that you enter as the session moves to the background is stopped or left unsent, and its text is kept in prompt history. Before this release, the response or command kept running where you could no longer see it, and a prompt sent right after `←` could run a second time unseen. A prompt typed while `SessionStart` hooks were still running was lost: not sent, and not in prompt history.
@@ -826,7 +834,7 @@
v2.1.246| `/fork` copies the full conversation from a session that itself started as a copy and hasn’t recorded a new prompt since: a `/fork` copy you attached to, a session reattached after `←` or `/background` moved it to the background, or a session started with `claude --resume <id> --fork-session`. Before this release, if you ran `/fork` in such a session before sending it a new prompt, Claude Code printed the normal confirmation but started the copy with an empty conversation. Moving such a session to the background with `←` or `/background` lost the conversation the same way.
v2.1.246| When you open a session you just dispatched while its worker process is still starting, such as by pressing `Enter` on its row, Claude Code waits for the process and then attaches. Before this release, if you pressed `Enter` while the process was still starting, Claude Code could stop the session with [`Session <id> was stopped while the respawn was in flight`](</docs/en/errors#session-was-stopped-while-the-respawn-was-in-flight>).
v2.1.246| When you background a named session, Claude Code lists it once, and when you background the same conversation again, it numbers the new row’s name, such as `my-session (2)`, with the existing row keeping its name. Before this release, the terminal you pressed `←` in could appear in `claude agents --json` as a second session under the same name, and if you backgrounded the same conversation again, Claude Code added another row under the identical name.
-v2.1.239| With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `Esc` in agent view’s input switches from INSERT to NORMAL mode and keeps your text, matching the main prompt; in NORMAL mode with text still in the input, pressing `Esc` clears it, and pressing `Esc` on an empty input exits, as the `Esc` shortcut describes. Before this release, `Esc` cleared the input.
+v2.1.239| With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `Esc` in agent view’s input switches from INSERT to NORMAL mode and keeps your text, matching the main prompt. Before this release, `Esc` cleared the input.
v2.1.233| For a session linked to a GitLab merge request, Claude Code writes the row’s label in GitLab’s `!1234` reference syntax. You can also paste the merge request’s URL into the dispatch input to select that session. Before this release, the label rendered as `#1234`, and a pasted merge request URL matched a session only when its first prompt contained the URL.
v2.1.227| Deleting a session keeps the session and its worktree while another live Claude Code session is running inside that worktree directory. Agent view shows `not deleted` on the row and the reason in the footer, and `claude rm` prints `kept <id>` with the reason, which names the other session’s process ID. Before this release, deleting the session removed the worktree while the other session was still working in it.
v2.1.225| `claude agents` in a directory you haven’t trusted shows the same [workspace trust dialog](</docs/en/permissions#project-allow-rules-and-workspace-trust>) that `claude` shows on startup, before agent view opens. Accepting saves trust for that workspace; declining exits without opening agent view. Before this release, `claude agents` opened without asking, so sessions you dispatched from it ran in a directory you’d never been asked to trust.
--- a/artifacts.md
+++ b/artifacts.md
@@ -322,9 +322,9 @@
To set how long artifacts are kept before automatic deletion, go to [**Organization settings > Data and privacy**](<https://claude.ai/admin-settings/data-privacy-controls>). You can set separate retention periods for artifacts that are still private to their author and artifacts that have been shared.
-### Review the audit log
-
-Publishing, sharing, and deleting an artifact each appear in your organization’s audit log under the `claude_artifact_*` event types, the same family used for artifacts created in claude.ai conversations.
+### Audit artifact activity with the Compliance API
+
+On Enterprise plans, query the Compliance API’s [Activity Feed](<https://platform.claude.com/docs/en/manage-claude/compliance-activity-feed>) to see who published, shared, or deleted an artifact. To find the activity types to filter by, expand `activity_types` in the [Activity Feed reference](<https://platform.claude.com/docs/en/api/compliance/activities/list>) and look for names that contain `artifact`.
### Allowlist the viewer domain
--- a/auto-mode-config.md
+++ b/auto-mode-config.md
@@ -14,11 +14,11 @@
## Common boundaries
-Auto mode allows pushes to any branch of the repository you’re working in, including the default branch, and pull request creation by default. A non-default branch whose name marks it as a deploy or publication target, such as `production`, `release`, or `gh-pages`, isn’t covered by that default: the classifier judges a push there on its own terms, including as a production deploy. The push’s content is also still checked, so a force push, a secret entering the commit, or a change that would send secrets outside the repository when CI or a deploy pipeline runs it stays blocked. If you want a human checkpoint before Claude’s push and pull request commands, add permission rules: the recipes below keep auto mode on for everything else.
+By default in auto mode, Claude can push to the repository you’re working in, including its default branch, without a prompt. It can also open pull requests there when your task asks for one. Some pushes and pull requests [are blocked](</docs/en/permission-modes#what-the-classifier-blocks-by-default>), such as a push with a secret or a pull request to another repository. If you want a human checkpoint before Claude’s push and pull request commands, add permission rules: the recipes below keep auto mode on for everything else.
### Add a human checkpoint
-The most direct mechanism is [`permissions.ask`](</docs/en/permissions#permission-rule-syntax>). Content-scoped ask rules like the ones below are evaluated before the classifier and always force a permission prompt, even in auto mode, because an explicit ask rule is your stated intent to be prompted for that action. Add the rules in your [settings](</docs/en/settings#where-settings-live>):
+The most direct mechanism is [`permissions.ask`](</docs/en/permissions#permission-rule-syntax>). The ask rules below are evaluated before the classifier, so by default you see a prompt. Add the rules in your [settings](</docs/en/settings#where-settings-live>):
{
"permissions": {
@@ -33,7 +33,7 @@
Boundary| Mechanism| Behavior in auto mode
---|---|---
-Prompt before the action| `permissions.ask`| Always prompts for a command that matches a content-scoped rule like the recipe above. The classifier cannot auto-approve a matching action.
+Prompt before the action| `permissions.ask`| By default, prompts for a command that matches a content-scoped rule like the recipe above. The classifier cannot auto-approve a matching action.
Never run the action| `permissions.deny`| Blocks before the classifier is consulted. Neither the classifier nor user intent can override it.
One-off boundary for this session| State it in conversation, like “don’t push until I review”| The classifier blocks matching actions, but the boundary can be lost if [context compaction](</docs/en/costs#reduce-token-usage>) removes the message that stated it. Use an ask or deny rule for a durable guarantee.
@@ -66,10 +66,10 @@
* **CI/CD deploy targets**
* **Network posture**
* **Host containment** : defaults to an ordinary developer machine or CI runner with open internet. If Claude Code runs in a container, VM, or pod with an egress allow-list or neighbors it must not touch, name the allowed hosts, whether the cloud metadata endpoint should be reachable, and which cloud project, cluster, or registry the task uses and under what identity. Until this entry names that identity, the classifier [blocks](</docs/en/permission-modes#what-the-classifier-blocks-by-default>) requests for the host’s own credentials. Requires Claude Code v2.1.257 or later
- * **Protected deployment namespaces / environments** : falls back to the Sensitive remote targets heuristic until you name them
+ * **Protected deployment namespaces / environments** : falls back to the Sensitive remote targets default until you name them
* **Data retention / declassification**
* **Trust slots** : name what the classifier treats as inside your boundary. The slots are Trusted repo, Source control, Trusted internal domains, Trusted cloud buckets, Key internal services, and Internal package registry. The repo and source-control entries default to the working repository and its configured remotes. Every other trust slot defaults to `None configured`, so nothing else is trusted until you add it. A repository’s visibility scopes only confidential material: a private repository is an acceptable destination for confidential material, but making a repository private never clears secrets or personal or entrusted data into it, and the classifier treats content ported, repointed, or first read from outside the working repository as not that repository’s own work.
- * **Sensitivity slots** : name what the protective rules treat as high-risk. The slots are Sensitive data locations & audiences, Sensitive remote targets, and Protected IaC scopes. Each defaults to a broad heuristic, such as treating any host or namespace whose name carries `prod` or `production` as a sensitive remote target, so the protective rules are active before you configure anything. Naming concrete targets in a sensitivity slot makes those rules apply to the named targets instead of the heuristic.
+ * **Sensitivity slots** : name what the protective rules treat as high-risk. The slots are Sensitive data locations & audiences, Sensitive remote targets, and Protected IaC scopes. By default, a host or namespace counts as a sensitive remote target when `prod` or `production` is a whole word in its name. For example, `prod-db` counts and `webprod01` doesn’t.
To add your own entries alongside the defaults, include the literal string `"$defaults"` in the array. The default entries are spliced in at that position, so your custom entries can go before or after them. The following example keeps the default entries and adds an organization’s repos, buckets, domains, and services.
@@ -94,7 +94,7 @@
* **Key internal services** : CI, artifact registries, internal package indexes, incident tooling
* **Internal package registry** : the private npm, PyPI, or other registry that installs should route through, so installs that bypass it for a public registry get blocked
* **Sensitive data locations & audiences**: the buckets, databases, or paths that hold personal data, confidential business data, credentials, regulated data, or similarly sensitive material, and the audiences that data in each location may be shared with, so the classifier protects those locations instead of guessing from content.
- * **Sensitive remote targets** : the namespaces, hosts, or containers that count as production, so remote shells and port-forwards into them need your explicit approval
+ * **Sensitive remote targets** : the namespaces, hosts, or containers that count as production
* **Protected IaC scopes** : the infrastructure resources whose apply or destroy should always require you to name the change
* **Additional context** : regulated-industry constraints, multi-tenant infrastructure, or compliance requirements that affect what the classifier should treat as risky
@@ -176,7 +176,11 @@
* `autoMode.soft_deny`: destructive actions that user intent can clear
* `autoMode.allow`: exceptions to soft block rules
-Each is an array of prose descriptions, read as natural-language rules. For tool-pattern-based hard blocks that run before the classifier, use [`permissions.deny`](</docs/en/permissions>). Inside the classifier, precedence works in four tiers:
+Each is an array of prose descriptions, read as natural-language rules. For tool-pattern-based hard blocks that run before the classifier, use [`permissions.deny`](</docs/en/permissions>).
+
+In a [Code Mode](</docs/en/code-mode#permission-checks>) session, the classifier applies `hard_deny` and `soft_deny` when it reviews Claude’s code, and not to each tool call the code makes. `permissions.deny` rules apply to each call.
+
+Inside the classifier, precedence works in four tiers:
* `hard_deny` rules block unconditionally. User intent and `allow` exceptions don’t apply.
* `soft_deny` rules block next. User intent and `allow` exceptions can override these.
@@ -217,11 +221,13 @@
## Edit rules from `/permissions`
-To view and edit classifier rules and `environment` entries without opening a settings file, run [`/permissions`](</docs/en/permissions#manage-permissions>) and select the **Auto mode** tab. The tab requires Claude Code v2.1.246 or later, and it appears only when [auto mode is available](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) to your session. Claude Code shows entries from [managed settings](</docs/en/server-managed-settings>) or the `--settings` flag as read-only, and saves every change you make on the tab to `~/.claude/settings.json`.
-
-## Route all shell commands through the classifier
-
-By default, narrow Bash and PowerShell allow rules such as `Bash(npm test)` stay in effect in auto mode. Claude Code resolves them before the classifier runs, unless the command carries [per-command allowed domains](</docs/en/sandboxing#per-command-allowed-domains-in-auto-mode>). Claude Code suspends only the broad rules that grant arbitrary code execution, such as `Bash(*)` or wildcarded interpreters, together with every rule that names [`Monitor`](</docs/en/tools-reference#monitor-tool>), because Monitor commands run through the shell. This means a narrow rule can still let a destructive argument through without the classifier seeing it, for example a script path or flag the rule’s prefix didn’t anticipate. Set `autoMode.classifyAllShell` to `true` to suspend every Bash and PowerShell allow rule while auto mode is active, so the classifier evaluates every shell command regardless of your allow list, except [critical-path removals](</docs/en/permission-modes#critical-paths>).
+To view and edit classifier rules and `environment` entries without opening a settings file, run [`/permissions`](</docs/en/permissions#manage-permissions>) in the CLI and select the **Auto mode** tab. The tab requires Claude Code v2.1.246 or later, and it appears only when [auto mode is available](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) to your session. Claude Code shows entries from [managed settings](</docs/en/server-managed-settings>) or the `--settings` flag as read-only, and saves every change you make on the tab to `~/.claude/settings.json`.
+
+In the desktop app, `/permissions` has no **Auto mode** tab. In a local, WSL, or SSH session, edit the `autoMode` block in `~/.claude/settings.json` on the machine or WSL distribution where the session runs.
+
+## Suspend shell allow rules
+
+By default, narrow Bash and PowerShell allow rules such as `Bash(npm test)` stay in effect in auto mode. Claude Code resolves them before the classifier runs, unless the command carries [per-command allowed domains](</docs/en/sandboxing#per-command-allowed-domains-in-auto-mode>). Claude Code suspends only the broad rules that grant arbitrary code execution, such as `Bash(*)` or wildcarded interpreters, together with every rule that names [`Monitor`](</docs/en/tools-reference#monitor-tool>), because Monitor commands run through the shell. This means a narrow rule can still let a destructive argument through without the classifier seeing it, for example a script path or flag the rule’s prefix didn’t anticipate. Set `autoMode.classifyAllShell` to `true` to suspend your Bash and PowerShell allow rules while auto mode is active, and in [plan mode while the classifier reviews commands](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>). In a [Code Mode](</docs/en/code-mode#permission-checks>) session, the classifier reviews the code that runs the commands, even with this setting on.
{
"autoMode": {
@@ -229,7 +235,7 @@
}
}
-This trades latency for coverage: a command that an allow rule would have approved instantly now waits for a classifier decision, and each shell command counts as a classifier call. The setting applies only while auto mode is active, and your allow rules behave normally in other permission modes.
+In auto mode and plan mode, commands that only an allow rule would have approved take longer, because each waits for a classifier decision.
## Inspect the defaults and your effective config
@@ -272,6 +278,8 @@
The command summarizes what it will remove and asks `Reset auto mode configuration to defaults?` before writing; pass `--yes` to skip the confirmation. Reset changes only `~/.claude/settings.json`: `autoMode` rules from [managed settings](</docs/en/server-managed-settings>) or the `--settings` flag still apply.
## Review denials
+
+In the desktop app, `/permissions` has no **Recently blocked** tab. To let Claude retry an action you did intend, [name the action and its specifics](</docs/en/permission-modes#approvals-you-state-in-conversation>) in your next message.
To let Claude retry a blocked action, use the **Recently blocked** tab in `/permissions`:
Show diff (162 lines)
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,159 @@
This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Longer releases are grouped by type of change, with long lists of improvements and bug fixes collapsed. Run `claude --version` to check your installed version.
+
+2.1.325
+
+November 13, 2026
+
+**Added**
+
+ * Added a spinner tip in VS Code and similar integrated terminals about re-running a notebook cell, shown once Claude has read or edited a Jupyter notebook
+ * Added a line under the error shown when your organization’s policy blocks a request, saying how to continue: run `/rewind` and change the message, or run `/clear`
+ * Added a note for Claude when a sandboxed `git checkout`, `git stash` or autostash pull cannot update protected files such as those in `.claude`
+ * [VSCode] Added prompt suggestions wherever the terminal shows them: Tab accepts the suggested next prompt; `promptSuggestionEnabled: false` in Claude Code’s settings.json turns them off
+ * [VSCode] Added a Console sign-in that creates no API key
+ * [VSCode] Added a field to paste the redirect URL when signing in to an MCP server from the panel in SSH, WSL and container windows
+
+**Changed**
+
+ * Changed sandboxed Bash commands to follow the normal permission flow by default; set `sandbox.autoAllowBashIfSandboxed: true` to keep running them without prompts
+ * Changed managed settings that turn the sandbox on: to keep commands running without prompts, set `sandbox.autoAllowBashIfSandboxed: true` in your highest-ranking managed source
+ * Changed read-only git commands to ask first in a repository that isn’t the project’s or one you trusted; name it with `--add-dir`, not the `additionalDirectories` setting, to run them without prompts
+ * Changed scheduled tasks and `/loop` to ask before running a skill that declares `allowed-tools` or hooks; add `Skill(name)` to `permissions.allow` to run it unattended
+ * Changed “Always allow” in Desktop, IDE and SDK hosts: a rule alone is offered only when saving it would allow that command again, so a scheduled task that relied on one can now wait for you
+ * Changed the sandbox to refuse sandboxed writes to `.claude` settings, skills, agents, commands and hooks in added directories, as it does in the launch folder
+ * Changed worktree isolation: an isolated worktree session or agent is now refused `git bisect run`, `git maintenance register|start` and `scalar`’s set-up commands, and is told what still works
+ * Changed plugin MCP bundles (`.mcpb`, `.dxt`) to unpack under the plugins directory, not `.mcpb-cache` in the plugin’s folder, so read-only plugin folders load; one fetched by URL downloads again once
+ * Changed plugins of a remote marketplace that managed settings declare, enable and list in `prependPlugins` or `appendPlugins` to count as the organization’s; `pluginDigests` is deprecated and ignored
+ * Changed plugin loading to skip, and `claude plugin validate` to report, some unsafe paths and links in a plugin’s folder
+ * Changed nested skill loading: `.claude/skills` folders in `--plugin-dir` plugins no longer load from a session started above them; start Claude Code in the plugin folder instead
+ * Changed EnterWorktree to refuse a `WorktreeCreate` hook path that goes through a symlink inside the project; have the hook print the real path
+ * Changed tmux and iTerm2 teammates, and new sessions from the agents view opened with ←, to start in the session’s folder instead of where the shell last ran `cd`
+ * Changed prompt suggestions in the terminal to refresh less often after 8 turns in a row started by background or scheduled tasks, saving usage until you press a key or return to the terminal
+ * Changed Esc on a background MCP task’s question to “answer later”: nothing is sent to the server, and the question stays in `/tasks`
+ * Changed `CLAUDE_CODE_MAX_CONTEXT_TOKENS` to also set the context window of unrecognized model IDs that start with `claude-`, such as a gateway’s `claude-sonnet-latest`
+ * Changed `/login` to ask for permission to change your privacy settings
+ * Changed `/cost`, `$.session.usage()`, `--max-budget-usd` and the cost and token metrics to count a mod’s `$.model.complete` and `$.model.classify` calls
+ * Changed the programs that Claude Code’s sandbox starts for its own use, such as its network bridge, to run without Claude Code’s sign-in tokens and API keys in their environment
+ * Changed ripgrep, local git commands and the sandbox runtime’s own helper programs to run without the mTLS client key’s passphrase in their environment
+ * Remote Control: Changed `/resume` and `/teleport` to disconnect first when the connected session has a share link, or when that can’t be checked; run `/remote-control` to connect again
+ * Changed Claude Code on the web, cloud scheduled tasks and Cowork cloud sessions to start despite `sandbox.failIfUnavailable`: the hosted container has no command sandbox
+ * Changed requests for settings, permission rules, hooks or status over a cloud or self-hosted session’s connection to return less or be refused; what applies in the session is unchanged
+ * Changed `claude -p` with no cached account data to wait for that data before its first request, so a first run in a clean environment can start a few seconds later
+ * Changed Claude’s instructions to keep files you’ll want out of its temporary scratchpad folder, which can be cleared
+ * Changed marketplace `ref` to accept the full ID of any commit on a branch or tag; clients before this version can’t clone such a pin, so a marketplace pinned this way stops loading there
+ * Changed plugin marketplace and plugin downloads to use a CONNECT tunnel when `ALL_PROXY` is the only proxy set; a proxy that refuses CONNECT now fails them
+ * Changed `-p` and SDK runs in a worktree or submodule mounted into a container to apply `.claude/settings.local.json` allow rules only once the folder is trusted
+ * Changed self-hosted runners to refuse a session whose session folder or repository path is a symbolic link, other than a `checkout` hook’s checkout
+ * Removed “ask your admin to raise it” from spend limit and shared budget errors in cloud sessions and under Remote Control
+ * [VSCode] Changed the install link’s marketplace confirmation button to “Trust marketplace and continue”
+
+Show 14 improvements
+
+ * Improved subagents cut off at the output token limit: they are now asked for the whole answer again, more briefly, instead of returning only its end
+ * Improved startup with a keyless Console sign-in or other Anthropic profile login: a token that is still valid is read without waiting for the credentials lock
+ * Improved the account email check: it now also refuses your email as a client’s identity in scripts a command runs, file writes, web fetches and MCP calls
+ * Improved the `HTTPS authentication failed` message for private plugin marketplaces: it now says git’s terminal prompts and askpass programs are disabled, and it also appears with newer git versions
+ * Improved the add-marketplace confirmations, plugin recommendation prompts and plugin install warning to say that plugins can run code on your computer, with access to your files and shell
+ * Improved the `claude --desktop` sign-in error to name the API key, provider or setting that stops a Claude account sign-in from working
+ * Improved the `/voice` “No audio detected” message on macOS and Windows: it now says where to pick your microphone
+ * Improved MCP tasks: Claude is now told when a task is waiting for your answer, and can point you to `/tasks`
+ * Improved `claude remote-control`: it now exits with status 4 when it stops by itself (single-session runs still exit 0) and 69 when it can’t register, so a service manager can start it again
+ * Improved the messages shown when a background session can’t use its session’s API key or token: they no longer suggest adding the key to settings
+ * Improved the bundled dataviz skill’s part-to-whole advice for static images and for parts with a natural order, such as age bands
+ * [VSCode] Improved the note shown for an untrusted folder: it now says why the extension is off and how to turn it on
+ * [VSCode] Improved the error shown when the system refuses to run Claude Code: it now says your IT team can allow a blocked program
+ * [VSCode] Improved the sign-in card to say what to do when the browser shows a connection error for localhost
+
+Show 88 bug fixes
+
+ * Fixed a security issue in how zstd-compressed responses are decoded
+ * Fixed `/security-review` and skills’ inline git commands stopping with an error in worktrees of bare repositories, `--separate-git-dir` checkouts and Android `repo` checkouts
+ * Fixed subagents with their own model being moved to the plan-mode model when the model setting is `opusplan` or `haiku`
+ * Fixed subagents on a different model sizing file reads and MCP results with the main session’s model
+ * Fixed sessions on many third-party gateways and Foundry stopping with a context length error on every turn instead of compacting
+ * Fixed recent turns sometimes going missing from a resumed session after Claude Code stopped without a clean exit
+ * Fixed shell commands running in the launch directory after the working directory was deleted; the command now fails with a message and can be re-issued
+ * Fixed an approved plan edit being lost when the `plansDirectory` folder can’t take it: the plan is now saved in the default plans folder, and a warning says where and why
+ * Fixed a saved `sonnet[1m]` model setting being rewritten on a new install to a model id the API rejects
+ * Fixed focus view hiding the reply to your prompt when a scheduled task replied after it
+ * Fixed the prompt sometimes missing from a background subagent’s view when fullscreen is off
+ * Fixed long options in lists and permission prompts being partly overwritten when they wrap, and first-run screens losing lines on narrow terminals
+ * Fixed startup warnings about permission rules and the “N MCP servers need authentication” notice being recorded as seen when they were scrolled out of view
+ * Fixed the welcome header showing control characters or splitting across lines when an agent’s name or the working folder contains them or a line break
+ * Fixed the red error shown when Claude tries a command only you can run: a dim line now says it runs only when you type it at the prompt
+ * Fixed `/stats` showing an Active days total that was one day too high
+ * Fixed `/insights` saying a report was ready when no session qualified for analysis, and writing two values into its HTML report without escaping them
+ * Fixed `/voice` saying voice mode changed when managed settings, `--settings`, or the project’s `.claude/settings.json` or `.claude/settings.local.json` kept it as it was; it now says what holds it
+ * Fixed the IDE welcome dialog showing Cmd+Esc for Quick Launch on Windows and Linux
+ * Fixed Slack app tips showing when your organization’s policy denies cloud sessions
+ * Fixed `claude purge` hanging silently when there is no terminal to read keys from, and its project picker and `-i` prompts ignoring the keyboard when stdin is piped
+ * Fixed `claude plugin eval --output-dir ''` writing the report into the current folder; it now exits with an error
+ * Fixed `claude -p` text output on a terminal passing control sequences other than text styling; pipes and files are unchanged
+ * Fixed leftover `.oauth_refresh.lock.owner.tmp.*` files piling up in the config directory
+ * Fixed `/fast` saying “Fast mode has been disabled by your organization” under the keyless Console sign-in, where Claude Code had not asked the server
+ * Fixed `/model` saying that your organization restricts a model when Claude Code could not check that, for example with no network
+ * Fixed “Sign in with your Console account” in `/login` replacing your existing login when you pressed Esc right after the browser step
+ * Fixed the browser showing the sign-in success page in some cases where sign-in failed or was canceled
+ * Fixed `claude auth status` and other short commands leaving a lock behind on a Console profile, which made the next session hang for about a minute
+ * Fixed background sessions started on your claude.ai login using (and billing) an API key or token from the shell that started the background service
+ * Fixed more cases of a session moving to another sign-in in the background; these moves are now refused, with a message saying what works
+ * Fixed a second Enter in the exit dialog stopping background work after the move to the background was refused
+ * Fixed token counting on Amazon Bedrock sending the conversation to Bedrock when the `allowedProviders` managed setting does not allow it
+ * Fixed AWS `credential_process` helpers and Google Cloud default credentials failing when Claude Code is started without a `HOME` environment variable
+ * Fixed a session sometimes going back to an earlier permission mode after a subagent’s plan was approved
+ * Fixed one invalid value in an Agent SDK `applyFlagSettings()` call silently discarding all settings from earlier calls; a call that would do this is now refused with an error
+ * Fixed sessions showing as waiting for input when a finished pull request only needed your own review or merge
+ * Fixed an unrecognized `teammateMode` settings value being ignored without a warning: `claude -p`, the startup warning and `claude doctor` now list it as a skipped entry (still not applied)
+ * Fixed `--worktree` skipping a `WorktreeCreate` hook from a plugin in `CLAUDE_CODE_PLUGIN_SEED_DIR` on the first run in a new home directory
+ * Fixed brief-mode sessions, such as Dispatch, sending a reply again after the turn had already replied
+ * Fixed Claude saying a working Atlassian, Asana or Sentry connector had failed in cloud sessions when a plugin listed it at a different URL
+ * Fixed Claude Desktop and SDK sessions listing a folder’s own MCP servers (`.mcp.json`, local) as host-added or not at all, and not connecting WebSocket ones, after a folder move or pre-warmed start
+ * Fixed `/mcp` still listing a plugin’s MCP server after a plugin reload removed it while it was connecting
+ * Fixed an MCP server staying “needs authentication”, and its `mcp_tool` hooks being skipped, after a token refresh that was refused only for a moment
+ * Fixed MCP elicitation requests being cancelled without asking in headless mode after a server’s connection was replaced during a tool call
+ * Fixed MCP tool calls from an SDK host answering “Not connected” after a tool call had reconnected the MCP server
+ * Fixed an MCP task getting stuck after its question was closed with Esc or asked again: the footer now says it needs your input, and Enter in `/tasks` shows the question again
+ * Fixed background MCP tasks that stopped updating after another call to the same server lost the connection, when a later call reconnects
+ * Fixed a background MCP task’s question opening over a message you were still typing; it now waits until you send or clear the draft, and the spinner and turn timer keep running
+ * Fixed `worktree.sparsePaths` and sparse plugin and marketplace clones leaving out the repository’s root files on older git versions, such as 2.34
+ * Fixed self-hosted runner sessions with several repositories being unable to use a repository added mid-session
+ * Fixed Claude asking for permission before reading your own artifact or its data
+ * Fixed deny and ask permission rules and hooks for the Artifact tool not applying in some cloud sessions
+ * Fixed Code Mode scripts ignoring a worktree entered with `EnterWorktree`, writing `~` paths into the project, and leaving `/mcp` showing an MCP server as connected after its sign-in expired
+ * Fixed words typed with a Yes at a permission dialog or plan approval not reaching Claude in Code Mode
+ * Fixed Claude starting work by itself when you resumed a session that ended during a Code Mode script; it now waits for your next prompt
+ * Fixed a missing OpenTelemetry `user_prompt` event for a message sent while tool calls run. The event has `delivery.mode: "mid_turn"` and the running turn’s `prompt.id`
+ * Fixed the OpenTelemetry `user_prompt` event leaving out earlier messages’ text when queued messages merged into one turn in VS Code, or when one message had an image
+ * Fixed a slash command’s `allowed-tools` grants applying to background agents woken during or after its turn
+ * Fixed `/feedback` and `/bug` to upload other sessions only when they were recorded by the signed-in account or organization
+ * Fixed relative deny and ask permission rules (e.g. `Read(./.env)`) no longer covering the project after a `cd`; they now also apply in added directories
+ * Fixed deny and ask permission rules starting with `mcp__plugin_*_` missing a plugin’s MCP server or tool spelled in another letter case
+ * Fixed deny rules not being applied to a permission approval that arrives after Claude Code restarts, in self-hosted runner and `claude remote-control` sessions
+ * Fixed a case where a committed `.claude/settings.local.json` could be treated as the user’s own when Claude Code was started in certain subfolders of a repository
+ * Fixed some deny and ask rules not applying to certain Bash commands
+ * Fixed a gap in Bash permission checks where some compound commands could run without asking; these now ask for permission
+ * Fixed a case where a Bash allow rule could run a different program than the one it names
+ * Fixed a connector tool’s approval prompt in cloud sessions being answered automatically while plugins were still loading
+ * Fixed some subagents changing an artifact that people outside your organization can see, or uploading files to it, without asking first when an allow rule is set or uploads were approved earlier
+ * Fixed some artifact publishes skipping the confirmation for pages that people outside your organization can see when “don’t ask again” had been chosen for Artifact
+ * Fixed auto mode judging only the first change to an artifact that people outside your organization can see; its yes now covers that change alone
+ * Fixed a managed `strictPluginOnlyCustomization` lock on agents and skills not taking effect in sessions that were already running
+ * Fixed sandboxed commands being able to write to the native updater’s download folder in some cases
+ * Fixed a case where the Bash sandbox did not fully protect a worktree’s settings and hooks
+ * Fixed a case where the Bash sandbox did not fully protect a linked worktree’s shared git folder
+ * Fixed `/teleport`’s stash choice in some unusual git states: it now stops and says what to do
+ * Windows: Fixed a start-up stall that could last about a second when a PATH entry sits under a folder your account cannot open
+ * Fixed `/resume` on Windows refusing or hiding sessions whose folder was recorded with a different drive-letter case or slashes
+ * Fixed an in-session `/resume` on Windows dropping a project’s saved trust when the session was recorded with a different drive-letter case
+ * Linux: Fixed sandboxed Bash commands failing with `bwrap: Can't create file` when the working directory was below an `allowRead` folder inside a `denyRead`, such as under a symlinked home directory
+ * Fixed Claude Desktop’s third-party deployments staying on “Stopping” until a token renewal finished (once it includes this version)
+ * [VSCode] Fixed the model picker’s check mark staying on the old model after Claude Code restarted on another model or the model was switched over Remote Control
+ * [VSCode] Fixed the effort selector offering levels above the effort cap set by your organization or the `maxEffortLevel` setting
+ * [VSCode] Fixed the sign-in screen offering sign-ins that the managed `allowedProviders` setting refuses
+ * [VSCode] Fixed the permission prompt for MCP tools not saying why Claude Code asks when a safety check raises the question
+ * [VSCode] Fixed the message for organization settings that couldn’t load saying to run a command again; it now says to try again, matching the tab’s Retry link
+ * [Claude Code on the web] Fixed new cloud sessions cutting MCP tool descriptions loaded through tool search at 4,096 characters; the limit is now 16,384, as in other Claude Code sessions
+ * [Claude Tag] Fixed artifact links pasted in Slack getting no card when the poster’s Claude sign-in had expired in a workspace their organization doesn’t manage; a plain card now appears
2.1.323
--- a/checkpointing.md
+++ b/checkpointing.md
@@ -1,4 +1,4 @@
-Claude Code automatically tracks Claude’s file edits as you work, allowing you to quickly undo changes and rewind to previous states if anything gets off track.
+Claude Code automatically tracks Claude’s file edits as you work. To undo edits, run `/rewind` or its alias `/undo` in your session to open the rewind menu.
## How checkpoints work
--- a/chrome.md
+++ b/chrome.md
@@ -27,9 +27,13 @@
* [Claude Code](</docs/en/quickstart#step-1-install-claude-code>)
* A direct Anthropic plan (Pro, Max, Ultra, Team, or Enterprise)
-In Enterprise organizations that have HIPAA enabled, Claude in Chrome is off by default, and an [Owner](</docs/en/server-managed-settings#access-control>) can turn it on in [**Organization settings > Claude in Chrome**](<https://claude.ai/admin-settings/browser-extension>). Your Business Associate Agreement (BAA) with Anthropic doesn’t cover data sent to third-party sites through Claude in Chrome. See the [Implementation Guide](<https://trust.anthropic.com/resources?s=l1wrssd9hsbi4gak0tp5a6&name=%5Banthropic%5D-hipaa-ready-offering-implementation-guide>) for a list of Eligible Services. Chrome integration also requires signing in with `/login`. If you authenticate with an API key or a long-lived token from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), Claude Code keeps Chrome integration off, even when you pass `--chrome`. The browser extension can’t authenticate with those credentials.
+Chrome integration also requires signing in with `/login`. If you authenticate with an API key or a long-lived token from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), Claude Code keeps Chrome integration off, even when you pass `--chrome`. The browser extension can’t authenticate with those credentials.
Chrome integration is not available through third-party providers like Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. If you access Claude exclusively through a third-party provider, you need a separate claude.ai account to use this feature.
+
+### Chrome availability with HIPAA or zero data retention
+
+In Enterprise organizations that have HIPAA enabled, Claude in Chrome is off by default, and an [Owner](</docs/en/server-managed-settings#access-control>) can turn it on in [**Organization settings > Claude in Chrome**](<https://claude.ai/admin-settings/browser-extension>). Your Business Associate Agreement (BAA) with Anthropic doesn’t cover data sent to third-party sites through Claude in Chrome. See the [Implementation Guide](<https://trust.anthropic.com/resources?s=l1wrssd9hsbi4gak0tp5a6&name=%5Banthropic%5D-hipaa-ready-offering-implementation-guide>) for a list of Eligible Services. If your organization has [Zero Data Retention (ZDR)](</docs/en/zero-data-retention>) enabled for Claude Code, Claude in Chrome isn’t available in Claude Code. It stays off even if an Owner turned it on in **Organization settings > Claude in Chrome** or you pass `--chrome`. `/chrome` reports `Claude in Chrome is disabled by your organization's policy`. You can still use the extension outside Claude Code where your organization allows it.
## Get started in the CLI
--- a/claude-apps-gateway-config.md
+++ b/claude-apps-gateway-config.md
@@ -2,7 +2,7 @@
## File structure
-Five sections are required. Every other section is optional, and an omitted section takes its defaults. Unknown keys fail boot, so a typo surfaces as a named error rather than a silently ignored setting. **Required sections:**
+Five sections are required. Every other section is optional, and an omitted section takes its defaults. **Required sections:**
* `listen`: bind address, public URL, TLS termination
* `oidc`: your identity provider (IdP), including issuer, client, claim mapping, and who may sign in
@@ -419,6 +419,8 @@
By default the gateway signs every Bedrock request with one credential, so AWS sees all developers’ requests under a single IAM principal. Add `session_name: email` to `assume_role` and the gateway calls `sts:AssumeRole` once per developer per hour, with the session name set to that developer’s email, and signs their requests with the returned credentials, so each developer’s requests reach AWS under their own assumed-role session. The role can be in the gateway’s own account. Requires a gateway running Claude Code v2.1.281 or later. [Cost attribution on AWS](</docs/en/claude-apps-gateway-on-aws#cost-attribution>) covers the IAM role and where AWS billing shows the sessions.
+For per-developer attribution, set `assume_role` with `session_name` on every `bedrock` and `mantle` upstream except those that use `aws_bearer_token`. Those can’t take `assume_role`, so their requests stay under one principal.
+
upstreams:
- provider: bedrock
region: us-east-1
@@ -427,7 +429,7 @@
role_arn: arn:aws:iam::123456789012:role/claude-gateway-bedrock-user
session_name: email # or sub
-`session_name` selects which verified claim becomes the AWS `RoleSessionName`: `email` or `sub`. The gateway writes any character other than ASCII letters, digits, and `_+,.@-` as `=XX` hex per UTF-8 byte, and shortens a result longer than 64 characters to a prefix plus a hash, so each developer’s session name stays valid and unique. A request from a developer whose token lacks the claim isn’t sent through this upstream, and the operator log says to switch to `sub` or set `oidc.email_claim`. An active developer costs one STS call per hour per gateway replica, and concurrent first requests share one call. The gateway also makes one call of its own on this role: the token count for a request the client abandoned, so that [spend limits](</docs/en/claude-apps-gateway-spend-limits>) stay accurate. That count and its one-token fallback request are signed by the shared `claude-apps-gateway` session, so AWS attributes the fallback to `claude-apps-gateway` rather than to the developer. For strict per-developer attribution, set `assume_role` with `session_name` on every Bedrock upstream you list. An upstream without it signs the requests it serves with its own credentials.
+`session_name` selects which verified claim becomes the AWS `RoleSessionName`: `email` or `sub`. The gateway writes any character other than ASCII letters, digits, and `_+,.@-` as `=XX` hex per UTF-8 byte, and shortens a result longer than 64 characters to a prefix plus a hash, so each developer’s session name stays valid and unique. A request from a developer whose token lacks the claim isn’t sent through this upstream, and the operator log says to switch to `sub` or set `oidc.email_claim`. An active developer costs one STS call per hour per gateway replica, and concurrent first requests share one call. The gateway also makes one call of its own on this role: the token count for a request the client abandoned, so that [spend limits](</docs/en/claude-apps-gateway-spend-limits>) stay accurate. That count and its one-token fallback request are signed by the shared `claude-apps-gateway` session, so AWS attributes the fallback to `claude-apps-gateway` rather than to the developer.
#### Amazon Bedrock Mantle endpoint
@@ -1031,6 +1033,8 @@
Claude Code applies this variable without showing the developer the approval dialog. The variable applies to every model, including model IDs that end in `[1m]`. To turn off 1M context instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT: "1"`](</docs/en/model-config#extended-context>) in the same `env` block. Claude Code then treats every model as having a 200K window. In interactive sessions, each developer approves this variable in the approval dialog before it takes effect.
+Claude Code doesn’t read an alias’s `upstream_model` to size its context window. To give its model’s window to an alias in `models` that Claude Code doesn’t recognize, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>).
+
#### One-hour prompt cache
To request the one-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default five minutes, add these keys to a policy’s existing `code`, `cli`, or `settings` block and restart the gateway. The keys need Claude Code v2.1.242 or later on the gateway server and on clients. `promptCacheTtl` covers the main conversation. `subagentPromptCacheTtl` is optional and covers subagents, workflows, and background requests. This example adds both to a `match: {}` policy keyed `cli`:
@@ -1071,7 +1075,7 @@
##### Apply `code` settings in the Code tab
-The Claude Code settings a policy holds under its `code` key apply in Claude Desktop’s Code tab when all of these hold:
+Apart from [some provider and model variables](</docs/en/desktop#managed-settings>), the Claude Code settings a policy holds under its `code` key apply in Claude Desktop’s Code tab when all of these hold:
* The policy also has a `desktop` key, and an empty `desktop: {}` counts
* Claude Desktop is version 2.9939.2 or later
@@ -1105,18 +1109,27 @@
##### What the gateway rejects at boot
-The gateway validates each `desktop` block at boot against the configuration schema Claude Desktop itself uses, so a mistake surfaces at gateway start as an error naming the key rather than reaching every connected desktop. The gateway fails at boot when a block contains:
-
- * An unknown key
- * A recognized key whose value Claude Desktop would reject or silently drop, such as an empty value or a misspelled sub-key inside a nested entry. Before v2.1.260, the gateway silently dropped a misspelled field inside a nested object of a `managedMcpServers` or `orgPluginSettings` entry instead of failing at boot.
+The gateway fails at boot when a `desktop` block contains:
+
+ * A recognized key whose value Claude Desktop would reject or silently drop, such as an empty value.
* A key the gateway computes itself: the inference connection, the model list, and the OTLP relay. Configure those through `upstreams`, `models`, and the `telemetry` section’s `forward_to`.
* A legacy alias of a current key. In the boot error, the gateway names the canonical key to write.
+ * From v2.1.300, any key whose name starts with `selfHosted`, such as the keys for a self-hosted session host. Remove these keys before you upgrade the gateway to v2.1.300 or later.
If you use a deprecated value or entry shape, such as a `managedMcpServers` entry without `transport`, the gateway starts and logs a warning that names the replacement. Before v2.1.232, the gateway accepted a fixed list of 11 feature-gate keys, such as `chatTabEnabled` and `disableAutoUpdates`, and rejected every other key at boot. Before v2.1.227, the gateway also rejected `chatTabEnabled` and `chatAdvancedFileAnalysisEnabled` at boot.
+##### Keys the gateway doesn’t know
+
+On a gateway running Claude Code v2.1.295 or later, most keys from a newer Claude Desktop release need no gateway upgrade. On v2.1.321 or later, neither do most new sub-keys inside a known key. Some keys and values still fail at boot, such as these:
+
+ * A new choice in a known key’s fixed list of values.
+ * A likely typo of a key you can set in a `desktop` block, such as `disable_auto_updates` for `disableAutoUpdates`. The error suggests a name.
+
+In each case, if the name or value is real in a newer Claude Desktop release, [upgrade the gateway](</docs/en/claude-apps-gateway-deploy#upgrades>) to the latest release. Otherwise correct or remove it. To find out before you deploy, test the policy.
+
##### Keys that need a later gateway or Claude Desktop version
-The gateway validates a `desktop` block against the schema bundled with its installed version, as it does the `cli` block. To deliver a setting introduced by a newer Claude Desktop release, upgrade the gateway first. For example, `userPluginMarketplacesEnabled` and `userPluginUploadsEnabled` need Claude Code v2.1.260 or later on the gateway server and Claude Desktop 1.37937.0 or later on members’ machines. `blockReadsOutsideWorkingDirectories`, `disableBypassPermissionsMode`, `configRecheckIntervalMinutes`, and `sshClientPath` need Claude Code v2.1.281 or later on the gateway server. So do the `required` value of `microsoftAuthBroker` and the `continuousAccessEvaluation` field of a Microsoft 365 `managedMcpServers` entry. Claude Desktop releases that predate the `required` value read it as `disabled`, so set `required` only after every member’s Claude Desktop supports it. Claude Desktop’s [managed configuration reference](<https://claude.com/docs/third-party/claude-desktop/configuration>) lists the release that first reads each key.
+`userPluginMarketplacesEnabled` and `userPluginUploadsEnabled` need Claude Code v2.1.260 or later on the gateway server and Claude Desktop 1.37937.0 or later on members’ machines. `blockReadsOutsideWorkingDirectories`, `disableBypassPermissionsMode`, `configRecheckIntervalMinutes`, and `sshClientPath` need Claude Code v2.1.281 or later on the gateway server. So do the `required` value of `microsoftAuthBroker` and the `continuousAccessEvaluation` field of a Microsoft 365 `managedMcpServers` entry. Claude Desktop releases that predate the `required` value read it as `disabled`, so set `required` only after every member’s Claude Desktop supports it. Claude Desktop’s [managed configuration reference](<https://claude.com/docs/third-party/claude-desktop/configuration>) lists the release that first reads each key.
[`sshTransport`](<https://claude.com/docs/third-party/claude-desktop/configuration#sshtransport>) needs Claude Code v2.1.293 or later on the gateway server.
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -132,8 +132,8 @@
On success, the command prints the session ID and a link to view the session:
Sent to cloud session.
- Session ID: session_01DiUkqY2kzbUbDmW1w96rfi
- View: https://claude.ai/code/session_01DiUkqY2kzbUbDmW1w96rfi?from=cli&m=0
+ Session ID: session_01HJKLMNOPQRSTUVWXYZ
+ View: https://claude.ai/code/session_01HJKLMNOPQRSTUVWXYZ?from=cli&m=0
Pass `--output-format json` for a machine-readable result: `{ok, session_id, url}` on success, or `{ok: false, session_id, error}` when the send fails, for example when the session is missing or archived. Configuration errors, such as an unsupported provider or a disabled organization policy, print to stderr without JSON. `--output-format stream-json` isn’t supported with `--cloud <session-id>`. If the send fails, see Errors when sending to a cloud session.
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -121,6 +121,7 @@
`usage-data/`| `report.html` and timestamped report copies written by [`/insights`](</docs/en/costs#analyze-your-usage-patterns>), plus cached per-session analysis data used to build them
`skills/.trash/`, `plugins/.trash/`| [Skills](</docs/en/skills#how-synced-skills-behave>) and [plugins](</docs/en/plugins/loading#synced-plugins>) that the claude.ai sync removed, such as after you turn one off on claude.ai or stop syncing. The files stay here so you can recover them until the sweep deletes them
`plugins/installed_plugins.set-aside.<date>.<hash>.json`, `plugins/installed_plugins.unreadable.<date>.<hash>.kept`| Dated copies Claude Code makes before rewriting [`installed_plugins.json`](</docs/en/plugins/loading#find-plugins-on-disk>): install records it dropped, and the contents of a file it couldn’t read.
+`plugins/mcpb/`| The files Claude Code extracted from the [MCP bundles](</docs/en/plugins/components#include-a-packaged-mcpb-server>) that plugins declare. A bundle’s age counts from the last session that used it.
`todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory.
Session files in `sessions/`, auto memory, and Claude Desktop and Cowork transcripts each follow their own retention rule:
Show diff (135 lines)
--- a/claude-models-on-google-cloud-anthropic-managed.md
+++ b/claude-models-on-google-cloud-anthropic-managed.md
@@ -0,0 +1,132 @@
+Claude Models on Google Cloud (Anthropic managed) is the Claude API, run by Anthropic and reached through your Google Cloud project. To use it from Claude Code, sign in to Google Cloud and set three environment variables.
+
+Google Cloud also offers Claude through Google Cloud’s Agent Platform, formerly Vertex AI, which Google manages. If you use Agent Platform, follow [Claude Code on Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) instead. To find out which one you use, see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>)
+
+Before you start, [install Claude Code](</docs/en/setup#install-claude-code>) v2.1.307 or later. To check your version, run `claude --version` in your shell. To update, run `claude update`.
+
+## Prerequisites
+
+ * A Google Cloud project where the [account setup](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#set-up-your-account>) is complete
+ * The `roles/claude.user` [IAM role](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#iam-roles>) on that project, for each Google account or service account that runs Claude Code
+ * Your project ID and your [workspace ID](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#find-your-workspace-id>), which starts with `wrkspc_`
+ * The [gcloud CLI](<https://cloud.google.com/sdk/docs/install>), if you sign in with a Google account rather than with a service account key file
+
+## Set up Claude Code
+
+1
+
+Create Application Default Credentials
+
+ * Google account
+
+ * Service account key file
+
+Run this command in your shell, and sign in with the Google account that has the `roles/claude.user` role:
+
+ gcloud auth application-default login
+
+Run it even if you’ve already run `gcloud auth login`.If `GOOGLE_APPLICATION_CREDENTIALS` is set, unset it. While that variable is set, Claude Code uses the file it names and ignores the credentials that the command saves.
+
+In the shell or CI job that runs Claude Code, set `GOOGLE_APPLICATION_CREDENTIALS` to the path of a [service account key file](<https://docs.cloud.google.com/iam/docs/keys-create-delete>). For other credential sources, see [how to authenticate](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#authentication>).
+
+2
+
+Add the variables to your settings
+
+Add three variables to the `env` block of your [user settings file](</docs/en/settings>), `~/.claude/settings.json`. If the file doesn’t exist, create it with this content:
+
+ {
+ "env": {
+ "CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD": "1",
+ "ANTHROPIC_GOOGLE_CLOUD_PROJECT": "my-project-id",
+ "ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID": "wrkspc_01ABCDEFGHIJKLMN"
+ }
+ }
+
+Use your own project ID and [workspace ID](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#find-your-workspace-id>) in place of `my-project-id` and the `wrkspc_` value. To configure a single shell or a CI job instead, set the same three variables in that environment.You don’t need to log in to an Anthropic account, or to log out of one.
+
+3
+
+Start Claude Code and check the provider
+
+Run `claude` in your shell, then run `/status` at the Claude Code prompt. The `API provider` line contains `on Google Cloud`, and the lines after it show your `Workspace ID`, `GCP project`, and `GCP location`. To print the same lines from your shell or a CI job, run [`claude auth status --text`](</docs/en/cli-reference>).If you see `on Google Cloud`, send a prompt, or run `claude -p "hello"` in a CI job. A reply confirms that your credentials and IAM role work. If you don’t see it, or Claude Code shows an error, troubleshoot the provider setup.
+
+### Set up Claude Code for a team
+
+Put the `env` block from step 2 of Set up Claude Code in a [managed settings](</docs/en/managed-settings>) file on each developer’s machine. Grant each developer the `roles/claude.user` role on the project, and have each one run `gcloud auth application-default login` on their own machine.
+
+## Pin model versions
+
+If you deploy to a team, [pin the model IDs](</docs/en/model-config#pin-models-for-third-party-deployments>), so a Claude Code update doesn’t move everyone to a newer model at once. Add these variables to the `env` block that holds the three variables from Set up Claude Code:
+
+ {
+ "env": {
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
+ "ANTHROPIC_DEFAULT_FABLE_MODEL": "claude-fable-5-1",
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
+ }
+ }
+
+Use the Claude API model IDs that you want from [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>) in place of the example values.
+
+## Environment variables
+
+Variable| Required| Description
+---|---|---
+`CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`| Yes| Set to `1` to send model requests to Claude Models on Google Cloud (Anthropic managed)
+`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID`| Yes, unless you set `ANTHROPIC_GOOGLE_CLOUD_BASE_URL`| Your workspace ID
+`ANTHROPIC_GOOGLE_CLOUD_PROJECT`| Recommended| Your Google Cloud project ID. Without it, Claude Code uses `GOOGLE_CLOUD_PROJECT`
+`ANTHROPIC_GOOGLE_CLOUD_LOCATION`| No| The [location](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#project-location-and-workspace-resolution>) in the request URL. Defaults to `global`
+`ANTHROPIC_GOOGLE_CLOUD_BASE_URL`| No| Replaces the base URL that Claude Code builds from the project, location, and workspace ID, for example with the address of an [LLM gateway](</docs/en/llm-gateway>). Claude Code appends the API path, such as `/v1/messages`
+`CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH`| No| Set to `1` when a gateway attaches the Google credentials itself, so that Claude Code sends no Google access token
+
+## Claude Code features that aren’t available
+
+ * [Fast mode](</docs/en/fast-mode>): you can’t turn it on with `/fast` or the `fastMode` setting
+ * [Remote Control](</docs/en/remote-control>) and [cloud sessions](</docs/en/claude-code-on-the-web>)
+ * [MCP connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>)
+ * [Channels](</docs/en/channels>)
+ * The [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>)
+ * [Server-managed settings](</docs/en/server-managed-settings>). To enforce settings for your team, use [managed settings](</docs/en/managed-settings>) on each machine instead
+
+## Troubleshooting
+
+If Claude Code asks you to log in, or the `API provider` line in `/status` doesn’t contain `on Google Cloud`:
+
+ * Make sure `CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD` is `1`
+ * Make sure `claude --version` prints 2.1.307 or later
+ * Remove `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_FOUNDRY`, and `CLAUDE_CODE_USE_ANTHROPIC_AWS` from your shell and your [settings files](</docs/en/settings#find-or-create-your-settings-files>)
+
+`CLAUDE_CODE_USE_VERTEX` can stay set. After you change a variable, restart Claude Code. If `/status` doesn’t show the change, see [A value you set is ignored](</docs/en/settings#a-value-you-set-is-ignored>).
+
+### `No workspace ID found`
+
+Set `ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` to your [workspace ID](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#find-your-workspace-id>), then restart Claude Code. Ignore the `workspaceId` constructor option that the message mentions: it’s for people who call Anthropic’s SDK from their own code.
+
+### `No project was given`
+
+Set `ANTHROPIC_GOOGLE_CLOUD_PROJECT` to your Google Cloud project ID, then restart Claude Code.
+
+### `Could not load Google Cloud credentials`
+
+Repeat step 1 of Set up Claude Code, with a new key if you use a service account key file.
+
+### `Google Cloud credentials expired or invalid`
+
+If the message tells you to refresh your Google Cloud credentials, repeat step 1 of Set up Claude Code. With a service account key file, use a new key.
+
+### `Google Cloud authentication failed`
+
+Follow the steps for `Google Cloud credentials expired or invalid`. If that doesn’t clear the error:
+
+ * **Project** : in `/status`, make sure the `GCP project` line names your project. If it names another project, or there’s no such line, follow `No project was given`
+ * **Workspace** : in `/status`, make sure the `Workspace ID` line shows your workspace ID. If it shows another, follow `No workspace ID found`
+ * **IAM role** : make sure the Google account or service account that runs Claude Code has `roles/claude.user` or `roles/claude.admin` on the project in the `GCP project` line. To grant the role, use [the service’s grant command](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#before-making-api-calls>), or ask a project admin to grant it
+ * **Service** : make sure the `claude.googleapis.com` service is enabled on the project in the `GCP project` line. To enable it, follow [the service’s account setup steps](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#set-up-your-account>), or ask a project admin to enable it
+
+## Related resources
+
+ * [Claude Models on Google Cloud (Anthropic managed)](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed>): account setup, IAM roles, billing, data retention, and feature support
+ * [Enterprise deployment overview](</docs/en/third-party-integrations>): the other ways to deploy Claude Code, and proxy and gateway setup
+ * [Model configuration](</docs/en/model-config>): model aliases, pinning a model version, and restricting which models users can select
--- a/claude-projects.md
+++ b/claude-projects.md
@@ -151,10 +151,10 @@
Claude decides where each message you send in the conversation goes:
* A quick question usually gets an answer in the conversation.
- * New work goes to a new thread or to a thread already working in that area, and Claude tells you which. Each new thread shows up under your message as a card: a box with the thread’s title and status, which you click to open the thread.
+ * New work goes to a new thread or to a thread already working in that area, and Claude tells you which. Each new thread shows up in the conversation, and you click it to open the thread.
* Several unrelated tasks in one message become separate threads.
-If Claude routes something differently than you wanted, say so. Tune how Claude runs a project lists things you can tell it, such as reusing an existing thread for follow-ups or answering in place instead of starting a thread. A thread’s full results stay in the thread, and you open its card in the conversation to read them. Files a thread produced are also in the project’s **Library**. Sometimes Claude proposes threads instead of starting them, in a **Suggested threads** list. Click the arrow on a suggestion to start that thread. When several are listed, a button under the list starts all of them.
+If Claude routes something differently than you wanted, say so. Tune how Claude runs a project lists things you can tell it, such as reusing an existing thread for follow-ups or answering in place instead of starting a thread. A thread’s full results stay in the thread, so open the thread to read them. Files a thread produced are also in the project’s **Library**. Sometimes Claude proposes threads instead of starting them, in a **Suggested threads** list. Click the arrow on a suggestion to start that thread. When several are listed, a button under the list starts all of them.
### Review a thread’s pull request
@@ -163,12 +163,6 @@
* **Branch** : works on a new branch, started from the repository’s default branch.
* **Pull request** : opens one when you ask, and can open one on its own for a bug fix or another concrete change.
* **After it opens** : watches the pull request with [auto-fix](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) turned on, whether or not auto-fix is on for your other cloud sessions. It pushes fixes when CI fails, addresses review comments, and replies in the thread when checks pass and the pull request is ready for you.
-
-When a thread has pushed a branch or opened a pull request, its card in the conversation can show a button for the next step:
-
- * **Resolve conflicts** , **Fix CI** , **Address comments** , and **Merge it** send that instruction to the thread as a message from you, so you can prompt the thread yourself instead of waiting for it to react to the pull request.
- * **Review PR** opens the pull request on GitHub.
- * **Create PR** appears when an idle thread has pushed a branch but hasn’t opened a pull request. Clicking it creates the pull request from that branch directly rather than sending the thread an instruction to open one.
To change when threads open pull requests, for example only when you ask, or which branch they start from, say so in the task or in project instructions.
@@ -192,7 +186,7 @@
### Open a thread when you need control
-Click a thread’s card in the conversation or its row in Overview to open its transcript in the Overview pane. From there you can:
+Click a thread in the conversation or its row in Overview to open the thread in the Overview pane. From there you can:
* Read what Claude did, step by step.
* Steer the task by writing in the thread’s own message box. A message there goes straight to that thread, while a follow-up in the project conversation reaches it only when Claude matches the follow-up to that thread.
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -35,7 +35,7 @@
`claude purge [path]`| Delete all local Claude Code state for a project: transcripts, task lists, debug logs, file-edit history, prompt history lines, and the project’s entry in `~/.claude.json`. Omit `[path]` to pick from an interactive list. Flags: `--dry-run` to preview, `-y`/`--yes` to skip confirmation, `-i`/`--interactive` to confirm each item, `--all` for every project. See [Clear local data](</docs/en/claude-directory#clear-local-data>)| `claude purge ~/work/repo --dry-run`
`claude remote-control`| Start a [Remote Control](</docs/en/remote-control>) server to control Claude Code from claude.ai or the Claude app. Alias: `claude rc`. Runs in server mode (no local interactive session). See [Server mode flags](</docs/en/remote-control#start-a-remote-control-session>). After you stop the server, you can bring back the sessions it was serving. See [Resume sessions after stopping the server](</docs/en/remote-control#resume-sessions-after-stopping-the-server>)| `claude remote-control --name "My Project"`
`claude respawn <id>`| Restart a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>), running or stopped, with its conversation intact. Use `--all` to restart every running session, e.g. to pick up an updated Claude Code binary| `claude respawn 7c5dcf5d`
-`claude rm <id>`| Remove a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>) from the list. When the removal is [refused over the session’s worktree](</docs/en/agent-view#what-deleting-a-session-removes>) and a second `claude rm` can resolve it, the refusal prints the exact flag and value to pass: `--discard-unpushed <commit>@<worktree-id>` discards a worktree that has unpushed commits along with those commits, and `--force-remove-worktree <worktree-id>` deletes a worktree directory that git or the `WorktreeRemove` hook couldn’t remove. `--discard-unpushed` requires Claude Code v2.1.260 or later, and `--force-remove-worktree` requires v2.1.268 or later. The conversation transcript stays on your local machine, available through `claude --resume`| `claude rm 7c5dcf5d`
+`claude rm <id>`| Remove a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>) from the list. If Claude Code refuses to delete the session because of its worktree, see [Delete a session after Claude Code refuses](</docs/en/agent-view#delete-a-session-after-claude-code-refuses>). The conversation transcript stays on your local machine, available through `claude --resume`| `claude rm 7c5dcf5d`
`claude self-hosted-runner`| Start a runner process that registers this machine or container with a [self-hosted environment](</docs/en/self-hosted-environments>) and hosts Claude Code cloud sessions on your infrastructure. Run `claude self-hosted-runner setup` for a guided operator walkthrough, `claude self-hosted-runner doctor` to [diagnose a deployed runner](</docs/en/self-hosted-environments-deploy#troubleshooting>), and `claude self-hosted-runner orchestrator` to spawn [on-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>). Requires Claude Code v2.1.224 or later| `claude self-hosted-runner setup`
`claude setup-token`| Generate a long-lived OAuth token for CI and scripts. Prints the token to the terminal without saving it. Requires a Claude subscription. See [Generate a long-lived token](</docs/en/authentication#generate-a-long-lived-token>)| `claude setup-token`
`claude stop <id>`| Stop a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>). Also accepts `claude kill`| `claude stop 7c5dcf5d`
@@ -122,7 +122,7 @@
`--session-id`| Use a specific session ID for the conversation (must be a valid UUID)| `claude --session-id "550e8400-e29b-41d4-a716-446655440000"`
`--setting-sources`| Comma-separated list of setting sources to load (`user`, `project`, `local`). See [agent view](</docs/en/agent-view#what-carries-over-when-you-background>) and [agent teams](</docs/en/agent-teams#context-and-communication>) for the sessions you start from this one that inherit the list| `claude --setting-sources user,project`
`--settings`| Path to a settings JSON file or an inline JSON string. Values you set here override the same keys in your `settings.json` files for this session. Keys you omit keep their file-based values. The file must be a regular file no larger than 2 MiB. See [settings precedence](</docs/en/settings#settings-precedence>)| `claude --settings ./settings.json`
-`--strict-mcp-config`| Only use MCP servers from `--mcp-config`, ignoring all other MCP configurations. See [Exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for what the flag does under a managed MCP file| `claude --strict-mcp-config --mcp-config ./mcp.json`
+`--strict-mcp-config`| Skip the MCP servers configured in places such as `.mcp.json`, `~/.claude.json`, or a plugin, and load the ones you pass with `--mcp-config`. See [Exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for what the flag does under a managed MCP file| `claude --strict-mcp-config --mcp-config ./mcp.json`
`--system-prompt`| Replace the entire system prompt with custom text| `claude --system-prompt "You are a Python expert"`
`--system-prompt-file`| Load system prompt from a file, replacing the default prompt| `claude --system-prompt-file ./custom-prompt.txt`
`--system-prompt-snapshot`| Pass `off` to rebuild the system prompt on every request instead of reusing the prompt recorded on the conversation’s first request, for example while you iterate on `--append-system-prompt` text across `--continue` runs. Requires Claude Code v2.1.257 or later| `claude --system-prompt-snapshot off`
Show diff (205 lines)
--- a/code-mode.md
+++ b/code-mode.md
@@ -0,0 +1,202 @@
+Code Mode changes how Claude uses its [tools](</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.
+
+Code Mode is experimental and off by default. It may change or be removed in any release. To share feedback, run `/feedback`.
+
+## 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](</docs/en/interactive-mode#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 `PreToolUse` hook can’t run or times out, and code output blocked by a `UserPromptSubmit` hook
+ * **Unavailable features** : you can’t use [Remote Control](</docs/en/remote-control>), [Claude in Chrome](</docs/en/chrome>), or [computer use](</docs/en/computer-use>)
+ * **Moving the session** : you can’t move the session to the Desktop app or turn it into a [background session](</docs/en/agent-view>), and `/fork` can’t start a background copy
+
+## Requirements
+
+ * **Version** : Claude Code v2.1.323 or later, on either [release channel](</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`
+ * **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
+ * **Organization** : your organization doesn’t use the [HIPAA configuration](</docs/en/hipaa-setup>) or [zero data retention](</docs/en/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. Code Mode doesn’t work with `-p`, the Agent SDK, the VS Code panel, the Desktop app, or cloud sessions
+ * **Installation** : the [native build](</docs/en/setup>) of Claude Code
+ * **Windows** : [Git for Windows](<https://git-scm.com/downloads/win>) is installed
+
+You also can’t start Code Mode with some settings on, such as an API key helper, agent teams, OpenTelemetry export, or `DISABLE_TELEMETRY`. For the fix for each, see Code Mode doesn’t start.
+
+## Try Code Mode
+
+Turn on Code Mode, give Claude a task, and look at the code that Claude wrote.
+
+1
+
+Check your version
+
+Run `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 `latest`](</docs/en/setup#configure-release-channel>).
+
+2
+
+Start Claude Code with Code Mode on
+
+Set the [`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`](</docs/en/env-vars#variables>) environment variable to `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.
+
+ * macOS, Linux, WSL
+
+ * Windows PowerShell
+
+ * settings.json
+
+ CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude
+
+ $env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
+ claude
+
+Save this `env` block in `~/.claude/settings.json` and start `claude`:
+
+ {
+ "env": {
+ "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
+ }
+ }
+
+Claude Code [ignores this variable in a project’s settings files](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), so a repository you clone can’t turn on Code Mode for you.
+
+3
+
+Confirm that you want Code Mode
+
+Claude Code asks you to confirm before your first Code Mode session. Select **Yes, turn on Code Mode**. Claude Code restarts and shows this line near the top of the session:
+
+ Code Mode (experimental) is on · this session can be resumed only with Code Mode on
+
+If you see a different line or none, see Code Mode doesn’t start.
+
+4
+
+Give Claude a task with many tool calls
+
+In a project you know, send a prompt such as this one:
+
+ Read every Markdown file in this project and list the links that point to local files that don't exist.
+
+5
+
+Read the code Claude wrote
+
+Press `Ctrl+O` and expand a **Code** row to see the JavaScript behind the tool calls. Press `Ctrl+O` again to return to the conversation.
+
+To resume a Code Mode session later, 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. Sessions that you started without Code Mode resume without Code Mode, even with the variable set.
+
+### Turn off Code Mode
+
+Remove `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.
+
+### Block Code Mode for your organization
+
+Add `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` with the value `0` to your [managed settings](</docs/en/managed-settings>) so that nobody in your organization can use Code Mode:
+
+ {
+ "env": {
+ "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"
+ }
+ }
+
+Users who are in a Code Mode session stay in it until they exit or restart Claude Code. After that, your users start without Code Mode and can’t resume their Code Mode sessions while the `0` is in place. You can’t turn on Code Mode for your users from managed settings.
+
+## Permissions and long-running code
+
+Your permission mode decides how Claude’s code is checked and whether you can talk to Claude while the code runs.
+
+### Permission checks
+
+Each tool call that Claude’s code makes goes through your `deny` and `ask` [permission rules](</docs/en/permissions>) and your [`PreToolUse` hooks](</docs/en/hooks#pretooluse>). You don’t need to change a rule or matcher for a tool such as `Bash`. Beyond rules and hooks, a classifier reviews the code in auto mode, and you answer prompts in the modes that ask:
+
+ * **[Auto mode](</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
+ * **Other[permission modes](</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
+
+To check the code itself, write a `PreToolUse` hook that matches `REPL`, the tool that runs Claude’s code, and read the JavaScript from `tool_input.code`.
+
+Bash rules match command text, so Claude can run a denied command [in a form the rule doesn’t match](</docs/en/permissions#bash-rule-limits>), with or without Code Mode. For limits that don’t depend on command text, see [sandboxing](</docs/en/sandboxing>).
+
+### Long-running code
+
+While code runs a long build or test, Claude either waits for it or lets it continue in the background:
+
+ * **Waiting** : Claude answers after the code finishes, and the code stops after ten minutes, including time you spend at permission prompts
+ * **Background** : you can keep talking to Claude, and the code can run for up to two hours
+
+For background code, start your session in auto or `bypassPermissions` mode. If Claude still waits, check your current mode and how you started the session:
+
+ * **You switched to another mode** : press `Shift+Tab` until you’re back in the mode you started in
+ * **You started in another mode, or picked the session from the`claude --resume` list**: if [auto mode is available](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) to you, exit, then run `claude --continue --permission-mode auto` with Code Mode on
+ * **You passed tool names to`--tools`**: start again in auto mode without that flag
+
+## Troubleshooting
+
+### Code Mode doesn’t start
+
+`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.
+
+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 connection and start again. If the reason stays, try again another day
+`it only works with the Anthropic API`| Remove the 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 with `--model opus`. Haiku 5.5 and Fable 5.2 also work
+`it doesn't work in background jobs`| Start in the foreground, without `--remote-control`
+`it needs settings that Claude Code downloads from Anthropic`| Unset the variable that [turns off feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as `DISABLE_TELEMETRY`
+`OpenTelemetry is on`| Unset `CLAUDE_CODE_ENABLE_TELEMETRY` and `ENABLE_BETA_TRACING_DETAILED` if you can work without [OpenTelemetry export](</docs/en/monitoring-usage>)
+`it doesn't yet work with an installed mod`| Turn off the [mod](</docs/en/plugins/mods/overview>) that checks tool calls
+`it can't be used together with agent teams yet`| Unset `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`
+`this launch's tool options`| Start without `--restricted`, add `REPL` to `--tools`, and remove `REPL` from `--disallowedTools` and your `deny` rules
+`couldn't save your answer`| Make `~/.claude.json` writable
+`your organization's settings don't allow it`| Ask your administrator about the managed setting
+
+If you see no line about Code Mode, run `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.
+
+### Permission prompt with a countdown
+
+When 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:
+
+ Claude Code will automatically block this request in 1:59, to avoid holding up an unattended session
+
+Answer before the countdown ends. Otherwise that call is refused, and later calls that would show a countdown are refused without a prompt. To see the prompts again, send Claude a message.
+
+### Tool call refused by a hook
+
+If 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 [`onFailure`](</docs/en/hooks#block-the-action-when-a-hook-fails>) is unset:
+
+ * **`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
+ * **`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`](</docs/en/hooks#common-fields>)
+
+To let calls go ahead when a `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"`.
+
+### Code output withheld by a hook
+
+If Claude reports a hook’s block reason where you expected output from Claude’s code, check your [`UserPromptSubmit`](</docs/en/hooks#userpromptsubmit>) hooks. When code can run in the background, `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`.
+
+## Related resources
+
+ * [Permission modes](</docs/en/permission-modes>): compare auto mode with the modes that prompt you
+ * [Hooks reference](</docs/en/hooks>): write `PreToolUse` and `UserPromptSubmit` hooks
+ * [Managed settings](</docs/en/managed-settings>): apply one configuration across an organization
--- a/commands.md
+++ b/commands.md
@@ -39,7 +39,7 @@
`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [--max-findings n|all|default] [pr#|branch|path]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff, or a PR number, branch, or path you pass, for correctness bugs. Depending on your model and effort level, the review also covers cleanup opportunities. Pass `--fix` to have Claude apply the findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). Posting to a GitLab merge request requires Claude Code v2.1.257 or later. With `ultra` on a `github.com` PR target, pass `--post` to preselect [posting the finished findings to the PR](</docs/en/ultrareview#post-findings-to-the-pull-request>) in the launch dialog; `--post` requires Claude Code v2.1.227 or later. See [Review locally with `/code-review`](</docs/en/code-review-local>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review`
`/color [color|default]`| Set the prompt bar color for the current session. Available colors: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan`. Use `default` to reset, or run with no argument to pick a random color. When [Remote Control](</docs/en/remote-control>) is connected, the color syncs to claude.ai/code. Also available in non-interactive mode (`-p`)
`/compact [instructions]`| Free up context by summarizing the conversation so far. Optionally pass focus instructions for the summary. See [how compaction handles rules, skills, and memory files](</docs/en/context-window#what-survives-compaction>)
-`/config [key=value ...]`| Open the [Settings](</docs/en/settings>) interface to adjust theme, model, [output style](</docs/en/output-styles>), and other preferences. Pass one or more `key=value` pairs to set a setting directly without opening the interface, for example `/config thinking=false`, `/config theme=dark`, or `/config model=sonnet`. The `key=value` form also works in non-interactive mode (`-p`) and from the Claude mobile app via [Remote Control](</docs/en/remote-control>). The `key=value` form can’t turn on a setting that needs your confirmation in the panel, such as [`autoContinueAtUsageLimit`](</docs/en/interactive-mode#turn-automatic-continue-off>), though it can turn one off. Run `/config --help` to list the keys it accepts. Alias: `/settings`
+`/config [key=value ...]`| Open the [Settings](</docs/en/settings>) interface to adjust preferences. Pass `key=value` pairs to set a setting directly, for example `/config verbose=true`, `/config theme=dark`, or `/config model=sonnet`. That form also works in non-interactive mode (`-p`) and from the Claude mobile app via [Remote Control](</docs/en/remote-control>). It can’t turn on a setting that needs your confirmation in the panel, such as [`autoContinueAtUsageLimit`](</docs/en/interactive-mode#turn-automatic-continue-off>). Run `/config --help` to list the keys it accepts. Alias: `/settings`
`/context [all]`| Visualize current context usage as a colored grid. Shows optimization suggestions for context-heavy tools, memory bloat, and capacity warnings. When the conversation exceeds the context window, the output includes a [warning](</docs/en/errors#context-exceeds-the-token-limit>) showing how far over the limit you are and which command frees space. In [fullscreen mode](</docs/en/fullscreen>), `/context` collapses the per-item breakdown to keep the grid visible. Pass `all` to expand it
`/copy [N]`| Copy the last assistant response to clipboard. Pass a number `N` to copy the Nth-latest response: `/copy 2` copies the second-to-last. When code blocks or blockquotes are present, shows an interactive picker to select individual blocks or the full response. Press `w` in the picker to write the selection to a file instead of the clipboard, which is useful over SSH
`/cost`| Alias for `/usage`
@@ -82,7 +82,7 @@
`/model [model]`| Switch the AI model and save it as your default for new sessions. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `s` on a row to switch for the current session only. See [when the new model starts](</docs/en/interactive-mode#when-claude-code-sends-what-you-queued>). Before v2.1.242, it could wait. With `-p`, pass a model argument, which isn’t saved as your default; requires v2.1.205 or later
`/output-style [style]`| List [output styles](</docs/en/output-styles>) or switch to one, for example `/output-style concise`. See [Change your output style](</docs/en/output-styles#change-your-output-style>). Requires Claude Code v2.1.269 or later
`/passes`| Share a free week of Claude Code with friends. Only visible if your account is eligible
-`/permissions`| Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review [recent auto mode denials](</docs/en/auto-mode-config#review-denials>). You can also view and edit [auto mode classifier rules](</docs/en/auto-mode-config#edit-rules-from-permissions>) from the dialog’s **Auto mode** tab. Alias: `/allowed-tools`
+`/permissions`| Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review [recent auto mode denials](</docs/en/auto-mode-config#review-denials>). You can also view and edit [auto mode classifier rules](</docs/en/auto-mode-config#edit-rules-from-permissions>) from the dialog’s **Auto mode** tab. In the desktop app, edit your [settings files](</docs/en/auto-mode-config#where-the-classifier-reads-configuration>) instead. Alias: `/allowed-tools`
`/plan [description]`| Enter plan mode directly from the prompt. Pass an optional description to enter plan mode and immediately start with that task, for example `/plan fix the auth bug`
`/plugin [subcommand]`| Manage Claude Code [plugins](</docs/en/plugins/overview>). Run with no argument to open the plugin menu, or pass a subcommand such as `list`, `install`, `enable`, or `disable` to act directly. Claude Code can activate a plugin during the install; the [install summary](</docs/en/plugins/install#install-a-plugin>) tells you whether it did or whether to run `/reload-plugins`
`/plugin-authoring`| Load the reference Claude works from to [write a mod](</docs/en/plugins/mods/create#ask-claude-for-a-mod>). Claude can load it on its own when you ask for a mod. This is a skill from a [built-in plugin](</docs/en/plugins/mods/overview#mods-built-into-claude-code>), which you can turn off in `/plugin`. Requires Claude Code v2.1.287 or later
@@ -117,7 +117,7 @@
`/stats`| Alias for `/usage`. Opens on the Stats tab
`/status`| Open the Settings interface on the Status tab, showing version, model, account, and connectivity. A `Session kind` row reads `background job · attached` or `background job · unattended` in a [background session](</docs/en/agent-view>), depending on whether a terminal is attached, and `interactive` in any other session. Before v2.1.221, `/status` didn’t show this row. Works while Claude is responding
`/statusline`| Configure Claude Code’s [status line](</docs/en/statusline>). Describe what you want, or run without arguments to auto-configure from your shell prompt
-`/stickers`| Order Claude Code stickers
+`/stickers`| Check Claude Code sticker availability
`/stop`| Stop the [background session](</docs/en/agent-view>) you’re attached to, or the one you send it to as a [peek reply](</docs/en/agent-view#peek-and-reply>); the transcript and any worktree are kept. To detach without stopping, use `/exit` or press `←`
`/subtask <task>`| Spawn a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>): a background subagent that inherits the full conversation and works on the task while you keep working. Its result returns to this conversation when it finishes. To copy the conversation into a separate background session instead, use `/fork`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` spawns the forked subagent instead
`/tasks`| View and manage background work in the current session, including subagents that have finished. Also available as `/bashes`
@@ -129,9 +129,9 @@
`/ultraplan <prompt>`| Removed. Use [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) instead. Previously sent a planning task to a [cloud session](</docs/en/claude-code-on-the-web>) for review in your browser
`/ultrareview [PR or branch]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). Pass a PR reference to review that pull request, or a base branch or commit to change the comparison base. The preferred invocation is `/code-review ultra`, and `/ultrareview` is an alias. Includes 3 free runs on Pro, Max, and Ultra, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>)
`/update-config [request]`| **[Skill](</docs/en/skills#bundled-skills>).** Describe a settings change, such as allowing a command, setting an environment variable, or adding a [hook](</docs/en/hooks>), and Claude edits the matching [`settings.json`](</docs/en/settings>) file. For options such as theme and model, use `/config` instead
-`/upgrade`| Open the upgrade page in your browser to switch to a higher plan tier. When the browser fails to open, the command shows a sign-in prompt without printing the URL
+`/upgrade`| Open the upgrade page in your browser to switch to a higher plan tier. When no browser can open the page, for example over SSH, the command prints the page’s URL above its sign-in prompt. Printing the URL requires Claude Code v2.1.323 or later
`/usage`| Show session cost, plan usage limits, and activity stats. On a Pro, Max, Ultra, Team, or Enterprise plan, includes a [breakdown of what counts against your plan limits](</docs/en/costs#plan-usage-breakdown>). Behind a Claude apps gateway that tracks spend, shows [your spend through the gateway](</docs/en/claude-apps-gateway-spend-limits#usage-warnings-in-claude-code>). `/cost` and `/stats` are aliases
-`/usage-credits`| Configure usage credits, or request them from your admin, when you hit a limit. Opens your [usage-credits billing settings](</docs/en/costs#add-usage-credits-to-your-subscription>) in the browser, except that Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI, after confirming in a dialog that the request notifies their admins. When no browser can open the billing page, for example over SSH, the command prints the URL to visit instead; this requires Claude Code v2.1.205 or later, and earlier versions showed nothing in that case. Previously `/extra-usage`
+`/usage-credits`| Configure usage credits, or request them from your admin, when you hit a limit. Opens your [usage-credits billing settings](</docs/en/costs#add-usage-credits-to-your-subscription>) in the browser. Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI. At a terminal where no browser can open the page, for example over SSH, the command prints the URL. Printing it requires Claude Code v2.1.205 or later. Previously `/extra-usage`
`/verify`| **[Skill](</docs/en/skills#bundled-skills>).** Confirm a code change does what it should by building your project’s app, running it, and observing the result, rather than relying on tests or type checks. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>)
`/vim`| Removed in v2.1.92. To toggle between Vim and Normal editing modes, use `/config` → Editor mode
`/voice [hold|tap|off]`| Toggle [voice dictation](</docs/en/voice-dictation>), or enable it in a specific mode. Requires a Claude.ai account
--- a/custom-tools.md
+++ b/custom-tools.md
@@ -362,7 +362,7 @@
### Require approval for specific tools
-Set a tool’s `permission_policy` to `always_ask`, and `allowedTools` stops approving that tool’s calls, so they can reach your [`canUseTool`](</docs/en/agent-sdk/user-input>) callback even though the tool is listed. Set `always_deny` instead, and [a call to the tool is denied](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>), but a [mod](</docs/en/plugins/mods/overview>) in a plugin you load [can still approve it](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). The field is TypeScript-only and requires Agent SDK v0.3.301 or later. Put the policy entry in a `tools` array on the config object `createSdkMcpServer()` returns, not in the `tools` option you pass into that function. This example spreads `weatherServer` from the weather tool example and adds a `tools` array giving `get_temperature` the `always_ask` policy:
+Set a tool’s `permission_policy` to `always_ask`, and `allowedTools` stops approving that tool’s calls, so they can reach your [`canUseTool`](</docs/en/agent-sdk/user-input>) callback even though the tool is listed. Set `always_deny` instead to [block the tool](</docs/en/agent-sdk/typescript#permission-policy-values>). The field is TypeScript-only and requires Agent SDK v0.3.301 or later. Put the policy entry in a `tools` array on the config object `createSdkMcpServer()` returns, not in the `tools` option you pass into that function. This example spreads `weatherServer` from the weather tool example and adds a `tools` array giving `get_temperature` the `always_ask` policy:
TypeScript
--- a/desktop.md
+++ b/desktop.md
@@ -204,7 +204,7 @@
### Minimize a pane
-To keep the Terminal, Browser, [iOS Simulator](</docs/en/desktop-ios-simulator>), or a side chat in view at a small size, click **Minimize** in the pane’s header. The button requires Claude Desktop v4.0.0 or later and a Claude account rather than a [third-party provider](</docs/en/third-party-integrations>). The Browser pane has it only in local sessions. The minimized pane sits in the session details panel while that panel is on screen, and floats in a corner of the chat otherwise:
+To keep the Terminal, Browser, [iOS Simulator](</docs/en/desktop-ios-simulator>), or a side chat in view at a small size, click **Minimize** in the pane’s header. The button requires Claude Desktop v4.0.0 or later. With a [third-party provider](</docs/en/third-party-integrations>) it requires v5.11492.0 or later, so check your version. The Browser pane has the button only in local sessions. The minimized pane sits in the session details panel while that panel is on screen, and floats in a corner of the chat otherwise:
* **In the panel** : the minimized pane sits below the panel’s cards, where you can’t move or resize it. To float it over the chat instead, hide the panel.
* **In a corner of the chat** : hover over the minimized pane to show its header. Drag the header to move it to another corner. To resize it, drag the corner of the minimized pane nearest the center of the chat.
@@ -1871,10 +1871,11 @@
Check the `forceLoginOrgUUID` value before you deploy it. If the ID isn’t your organization’s, people in your organization can’t use Claude Desktop unless they also belong to an organization with that ID. To recover, deploy the correct ID and have them restart Claude Desktop.
-If you set `forceLoginMethod` and `forceLoginOrgUUID` in Claude Code’s [managed settings](</docs/en/managed-settings>), you don’t change the Claude Desktop sign-in screen. A person can still use Claude Desktop with their own Claude API key or [Claude Console account](<https://claude.com/docs/third-party/claude-desktop/claude-api#which-devices-offer-the-claude-api-account-sign-in>), and run Code tab sessions that way. To stop that, also deploy `forceLoginOrgUUID` in the Claude Desktop policy (in `HKLM` on Windows), with your claude.ai organization ID. Unless the policy itself [selects the Claude API](<https://claude.com/docs/third-party/claude-desktop/claude-api#choose-an-authentication-approach>), Claude Desktop stops using a person’s own API key or Console account at the app’s next launch. Check two cases before you deploy it:
+If you set `forceLoginMethod` and `forceLoginOrgUUID` in Claude Code’s [managed settings](</docs/en/managed-settings>), you don’t change the Claude Desktop sign-in screen. A person can still use Claude Desktop with their own Claude API key or [Claude Console account](<https://claude.com/docs/third-party/claude-desktop/claude-api#which-devices-offer-the-claude-api-account-sign-in>), and run Code tab sessions that way. To stop that, also deploy `forceLoginOrgUUID` in the Claude Desktop policy (in `HKLM` on Windows), with your claude.ai organization ID. Unless the policy itself [selects the Claude API](<https://claude.com/docs/third-party/claude-desktop/claude-api#choose-an-authentication-approach>), Claude Desktop stops using a person’s own API key or Console account at the app’s next launch. Check three cases before you deploy it:
* **Claude Console organizations** : don’t deploy `forceLoginOrgUUID` on its own with a Claude Console organization’s ID, or you’d lock your people out of Claude Desktop. See [Which devices offer the Claude API account sign-in](<https://claude.com/docs/third-party/claude-desktop/claude-api#which-devices-offer-the-claude-api-account-sign-in>) instead.
* **Enterprise Admin Console** : if it delivers your computers’ Claude Desktop configuration, update them to Claude Desktop v2.37337.0 or later first, because earlier versions ignore it once this key is set. See [Keep a device on its managed profile](<https://claude.com/docs/third-party/claude-desktop/admin-console#keep-a-device-on-its-managed-profile>).
+ * **Third-party providers** : if people set up their own [third-party inference configuration](<https://claude.com/docs/third-party/claude-desktop/in-app-configuration>) in the app, Claude Desktop ignores that configuration from the next launch after you deploy this key. To keep people on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an LLM gateway, [deploy a configuration](<https://claude.com/docs/third-party/claude-desktop/configuration>) to their computers in the same Claude Desktop policy.
### Network access requirements
@@ -1975,7 +1976,7 @@
#### MCP servers from the Claude Desktop chat app
-The Desktop app loads MCP servers from `claude_desktop_config.json` into local Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. A server you define in `claude_desktop_config.json` is available in both the Desktop chat surface and local Code tab sessions. If you define the same server name in `claude_desktop_config.json` and in `~/.claude.json` or `.mcp.json`, the Code tab in local sessions connects once and uses the `claude_desktop_config.json` definition. The app also re-delivers stdio servers from `~/.claude.json` to the embedded CLI in local sessions. When the top level of `~/.claude.json` (user scope) and `.mcp.json` define the same stdio server name, the Code tab uses the `~/.claude.json` definition, departing from the CLI [scope hierarchy](</docs/en/mcp#scope-hierarchy-and-precedence>).
+The Desktop app loads MCP servers from `claude_desktop_config.json` into local Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. A server you define in `claude_desktop_config.json` is available in both the Desktop chat surface and local Code tab sessions.
The standalone CLI does not read `claude_desktop_config.json`. On macOS and WSL, run `claude mcp add-from-claude-desktop` to copy those servers into `~/.claude.json`. See [Import MCP servers from Claude Desktop](</docs/en/mcp#import-mcp-servers-from-claude-desktop>) for the import flow and scope options.
--- a/desktop-scheduled-tasks.md
+++ b/desktop-scheduled-tasks.md
@@ -164,7 +164,11 @@
* **Review allowed permissions** : see and revoke saved tool approvals for this task from the **Always allowed** panel
* **Delete** : remove the task. The sessions the task created are [archived](</docs/en/desktop#organize-and-find-sessions>), not deleted. The folder holding the task’s `SKILL.md` file stays on disk at `~/.claude/scheduled-tasks/<task-name>/`, or at `scheduled-tasks/<task-name>/` under [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) if you set that variable. To remove that folder, delete it yourself.
-You can also list, create, edit, and pause tasks by asking Claude in any Desktop session. For example, “pause my dependency-audit task” or “show me my scheduled tasks.” To delete a task, use the **Delete** button on its detail page. To let a task change its own schedule or prompt with the `update_scheduled_task` MCP tool, click **Run now** and approve the call each time. To edit a task’s prompt on disk, open `~/.claude/scheduled-tasks/<task-name>/SKILL.md` (or under [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) if set). The file uses YAML frontmatter for `name` and `description`, with the prompt as the body. Changes take effect on the next run. Schedule, folder, and enabled state are not in this file: change them through the Edit form or ask Claude.
+You can also manage tasks by asking Claude, letting a task update itself, or editing a task’s prompt on disk:
+
+ * **Ask Claude** : list, create, edit, and pause tasks by asking Claude in any Desktop session. For example, “pause my dependency-audit task” or “show me my scheduled tasks.” To delete a task, use the **Delete** button on its detail page.
+ * **Let a task update itself** : for a task to change its own schedule or prompt with the `update_scheduled_task` MCP tool, click **Run now** and approve the call each time
+ * **Edit the prompt on disk** : open `~/.claude/scheduled-tasks/<task-name>/SKILL.md`, or `scheduled-tasks/<task-name>/SKILL.md` under [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) if you set that variable. The file uses YAML frontmatter for `name` and `description`, with the prompt as the body. Changes take effect on the next run. Schedule, folder, and enabled state are not in this file: change them through the Edit form or ask Claude.
## Related resources
Show diff (107 lines)
--- a/env-vars.md
+++ b/env-vars.md
@@ -130,6 +130,10 @@
`ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later
`ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>))
`ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Claude Code [refuses a URL or host name](</docs/en/errors#anthropic-foundry-resource-must-be-a-foundry-resource-name>). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>))
+`ANTHROPIC_GOOGLE_CLOUD_BASE_URL`| Override the [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) endpoint URL, for example when routing through an [LLM gateway](</docs/en/llm-gateway>)
+`ANTHROPIC_GOOGLE_CLOUD_LOCATION`| Google Cloud location that Claude Code puts in the [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) request URL. Defaults to `global`
+`ANTHROPIC_GOOGLE_CLOUD_PROJECT`| Google Cloud project ID for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>)
+`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID`| Workspace ID for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>). Required, unless you’re on v2.1.307 or later and `ANTHROPIC_GOOGLE_CLOUD_BASE_URL` is set
`ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>))
`ANTHROPIC_ORGANIZATION_ID`| Organization ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_FEDERATION_RULE_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>)
`ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>) or by [signing in to a Console account without an API key](</docs/en/authentication#sign-in-without-an-api-key>). See [authentication precedence](</docs/en/authentication#authentication-precedence>)
@@ -173,6 +177,7 @@
`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting
`CLAUDE_CODE_AUTO_MODE_MODEL`| Sets the model for the classifier requests Claude Code sends in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Use a full model ID such as `claude-sonnet-4-6`. For the cases where Claude Code ignores it, see [Choose the classifier model](</docs/en/permission-modes#choose-the-classifier-model>). Requires Claude Code v2.1.302 or later
`CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later
+`CLAUDE_CODE_AUTOMOUNT_ROOTS`| Automount root folders for Claude Code to skip when it looks in the folders above your working directory for files such as `CLAUDE.md`, skills, and `.mcp.json`. Set it when those lookups wait on your automounter. Separate multiple paths with `:` on Unix or `;` on Windows, and give each as an absolute path with no symlink in it. Requires Claude Code v2.1.323 or later
`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies on Amazon Bedrock, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later
`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later
`CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status
@@ -216,7 +221,7 @@
`CLAUDE_CODE_DISABLE_FILE_MENTIONS`| Set to `1` to stop Claude Code from expanding [`@` mentions](</docs/en/common-workflows#reference-files-and-directories>) of files and directories. Claude instead gets the mentioned paths with a note to read them using its file tools. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.299 or later
`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set
`CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later
-`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry
+`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. The remap doesn’t run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry
`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later
`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later
`CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later
@@ -236,6 +241,7 @@
`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>)
`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there
`CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so that [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` in a folder you haven’t trusted when it can’t ask you to trust it, such as in CI. Set it in the environment that launches Claude Code, not a settings `env` block, and only where every such run starts in a folder you trust. Runs that can ask still ask. Requires Claude Code v2.1.309 or later
+`CLAUDE_CODE_DISABLE_ULTRATHINK`| Set to `1` to turn the [`ultrathink`](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>) keyword off. Requires Claude Code v2.1.316 or later
`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later
`CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear
`CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later
@@ -260,6 +266,7 @@
`CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS`| Set to `1` to [run dangerous `rm` commands with no prompt](</docs/en/permission-modes#turn-off-the-critical-path-removal-prompt-in-bypasspermissions-mode>) in `bypassPermissions` mode, which removes a safety prompt for destructive deletes. The linked section lists where it has no effect. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.311 or later
`CLAUDE_CODE_EXIT_AFTER_STOP_DELAY`| Time in milliseconds to wait after the query loop becomes idle before automatically exiting. Useful for automated workflows and scripts using SDK mode
`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default
+`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`| Set to `1` to start sessions in [Code Mode](</docs/en/code-mode>), an experimental feature. Set to `0` to keep it off, or in managed settings to [block it for an organization](</docs/en/code-mode#block-code-mode-for-your-organization>). The variable [doesn’t count in every settings file](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See the [version and account requirements](</docs/en/code-mode#requirements>)
`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of model request bodies except on some requests outside the conversation, such as `/model` checks. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited
`CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room
`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed
@@ -310,13 +317,13 @@
`CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>)
`CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>)
`CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>)
-`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds, in place of the default 500, of the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later
-`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds, in place of the default 32000, on the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it so that later retries keep spreading apart when the API is at capacity. Give whole milliseconds from 32000 to 64000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later
+`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 500). Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.292 or later
+`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 32000). Raise it so that later retries keep spreading apart. Give whole milliseconds from 32000 to 300000 in plain digits; Claude Code treats any other value as unset. Values above 64000 require v2.1.323 or later. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.296 or later
`CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>)
`CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking
`CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins`
`CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>)
-`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether Claude Code reloads a [mod](</docs/en/plugins/mods/overview>) when the mod’s files change. Reloading applies to a mod you load from a directory with `--plugin-dir`, and it’s on by default in interactive sessions. Set to `1` to turn it on in non-interactive sessions as well, or `0` to turn it off in every session. Requires Claude Code v2.1.287 or later. See [mod settings and environment variables](</docs/en/plugins/mods/reference#settings-and-environment-variables>)
+`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its files change. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later
`CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>)
`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>)
`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com`
@@ -332,6 +339,7 @@
`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session
`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>)
`CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later
+`CLAUDE_CODE_RESUME_HINT_COMMAND`| In a wrapper script that starts Claude Code, set this to the name you type to run the wrapper, such as `mytool`. A local session then prints `mytool --resume <session-id>` at exit in place of `claude --resume <session-id>`. Claude Code ignores a name that doesn’t match `^\w[\w-]*$`. It also ignores the variable in a settings file’s `env` block. Requires Claude Code v2.1.323 or later
`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>)
`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` sets no bound, except that some turns resume only within six hours of their last message, such as one that ended with an API error. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later
`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default
@@ -350,6 +358,7 @@
`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>)
`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Choose between Claude Code’s full system prompt and a shorter one with abbreviated tool descriptions. When unset, Haiku 4.5, Sonnet 5, Opus 4.7, and earlier models in those families use the full prompt by default, and newer models use the shorter one. Set to `1` to use the shorter prompt on any model. Set to `0`, `false`, `no`, or `off` to use the full prompt on any model, even where an experiment or server configuration would otherwise select the shorter one. Either prompt keeps the full tool set, hooks, MCP servers, and CLAUDE.md discovery
`CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves
+`CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH`| Skip Google Cloud authentication for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>), for gateways that attach the credentials themselves
`CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later
`CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway)
`CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to treat a failed [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) availability check as available, for networks that block the check’s direct request to `api.anthropic.com`. Claude Code still honors a “disabled by your organization” response
@@ -367,7 +376,7 @@
`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from the environments of the subprocesses Claude Code starts, such as Bash commands, hooks, and stdio MCP servers. The scrub recognizes a credential by its variable name or its value, and it leaves GitHub tokens and proxy settings in place. See What the subprocess environment scrub removes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured
`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait
`CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete
-`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [sync these skills](</docs/en/skills#where-synced-skills-load>) without this variable, so set it only when a `-p` run needs your current skills on its first query
+`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to make Claude Code download the skills enabled for your claude.ai account. In non-interactive mode with the `-p` flag, Claude Code also waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of skills before it runs the first query. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [sync these skills](</docs/en/skills#where-synced-skills-load>) without this variable. In an interactive session, the variable requires v2.1.323 or later
`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for the skills resync that runs mid-session when an app built on the [Agent SDK](</docs/en/agent-sdk/typescript#query-object>) reloads skills (default: 30000). When exceeded, the reload continues with whichever skills have arrived, and the remaining downloads finish in the background
`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill
`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting
@@ -379,6 +388,7 @@
`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later
`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>)
`CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
+`CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`| Use [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>)
`CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>)
`CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>)
`CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>)
@@ -533,8 +543,9 @@
* Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans
* Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions
* Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>)
- * Use [the advisor tool](</docs/en/advisor#requirements>), except on Claude Platform on AWS with Claude Code v2.1.300 or later
+ * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>)
* Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>)
+ * Turn on [Code Mode](</docs/en/code-mode#requirements>)
* Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>)
* Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>)
* Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on
Show diff (180 lines)
--- a/errors.md
+++ b/errors.md
@@ -77,6 +77,7 @@
`Session failed: working folder not found:`| [Troubleshoot Remote Control](</docs/en/remote-control#working-folder-not-found>)
`The program file this Remote Control started from is gone`| [Troubleshoot Remote Control](</docs/en/remote-control#program-file-is-gone>)
`Session failed: spawn error:` followed by an `ENOENT` message| [Troubleshoot Remote Control](</docs/en/remote-control#program-file-is-gone>)
+`Remote Control disconnected:` followed by a reason that mentions a `share link`| [Remote Control](</docs/en/remote-control#what-connected-devices-see>)
`OAuth token revoked` / `OAuth token has expired`| Authentication
`Failed to authenticate: OAuth token revoked`| Authentication
`Your account does not have access to Claude. Please login again or contact your administrator.`| Authentication
@@ -142,6 +143,7 @@
`403` with `GitHub GraphQL is not available from Claude Code sessions` in a cloud session| [GitHub proxy](</docs/en/cloud-environments#github-proxy>)
`The cloud environments service returned an empty response` / `The cloud environments service returned a response in an unexpected format`| Network
`Failed to fetch session from Sessions API: Failed to fetch session logs`| Network
+`Couldn't load the history of cloud session`| Network
`Couldn't reconnect to your Remote Control session`| Network
`N sessions ended while this machine was offline — the environment was cleaned up on the server and can't be resumed.`| Network
`Couldn't share the transcript.`| Network
@@ -169,6 +171,7 @@
`PDF too large` / `PDF is password protected` / `pdftoppm is not installed`| Request errors
`Extra inputs are not permitted`| Request errors
`API Error: 400 ... tools.N.custom.input_schema: JSON schema is invalid` / `Property keys should match pattern`| Request errors
+`N tools left out` beside a server in `/mcp` / `Claude wasn't given N tools because the Anthropic API would reject their input schemas`| [Tools with invalid input schemas](</docs/en/mcp#tools-with-invalid-input-schemas>)
`Tool "mcp__<server>__<tool>" is not sent to Claude: its name has <N> characters and the API accepts at most 128`| Request errors
`tools.N.custom.name: String should have at most 128 characters`| Request errors
`tool_use.name: String should have at most 200 characters`| Request errors
@@ -259,6 +262,7 @@
`No available ports for OAuth redirect`| Command-line errors
`Shell command failed for pattern "..."`, from `/security-review` or any skill that injects dynamic context| Command-line errors
`Shell command permission check failed for pattern "..."`, from a skill that injects dynamic context| Command-line errors
+`Couldn't run `<command>` for <name>. A file named HEAD or .git in this folder or one above it may not be yours`, from a skill that injects dynamic context| [Permission checks on injected commands](</docs/en/skills#permission-checks-on-injected-commands>)
`Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found`| Command-line errors
`No shell command in <name> was run, because the <tool> tool does not accept one of them`| Command-line errors
`Input must be provided either through stdin or as a prompt argument when using --print`| Command-line errors
@@ -328,6 +332,8 @@
`Plugin "<plugin>" was not uninstalled: installed_plugins.json`| [Plugin troubleshooting](</docs/en/plugins/troubleshooting#installed-plugins-json-holds-a-record-this-version-cannot-read>)
`Plugin directory does not exist: <path>`| [Plugin troubleshooting](</docs/en/plugins/troubleshooting#plugin-directory-does-not-exist>)
`Skipping connection (recent failure cached; retries automatically in 15 min, or edit the plugin config to retry now)`| Plugin errors
+`is not added on this machine, so your organization's marketplace policy keeps its plugins off`| [Add a marketplace](</docs/en/plugins/install#add-a-marketplace>)
+`A mod's http.fetch hook stopped this request`| [Turn mods on or off](</docs/en/plugins/mods/overview#turn-mods-on-or-off>)
`Error: No such tool available: <tool name>`| Tool errors
`MCP server "<name>" connection closed before the tool call was answered`| Tool errors
`MCP server "<name>" is disabled — re-enable it via /mcp to use its tools`| Tool errors
@@ -416,6 +422,8 @@
`Workspace not trusted.` when starting or restarting a background session| Background session errors
`Claude Code is being updated by npm on this machine (still not runnable after 2 min, ...)`| Background session errors
`Claude Code process exited with code N`| Wrapper and IDE errors
+`Subprocess initialization did not complete within 60000ms`| Wrapper and IDE errors
+`Claude Code did not finish starting`| Wrapper and IDE errors
`The connection to Claude Code ended before this message completed`| Wrapper and IDE errors
`Could not locate the Claude CLI on PATH`| Wrapper and IDE errors
`The Claude Code program for this computer, the <build> build, could not be found`| Wrapper and IDE errors
@@ -545,7 +553,7 @@
`CLAUDE_CODE_RETRY_WATCHDOG_MAX_USAGE_LIMIT_WAIT_MS`| no cap| With `CLAUDE_CODE_RETRY_WATCHDOG` set, the longest time in milliseconds one request waits for your plan’s usage limit, such as the session or weekly limit, to reset. When the reset is further away than this cap, the request fails at once, unless usage credits have room or the API couldn’t check them. In those cases it’s retried, and fails if the cap passes before it succeeds. Requires Claude Code v2.1.301 or later.
[`CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`](</docs/en/env-vars>)| unset| Minimum interval in milliseconds between checks of whether a usage limit was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give plain digits from `60000` to `10800000`. When unset or outside that range, no checks are made. For when Claude Code skips these checks, see the [environment variables reference](</docs/en/env-vars>). Requires Claude Code v2.1.305 or later.
[`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`](</docs/en/env-vars>)| 500| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 32000, to spread the retries over a longer window when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later.
-[`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`](</docs/en/env-vars>)| 32000| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 64000, so that later retries keep spreading apart when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later.
+[`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`](</docs/en/env-vars>)| 32000| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 300000, so that later retries keep spreading apart when the API is at capacity. Values above 64000 require v2.1.323 or later. Has no effect in the same cases as `CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`. Requires Claude Code v2.1.296 or later.
[`API_TIMEOUT_MS`](</docs/en/env-vars>)| 600000| Time in milliseconds that each request attempt has to receive its response headers. It doesn’t limit how long a streaming response runs after that. Raise it for slow networks or proxies. For how it caps the first-byte deadline, see No response from API.
[`CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`](</docs/en/env-vars>)| unset| Limit on re-sends of a non-streaming request that times out. At the limit, the request fails. A response from Claude that takes longer than the timeout to generate times out again on every re-send, so set a low number such as `0` to fail sooner. For each attempt’s timeout, see How long a non-streaming attempt waits. Requires Claude Code v2.1.285 or later.
[`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`](</docs/en/env-vars>)| unset| Deadline in milliseconds for the first response byte of a streaming request. Requires Claude Code v2.1.242 or later. For how Claude Code picks the deadline when this is unset, see No response from API.
@@ -857,7 +865,7 @@
### You’ve hit your monthly spend limit
-Your plan’s included usage can’t cover this request, and the [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) that would otherwise pay for it have reached a spend limit. That happens when one of your plan’s usage windows has run out, or when the request is one that only usage credits pay for, such as a request to a model that [bills to usage credits](</docs/en/model-config#fable-and-usage-credits>). The message names whose limit blocked you. The text after the `·` says how to get that limit increased, and varies with your plan and whether you manage billing:
+Your plan’s included usage can’t cover this request, and the [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) that would otherwise pay for it have reached a spend limit. Your plan can’t cover a request when one of its usage windows has run out, or when only usage credits pay for the request. One example is a request to a model that [bills to usage credits](</docs/en/model-config#fable-and-usage-credits>). The words before the `·` name the limit that blocked you, such as your org’s monthly spend limit, and the text after it says how to get that limit increased. In a cloud session or under [Remote Control](</docs/en/remote-control>), that text gives no URL, and a message about your own `monthly spend limit` doesn’t say how to raise it. Other sessions show forms like these:
You've hit your monthly spend limit · raise it at https://claude.ai/settings/usage?from=cc_cli_limit_message
You've hit your individual spend limit · ask your admin for a higher limit
@@ -1538,6 +1546,7 @@
**What to do:**
* If the hint says credentials are managed by this environment, the app that launched Claude Code owns the credential and the other steps here don’t apply: retry, or contact your administrator
+ * If you set `CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`, follow the steps for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed#google-cloud-credentials-expired-or-invalid>) instead
* If you authenticate with application default credentials, run the [`gcpAuthRefresh`](</docs/en/google-vertex-ai#advanced-credential-configuration>) command named in the message, or `gcloud auth application-default login`, and complete the sign-in, then retry
* If you route through an [LLM gateway](</docs/en/llm-gateway>) with `CLAUDE_CODE_SKIP_VERTEX_AUTH` set, refresh the gateway token in `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_CUSTOM_HEADERS`, then retry
* If you authenticate with a service account key file, confirm `GOOGLE_APPLICATION_CREDENTIALS` points at a valid key. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>)
@@ -1554,6 +1563,7 @@
**What to do:**
* If the hint says credentials are managed by this environment, the app that launched Claude Code owns the credential and the other steps here don’t apply: retry, or contact your administrator
+ * If you set `CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`, follow the steps for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed#google-cloud-authentication-failed>) instead
* Confirm the roles in [IAM configuration](</docs/en/google-vertex-ai#iam-configuration>) are granted to the identity you authenticate with
* Confirm the model is enabled for your project. See [Request model access](</docs/en/google-vertex-ai#2-request-model-access>)
@@ -1830,6 +1840,16 @@
* Run the same teleport again. If it fails the same way, report the problem
Before v2.1.296, Claude Code didn’t retry a failed read, and after one it could open the session with an empty conversation and report success instead of printing this message.
+
+### Couldn’t load the history of cloud session
+
+This message means Claude Code found the [cloud session you asked to pull into your terminal](</docs/en/claude-code-on-the-web#from-cloud-to-terminal>), but the request for its conversation history came back as not found:
+
+ Couldn't load the history of cloud session session_01HJKLMNOPQRSTUVWXYZ. Check it at https://claude.ai/code/session_01HJKLMNOPQRSTUVWXYZ?from=cli
+
+**What to do:**
+
+ * Open the link in the message to check the session in your browser. If it opens there and the same teleport fails this way again, report the problem.
### Couldn’t reconnect to your Remote Control session
@@ -3000,7 +3020,7 @@
Claude Code shows the same error for any skill that [injects dynamic context](</docs/en/skills#when-an-injected-command-fails>), and a failed injected command aborts that skill’s invocation. Sibling strings fire before the command runs at all:
- * `Shell command permission check failed for pattern "..."`: the command’s permission check didn’t allow it. [Permission checks on injected commands](</docs/en/skills#permission-checks-on-injected-commands>) covers which results abort in each permission mode and how to pre-approve a command with `allowed-tools`
+ * `Shell command permission check failed for pattern "..."`: the command’s permission check didn’t allow it. See [Permission checks on injected commands](</docs/en/skills#permission-checks-on-injected-commands>) for which results abort in each permission mode and when `allowed-tools` pre-approves a command
* `Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found`: the skill’s frontmatter demands bash on a machine without it. Install Git for Windows or change the frontmatter to `shell: powershell`. See [How injected commands run](</docs/en/skills#how-injected-commands-run>)
**What to do:**
@@ -4320,9 +4340,9 @@
You opened a [background session](</docs/en/agent-view>) that ended while the background service was off, and [transcript cleanup](</docs/en/settings-reference#cleanupperioddays>) has since removed its saved conversation, for example after the machine was off for weeks. Opening such a row normally [resumes its saved conversation](</docs/en/agent-view#sessions-show-as-failed-after-shutdown>). With nothing left to resume, Claude Code refuses rather than re-run the session’s original prompt without asking:
- This session's saved conversation is no longer on disk (it ended while the background service was off, and old transcripts are cleaned up), so there is nothing to resume. `claude rm 7c5dcf5d` deletes the row; `claude respawn 7c5dcf5d` runs its original prompt again instead.
-
-`claude attach <id>` prints this text. In agent view, the footer is shorter and ends with `ctrl+x deletes the row`. **What to do:**
+ This session's saved conversation is no longer on disk (it ended while the background service was off, and old transcripts are cleaned up), so there is nothing to resume. `claude rm 7c5dcf5d` removes the row; `claude respawn 7c5dcf5d` runs its original prompt again instead.
+
+`claude attach <id>` prints this text. In agent view, the footer is shorter and ends with `ctrl+x removes the row`. **What to do:**
* Run `claude rm <id>` to delete the row. When one of the [kept cases](</docs/en/agent-view#what-deleting-a-session-removes>) applies, `claude rm` keeps the row and the worktree instead and names the reason
* To run the session’s original prompt again as a fresh conversation, run `claude respawn <id>`
@@ -4331,19 +4351,19 @@
### Worktree has commits that are not pushed anywhere
-You tried to delete a [background session](</docs/en/agent-view#what-deleting-a-session-removes>) whose worktree holds commits Claude Code can’t confirm are saved elsewhere. Claude Code keeps the worktree and the session row rather than destroy the commits unseen. `claude rm` names the branch and the unpushed commits, and says how to proceed:
+You tried to delete a [background session](</docs/en/agent-view#what-deleting-a-session-removes>) whose worktree holds commits Claude Code can’t confirm are saved elsewhere. `claude rm` says how to proceed:
kept 7c5dcf5d — its worktree is still at “/home/you/project/.claude/worktrees/fix-login”
2 unpushed commits on “claude/fix-login”: a1b2c3d “Fix login flow” and 1 more. They exist on no remote, so deleting the worktree would lose them.
push them and run 'claude rm 7c5dcf5d' again, or discard the worktree and its commits: claude rm 7c5dcf5d --discard-unpushed a1b2c3d000000000000000000000000000000000@0123456789abcdef0123456789abcdef
-When Claude Code can’t summarize the commits, the detail line reads `The worktree has unpushed commits` instead. In [agent view](</docs/en/agent-view>), the session’s row shows `not deleted` with the same reason. Commits on a remote don’t block the delete. Neither do commits on the local copy of your `origin` remote’s default branch, as long as that branch is checked out in your main checkout, the repository directory itself rather than a worktree. **What to do:**
-
- * To keep the commits, push the worktree’s branch, or merge it into the default branch checked out in your main checkout, then delete the session again
- * To discard the commits, run the `claude rm <id> --discard-unpushed` command the message printed, or press `Ctrl+X` twice on the session’s row in agent view again. This removes the session and the worktree along with its branch, the unpushed commits, and any uncommitted changes. If the delete is refused again, follow the new message.
- * When the message says the worktree is also recorded by another finished session, deleting again doesn’t discard it: push the commits, then delete the session again
-
-Before v2.1.268, `claude rm` put the commit summary on the `kept` line itself. When `claude rm` couldn’t summarize the commits, the `kept` line read `worktree has commits that are not pushed anywhere` in place of the summary. Before v2.1.260, the message didn’t name the branch or commits, and there was no discard route. You can still delete the session, losing uncommitted changes but keeping the branch and commits. Run `git worktree remove --force --force <path>` with the path the refusal printed, then `claude rm <id>`. Git needs `--force` twice for a locked worktree. Before v2.1.248, the default branch checked out in your main checkout didn’t count: a branch you had already merged there still triggered this refusal until its commits reached a remote.
+When Claude Code can’t summarize the commits, the detail line reads `The worktree has unpushed commits` instead. In [agent view](</docs/en/agent-view>), the session’s row shows `not removed` with the same reason. **What to do:**
+
+ * To keep the commits, push them. Once the push puts them on a remote-tracking branch, such as `origin/claude/fix-login`, try deleting the session again.
+ * If the message offers to discard the commits, first make sure you don’t need the worktree, the commits or any uncommitted changes. Then take the step the message gives: press `Ctrl+X` twice on the session’s row in agent view, or run the `claude rm <id> --discard-unpushed <commit>@<worktree-id>` command that `claude rm` printed. If Claude Code refuses again, follow the new message.
+ * When the message says the worktree is also recorded by another finished session, deleting again doesn’t discard it: push the commits, then try deleting the session again
+
+Before v2.1.268, `claude rm` put the commit summary on the `kept` line itself. When `claude rm` couldn’t summarize the commits, the `kept` line read `worktree has commits that are not pushed anywhere` in place of the summary. Before v2.1.260, the message didn’t name the branch or commits, and there was no discard route. You can still delete the session, losing uncommitted changes but keeping the branch and commits. Run `git worktree remove --force --force <path>` with the path the refusal printed, then `claude rm <id>`. Git needs `--force` twice for a locked worktree.
### Terminal host process died
@@ -4523,6 +4543,26 @@
## Wrapper and IDE errors
These errors come from the program that launched Claude Code for you, such as an IDE extension or an [Agent SDK](</docs/en/agent-sdk/overview>) application, rather than from Claude Code itself.
+
+### Subprocess initialization did not complete within 60000ms
+
+This error means a Claude Code process that the [VS Code extension](</docs/en/vs-code>) or an Agent SDK application launched didn’t report in time that it was ready. The extension or application then stopped it. In a VS Code conversation the error starts with `Claude Code did not finish starting`, for example:
+
+ Claude Code did not finish starting: it did not answer in time. The output logs ("View output logs") show how far it got. Slow plugins, MCP servers, hooks, disks or network can each cause this.
+
+In the extension’s output logs, on its sign-in screen, and in an Agent SDK application, the error reads differently. It starts with `Subprocess initialization did not complete within` and the time limit, then gives what Claude Code reported, for example:
+
+ Subprocess initialization did not complete within 60000ms. Claude Code did not answer the initialize request and reported no SessionStart or Setup hook running. Slow plugins, MCP servers, hooks that Claude Code does not report, disks or network can each cause this.
+
+**What to do:**
+
+ * To try again in VS Code, send a message. If the error appeared while you were signing in, select the sign-in method again instead.
+ * To see how far Claude Code got, click **View output logs** under a conversation’s error, or run **Claude Code: Show Logs** from the Command Palette. Include the entries around the `Subprocess initialization` line when [reporting the problem](<https://github.com/anthropics/claude-code/issues>).
+ * To check your network, see [Network configuration](</docs/en/network-config>). If the message tells you to check your sign-in or authentication, see [Login and authentication](</docs/en/troubleshoot-install#login-and-authentication>).
+ * If the message says that [SessionStart](</docs/en/hooks#sessionstart>) or [Setup](</docs/en/hooks#setup>) hooks hadn’t finished, [check how long yours run](</docs/en/hooks#debug-hooks>). In VS Code, the first 10 minutes in which Claude Code reports these hooks running don’t count toward the 60-second limit. Make a slow hook finish sooner, lower a non-async hook’s [`timeout`](</docs/en/hooks#common-fields>), or [remove the hook](</docs/en/hooks#disable-or-remove-hooks>).
+ * If your Agent SDK application calls [`startup()`](</docs/en/agent-sdk/typescript#startup>), set `initializeTimeoutMs` long enough for the whole start, or leave it unset so up to 10 minutes of reported hook time doesn’t count.
+
+Before VS Code extension v2.1.304 and TypeScript Agent SDK v0.3.304, all hook time counted toward the limit. With the default limit, the message contained `Subprocess initialization did not complete within 60000ms — check authentication and network connectivity`. If you see that wording, update the extension or the SDK.
### Claude Code process exited with code N
--- a/events.md
+++ b/events.md
@@ -62,6 +62,12 @@
on('tool.call', { tool: /^mcp__github__/ }, hook)
`hook` runs once for a Bash, Edit, or Write call, and once for a call to a tool whose name starts with `mcp__github__`. A call to any other tool, such as Read, matches none of the three, so `hook` doesn’t run for it. The event name can be a wildcard. `'classic.*'` matches every settings hook event. `'*'` matches every event except the [telemetry events](</docs/en/plugins/mods/reference#telemetry>), which take their own name and a `{ to: 'collector' }` filter. Register each event once per matcher. If you call `on` twice for `session.start` with no matcher, the module fails to load with `on("session.start") is registered twice without a matcher`. Put everything your mod does at session start in one hook.
+
+#### Hook other mods’ drawings and controls
+
+To hook another mod’s controls, panes, or row above the prompt, pass a matcher with `plugin`. Use the mod’s name without its marketplace, as in `{ plugin: 'other-mod' }`, or `{ plugin: '*' }` for every mod. Without `plugin`, a hook on `ui.press`, `ui.input`, `ui.select`, or `ui.focus` doesn’t run for other mods’ controls, and a `ui.render` hook skips their panes and their rows above the prompt. A hook on a wildcard with no matcher, such as `on('*', hook)` or `on('ui.*', hook)`, still runs for every mod. A wildcard with a matcher needs `plugin` too.
+
+`{ plugin: '*' }` requires Claude Code v2.1.323 or later. Before v2.1.323, a hook with no `plugin` ran for every mod, and a hook with `{ plugin: '*' }` didn’t run. To match every mod on both versions, use `{ plugin: /./ }` on `ui.press`, `ui.input`, and `ui.select`. For `ui.focus` and `ui.render`, use `on('ui.*', hook)` and check the event’s name in `next.event`, as in `if (next.event !== 'ui.focus') return next(e)`.
## Hook what Claude is doing
Show diff (138 lines)
--- a/feature-availability.md
+++ b/feature-availability.md
@@ -8,7 +8,8 @@
* **Anthropic Console** : you authenticate with an Anthropic API key or by [signing in to a Console account without one](</docs/en/authentication#sign-in-without-an-api-key>)
* **Amazon Bedrock** : you use Claude models from the Amazon Bedrock model catalog and set `CLAUDE_CODE_USE_BEDROCK`. The [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) (`CLAUDE_CODE_USE_MANTLE`) is covered by this column
* **Claude Platform on AWS** : you bought Claude through AWS Marketplace but call the Anthropic API, and set `CLAUDE_CODE_USE_ANTHROPIC_AWS`
- * **Google Cloud’s Agent Platform** : Google-operated; you set `CLAUDE_CODE_USE_VERTEX`
+ * **Google Cloud (Anthropic managed)** : you use Claude Models on Google Cloud (Anthropic managed). You reach the Anthropic-operated Claude API through your Google Cloud project. To tell the two Google Cloud offerings apart, see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>)
+ * **Google Cloud (Google managed)** : Google-operated as part of Google Cloud’s Agent Platform, formerly Vertex AI; you set `CLAUDE_CODE_USE_VERTEX` and use Claude Models on Google Cloud (Google managed)
* **Microsoft Foundry** : Anthropic-operated; you set `CLAUDE_CODE_USE_FOUNDRY`
### Features available on every provider
@@ -24,10 +25,10 @@
These have provider-specific differences:
- * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method. [Tool search](</docs/en/mcp#configure-tool-search>) isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>). On Google Cloud’s Agent Platform, tool search isn’t supported on models earlier than Claude Opus 4.5, Claude Sonnet 4.5, and Claude Haiku 4.5
- * **Subagents** : when the main conversation runs Fable, the built-in [Explore subagent](</docs/en/sub-agents#built-in-subagents>) runs on Opus with a Claude subscription, an Anthropic Console account, or an [LLM gateway](</docs/en/llm-gateway>) reached through `ANTHROPIC_BASE_URL`. On other providers, including Claude Platform on AWS, it runs on Fable
+ * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method. [Tool search](</docs/en/mcp#configure-tool-search>) isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>). On Google Cloud (Google managed), tool search isn’t supported on models earlier than Claude Opus 4.5, Claude Sonnet 4.5, and Claude Haiku 4.5
+ * **Subagents** : when the parent conversation runs Fable, the built-in [Explore subagent](</docs/en/sub-agents#built-in-subagents>) runs on Opus with a Claude subscription, an Anthropic Console account, or an [LLM gateway](</docs/en/llm-gateway>) reached through `ANTHROPIC_BASE_URL`. On other providers, including Claude Platform on AWS, it runs on Fable
* **[Commands](</docs/en/commands#all-commands>)** :
- * `/design-sync` and `/import` with its `claude import` subcommand form are unavailable on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>)
+ * `/design-sync` and `/import` with its `claude import` subcommand form are unavailable on cloud providers and through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>)
* `/voice` requires a claude.ai account
* `/list-agents` and its alias `/peers` are available only in sessions where [cross-session messaging is enabled](</docs/en/cross-session-messaging#availability>)
@@ -51,47 +52,50 @@
### CLI capabilities that vary by provider
-These features work in the local CLI but depend on a server-side capability that not every provider exposes. Feature| Claude subscription| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform| Microsoft Foundry
----|---|---|---|---|---|---
-[Web search](</docs/en/tools-reference#websearch-tool-behavior>)| ✓| ✓| ✗| ✓| See note 1| ✓
-[Fast mode](</docs/en/fast-mode>)| ✓ ([Owner-enabled](</docs/en/fast-mode#enable-fast-mode-for-your-organization>) on Team and Enterprise)| ✓ (Opus 5 and 4.8 need provisioning)| ✗| ✗| ✓ ([Fable 5.2, with conditions](</docs/en/fast-mode#use-fast-mode-on-agent-platform>))| ✗
-[Auto mode](</docs/en/auto-mode-config>)| ✓| ✓| See note 2| ✓| See note 2| See note 2
-[Advisor](</docs/en/advisor>)| ✓| ✓| ✗| ✓ (Claude Code v2.1.300 or later)| ✗| ✗
-[Cross-session messaging](</docs/en/cross-session-messaging>)| ✓ 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5
-[Channels](</docs/en/channels>)| ✓| ✓| ✗| ✗| ✗| ✗
-[GitHub Actions](</docs/en/github-actions>)| ✓| ✓| ✓| ✗| ✓| ✓
-[GitLab CI/CD](</docs/en/gitlab-ci-cd>)| ✓| ✓| ✓| ✓| ✓| ✗
+These features work in the local CLI but depend on a server-side capability that not every provider exposes. Feature| Claude subscription| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud (Anthropic managed)| Google Cloud (Google managed)| Microsoft Foundry
+---|---|---|---|---|---|---|---
+[Web search](</docs/en/tools-reference#websearch-tool-behavior>)| ✓| ✓| ✗| ✓| ✓| See note 1| ✓
+[Fast mode](</docs/en/fast-mode>)| ✓ ([Owner-enabled](</docs/en/fast-mode#enable-fast-mode-for-your-organization>) on Team and Enterprise)| ✓ (Opus 5 and 4.8 need provisioning)| ✗| ✗| ✗| ✓ ([Fable 5.2, with conditions](</docs/en/fast-mode#use-fast-mode-on-agent-platform>))| ✗
+[Auto mode](</docs/en/auto-mode-config>)| ✓| ✓| See note 2| ✓| ✓| See note 2| See note 2
+[Advisor](</docs/en/advisor>)| ✓| ✓| ✗| ✓ (Claude Code v2.1.300 or later)| ✓ (Claude Code v2.1.300 or later)| ✗| ✗
+[Code Mode](</docs/en/code-mode>)| ✓ (experimental, [requirements apply](</docs/en/code-mode#requirements>))| ✓ (experimental, [requirements apply](</docs/en/code-mode#requirements>))| ✗| ✗| ✗| ✗| ✗
+[Cross-session messaging](</docs/en/cross-session-messaging>)| ✓ 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5| ✓ (same machine) 5
+[Channels](</docs/en/channels>)| ✓| ✓| ✗| ✗| ✗| ✗| ✗
+[GitHub Actions](</docs/en/github-actions>)| ✓| ✓| ✓| ✗| ✗| ✓| ✓
+[GitLab CI/CD](</docs/en/gitlab-ci-cd>)| ✓| ✓| ✓| ✓| ✓| ✓| ✗
### Admin and analytics
-Organization-level controls and usage visibility. Feature| Claude subscription| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform| Microsoft Foundry
----|---|---|---|---|---|---
-[Analytics dashboard and API](</docs/en/analytics>)| ✓ (dashboard: Team and Enterprise; API: Enterprise)| ✓ 4| ✗| ✗| ✗| ✗
-[Server-managed settings](</docs/en/server-managed-settings>)| ✓ (Team and Enterprise)| See [Platform availability](</docs/en/server-managed-settings#platform-availability>)| ✗| ✗| ✗| ✗
-[Zero Data Retention](</docs/en/zero-data-retention>)| ✓ (qualified Enterprise accounts)| ✓ (qualified accounts)| See note 3| ✓ (qualified accounts)| See note 3| See note 3
-1 On Google Cloud’s Agent Platform, web search is available for Opus 4, Sonnet 4, Haiku 4.5, and later models.
+Organization-level controls and usage visibility. Feature| Claude subscription| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud (Anthropic managed)| Google Cloud (Google managed)| Microsoft Foundry
+---|---|---|---|---|---|---|---
+[Analytics dashboard and API](</docs/en/analytics>)| ✓ (dashboard: Team and Enterprise; API: Enterprise)| ✓ 4| ✗| ✗| ✗| ✗| ✗
+[Server-managed settings](</docs/en/server-managed-settings>)| ✓ (Team and Enterprise)| See [Platform availability](</docs/en/server-managed-settings#platform-availability>)| ✗| ✗| ✗| ✗| ✗
+[Zero Data Retention](</docs/en/zero-data-retention>)| ✓ (qualified Enterprise accounts)| ✓ (qualified accounts)| See note 3| ✓ (qualified accounts)| ✓ (on request)| See note 3| See note 3
+1 On Google Cloud (Google managed), web search is available for Opus 4, Sonnet 4, Haiku 4.5, and later models.
2 On these providers, auto mode supports only Claude Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and the Fable models. See [Auto mode configuration](</docs/en/auto-mode-config>). For the permission mode a session on these providers starts in, see [Which mode a session starts in](</docs/en/permission-modes#which-mode-a-session-starts-in>).
3 Subject to your agreement with the cloud provider.
4 Dashboard and API only. [Contribution metrics](</docs/en/analytics#enable-contribution-metrics>) requires a claude.ai Team or Enterprise organization.
-5 Requires Claude Code v2.1.224 or later on macOS and Linux, including Linux inside WSL 2. On native Windows, requires Claude Code v2.1.234 or later. With API key authentication, messaging is same-machine only. On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, messaging is same-machine only and requires Claude Code v2.1.248 or later. Claude can find your [cloud sessions](</docs/en/claude-code-on-the-web>) and your sessions on other machines only from a session that is connected to [Remote Control](</docs/en/remote-control>). To connect, you need a claude.ai sign-in and the other [Remote Control requirements](</docs/en/remote-control#requirements>). See [Message sessions on other machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>).
+5 Requires Claude Code v2.1.224 or later on macOS and Linux, including Linux inside WSL 2. On native Windows, requires Claude Code v2.1.234 or later. With API key authentication, messaging is same-machine only. On Amazon Bedrock, Claude Platform on AWS, Google Cloud (Anthropic managed), Google Cloud (Google managed), and Microsoft Foundry, messaging is same-machine only and requires Claude Code v2.1.248 or later. Claude can find your [cloud sessions](</docs/en/claude-code-on-the-web>) and your sessions on other machines only from a session that is connected to [Remote Control](</docs/en/remote-control>). To connect, you need a claude.ai sign-in and the other [Remote Control requirements](</docs/en/remote-control#requirements>). See [Message sessions on other machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>).
If you authenticate through an [LLM gateway](</docs/en/llm-gateway>), feature availability matches the underlying provider the gateway forwards to, except for the features Claude Code itself turns off. Whenever `ANTHROPIC_BASE_URL` points at a host other than `api.anthropic.com`, Claude Code turns off features such as [Remote Control](</docs/en/remote-control#requirements>) and [server-managed settings](</docs/en/server-managed-settings#platform-availability>), whatever the gateway forwards. Some features, such as the [Advisor](</docs/en/advisor#requirements>), work only if the gateway forwards requests intact.For how the requests Claude Code sends differ between an Amazon Bedrock- or Agent Platform-format gateway, an `ANTHROPIC_BASE_URL` gateway, and a Claude apps gateway sign-in, see [client behavior by connection method](</docs/en/llm-gateway-protocol#how-the-connection-method-changes-client-behavior>).
### Summary by provider
-Each tab lists what is unavailable or partially supported on that provider, with alternatives where one exists. Everything not listed works the same as on a Claude subscription, apart from the provider-specific differences noted above. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, error reporting and telemetry to Anthropic are off by default. See [default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) for what traffic still reaches Anthropic and how to opt out.
+Each tab lists what is unavailable or partially supported on that provider, with alternatives where one exists. See also the provider-specific differences. On Amazon Bedrock, Google Cloud (Google managed), Microsoft Foundry, and Claude Platform on AWS, error reporting and telemetry to Anthropic are off by default. See [default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) for what traffic still reaches Anthropic and how to opt out.
* Amazon Bedrock
* Claude Platform on AWS
- * Google Cloud's Agent Platform
+ * Google Cloud (Anthropic managed)
+
+ * Google Cloud (Google managed)
* Microsoft Foundry
* Anthropic Console
-**Not available:** all features that require a Claude subscription, plus [web search](</docs/en/tools-reference#websearch-tool-behavior>), [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
+**Not available:** all features that require a Claude subscription, plus [web search](</docs/en/tools-reference#websearch-tool-behavior>), [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [Code Mode](</docs/en/code-mode>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
* [Desktop](</docs/en/desktop>): only via [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>)
* [Auto mode](</docs/en/auto-mode-config>): Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and Fable models only
@@ -100,13 +104,20 @@
**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>). For web lookups, use the [WebFetch tool](</docs/en/tools-reference#webfetch-tool-behavior>) with a specific URL.
-**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Available here, not on Amazon Bedrock:** [web search](</docs/en/tools-reference#websearch-tool-behavior>), plus the [Advisor](</docs/en/advisor>) in Claude Code v2.1.300 or later.**Partial support:**
+**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>), [Code Mode](</docs/en/code-mode>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Available here, not on Amazon Bedrock:** [web search](</docs/en/tools-reference#websearch-tool-behavior>), plus the [Advisor](</docs/en/advisor>) in Claude Code v2.1.300 or later.**Partial support:**
* [Cross-session messaging](</docs/en/cross-session-messaging>): between your sessions on this machine only 5
**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) instead of `/schedule`. For cloud sessions, use [GitLab CI/CD](</docs/en/gitlab-ci-cd>).
-**Not available:** all features that require a Claude subscription, plus [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
+**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>), [Code Mode](</docs/en/code-mode>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Available here, not on Google Cloud (Google managed):** the [Advisor](</docs/en/advisor>) in Claude Code v2.1.300 or later.**Partial support:**
+
+ * [Cross-session messaging](</docs/en/cross-session-messaging>): between your sessions on this machine only 5
+ * [Zero Data Retention](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/anthropic-managed#data-retention>): available on request. Contact your Anthropic account representative
+
+**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) instead of `/schedule`.
+
+If you set `CLAUDE_CODE_USE_VERTEX` to use Claude Code with Google Cloud’s Agent Platform, you’re on this provider.**Not available:** all features that require a Claude subscription, plus [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [Code Mode](</docs/en/code-mode>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
* [Desktop](</docs/en/desktop>): via [managed settings](<https://claude.com/docs/third-party/claude-desktop/configuration>) or [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>)
* [Web search](</docs/en/tools-reference#websearch-tool-behavior>): Opus 4, Sonnet 4, Haiku 4.5, and later models
@@ -117,7 +128,7 @@
**Alternatives:** for scheduling, use [`/loop`](</docs/en/scheduled-tasks>) instead of `/schedule`. For cloud sessions, use [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>).
-**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitLab CI/CD](</docs/en/gitlab-ci-cd>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
+**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitLab CI/CD](</docs/en/gitlab-ci-cd>), [Code Mode](</docs/en/code-mode>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/import` commands](</docs/en/commands#all-commands>).**Partial support:**
* [Desktop](</docs/en/desktop>): only via [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>)
* [Auto mode](</docs/en/auto-mode-config>): Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and Fable models only
@@ -132,7 +143,7 @@
## Availability by subscription plan
-If you authenticate through Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an Anthropic Console API key, this section does not apply to you. When you sign in with a claude.ai account, your plan determines which of the features below are available. In Enterprise organizations with the [HIPAA configuration](</docs/en/hipaa-setup>) applied, some features in this table are turned off.
+If you authenticate through a cloud provider or an Anthropic Console API key, this section does not apply to you. When you sign in with a claude.ai account, your plan determines which of the features below are available. In Enterprise organizations with the [HIPAA configuration](</docs/en/hipaa-setup>) applied, some features in this table are turned off.
Feature| Pro| Max| Ultra| Team| Enterprise
---|---|---|---|---|---
--- a/features-overview.md
+++ b/features-overview.md
@@ -148,7 +148,7 @@
**Context cost**| Zero unless the hook returns output| Description loads each session; full content loads when used
**Best for**| Linting after edits, blocking unsafe commands, logging, notifications| Workflows that need reasoning, reference material, multi-step tasks
-**Use a hook** when the action must happen the same way every time and doesn’t need Claude to think. For example: format on save, reject `rm -rf /`, post a Slack message when a session ends.**Use a skill** when Claude should decide how to apply the steps, or when the content is knowledge rather than a script. For example: a `/release` checklist, your API style guide, a debugging playbook.**Put guardrails in hooks.** An instruction like “never edit `.env`” in CLAUDE.md or a skill is a request, not a guarantee. A `PreToolUse` hook that blocks the edit is enforcement. If a rule must hold every time, make it a hook rather than a prompt instruction.**Hook output lands in context.** A `PostToolUse` hook that runs your linter feeds results back as text Claude reads; a `/fix-lint` skill tells Claude how to resolve them.
+**Use a hook** when the action must happen the same way every time and doesn’t need Claude to think. For example: format on save, reject `rm -rf /`, post a Slack message when a session ends.**Use a skill** when Claude should decide how to apply the steps, or when the content is knowledge rather than a script. For example: a `/release` checklist, your API style guide, a debugging playbook.**Put guardrails in hooks.** An instruction like “never edit `.env`” in CLAUDE.md or a skill is a request, not a guarantee. A `PreToolUse` hook that blocks the edit is enforcement. If a rule must hold every time, make it a hook rather than a prompt instruction.**Pair a hook with a skill.** Use a `PostToolUse` hook to run your linter and [send the errors to Claude](</docs/en/hooks#exit-code-2-behavior-per-event>). To give Claude your own rules for fixing the errors, write a skill such as `/fix-lint`.
### Understand how features layer
--- a/file-checkpointing.md
+++ b/file-checkpointing.md
@@ -4,7 +4,7 @@
## How checkpointing works
-When you enable file checkpointing, the SDK creates backups of files before modifying them through the Write, Edit, or NotebookEdit tools. User messages in the response stream include a checkpoint UUID that you can use as a restore point.
+When you enable file checkpointing, the SDK creates backups of files before modifying them through the Write, Edit, or NotebookEdit tools. Each prompt that starts a turn is a checkpoint, and its user message’s UUID is the restore point.
File rewinding restores files on disk to a previous state. It does not rewind the conversation itself. The conversation history and context remain intact after calling `rewindFiles()` (TypeScript) or `rewind_files()` (Python).
@@ -133,7 +133,7 @@
Capture checkpoint UUID and session ID
-With the `replay-user-messages` option set, each user message in the response stream has a UUID that serves as a checkpoint.For most use cases, capture the first user message UUID (`message.uuid`); rewinding to it restores the tracked files to their original state. To store multiple checkpoints and rewind to intermediate states, see Multiple restore points.Capturing the session ID (`message.session_id`) is optional; you only need it if you want to rewind later, after the stream completes. If you’re calling `rewindFiles()` immediately while still processing messages (as the example in Checkpoint before risky operations does), you can skip capturing the session ID.
+With the `replay-user-messages` option set, the user message for each prompt that starts a turn has a UUID that serves as a checkpoint. User messages that carry tool results have a UUID too, but it isn’t a checkpoint.For most use cases, capture the first user message UUID (`message.uuid`); rewinding to it restores the tracked files to their original state. To store multiple checkpoints and rewind to intermediate states, see Multiple restore points.Capturing the session ID (`message.session_id`) is optional; you only need it if you want to rewind later, after the stream completes. If you’re calling `rewindFiles()` immediately while still processing messages (as the example in Checkpoint before risky operations does), you can skip capturing the session ID.
3
@@ -151,7 +151,7 @@
### Checkpoint before risky operations
-This pattern keeps only the most recent checkpoint UUID, updating it before each agent turn. If something goes wrong during processing, you can immediately rewind to the last safe state and break out of the loop. Before running this example, replace `your_revert_condition` (Python) or `yourRevertCondition` (TypeScript) with your own check, such as error detection or a validation failure; the placeholder is not defined in the example.
+This pattern keeps only the most recent checkpoint UUID, updating it at each prompt that starts a turn. If something goes wrong during processing, you can immediately rewind to the last safe state and break out of the loop. Before running this example, replace `your_revert_condition` (Python) or `yourRevertCondition` (TypeScript) with your own check, such as error detection or a validation failure; the placeholder is not defined in the example.
Python
@@ -173,9 +173,14 @@
await client.query("Refactor the authentication module")
async for message in client.receive_response():
- # Update checkpoint before each agent turn starts
+ # Update checkpoint at each prompt you send; a tool result isn't one
# This overwrites the previous checkpoint. Only keep the latest
- if isinstance(message, UserMessage) and message.uuid:
+ if (
+ isinstance(message, UserMessage)
+ and message.uuid
+ and message.tool_use_result is None
+ and message.parent_tool_use_id is None
+ ):
safe_checkpoint = message.uuid
# Decide when to revert based on your own logic
@@ -202,9 +207,9 @@
let safeCheckpoint: string | undefined;
for await (const message of response) {
- // Update checkpoint before each agent turn starts
+ // Update checkpoint at each prompt you send; a tool result isn't one
// This overwrites the previous checkpoint. Only keep the latest
- if (message.type === "user" && message.uuid) {
+ if (message.type === "user" && "isReplay" in message && message.isReplay && message.uuid) {
safeCheckpoint = message.uuid;
}
@@ -222,7 +227,7 @@
### Multiple restore points
-If Claude makes changes across multiple turns, you might want to rewind to a specific point rather than all the way back. For example, if Claude refactors a file in turn one and adds tests in turn two, you might want to keep the refactor but undo the tests. This pattern stores all checkpoint UUIDs in an array with metadata. After the session completes, you can rewind to any previous checkpoint:
+If Claude makes changes across several prompts, you might want to rewind to a specific point rather than all the way back. For example, if your first prompt refactors a file and your second adds tests, rewind to your second prompt’s checkpoint to keep the refactor and undo the tests. This pattern stores each checkpoint UUID in an array with metadata. After the session completes, you can rewind to any previous checkpoint:
Python
@@ -259,7 +264,12 @@
await client.query("Refactor the authentication module")
async for message in client.receive_response():
- if isinstance(message, UserMessage) and message.uuid:
+ if (
+ isinstance(message, UserMessage)
+ and message.uuid
+ and message.tool_use_result is None
+ and message.parent_tool_use_id is None
+ ):
checkpoints.append(
Checkpoint(
id=message.uuid,
@@ -310,7 +320,7 @@
try {
for await (const message of response) {
- if (message.type === "user" && message.uuid) {
+ if (message.type === "user" && "isReplay" in message && message.isReplay && message.uuid) {
checkpoints.push({
id: message.uuid,
description: `After turn ${checkpoints.length + 1}`,
@@ -592,6 +602,7 @@
* File checkpointing was not enabled on the original session (`enable_file_checkpointing` or `enableFileCheckpointing` was not set to `true`)
* The session wasn’t properly completed before attempting to resume and rewind
+ * The UUID came from a user message that carries a tool result, which isn’t a checkpoint
**Solution** : Ensure `enable_file_checkpointing=True` (Python) or `enableFileCheckpointing: true` (TypeScript) was set on the original session, then use the pattern shown in the examples: capture the first user message UUID, complete the session fully, then resume with an empty prompt and call `rewindFiles()` once.
--- a/gallery.md
+++ b/gallery.md
@@ -285,7 +285,7 @@
### `Image` and `Client`
-Two more elements have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [elements reference](</docs/en/plugins/mods/reference#elements>) lists their props. An `Image` draws as a picture in these terminals:
+`Image` and `Client` have no sample here. `Image` draws a PNG or raw pixels in the terminal. `Client` is a region that a second file of yours draws, for animation and pointer input. The [elements reference](</docs/en/plugins/mods/reference#elements>) lists their props. An `Image` draws as a picture in these terminals:
* kitty 0.28 or later
* Ghostty
--- a/github-actions.md
+++ b/github-actions.md
@@ -103,6 +103,7 @@
Administration| Read
Checks| Read and write
Contents| Read and write
+Dependabot alerts| Read
Discussions| Read and write
Issues| Read and write
Members| Read
--- a/glossary.md
+++ b/glossary.md
@@ -191,7 +191,7 @@
### Sandboxing
-OS-level filesystem and network isolation for the Bash tool. Commands run inside a boundary you define upfront, so Claude can work freely within it without per-command approval prompts. Sandboxing is a separate layer from permission rules. Learn more: [Sandboxing](</docs/en/sandboxing>)
+OS-level filesystem and network isolation for the Bash tool. Commands run inside a boundary you define upfront. Sandboxing is a separate layer from permission rules. Learn more: [Sandboxing](</docs/en/sandboxing>)
### Session
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -1,3 +1,5 @@
+This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud’s Agent Platform, formerly Vertex AI, which Google manages. If you use Claude Models on Google Cloud (Anthropic managed), follow [its Claude Code setup page](</docs/en/claude-models-on-google-cloud-anthropic-managed>) instead. To find out which one you use, see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>)
+
## Prerequisites
Before configuring Claude Code with Google Cloud’s Agent Platform, formerly Vertex AI, ensure you have:
--- a/headless.md
+++ b/headless.md
@@ -49,11 +49,15 @@
After Claude finishes its turn and stdin has closed, a `claude -p` run can stay open to wait for background work that Claude started. Unless a background command that the main conversation started is still running, Claude Code stops whatever is still running after 10 minutes of continuous idle waiting by default and drops its partial result. To change the 10-minute cap, set [`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`](</docs/en/env-vars>), or set it to `0` to wait without one. The run waits for background work such as background commands, subagents and workflows, Monitor watches, and pending `/loop` wakeups:
* **[Background commands](</docs/en/tools-reference#background-commands>)** : for a command that the main conversation started, for example a dev server or a watch build, the run waits until the command exits or reaches its [time limit](</docs/en/tools-reference#time-limit-for-background-commands>). Claude then takes one more turn with the outcome. While the command runs, the 10-minute cap doesn’t end the wait.
- * **Background[subagents](</docs/en/sub-agents>) and workflows**: the run stays open until that work completes, because its result is part of the final output.
+ * **Background[subagents](</docs/en/sub-agents>) and workflows**: the run stays open until each one finishes or the 10-minute cap ends the wait.
* **[Monitor](</docs/en/tools-reference#monitor-tool>) watches**: the run waits until the watch times out or the 10-minute cap ends the wait, whichever comes first. While it waits, Claude keeps responding to what the watch reports. By default, a watch times out five minutes after Claude starts it.
* **Pending wakeups** : in a run whose prompt you passed as text rather than with `--input-format stream-json`, when Claude has scheduled a [self-paced `/loop` wakeup](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), the run waits for each wakeup to fire and runs its iteration until the [loop ends](</docs/en/scheduled-tasks#stop-a-loop>), even past the 10-minute cap.
When stderr is a terminal and the run has waited five seconds, Claude Code prints a line to stderr that starts with `Waiting for background work to finish` and names the work. With `json` or `stream-json` output, the line prints only when stdout isn’t a terminal, so the JSON your script reads never carries it. If the run reaches its [`--max-budget-usd`](</docs/en/cli-reference#cli-flags>) cap, Claude Code stops the remaining background work instead of waiting. When background work starts another turn, the run prints each turn’s result with the default `text` output and the last turn’s result with `json` output. Before v2.1.295, the run printed only the last turn’s result with `text` output too.
+
+#### Give a long subagent command more time
+
+When a subagent’s long command [moves to the background](</docs/en/tools-reference#foreground-commands-that-move-to-the-background>) at its timeout, a `claude -p` run can exit with code 0 before the command finishes. To raise the default timeout above the command’s run time, set [`BASH_DEFAULT_TIMEOUT_MS`](</docs/en/env-vars>), for example `BASH_DEFAULT_TIMEOUT_MS=300000 claude -p "<prompt>"` for five minutes. For a background subagent’s command over 10 minutes, also raise the 10-minute cap.
#### MCP work when a non-interactive run ends
@@ -245,7 +249,11 @@
### Turn off permission prompts in unattended runs
-Pass `--permission-prompts none` when nobody is available to answer permission prompts, for example in a scheduled job. The flag matters most when your run has a permission host: an Agent SDK app with a [`canUseTool` callback](</docs/en/agent-sdk/user-input>), or an MCP tool you pass with [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>). Without the flag, your run waits for that host to answer each permission request. With the flag, your run doesn’t consult the host or wait on it. Anything that would prompt is denied unless a `PermissionRequest` hook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues. In a `-p` run with no host, these requests are denied either way, and the flag also tells Claude not to retry them. Permission rules, [`PermissionRequest` hooks](</docs/en/hooks#permissionrequest>), and the permission mode you set still decide every call first; Claude Code denies only the requests that nothing else resolves. This example runs an unattended task in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). The classifier reviews each action as usual, and Claude Code denies anything that would have fallen back to a prompt:
+Pass `--permission-prompts none` when nobody is available to answer permission prompts, for example in a scheduled job. The flag matters most when your run has a permission host: an Agent SDK app with a [`canUseTool` callback](</docs/en/agent-sdk/user-input>), or an MCP tool you pass with [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>). Without the flag or the [`permissions.denyInsteadOfPrompting`](</docs/en/settings-reference#permissions-denyinsteadofprompting>) setting, your run waits for that host to answer each permission request. With the flag, your run doesn’t consult the host or wait on it. Anything that would prompt is denied unless a `PermissionRequest` hook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues. In a `-p` run with no host, these requests are denied either way, and the flag also tells Claude not to retry them. Permission rules, [`PermissionRequest` hooks](</docs/en/hooks#permissionrequest>), and the permission mode you set still decide every call first; Claude Code denies only the requests that nothing else resolves.
+
+The `--permission-prompts none` flag lasts for one run. To deny calls that would wait on a permission prompt in later runs too, set [`permissions.denyInsteadOfPrompting`](</docs/en/settings-reference#permissions-denyinsteadofprompting>) to `true` in your user or managed settings.
+
+This example runs an unattended task in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). The classifier reviews each action as usual, and Claude Code denies anything that would have fallen back to a prompt:
claude -p "Update the dependency pins and run the tests" --permission-mode auto --permission-prompts none
@@ -267,7 +275,7 @@
* User-invoked [skills](</docs/en/skills>) and custom commands work. Include `/skill-name` in the prompt string and Claude Code expands it before running.
* Built-in commands that only run in the terminal interface, such as `/login`, aren’t available.
* `/model`, `/effort`, `/fast`, `/color`, and `/rename` accept the value as an argument, for example `/model sonnet`, and `/mcp` with no argument prints a text summary of server status. These forms follow each command’s [availability notes](</docs/en/commands#all-commands>).
- * To change a setting, pass `key=value` to `/config`, for example `/config thinking=false`.
+ * To change a setting, pass `key=value` to `/config`, for example `/config verbose=true`.
* `/output-style <style>` switches [output styles](</docs/en/output-styles>) and `/output-style` alone lists them. Requires Claude Code v2.1.269 or later.
### Customize the system prompt
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -190,7 +190,7 @@
### Block edits to protected files
-Prevent Claude from modifying sensitive files like `.env`, `package-lock.json`, or anything in `.git/`. Claude receives feedback explaining why the edit was blocked, so it can adjust its approach. This example uses a separate script file that the hook calls. The script checks the target file path against a list of protected patterns and exits with code 2 to block the edit.
+Stop Claude’s `Edit` and `Write` tools from modifying sensitive files like `.env`, `package-lock.json`, or anything in `.git/`. Claude receives feedback explaining why the edit was blocked, so it can adjust its approach. This example uses a separate script file that the hook calls. The script checks the target file path against a list of protected patterns and exits with code 2 to block the edit.
1
@@ -253,6 +253,8 @@
Test the hook
Ask Claude to add a comment to your `.env` file. Claude Code blocks the edit before it runs and passes the script’s `Blocked:` message to Claude as feedback.
+
+Claude can still change the protected files with shell commands. To block some of those commands, add an [`Edit` deny rule](</docs/en/permissions#what-read-and-edit-rules-cover>) per path under `permissions.deny` in `.claude/settings.json`, like `Edit(/.env)` for the project root’s `.env`. Even with those rules, Claude can change `.env` in other ways. To limit which files commands can write to, see [Configure sandboxing](</docs/en/sandboxing#configure-sandboxing>).
### Re-inject context after compaction
@@ -769,7 +771,7 @@
Your endpoint responds with a JSON body in the same [output format](</docs/en/hooks#json-output>) as command hooks, and Claude Code also checks the response status:
* **2xx status** : to block a tool call, return the appropriate `hookSpecificOutput` fields in the body.
- * **Any other status, or the request fails** : Claude Code reports a [non-blocking error](</docs/en/hooks#exit-code-output>) and lets the action continue. To make a failed endpoint block the action, set [`onFailure: "block"`](</docs/en/hooks#block-the-action-when-a-hook-fails>) on the hook.
+ * **Any other status, or the request fails** : Claude Code reports a [non-blocking error](</docs/en/hooks#exit-code-output>) and lets the action continue, unless the hook is one [whose failure blocks the action](</docs/en/hooks#block-the-action-when-a-hook-fails>). To make a failed endpoint block the action, set [`onFailure: "block"`](</docs/en/hooks#block-the-action-when-a-hook-fails>) on the hook.
Header values support environment variable interpolation using `$VAR_NAME` or `${VAR_NAME}` syntax. Only variables listed in the `allowedEnvVars` array are resolved; all other `$VAR` references remain empty. For full configuration options and response handling, see [HTTP hooks](</docs/en/hooks#http-hook-fields>) in the reference.
Show diff (212 lines)
--- a/interface.md
+++ b/interface.md
@@ -157,7 +157,7 @@
## Pick where to draw
-A `ui.render` hook runs for every render site unless you narrow it to the one you want to draw in. To choose the render site, pass a filter, called a [matcher](</docs/en/plugins/mods/events#filter-which-events-a-hook-handles>), as the second argument to `on`. `{ component: 'Pane' }` runs the hook only for panes. In the hook, `e.component` names the site, `e.surface` says which app is drawing, and `e.props` holds the site’s own data. For a pane, `e.requestId` is the `id` you opened it with. The pane and the band are empty until a mod fills them. Select a tab to see what each one is and how to draw in it:
+To choose the render site a `ui.render` hook draws in, pass a filter, called a [matcher](</docs/en/plugins/mods/events#filter-which-events-a-hook-handles>), as the second argument to `on`. `{ component: 'Pane' }` runs the hook only for panes. In the hook, `e.component` names the site, `e.surface` says which app is drawing, and `e.props` holds the site’s own data. For a pane, `e.requestId` is the `id` you opened it with. The pane and the band are empty until a mod fills them. Select a tab to see what each one is and how to draw in it:
* Pane
@@ -165,7 +165,7 @@
A pane is a sidebar beside the transcript in a wide fullscreen terminal, or a framed region above the prompt otherwise. With several panes open, each gets a tab that shows its title.A pane appears when your mod calls `$.ui.open` with an `id` you choose, as in `$.ui.open({ id: 'hello-tabs' })`. Open a pane at the right time covers the other fields and when a pane waits for a wider terminal.To draw in your pane, filter on `{ component: 'Pane' }` and check that `e.requestId` is your `id`.
-The band is a strip directly above the prompt input. It’s always there, and every mod shares it.Your hook returns a tree to show something in the band, or `next(e)` to show nothing. A tree replaces what the mods [after yours](</docs/en/plugins/mods/events#the-order-mods-run-in>) draw there. To keep theirs, put the result of `await next(e)` among the children of a `Box` in your tree.To draw in the band, filter on `{ component: 'AbovePrompt' }`.
+The band is a strip directly above the prompt input. Each mod that draws there gets its own row, and the rows stack from the top in the [order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>).To draw your mod’s row, filter on `{ component: 'AbovePrompt' }` and return a tree. To draw nothing, return `next(e)`.Before v2.1.323, all mods shared one drawing in the band, and your tree replaced what the mods after yours drew. To support those releases too, put the result of `await next(e)` among the children of a [`Box` that stays valid](</docs/en/plugins/mods/troubleshoot#another-mods-band-shows-and-yours-doesnt>). On v2.1.323 or later, that child doesn’t draw other mods’ rows.
A mod can also place a row of its own in the transcript.
@@ -233,11 +233,11 @@
return Box({ flexDirection: 'column', children: [theirs, Text({ children: ['under the spinner'] })] })
})
-While Claude works, the spinner animates as before, and `under the spinner` appears below it. The permission prompt isn’t a render site, so a mod can’t change what it shows. The question dialog, `AskUserQuestion`, is one, so a mod can change that. A tree for the dialog has to hold the reference exactly once, with your elements above it. Otherwise, Claude Code draws its own dialog.
+While Claude works, the spinner animates as before, and `under the spinner` appears below it. The permission prompt isn’t a render site, so a mod can’t change what it shows. The question dialog, `AskUserQuestion`, is one, so a mod can change that dialog when Claude asks a question. A tree for the dialog has to hold the reference exactly once, with your elements above it. Otherwise, Claude Code draws its own dialog.
### Open a pane at the right time
-A pane appears only when your mod opens it. How and when you open it decides whether it takes keyboard focus, how much room it asks for, and whether it shows at all in a narrow terminal. To open a pane, call [`$.ui.open`](</docs/en/plugins/mods/reference#mods-api-methods>) with an `id` you choose. The `id` is the pane’s name: your `ui.render` hook checks for it, and you pass it again to close the pane.
+A pane appears only when your mod opens it. How and when you open it decides whether it takes keyboard focus, how much room it asks for, and whether it shows at all in a narrow terminal. To open a pane, call [`$.ui.open`](</docs/en/plugins/mods/reference#mods-api-methods>) with an `id` you choose. The `id` is the pane’s name: your `ui.render` hook checks for it, and you pass it again to close the pane. If another mod has a pane open with that `id`, the call rejects.
await $.ui.open({ id: 'hello-tabs', title: 'Hello tabs', focus: true })
@@ -335,21 +335,21 @@
### Put a backdrop behind the conversation
-`$.theme.set` and `$.theme.clear` replace `$.ui.backdrop`, which Claude Code v2.1.319 removed. Change `$.ui.backdrop({ id: 'your-backdrop' })` to `$.theme.set({ backdrop: { id: 'your-backdrop' } })`, and `$.ui.backdrop(undefined)` to `$.theme.clear()`, which removes any mod’s backdrop.
-
-To put a backdrop behind the conversation in the Desktop app or the mobile app, call [`$.theme.set`](</docs/en/plugins/mods/reference#mods-api-methods>) with a `backdrop`, then draw the backdrop at the [`Backdrop`](</docs/en/plugins/mods/reference#render-sites>) render site. To take the backdrop off, call `$.theme.clear()`. The terminal draws no backdrop. `$.theme.set` and `$.theme.clear` require Claude Code v2.1.319 or later. This mod sets a backdrop when the session starts, draws the backdrop, and adds a `/plain` command that takes the backdrop off:
+`$.theme.set` and `$.theme.clear` replace `$.ui.backdrop`, which Claude Code v2.1.319 removed. Change `$.ui.backdrop({ id: 'your-backdrop' })` to a `$.theme.set` call like the one in this section’s example, and `$.ui.backdrop(undefined)` to `$.theme.clear()`, which removes any mod’s backdrop.
+
+To put a backdrop behind the conversation in the Desktop app or the mobile app, call [`$.theme.set`](</docs/en/plugins/mods/reference#mods-api-methods>) with a `backdrop`, then draw the backdrop at the [`Backdrop`](</docs/en/plugins/mods/reference#render-sites>) render site. To take the backdrop off, call `$.theme.clear()`. The terminal draws no backdrop. `$.theme.set` and `$.theme.clear` require Claude Code v2.1.319 or later. This example requires Claude Code v2.1.323 or later, so [check your version](</docs/en/plugins/mods/overview#turn-mods-on-or-off>) first. The mod sets a backdrop when the session starts, draws the backdrop, and adds a `/plain` command that takes the backdrop off:
export function register(on) {
// Neither a reload of this mod nor --resume keeps the backdrop, so set it here
on('session.start', async ($, e, next) => {
- await $.theme.set({ backdrop: { id: 'night-sky', colorScheme: 'dark' } })
+ await $.theme.set({ backdrop: { scene: 'night-sky' }, overrideColorScheme: 'dark' })
await $.command.register({ name: 'plain', description: 'Take the backdrop off' })
return next(e)
})
on('ui.render', { component: 'Backdrop' }, async ($, e, next) => {
- // This hook runs for every mod's backdrop, and another mod can use the same id
- if (e.props.plugin !== $.plugin.name || e.props.id !== 'night-sky') return next(e)
+ // This hook runs for every mod's backdrop, and another mod can use the same scene
+ if (e.props.plugin !== $.plugin.name || e.props.scene !== 'night-sky') return next(e)
const { Box, Text } = $.ui.resolve(e)
return Box({ backgroundColor: 'blue', children: [Text({ children: ['Night sky'] })] })
})
@@ -360,11 +360,120 @@
})
}
+Before v2.1.323, write `id` in place of `scene` in the `$.theme.set` call and in `e.props`, and move `overrideColorScheme` into `backdrop` as `colorScheme`.
+
To try the example, put this code in a [mod](</docs/en/plugins/mods/create>) and start a session in the Desktop app or the mobile app. To take the backdrop off, run `/plain` at the Claude Code prompt. The transcript shows `the theme is cleared` after the mod’s name, as in `night-sky: the theme is cleared` for a mod named `night-sky`. Check what `backdrop` takes, what the call’s result tells you, and what other mods can change:
- * **The`backdrop` fields**: `id`, a [name](</docs/en/plugins/mods/reference#limits>) you choose, is required, and the other fields are optional. `colorScheme` is `'light'` or `'dark'` and says whether your drawing is light or dark. For `glass`, see [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>).
+ * **The`backdrop` fields**: `scene` is a [name](</docs/en/plugins/mods/reference#limits>) you choose for a backdrop your hook draws. For the other fields and `overrideColorScheme`, see [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>).
* **Whether the backdrop is drawn** : `$.theme.set` resolves with `isDrawn: true` when a Desktop or mobile app connected to the session says it draws backdrops. Otherwise `isDrawn` is `false` and `reason` says why.
- * **One backdrop for each session** : a `$.theme.set` call replaces the session’s backdrop and `$.theme.clear()` removes that backdrop, whichever mod set it. Call `$.theme.clear()` only when the user asks for it.
+ * **One theme for each session** : a mod that calls `$.theme.set` replaces the session’s backdrop and colors, and a mod that calls `$.theme.clear()` removes them, whichever mod set them. Call `$.theme.clear()` only when the user asks for it.
+
+### Change the colors of the Desktop app
+
+To change the colors of the Desktop app’s Code tab with a mod, ask Claude for one or write one yourself. Both ways require Claude Code v2.1.324 or later in the Code tab, so [check the version there](</docs/en/desktop#claude-code-version-in-the-code-tab>) first. Claude Code in the terminal keeps its own colors.
+
+#### Ask Claude for a colors mod
+
+1
+
+Describe the colors
+
+Start a local session in the Code tab and tell Claude which colors you want. For example, enter `make a mod that makes the app cream in light mode and dark brown in dark mode`. Claude writes the mod’s files.
+
+2
+
+Approve the mod
+
+Answer the questions Claude Code asks about the mod’s files and hot reloading. For what each answer does, see [Ask Claude for a mod](</docs/en/plugins/mods/create#ask-claude-for-a-mod>).
+
+3
+
+Check the colors
+
+The Code tab changes color when the mod loads. To adjust a color, tell Claude what to change. If nothing changes, see Fix missing mod colors.
+
+#### Write a colors mod yourself
+
+`makeColors` is a function that builds a theme from a few hex colors. These steps create a mod named `paper` that uses it.
+
+1
+
+Have Claude copy makeColors
+
+Start a local session in the Code tab, and enter `copy make-colors.js and make-colors.d.ts from your plugin-authoring skill into ~/.claude/skills/paper/hooks/`. Check that both files are in that directory.
+
+2
+
+Save the manifest and hooks.json
+
+From [Write a mod yourself](</docs/en/plugins/mods/create#write-a-mod-yourself>), save `.claude-plugin/plugin.json` and `hooks/hooks.json` in `~/.claude/skills/paper/`, and change `first-mod` to `paper` in both files. A mod [under `~/.claude/skills/`](</docs/en/plugins/create#scaffold-a-plugin-that-loads-every-session>) loads when you start a session.
+
+3
+
+Write the code
+
+Save this file as `~/.claude/skills/paper/hooks/register.js`. When a session starts, the code calls `$.theme.set` with the colors for light mode and dark mode:
+
+ import { makeColors } from './make-colors.js'
+
+ const { theme } = makeColors({
+ label: 'Paper',
+ // surface-0 is the background, text-primary is the main text, and text-muted is the faint text
+ light: {
+ gray: { anchors: { 'surface-0': '#efe6d3', 'text-primary': '#2a241d', 'text-muted': '#6a5f50' } },
+ },
+ dark: {
+ gray: { anchors: { 'surface-0': '#1f1a15', 'text-primary': '#f0e7d7', 'text-muted': '#aca08d' } },
+ },
+ })
+
+ export function register(on) {
+ on('session.start', async ($, e, next) => {
+ await $.theme.set({ colors: theme })
+ return next(e)
+ })
+ }
+
+To use your own colors, replace the hex values with other six-digit hex colors.
+
+4
+
+Check the colors
+
+Start a new local session in the Code tab. With the example’s values, the background is cream in light mode and dark brown in dark mode. If nothing changes, see Fix missing mod colors.
+
+### Fix missing mod colors in the Desktop app
+
+If you use a [third-party provider](</docs/en/third-party-integrations>) instead of a Claude account in [Claude Desktop v5.11492.5 or earlier](</docs/en/desktop#check-your-version>), the Code tab keeps its own colors, so skip these checks. Otherwise, if a mod’s colors don’t appear in the Code tab, or if they disappear, check for these causes:
+
+ * **Old version** : [update the Desktop app](</docs/en/desktop#claude-code-version-in-the-code-tab>), restart it, and start a new local session in the Code tab. If Claude wrote the mod, ask for it again there.
+ * **Mod not loaded** : if Claude wrote the mod, see when it loads in [Ask Claude for a mod](</docs/en/plugins/mods/create#ask-claude-for-a-mod>). If you wrote it, compare your files and their paths with Write a colors mod yourself.
+ * **Refused theme** : ask Claude to run the mod’s `makeColors` call. If the call throws an error, or its `problems` list has an entry that starts `Desktop won't paint this theme`, have Claude fix the theme. If you installed the mod, send what Claude finds to its author.
+ * **Another`$.theme` call**: when any mod in the session calls `$.theme.set` or `$.theme.clear()`, the colors and backdrop from an earlier call disappear. In your own mod, pass `colors` and `backdrop` in the same `$.theme.set` call. Use one mod at a time that sets a theme.
+
+### Remove mod colors from the Desktop app
+
+To take a mod’s colors off the Code tab, turn off the mod first. A mod that’s still on can set its colors again.
+
+1
+
+Turn off the mod
+
+ * **Claude wrote the mod** : move its directory out of the [mods folder](</docs/en/plugins/mods/create#ask-claude-for-a-mod>) of the session where Claude wrote it.
+ * **You put the mod under`~/.claude/skills/`**: move its directory, such as `~/.claude/skills/paper/`, to a place outside `~/.claude/skills/`.
+ * **You installed the mod** : in the Desktop app, [disable or uninstall its plugin](</docs/en/desktop#install-plugins>) from **Manage plugins**. If you don’t see **Manage plugins** and you have [the CLI](</docs/en/quickstart>), you can [disable or uninstall a marketplace plugin from your shell](</docs/en/plugins/install#manage-plugins-from-your-shell>).
+
+2
+
+Start a new session
+
+Start a new local session in the Code tab.
+
+3
+
+Remove colors that stay
+
+If the colors are still there, open **Settings** from the Code tab, and search there for `code appearance`. Open the result, and select **Remove colors**.
## Build a tree from elements
@@ -420,7 +529,7 @@
Set `rows` to 2 or more for [a field that holds several lines](</docs/en/plugins/mods/gallery#input>).
-The [interface gallery](</docs/en/plugins/mods/gallery>) has samples and screenshots of most elements. This table lists every element:
+The [interface gallery](</docs/en/plugins/mods/gallery>) has samples and screenshots of most elements. This table lists the main elements:
Element| What it draws| Where
---|---|---
@@ -498,7 +607,7 @@
Give every `Input` and `Select` a `key` prop, such as `key: 'size'`. A `Button` can go without a `key` when it has a `label` prop or a single string child. Its key is then the `label` value or that string. Tests and other mods identify a control by its key:
* **Tests** : a [test](</docs/en/plugins/mods/test#test-a-drawing>) presses or types into a control by its key.
- * **Other mods** : Claude Code fires [`ui.press`, `ui.input`, or `ui.select`](</docs/en/plugins/mods/reference#interface>) with the control’s key in `e.element` before it runs the control’s callback. Another mod’s hook for that event sees what the user typed into your `Input` and can change that text or keep your callback from running. The mods API gives that mod no method to press your buttons.
+ * **Other mods** : Claude Code fires [`ui.press`, `ui.input`, or `ui.select`](</docs/en/plugins/mods/reference#interface>) with the control’s key in `e.element` before it runs the control’s callback. Another mod’s hook can also [run for that event](</docs/en/plugins/mods/events#hook-other-mods-drawings-and-controls>). That hook sees what the user typed into your `Input` and can change that text or keep your callback from running. The mods API gives that mod no method to press your buttons.
If a message says `needs a key` or `is drawn twice`, [find the cause by that message](</docs/en/plugins/mods/troubleshoot#needs-a-key>).
@@ -559,7 +668,7 @@
▸ plugin panel hidden · ctrl+x ctrl+a or click to show
-The same keys, or in fullscreen rendering a click on the row, expand the band again. Until then, nothing presses a button in it: no hotkey, no digit typed into an empty prompt, and no keybinding for a button’s [`action`](</docs/en/plugins/mods/reference#elements>). If the band has keyboard focus when the user collapses it, the focus returns to the prompt, and Ctrl+X then Tab skips the band while it’s collapsed. The band stays collapsed until the user expands it, even after `/clear`, and is expanded again the next time Claude Code starts. Your mod can’t expand it or tell that it’s collapsed: the `ui.render` hook keeps running, and nothing in `e.props` says so. Don’t make the band the only place your mod shows something the user has to answer.
+The same keys, or in fullscreen rendering a click on the row, expand the band again. Until then, nothing presses a button in it: no hotkey, no digit typed into an empty prompt, and no keybinding for a button’s [`action`](</docs/en/plugins/mods/reference#elements>). If the band has keyboard focus when the user collapses it, the focus returns to the prompt, and Ctrl+X then Tab skips the band while it’s collapsed. The band stays collapsed until the user expands it, even after `/clear`, and is expanded again the next time Claude Code starts. Your mod can’t expand it. Don’t make the band the only place your mod shows something the user has to answer. To show that elsewhere only while the band is collapsed, read `e.props.isCollapsed` in your `ui.render` hook, which keeps running. `isCollapsed` requires Claude Code v2.1.321 or later.
### Take typed input and draw a row for each item
--- a/keybindings.md
+++ b/keybindings.md
@@ -649,7 +649,7 @@
Claude Code validates your keybindings and writes a warning to the debug log for:
* Parse errors (invalid JSON or structure)
- * Misspelled modifiers, such as `ctl+k`. Claude Code drops the part it doesn’t recognize and applies the binding to the keystroke that remains, `k` in this example.
+ * Misspelled modifiers, such as `ctl+k`. Claude Code ignores the whole binding. Correct the modifier, to `ctrl+k` in this example.
* A space next to `+` in a key string, such as `ctrl+ k`. Claude Code reads the string as a chord of `ctrl+` followed by `k`. No keypress matches `ctrl+` on its own, so the binding never fires. Remove the space.
* Invalid context names
* Invalid action values, such as an action that isn’t a string or `null`
--- a/llm-gateway.md
+++ b/llm-gateway.md
@@ -29,6 +29,8 @@
[Roll out an LLM gateway for your organization](</docs/en/llm-gateway-rollout>) walks each step and shows the configuration files to distribute at each one. The gateway is one part of organization setup; for policy enforcement, usage visibility, and data handling decisions, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make a gateway reached through `ANTHROPIC_BASE_URL` the only destination a managed machine may use, set [`allowedProviders`](</docs/en/settings-reference#allowedproviders>) to `["customEndpoint"]` in the same managed settings file and put the gateway’s `ANTHROPIC_BASE_URL` in that file’s `env` block. Claude Code then refuses a session pointed anywhere else, including at Anthropic directly or at a developer’s own proxy, and accepts `ANTHROPIC_BASE_URL` only with the value you set there. For a gateway reached through a provider-specific endpoint variable such as `ANTHROPIC_BEDROCK_BASE_URL`, the `allowedProviders` entry says which variable to pin. Requires Claude Code v2.1.285 or later.
+With Desktop signed in to claude.ai, a Cowork session on the user’s machine counts as [`"anthropic"`](</docs/en/settings-reference#allowedproviders>). If you leave it out of this list in an MDM policy or managed settings file, that session is refused. With it in, sessions sent to Anthropic directly also pass this list.
+
## Subscriptions and gateways
While a [gateway credential variable](</docs/en/llm-gateway-connect#set-the-credential-variable>) or `apiKeyHelper` is active, requests carry that credential in place of a developer’s claude.ai subscription login, and the subscription’s usage limits don’t apply to them. Claude Code keeps a saved claude.ai login on the machine but doesn’t send it with those requests. That traffic is billed per token to whoever owns the credential the gateway forwards, such as your organization’s Anthropic Console account, or your Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry account when the gateway routes there. [`ANTHROPIC_BASE_URL`](</docs/en/llm-gateway-connect#set-the-base-url-and-credential>) is the variable that points Claude Code at the gateway. Setting only that variable, without a gateway credential, doesn’t replace the subscription. Requests still route through the gateway, but a saved claude.ai login remains the active credential, so its usage limits and billing apply. Gateways that pass this traffic on to Anthropic must forward `Authorization` and the OAuth capability in `anthropic-beta`; see the [request headers reference](</docs/en/llm-gateway-protocol#request-headers>).
--- a/llm-gateway-protocol.md
+++ b/llm-gateway-protocol.md
@@ -88,7 +88,7 @@
Two client-side settings change what Claude Code assumes for a model ID it doesn’t recognize, whichever connection method the developer uses:
- * **Context window** : Claude Code assumes 200K, or 1M when the ID carries `[1m]`. To declare the real window, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>)
+ * **Context window** : Claude Code assumes a 1M token context window by default. To declare the real window, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>)
* **Capabilities** : to give a gateway alias the capabilities of the model behind it, map that model’s Anthropic ID to your alias with a [`modelOverrides`](</docs/en/errors#unrecognized-model-id-on-a-request>) entry in the settings you distribute. For where the `ANTHROPIC_DEFAULT_*_MODEL_SUPPORTED_CAPABILITIES` variables apply, see feature pass-through
## Request headers
@@ -250,6 +250,7 @@
* The top-level `output_config.effort` field. Automatic retry and error forwarding covers an upstream that rejects it
* The adaptive reasoning `thinking` field, which has no beta header
* The `role: "system"` entries that carry mid-conversation system messages
+ * The `anthropic-beta` value and `safeguards` field for auto mode’s [server-side classifier review](</docs/en/permission-modes#server-side-classifier-review>), in sessions where that review stays on, such as when `/status` shows **Auto mode server** as `Enabled`. To turn the review off, set `CLAUDE_CODE_AUTO_MODE_SERVER=0` before starting the session. In the terminal, `/status` then shows **Auto mode server** as `Disabled`.
* The OAuth `anthropic-beta` value that subscription authentication requires
* Header values and body fields developers add themselves through [`ANTHROPIC_BETAS`](</docs/en/env-vars>) or [`CLAUDE_CODE_EXTRA_BODY`](</docs/en/env-vars>)
--- a/loading.md
+++ b/loading.md
@@ -187,6 +187,7 @@
`cache/<marketplace>/<plugin>/<version>/`| One directory per installed version of a marketplace plugin. `<plugin>` is the marketplace entry name and `<version>` is the resolved version. `${CLAUDE_PLUGIN_ROOT}` points at this directory
`data/<plugin-id>/`| The plugin’s persistent directory, exposed as `${CLAUDE_PLUGIN_DATA}`. For how `<plugin-id>` is formed, see [Path variables and persistent data](</docs/en/plugins/components#path-variables-and-persistent-data>). Claude Code creates it when a plugin component first uses it and keeps it across updates. By default, Claude Code deletes it when you uninstall the plugin from its last scope. For `--keep-data` and the other cases where it stays, see [plugin uninstall](</docs/en/plugins/cli-reference#plugin-uninstall>)
`marketplaces/<name>/`| The clone or download of a marketplace added from GitHub, another Git host, or a URL. A marketplace added from a local `file` or `directory` source has no copy here, and its `installLocation` in `known_marketplaces.json` is the path you gave
+`mcpb/`| The files Claude Code extracts from the [MCP bundles](</docs/en/plugins/components#include-a-packaged-mcpb-server>) that plugins declare. Requires Claude Code v2.1.324 or later
`synced/`| The plugins Claude Code synced from your claude.ai account
`.trash/`| Plugins that the claude.ai sync removed, such as after you turn one off on claude.ai or stop syncing
`installed_plugins.json` and `known_marketplaces.json`| The records of what Claude Code has installed and which marketplaces it has fetched, described under Check which stage a plugin reached. A [marketplace hosted on claude.ai](</docs/en/plugins/install#add-from-claude-ai>) is recorded in `known_marketplaces_claudeai.json` instead
--- a/managed-mcp.md
+++ b/managed-mcp.md
@@ -16,7 +16,7 @@
Pattern| What it does| Configure
---|---|---
**Disable MCP**| No servers load except the few that load under exclusive control| `managed-mcp.json` with an empty server map
-**Fixed deployment**| Every user gets the same servers and can’t add others| `managed-mcp.json` with the servers you want
+**Fixed deployment**| Every user gets the servers you list, and servers they configure don’t load| `managed-mcp.json` with the servers you want
**Provided servers**| Every user gets the remote servers you list and keeps their own| `managedMcpServers` in managed settings
**Approved catalog**| Publish a list of approved servers; users add the ones they want, anything else is blocked| `allowedMcpServers` \+ `allowManagedMcpServersOnly: true`
**Plugin servers only**| Users can’t add servers through `~/.claude.json` or `.mcp.json`; [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>) stop loading as plugins, and servers from other plugins still load| [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) with `mcp` in the list
@@ -33,6 +33,7 @@
* The servers the file defines
* Servers you provide through `managedMcpServers`
* In-process servers that the app that started the session registers, such as the VS Code extension’s own server or the [connectors the desktop app delivers](</docs/en/mcp#how-connectors-reach-claude-code>)
+ * The server that Claude Code creates when a [mod](</docs/en/plugins/mods/overview>) [adds tools](</docs/en/plugins/mods/api#add-a-tool>). To block the tools that your users’ mods add, [stop user-installed mods from loading](</docs/en/plugins/mods/admin#stop-user-installed-mods-from-loading>).
* The built-in [Claude in Chrome](</docs/en/chrome>) server, if you allow it alongside the managed set
Users can’t add, modify, or use any other MCP servers, including plugin-provided servers and servers passed with the [`--mcp-config` CLI flag](</docs/en/cli-reference#cli-flags>). The file also suppresses the claude.ai connectors Claude Code fetches itself unless you allow them alongside the managed set.
@@ -113,7 +114,7 @@
"mcpServers": {}
}
-`claude mcp add` fails with the enterprise-policy error above. Servers users had previously configured stop loading the next time they start a session, with no warning that policy is the reason. Servers you provide through `managedMcpServers`, and anything else you allow alongside the managed set, still load under an empty map, so leave those keys unset to turn MCP off completely.
+`claude mcp add` fails with the enterprise-policy error above. Servers users had previously configured stop loading the next time they start a session, with no warning that policy is the reason. Servers you provide through `managedMcpServers`, and anything else you allow alongside the managed set, still load under an empty map, so leave those keys unset.
### Allow claude.ai connectors alongside the managed set
--- a/managed-settings.md
+++ b/managed-settings.md
@@ -81,7 +81,7 @@
The keys are the same everywhere, but each mechanism stores them in a different place and shape:
- * **Server-managed** : Anthropic’s servers, or your gateway, hold the policy. Claude Code keeps a local cache that it applies at startup and [replaces on each successful fetch](</docs/en/server-managed-settings#security-considerations>).
+ * **Server-managed** : Anthropic’s servers, or your gateway, hold the policy. Claude Code keeps a local cache that it [can apply at startup](</docs/en/server-managed-settings#fetch-and-caching-behavior>) and [replaces on each successful fetch](</docs/en/server-managed-settings#security-considerations>).
* **macOS configuration profile** : the `com.anthropic.claudecode` managed preferences domain. Use the same top-level keys as `managed-settings.json`, with nested settings as dictionaries and lists as plist arrays.
* **Windows HKLM registry** : the JSON as a `REG_SZ` or `REG_EXPAND_SZ` value named `Settings` under `HKLM\SOFTWARE\Policies\ClaudeCode`.
* **File-based** : `managed-settings.json`, an optional `managed-settings.d/` directory, and `managed-mcp.json` in the system directory: `/Library/Application Support/ClaudeCode/` on macOS, `/etc/claude-code/` on Linux and WSL, and `C:\Program Files\ClaudeCode\` on Windows. Claude Code doesn’t read the legacy Windows path `C:\ProgramData\ClaudeCode\managed-settings.json`. You can deploy any of these files as a symbolic link, and Claude Code reads the file the link leads to. The policy still applies when the link leads outside the system directory or Claude Code can’t confirm that it stays inside. A warning naming the file then appears in `/status` and `claude doctor`. To clear the warning, point the link at a target inside the system directory.
--- a/manifest-reference.md
+++ b/manifest-reference.md
@@ -254,8 +254,8 @@
Shape| Example value| What Claude Code does
---|---|---
`.json` file path| `"./mcp/servers.json"`| Reads the file as an `mcpServers` map
-MCP bundle path| `"./bundle.mcpb"`| Extracts the `.mcpb` or `.dxt` bundle into `.mcpb-cache/` under the plugin root and reads its server config
-MCP bundle URL| `"https://example.com/server.mcpb"`| Downloads the bundle into `.mcpb-cache/`, then reads it
+MCP bundle path| `"./bundle.mcpb"`| Extracts the `.mcpb` or `.dxt` bundle into `mcpb/` under the [plugins root](</docs/en/plugins/loading#find-plugins-on-disk>) and reads its server config
+MCP bundle URL| `"https://example.com/server.mcpb"`| Downloads the bundle, then extracts and reads it the same way
Inline map| `{ "deploy-api": { "command": "node", "args": ["${CLAUDE_PLUGIN_ROOT}/server.js"] } }`| Uses the map as server configs keyed by name
A bundle path or URL must end in `.mcpb` or `.dxt`. Any other extension fails validation.
--- a/marketplace-reference.md
+++ b/marketplace-reference.md
@@ -26,7 +26,6 @@
* **Names that impersonate an official marketplace** : names such as `official-claude-plugins` or `claude-plugins-v2`, and any name containing a non-ASCII character. The error is `Marketplace name impersonates an official Anthropic/Claude marketplace`. A control or bidirectional-formatting character in a name also reports `Marketplace name cannot contain control or bidirectional-formatting characters`. A marketplace already registered under such a name stops loading, along with its plugins.
* **Another spelling of a reserved name** : a name that differs from a reserved name only by a trailing dot, or by a symbol other than an underscore in place of a hyphen, so `claude.code.plugins` counts as `claude-code-plugins`. Adding the marketplace fails with [`is another spelling of "<reserved>", a reserved marketplace name`](</docs/en/errors#marketplace-name-is-another-spelling-of-a-reserved-name>), and a marketplace already registered under one stops loading. This check requires Claude Code v2.1.280 or later.
* **Names Claude Code uses for plugins that don’t come from a marketplace** : `inline` for plugins loaded with [`--plugin-dir`](</docs/en/cli-reference>), `builtin` for built-in plugins, `skills-dir` for plugins auto-loaded from [`.claude/skills/`](</docs/en/skills>), and `synced` for plugins synced from your claude.ai account. `claude-plugin-test` is also reserved. `skills-dir` also appears as `{"source": "skills-dir"}` in `strictKnownMarketplaces` and `blockedMarketplaces`, described under Source values valid only in policy lists.
- * **`npm`, `pip`, `uv`, `cargo`, `github`, and `gh`**: reserved in any casing. This check requires Claude Code v2.1.275 or later.
* **Member names that every JavaScript object has** : `constructor`, `hasOwnProperty`, `isPrototypeOf`, `propertyIsEnumerable`, `toLocaleString`, `toString`, and `valueOf`. `claude plugin marketplace add` refuses a marketplace that uses one with [`Claude Code reserves this name and cannot register a marketplace under it`](</docs/en/plugins/troubleshooting#claude-code-reserves-this-name>). This check requires Claude Code v2.1.296 or later.
* **Names starting with`claudeai-`**: reserved for marketplaces hosted on claude.ai. `claude plugin marketplace add` refuses any other marketplace that uses one with `Cannot add marketplace "<name>": names starting with "claudeai-" are reserved for marketplaces hosted on claude.ai`.
* **The download folder of a registered GitHub marketplace,`<owner>-<repo>`**: Claude Code downloads a marketplace added from a `github` source such as `acme/x-tools` through a folder named `acme-x-tools`, whatever that marketplace’s own `name` is. While that marketplace is registered under a name other than `acme-x-tools`, `claude plugin marketplace add` refuses a different marketplace named `acme-x-tools` after downloading it, and reports `Can't use the marketplace name "acme-x-tools"`. This check requires Claude Code v2.1.290 or later.
@@ -339,7 +338,7 @@
`headers`| `url`| Map of HTTP headers Claude Code sends with the fetch, for authenticated hosts
`headersHelper`| `url`| Command that prints headers whose values are too short-lived to list in `headers`. Requires Claude Code v2.1.238 or later. See [Authenticate archive downloads](</docs/en/plugins/host-marketplace#authenticate-archive-downloads>)
`repo`| `github`| In `marketplace add` and `extraKnownMarketplaces`, `repo` must name one repository. `marketplace add` rejects `owner/*` as not a valid `owner/repo` shorthand; in `extraKnownMarketplaces` Claude Code takes it literally and the clone fails
-`ref`| `github`, `git`| Branch or tag. Defaults to the repository’s default branch
+`ref`| `github`, `git`| Branch, tag, or the full lowercase SHA of a commit on a branch or tag. Defaults to the repository’s default branch. A SHA requires Claude Code v2.1.324 or later and is refused for a marketplace with a reserved name, such as `claude-plugins-official`
`path`| `github`, `git`| The marketplace file’s path inside the repository. Defaults to `.claude-plugin/marketplace.json`
`path`| `file`| The marketplace file itself. Claude Code reads it in place and takes the directory two levels up as the marketplace root, so keep the file at `<root>/.claude-plugin/marketplace.json`
`path`| `directory`| The marketplace root, the directory that contains `.claude-plugin/marketplace.json`
@@ -347,6 +346,12 @@
`skipLfs`| `github`, `git`| Accepted and has no effect. See [Keep plugin files out of Git LFS](</docs/en/plugins/host-marketplace#keep-plugin-files-out-of-git-lfs>)
`name`| `settings`| Must equal the `extraKnownMarketplaces` key and can’t be a reserved name
`plugins`| `settings`| The inline catalog, with no hosted file. Each item takes `name`, `source`, `description`, `version`, `strict`, `headers`, and `headersHelper`. Write each item’s `source` as an object type, because a relative path has no repository to resolve against
+
+To keep refreshes and auto-updates from moving a `github` or `git` marketplace off a commit you’ve reviewed, set `ref` to that commit’s full SHA, as in this source:
+
+ { "source": "github", "repo": "acme-corp/plugins", "ref": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0" }
+
+Update Claude Code on every machine first, because versions before v2.1.324 can’t load a marketplace pinned this way. A plugin entry with its own remote source can still update, so pin that entry too, such as with `sha` on a `github`, `url`, or `git-subdir` source.
### Source values valid only in policy lists
@@ -394,7 +399,7 @@
`Marketplace name cannot contain path separators (/ or \), ".." sequences, or be "."`| Error| `name`
`Marketplace name impersonates an official Anthropic/Claude marketplace`| Error| `name`. See Reserved names
`Marketplace name cannot contain control or bidirectional-formatting characters`| Error| `name` contains a control character, such as an escape or a newline, or a Unicode bidirectional-formatting character
-`Marketplace name "inline" is reserved for --plugin-dir session plugins`, and the `builtin`, `skills-dir`, `synced`, `claude-plugin-test`, `npm`, `pip`, `uv`, `cargo`, `github`, and `gh` variants| Error| `name`
+`Marketplace name "inline" is reserved for --plugin-dir session plugins`, and the `builtin`, `skills-dir`, `synced`, and `claude-plugin-test` variants| Error| `name`
`Author name cannot be empty`| Error| `owner.name`
`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`| Error| `plugins[i].name`
`Plugin name cannot contain control or bidirectional-formatting characters`| Error| `plugins[i].name`
--- a/microsoft-foundry.md
+++ b/microsoft-foundry.md
@@ -103,7 +103,11 @@
## 1M token context window
-On Microsoft Foundry, when Claude Code can tell which model your deployment serves, Fable models, Sonnet 5 and later, and Opus 4.7 and later run with the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) by default, with no `[1m]` suffix needed. Claude Code reads the model from the deployment name in your model variables. Name each deployment with its model ID, such as `claude-opus-4-8`, or map the model to your deployment name with [`modelOverrides`](</docs/en/model-config#override-model-ids-per-version>). For a deployment name it can’t match to a model, Claude Code assumes a 200K window unless you [declare a different one](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). This `settings.json` entry tells Claude Code that a deployment named `team-opus-prod` serves Opus 4.8:
+On Microsoft Foundry, Fable models, Sonnet 5 and later, and Opus 4.7 and later run with the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) by default. This needs no `[1m]` suffix, as long as Claude Code can tell which model your deployment serves.
+
+Claude Code reads the model from the deployment name in your model variables. Name each deployment with its model ID, such as `claude-opus-4-8`, or map the model to your deployment name with [`modelOverrides`](</docs/en/model-config#override-model-ids-per-version>).
+
+This `settings.json` entry tells Claude Code that a deployment named `team-opus-prod` serves Opus 4.8:
{
"modelOverrides": {
@@ -111,7 +115,7 @@
}
}
-To keep a 200K window instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/model-config#turn-off-1m-context>). Opus 4.6 and Sonnet 4.6 reach the 1M window when you append `[1m]` to the deployment name in `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`, as [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) describes. Before v2.1.287, the Fable models and Opus 4.7 and later also needed that suffix on Microsoft Foundry and ran with a 200K window by default without it.
+To keep a 200K window instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/model-config#turn-off-1m-context>). If Claude Code can’t match a deployment name to a model, it assumes a 1M window by default, so [set the real window](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) if your deployed model accepts less. Opus 4.6 and Sonnet 4.6 reach the 1M window when you append `[1m]` to the deployment name in `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`, as [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) describes. Before v2.1.287, the Fable models and Opus 4.7 and later also needed that suffix on Microsoft Foundry and ran with a 200K window by default without it.
## Troubleshooting
Show diff (147 lines)
--- a/model-config.md
+++ b/model-config.md
@@ -35,6 +35,7 @@
---|---|---|---
Anthropic API| Opus 5.5| Sonnet 5.5| Haiku 5.5
[Claude Platform on AWS](</docs/en/claude-platform-on-aws>)| Opus 5.5| Sonnet 4.6| Haiku 4.5
+[Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>)| Opus 5.5| Sonnet 5.5| Haiku 4.5
Amazon Bedrock, Google Cloud’s Agent Platform| Opus 5.5| Sonnet 4.5| Haiku 4.5
Microsoft Foundry| Opus 4.6| Sonnet 4.5| Haiku 4.5
@@ -75,6 +76,7 @@
After you choose to continue on Fable using usage credits, Claude Code doesn’t show the prompt again. In a session with [Remote Control](</docs/en/remote-control>) connected, a [background session](</docs/en/agent-view>), or an [agent team](</docs/en/agent-teams>) teammate’s session, nobody may be at the terminal, so Claude Code holds the mid-session consent prompt for the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, five minutes by default. If nobody has answered by the deadline, Claude Code ends the turn without sending the request and adds a notice to the transcript, which the Remote Control client also shows. Your model selection is unchanged, and Claude Code asks for consent again on your next message. What you can do while the prompt is waiting depends on the session:
* With Remote Control connected or in a teammate’s session, press any key at the terminal to cancel the deadline, and Claude Code waits for your answer.
+ * With Remote Control connected in an interactive terminal session, you can also answer on your connected device, and that answer lasts for that session. Requires Claude Code v2.1.323 or later.
* In a background session, answer before the deadline.
* If you send a new message from the remote client before anyone has typed at the terminal, Claude Code ends the turn the same way, and your new message starts the next turn. After someone types at the terminal, Claude Code keeps waiting for the answer and queues your new message behind it.
@@ -113,6 +115,8 @@
Then switch models from within the session:
/model sonnet
+
+By default, a session you start on the Anthropic API with a Claude Opus 4 or Opus 4.1 ID such as `claude-opus-4-1` runs on the model `opus` resolves to.
Example settings file:
@@ -183,7 +187,7 @@
* **`/model`** : Claude Code rejects the switch with an error
* **`--model` flag, `ANTHROPIC_MODEL`, or the `model` setting**: Claude Code replaces the value at startup with a warning naming both the requested and substituted models, and the session starts on the default model
* **`ANTHROPIC_DEFAULT_MODEL`** : Claude Code ignores the variable
- * **Subagent or teammate override** : Claude Code runs the subagent or teammate on a fallback model rather than failing the request. See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the subagent fallback and [Specify teammates and models](</docs/en/agent-teams#specify-teammates-and-models>) for the teammate fallback. In interactive sessions, Claude Code warns you when it substitutes a subagent’s model, by this fallback or by the newest-permitted-version substitution above, naming the requested and substituted models; it doesn’t report a teammate’s fallback. Where the newest-permitted-version substitution above operates, a blocked family alias follows it instead. Before v2.1.222, an alias fell back like any other blocked value on every provider
+ * **Subagent or teammate override** : Claude Code runs the subagent or teammate on a fallback model rather than failing the request. See [When an allowlist blocks a subagent model](</docs/en/sub-agents#when-an-allowlist-blocks-a-subagent-model>) for the subagent fallback and [Specify teammates and models](</docs/en/agent-teams#specify-teammates-and-models>) for the teammate fallback. In interactive sessions, Claude Code warns you when it substitutes a top-level subagent’s model. It doesn’t report a teammate’s fallback. Where the newest-permitted-version substitution above operates, a blocked family alias follows it instead. Before v2.1.222, an alias fell back like any other blocked value on every provider
* **Skill or command override** : Claude Code ignores the override, including a blocked family alias, and the skill or command runs on the session model. A skill or command that [runs in a subagent](</docs/en/skills#run-skills-in-a-subagent>) follows the subagent behavior above instead
* **`advisorModel` setting**: the advisor is disabled for the session
* **`--advisor` flag**: Claude Code exits with an error at launch. In a [background session](</docs/en/agent-view>), it starts the session without the advisor instead of exiting
@@ -213,7 +217,7 @@
Delivery mechanism| CLI and IDE| Desktop local sessions| Web, mobile, and cloud sessions| Agent SDK and non-interactive| Cowork
---|---|---|---|---|---
-[Server-managed settings](</docs/en/server-managed-settings>) from the admin console| Enforced| Enforced| Enforced, except in [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions| Enforced| Remote Cowork sessions: the server checks the model. On the user’s machine: not delivered.
+[Server-managed settings](</docs/en/server-managed-settings>) from the admin console| Enforced| Enforced| Enforced, but not delivered to [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions or to sessions on a self-hosted runner that [uses Amazon Bedrock or Google Cloud’s Agent Platform](</docs/en/self-hosted-environments-configuration#what-differs-from-sessions-on-the-anthropic-api>)| Enforced| Remote Cowork sessions: the server checks the model. On the user’s machine: not delivered.
[MDM or managed settings files](</docs/en/managed-settings#delivery-mechanisms>)| Enforced| Enforced| Not delivered in Anthropic-hosted environments; in [self-hosted environments](</docs/en/self-hosted-environments>), enforced from the runner image per [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>)| Enforced| Enforced where deployed
* [Cloud sessions](</docs/en/claude-code-on-the-web>), including those you start from the Desktop app, run on Anthropic-managed VMs by default: settings deployed to your device do not reach them, so deliver the allowlist through server-managed settings. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on your own compute and also read the managed settings file in the runner image. [How Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) says when that file applies. A mid-session model switch in a cloud session is rejected when the requested model is excluded by the allowlist. When the `availableModels` list in your server-managed settings is non-empty, the server rejects a request to start a cloud session at claude.ai/code or from the Desktop app on a model the list excludes.
@@ -337,7 +341,7 @@
The behavior of `default` depends on your account type:
* **Pro, Max, Ultra, Team, Enterprise, and Anthropic API** : defaults to Opus 5.5
- * **Claude Platform on AWS, Amazon Bedrock, and Google Cloud’s Agent Platform** : defaults to Opus 5.5
+ * **Claude Platform on AWS, Claude Models on Google Cloud (Anthropic managed), Amazon Bedrock, and Google Cloud’s Agent Platform** : defaults to Opus 5.5
* **Microsoft Foundry** : defaults to Sonnet 4.5
Before v2.1.280, `default` resolved to Sonnet 5 on Pro and Team Standard, and to Opus 5 on Max, Ultra, Team Premium, Enterprise, the Anthropic API, Claude Platform on AWS, Amazon Bedrock, and Google Cloud’s Agent Platform from v2.1.219. Before v2.1.219, `default` resolved to Opus 4.8 on the Anthropic API, Max, Ultra, Team Premium, and Enterprise pay-as-you-go from v2.1.154, and on Claude Platform on AWS, Amazon Bedrock, and Google Cloud’s Agent Platform from v2.1.207. Before v2.1.207, `default` resolved to Opus 4.7 on Claude Platform on AWS and to Sonnet 4.5 on Amazon Bedrock and Google Cloud’s Agent Platform. When an admin has set an organization default model, `default` resolves to that model instead of the account-type default above. Requires Claude Code v2.1.196 or later. `default` can also resolve to the model you set with `ANTHROPIC_DEFAULT_MODEL`, under the conditions listed in its section, or to the model recorded on your account. When nothing is recorded on your account, managed settings enforce the allowlist for the Default model, and the account-type default is not in `availableModels`, `default` resolves to the enforced Default instead of the account-type default above. When an organization default and enforcement both apply, the organization default replaces the account-type default first and enforcement then applies to it: an allowlisted organization default is kept, while one outside the list resolves to the enforced Default.
@@ -362,13 +366,18 @@
To persist a chain across sessions, set `fallbackModel` in [settings](</docs/en/settings>) as an array:
{
- "fallbackModel": ["claude-sonnet-5", "claude-haiku-4-5"]
+ "fallbackModel": ["claude-sonnet-5", "claude-haiku-5-5"]
}
-The `--fallback-model` flag takes precedence over the `fallbackModel` setting. Each entry accepts a model name or alias, and `"default"` expands to the default model. Claude Code doesn’t confirm the chain at startup and `/status` doesn’t display it. The notice shown when a switch happens is the first visible sign that a fallback is configured. When a request fails over, Claude Code tries each entry in order until one accepts it. An entry that can’t be reached either, such as a retired model pinned in settings, fails over to the next one the same way. Claude Code removes two kinds of entry before that walk starts:
+The `--fallback-model` flag takes precedence over the `fallbackModel` setting. Each entry accepts a model name or alias, and `"default"` expands to the default model. Claude Code doesn’t confirm the chain at startup and `/status` doesn’t display it. The notice shown when a switch happens is the first visible sign that a fallback is configured.
+
+#### Which entries Claude Code tries
+
+When a request fails over, Claude Code tries each entry in order until one accepts it. An entry that can’t be reached either, such as a retired model pinned in settings, fails over to the next one the same way. Claude Code leaves an entry out in these cases:
* **Outside the allowlist** : Claude Code drops any entry not permitted by `availableModels` when it reads the chain.
* **Smaller context window during compaction** : the chain also covers [compaction](</docs/en/context-window#what-survives-compaction>), but Claude Code won’t fall back to a model with a smaller context window than the primary’s, since summarizing there would cut off part of the conversation first. If every fallback is smaller, compaction shows the original error and you can retry.
+ * **Not supported in auto mode** : in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), and in plan mode while the classifier reviews commands, Claude Code skips models that auto mode doesn’t support. Include a supported model if you use either mode.
Claude Code also applies the chain to [subagents](</docs/en/sub-agents>). When a subagent’s request fails over, Claude Code tries your configured fallback models in order, and the subagent continues on the model that accepts the request. Your session’s model is unchanged. Before v2.1.247, a failure the chain covers ended the subagent instead.
@@ -492,11 +501,19 @@
#### Use ultrathink for one-off deep reasoning
-Include `ultrathink` anywhere in your prompt to request deeper reasoning on that turn without changing your session effort setting. Claude Code recognizes the keyword and adds an in-context instruction. Claude Code passes other phrases such as “think”, “think hard”, and “think more” through as ordinary prompt text and doesn’t recognize them as keywords. Typed in the terminal prompt, the word can also raise that turn to `xhigh` effort. When it can, the word shows in rainbow colors. Requires Claude Code v2.1.311 or later. If the word isn’t rainbow when you start a new turn, try one of these:
+Include `ultrathink` anywhere in your prompt to request deeper reasoning on that turn without changing your session effort setting. Claude Code recognizes the keyword and adds an in-context instruction. Claude Code passes other phrases such as “think”, “think hard”, and “think more” through as ordinary prompt text and doesn’t recognize them as keywords. To raise that turn to `xhigh` effort as well, type the word in one of these places:
+
+ * The terminal prompt, where the word shows in rainbow colors when it can raise the turn. Requires Claude Code v2.1.311 or later.
+ * VS Code’s chat box, where the word also shows in rainbow colors. Requires Claude Code v2.1.316 or later.
+ * A local session in the desktop app’s Code tab. Requires Claude Code v2.1.316 or later.
+
+If the word isn’t rainbow when you start a new turn, try one of these:
* Retype it outside anything such as quotes, brackets, a path, or a command, in a prompt that doesn’t start with `/`
* Unset `CLAUDE_CODE_EFFORT_LEVEL` if it’s set below `xhigh`, raise your own [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) to `xhigh` or above, or ask an organization admin to raise your organization’s limit
- * Run `/model` in your session to switch to an Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2, or Fable 5.1 model. Where the word can’t raise a turn, such as on Amazon Bedrock, set the effort level instead
+ * Run `/model` in your session to switch to an Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2, or Fable 5.1 model. Where the word can’t raise a turn, such as on Amazon Bedrock, Google Cloud’s Agent Platform, or a [Claude apps gateway](</docs/en/claude-apps-gateway>), set the effort level instead
+
+To turn the keyword off, including its in-context instruction, set `CLAUDE_CODE_DISABLE_ULTRATHINK` to `1` in your shell or in a [settings file](</docs/en/env-vars#in-settings-files>). Requires Claude Code v2.1.316 or later.
#### Set the effort level
@@ -653,12 +670,12 @@
### Correct the window for a gateway or custom model ID
-Either of these warnings means Claude Code doesn’t recognize your session’s model ID, so it can’t tell the model’s context window and assumes 200K tokens:
-
- ⚠ Model "my-gateway-opus" isn't recognized · context assumed to be 200k tokens · ...
- Claude Code doesn't recognize the model "my-gateway-opus", so it assumes a context window of 200k tokens. Update Claude Code, or see https://code.claude.com/docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id to set the window.
-
-Claude Code auto-compacts the conversation at the assumed 200K, so if the model’s real context window is 200K, there is nothing to correct. Otherwise, give Claude Code the real window in whichever of these ways fits your ID:
+Either of these warnings means Claude Code doesn’t recognize your session’s model ID and assumes the context window the warning names:
+
+ ⚠ Model "my-gateway-opus" isn't recognized · context assumed to be 1m tokens · ...
+ Claude Code doesn't recognize the model "my-gateway-opus", so it assumes a context window of 1m tokens. Update Claude Code, or see https://code.claude.com/docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id to set the window.
+
+Claude Code auto-compacts the conversation to fit the assumed window, so if the warning names the model’s real context window, there is nothing to correct. Otherwise, give Claude Code the real window:
* **A model newer than your Claude Code version** : run `claude update` in your shell. If Claude Code recognizes the ID after the update, you don’t need to configure anything else.
* **Your gateway’s or provider’s name for a model Claude Code knows** : add a `modelOverrides` entry that maps the Anthropic model ID to your ID, such as `"claude-opus-4-8": "my-gateway-opus"`. You can instead list your ID in a [`modelPicker`](</docs/en/settings-reference#fields-for-modelpicker>) row with `behavesAs` set to that model. Either way, Claude Code then treats the ID as that model.
@@ -669,11 +686,11 @@
#### Which IDs `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies to
-On an [LLM gateway](</docs/en/llm-gateway>) or other custom deployment, Claude Code can assume a context window for the model ID that differs from the model’s real window, whether or not it resolves the ID to a Claude model. Set [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](</docs/en/env-vars>) to the window Claude Code should assume instead. How the variable applies depends on the ID. Claude Code treats an ID as a provider or custom spelling when it doesn’t start with `claude-`, in any casing, or when it carries a suffix that Claude Code strips when reading the ID, such as the `@YYYYMMDD` date used on Google Cloud’s Agent Platform. Before v2.1.259, Claude Code didn’t count a stripped suffix, so an unrecognized `claude-` ID with a date suffix was treated as a bare `claude-` name. An unrecognized provider or custom spelling, the same spelling with `[1m]`, and every other ID are three separate cases:
-
- * If Claude Code can’t resolve a provider or custom spelling to a model it recognizes and the ID doesn’t contain `[1m]`, the variable applies directly and proactive compaction continues at the declared window.
- * If Claude Code can’t resolve a provider or custom spelling to a model it recognizes and the ID contains `[1m]`, in any casing, Claude Code assumes a 1M window for it and the variable doesn’t apply on its own. To correct the window while keeping proactive compaction, also set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>). With that variable set, Claude Code sizes the ID like the same spelling without `[1m]`, so `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies when it would apply to that untagged spelling. With a declared window above 200K, the warning that [the 200K limit isn’t enforced](</docs/en/errors#the-200k-limit-isnt-enforced>) is expected in this configuration.
- * If the ID resolves to a model Claude Code recognizes, or the ID is a bare `claude-` name with no suffix for Claude Code to strip, in any casing, the variable takes effect only when you also set [`DISABLE_COMPACT`](</docs/en/env-vars>), which disables all compaction. For example, an ID that contains a Claude model name that Claude Code knows, such as `anthropic/claude-opus-4-8`, `us.anthropic.claude-…-v1:0`, or the dated `claude-sonnet-4-5@20250929`, resolves to that model. This includes IDs that also contain `[1m]`: Claude Code resolves `claude-opus-4-8[1m]` to Opus 4.8 even with `CLAUDE_CODE_DISABLE_1M_CONTEXT` set.
+On an [LLM gateway](</docs/en/llm-gateway>) or other custom deployment, Claude Code can assume a context window for the model ID that differs from the model’s real window, whether or not it resolves the ID to a Claude model. Set [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](</docs/en/env-vars>) to the window Claude Code should assume instead. The variable works differently for an unrecognized ID, an unrecognized ID with `[1m]`, and an ID that Claude Code recognizes:
+
+ * If Claude Code doesn’t recognize the ID and the ID doesn’t contain `[1m]`, the variable applies on its own and proactive compaction continues at the declared window. For an ID such as `claude-sonnet-latest`, this requires Claude Code v2.1.324 or later.
+ * If Claude Code doesn’t recognize the ID and the ID contains `[1m]`, in any casing, Claude Code assumes a 1M window for it. A value under 1M in the variable doesn’t apply on its own. To correct the window while keeping proactive compaction, also set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>). With that variable set, Claude Code sizes the ID like the same ID without `[1m]`, so `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies. With a declared window above 200K, the warning that [the 200K limit isn’t enforced](</docs/en/errors#the-200k-limit-isnt-enforced>) is expected in this configuration.
+ * If the ID resolves to a model Claude Code recognizes, the variable takes effect only when you also set [`DISABLE_COMPACT`](</docs/en/env-vars>), which disables all compaction. For example, an ID that contains a Claude model name that Claude Code knows, such as `anthropic/claude-opus-4-8`, `us.anthropic.claude-…-v1:0`, or the dated `claude-sonnet-4-5@20250929`, resolves to that model. This includes IDs that also contain `[1m]`: Claude Code resolves `claude-opus-4-8[1m]` to Opus 4.8 even with `CLAUDE_CODE_DISABLE_1M_CONTEXT` set.
For a model ID Claude Code doesn’t recognize, set [`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1`](</docs/en/env-vars>) to have Claude Code compact only after the API rejects the conversation with a [too-long error Claude Code recognizes](</docs/en/errors#prompt-is-too-long>). Claude Code doesn’t run that recovery when a gateway [rewrites the error](</docs/en/llm-gateway-connect#troubleshoot-gateway-errors>) to wording Claude Code doesn’t recognize.
@@ -727,7 +744,12 @@
Google Cloud’s Agent Platform| `export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8'`
Microsoft Foundry| `export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8'`
-Apply the same pattern for `ANTHROPIC_DEFAULT_FABLE_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL`. For current and legacy model IDs across all providers, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). To upgrade users to a new model version, update these environment variables and redeploy. A pinned model with a native 1M window, such as Opus 4.8 or Sonnet 5, runs with the 1M context window without any suffix when Claude Code can match the pinned ID to that model. The ID matches when it contains the model’s Anthropic API ID, as `us.anthropic.claude-opus-4-8` contains `claude-opus-4-8`, or when a `modelOverrides` entry maps the model to it. On a pinned ID that Claude Code can’t match to a model, sessions run with a 200K window by default unless the ID carries the `[1m]` suffix. For a model that reaches 1M through its `[1m]` variant, such as Opus 4.6 or Sonnet 4.6, enable extended context by appending `[1m]` to the model ID in `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`:
+Apply the same pattern for `ANTHROPIC_DEFAULT_FABLE_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL`. For current and legacy model IDs across all providers, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). To upgrade users to a new model version, update these environment variables and redeploy. By default, Claude Code treats a pinned ID as having the 1M context window, with no `[1m]` suffix needed, in these cases:
+
+ * **An ID Claude Code matches to a model with a native 1M window, such as Opus 4.8 or Sonnet 5** : the ID matches when it contains the model’s Anthropic API ID, as `us.anthropic.claude-opus-4-8` contains `claude-opus-4-8`, or when a `modelOverrides` entry maps the model to it
+ * **An ID Claude Code can’t match to a model** : set the real window if the model behind the ID accepts less
+
+For a model that reaches 1M through its `[1m]` variant, such as Opus 4.6 or Sonnet 4.6, enable extended context by appending `[1m]` to the model ID in `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`:
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-6[1m]'
--- a/modifying-system-prompts.md
+++ b/modifying-system-prompts.md
@@ -438,7 +438,7 @@
**Persistence**| Per-project file| Saved as files| Session only| Session only
**Reusability**| Per-project| Across projects| Code duplication| Code duplication
**Management**| On filesystem| CLI + files| In code| In code
-**Default tools**| Preserved| Preserved| Preserved| Lost (unless included)
+**Tool guidance**| Preserved| Preserved| Preserved| Lost (unless included)
**Built-in safety**| Maintained| Maintained| Maintained| Must be added
**Customization level**| Additions only| Additions; can omit coding instructions| Additions only| Complete control
**Version control**| With project| Yes| With code| With code
--- a/monitoring-usage.md
+++ b/monitoring-usage.md
@@ -74,7 +74,7 @@
`CLAUDE_CODE_ENABLE_TELEMETRY`| Enables telemetry collection (required)| `1`
`OTEL_METRICS_EXPORTER`| Metrics exporter types, comma-separated. Use `none` to disable| `console`, `otlp`, `prometheus`, `none`
`OTEL_LOGS_EXPORTER`| Logs/events exporter types, comma-separated. Use `none` to disable| `console`, `otlp`, `none`
-`OTEL_EXPORTER_OTLP_PROTOCOL`| Protocol for OTLP exporter, applies to all signals. Claude Code has no default protocol, so set this or the signal-specific protocol variable for each `otlp` exporter you enable| `grpc`, `http/json`, `http/protobuf`
+`OTEL_EXPORTER_OTLP_PROTOCOL`| Protocol for OTLP exporter, applies to all signals. Defaults to `http/protobuf` for a valid `http://` or `https://` endpoint. For a gRPC endpoint such as `http://localhost:4317`, set this to `grpc`. The default requires Claude Code v2.1.323 or later| `grpc`, `http/json`, `http/protobuf`
`OTEL_EXPORTER_OTLP_ENDPOINT`| OTLP collector endpoint for all signals| `http://localhost:4317`
`OTEL_EXPORTER_OTLP_METRICS_PROTOCOL`| Protocol for metrics, overrides general setting| `grpc`, `http/json`, `http/protobuf`
`OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`| OTLP metrics endpoint, overrides general setting| `http://localhost:4318/v1/metrics`
@@ -377,8 +377,8 @@
* **You set it on the computer that runs Desktop** : Desktop doesn’t pass a value you set there to the SSH session
* **You exported it in`/etc/profile` or another file that only login shells read**: the name arrives when you run `claude` from a login shell, but not in a Desktop SSH session. Desktop doesn’t start Claude Code through a login shell. Set the variable under `env` in the [managed settings file](</docs/en/desktop#managed-settings>) on the remote machine instead.
- * **A value has a space inside it** : Claude Code then copies none of the keys onto events or datapoints and reports no error. Take the space out of the value.
- * **Something else already sets the variable** : in a session that the desktop app starts, a variable already set in the launch environment [takes precedence over settings files](</docs/en/settings-reference#how-env-values-interact-with-your-shell>). The [debug log](</docs/en/debug-your-config>) names each ignored variable. When a third-party Desktop deployment names an OTLP endpoint in the environment it provides, that environment carries Desktop’s own `OTEL_RESOURCE_ATTRIBUTES`.
+ * **A value has a space inside it** : Claude Code then copies none of the keys onto events or datapoints. To see which value has the space, run `/status` in a session on the remote machine. Take the space out of the value.
+ * **Something else already sets the variable** : in a session that the desktop app starts, a variable already set in the launch environment [takes precedence over settings files](</docs/en/settings-reference#how-env-values-interact-with-your-shell>). The [debug log](</docs/en/debug-your-config>) can name an ignored variable. When a third-party Desktop deployment names an OTLP endpoint in the environment it provides, that environment carries Desktop’s own `OTEL_RESOURCE_ATTRIBUTES`.
### Example configurations
@@ -553,12 +553,12 @@
* All standard attributes
* `model`: Model identifier (for example, “claude-sonnet-5”)
- * `query_source`: Category of the subsystem that issued the request. One of `"main"`, `"subagent"`, or `"auxiliary"`
+ * `query_source`: Category of the subsystem that issued the request. One of `"main"`, `"subagent"`, `"auxiliary"`, `"plugin_model_complete"`, or `"plugin_model_classify"`. The last two mark the requests a [mod](</docs/en/plugins/mods/overview>) makes with `$.model.complete` or `$.model.classify`. Claude Code counts those requests from v2.1.324, so totals can step up after you upgrade.
* `speed`: `"fast"` when the request used fast mode. Absent otherwise
* `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort.
* `agent.name`: Subagent type that issued the request. Built-in agent names and agents from official-marketplace plugins appear verbatim. Other user-defined agent names are replaced with `"custom"`. Absent when the request was not issued by a named subagent type.
* `skill.name`: Skill active for the request, set by the Skill tool or a `/` command, or inherited by a spawned subagent. Built-in, bundled, user-defined, and official-marketplace plugin skill names appear verbatim. Third-party plugin skill names are replaced with `"third-party"`. Absent when no skill is active.
- * `plugin.name`: Owning plugin when the active skill or subagent is provided by a plugin. Official-marketplace plugin names appear verbatim. Third-party plugin names are replaced with `"third-party"`. Absent when neither the skill nor the subagent has an owning plugin.
+ * `plugin.name`: Owning plugin when the active skill or subagent is provided by a plugin, or the plugin whose `$.model` call made the request. Official-marketplace plugin names appear verbatim. Third-party plugin names are replaced with `"third-party"`. Absent for other requests.
* `marketplace.name`: Marketplace the owning plugin was installed from. Only emitted for official-marketplace plugins, even with `OTEL_LOG_TOOL_DETAILS=1` set. Absent otherwise.
* `mcp_server.name`: MCP server whose tool result this request consumed. Built-in, claude.ai-proxied, and official-registry server names appear verbatim. User-configured server names are replaced with `"custom"`. Absent when the request consumed no MCP tool result. Before v2.1.222, Claude Code set this attribute on every request after an MCP tool call, not only on requests that consumed a tool result, so dashboards that aggregate it show a step down after you upgrade.
* From v2.1.312, the name of a remote server with a fixed URL that a plugin from Anthropic’s official marketplace declares also appears verbatim, as `plugin_<plugin>_<server>`. That name is replaced with `"custom"` when the plugin’s marketplace copy didn’t come from Anthropic’s registered source, such as one mounted from a seed directory in a cloud session.
@@ -571,7 +571,7 @@
* All standard attributes
* `type`: (`"input"`, `"output"`, `"cacheRead"`, `"cacheCreation"`). The `"input"` type excludes tokens read from or written to the prompt cache, which are counted under `"cacheRead"` and `"cacheCreation"`. The `"cacheCreation"` type counts cache writes with the five-minute and one-hour [cache lifetimes](</docs/en/prompt-caching#cache-lifetime>) together.
* `model`: Model identifier (for example, “claude-sonnet-5”)
- * `query_source`: Category of the subsystem that issued the request. One of `"main"`, `"subagent"`, or `"auxiliary"`
+ * `query_source`: Category of the subsystem that issued the request. See Cost counter for the values.
* `speed`: `"fast"` when the request used fast mode. Absent otherwise
* `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. See Cost counter for details.
* `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior.
--- a/network-config.md
+++ b/network-config.md
@@ -1,6 +1,8 @@
-Claude Code supports various enterprise network and security configurations through environment variables. This includes routing traffic through corporate proxy servers, trusting custom Certificate Authorities (CA), and authenticating with mutual Transport Layer Security (mTLS) certificates for enhanced security. Set these environment variables before you launch Claude Code. Variables exported in your shell are read once at startup, so a running session doesn’t pick up later changes to your shell environment.
+Claude Code supports various enterprise network and security configurations through environment variables. Set these environment variables before you launch Claude Code. Variables exported in your shell are read once at startup, so a running session doesn’t pick up later changes to your shell environment.
All environment variables shown on this page can also be configured in [`settings.json`](</docs/en/settings>).
+
+When you [sign in to a remote MCP server](</docs/en/mcp#authenticate-with-remote-mcp-servers>), Claude Code applies your proxy, CA, and client certificate variables to the sign-in requests it sends. For [`claude mcp login`](</docs/en/mcp#authenticate-from-the-command-line>), set the variables in your shell, `~/.claude/settings.json`, or a [managed settings file](</docs/en/managed-settings#deploy-a-managed-settings-file>), not in project or local settings.
## Proxy configuration
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -34,7 +34,7 @@
You want to| Start with| Isolation needed| Notes
---|---|---|---
Review every action yourself| Manual mode: `claude --permission-mode default`| None| Sensitive work, unfamiliar code
-Iterate locally with fewer prompts, without a classifier| Manual mode plus the Bash sandbox in [auto-allow mode](</docs/en/sandboxing#sandbox-modes>): `claude --permission-mode default`, then run `/sandbox` and select auto-allow| The built-in Bash sandbox, on macOS, Linux, and WSL2| Deny rules still apply, and ask rules that name a command, such as `Bash(git push *)`, still prompt. [Auto-allow mode](</docs/en/sandboxing#auto-allow-mode>) covers other commands that can prompt. To turn the sandbox on from a settings file instead, set [`sandbox.enabled`](</docs/en/settings-reference#sandbox-enabled>) to `true`
+Iterate locally with fewer prompts, without a classifier| Manual mode plus the Bash sandbox in [auto-allow mode](</docs/en/sandboxing#sandbox-modes>): `claude --permission-mode default`, then run `/sandbox` and select auto-allow| The built-in Bash sandbox, on macOS, Linux, and WSL2| Deny rules still apply, and ask rules that name a command, such as `Bash(git push *)`, still prompt. [Auto-allow mode](</docs/en/sandboxing#auto-allow-mode>) covers other commands that can prompt. To turn the sandbox on from a settings file instead, set [`sandbox.enabled`](</docs/en/settings-reference#sandbox-enabled>) and [`sandbox.autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) to `true`
Explore before changing anything| `claude --permission-mode plan`| None| Claude Code blocks edits until you approve a plan
Work hands-off in auto mode| `claude --permission-mode auto`, the built-in starting permission mode with v2.1.283 or later| None; a sandbox or container adds defense in depth| Requires a supported model, and your organization can turn auto mode off
Run in CI with an exact allowlist| `claude -p "run the test suite" --permission-mode dontAsk --allowedTools "Bash(npm test)" "Read"`| None beyond what your CI runner provides| [Cloud sessions](</docs/en/claude-code-on-the-web>) ignore `dontAsk` from settings files
@@ -242,8 +242,10 @@
* **Plan** : All plans.
* **Organization** : on Team and Enterprise, auto mode is available by default. Administrators can turn it off for the organization by setting `permissions.disableAutoMode` to `"disable"` in [managed settings](</docs/en/managed-settings>).
- * **Model** : on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Claude Opus 4.6 or later, Sonnet 4.6 or later, Haiku 5.5, or a [Fable model](</docs/en/model-config#work-with-fable>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, only Claude Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and the Fable models. Older models, including Sonnet 4.5, Opus 4.5, Haiku 4.5, and claude-3 models, are not supported on any provider.
- * **Provider** : available by default on the Anthropic API, Claude Platform on AWS, Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in Claude apps gateway sessions.
+ * **Provider and model** : available by default on these providers, with these models:
+ * **Anthropic API,[Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>)**: Claude Opus 4.6 or later, Sonnet 4.6 or later, Haiku 5.5, or a [Fable model](</docs/en/model-config#work-with-fable>)
+ * **Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in[Claude apps gateway](</docs/en/claude-apps-gateway>) sessions**: only Claude Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and the Fable models
+Older models, including Sonnet 4.5, Opus 4.5, Haiku 4.5, and claude-3 models, are not supported on any provider.
If Claude Code reports auto mode as unavailable, first check these requirements and whether any settings file sets [`disableAutoMode`](</docs/en/settings-reference#disableautomode>). Anthropic may also have turned auto mode off server-side, or the server may have rejected auto mode for your account. A session that received either answer keeps auto mode off until the session ends, so start a new session later. A separate message that names a model and says auto mode “cannot determine the safety” of an action means a classifier request failed. That failure is usually transient, but on Amazon Bedrock it can repeat until your account can invoke the named model. See the [error reference](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) for the causes and what to do. If you set `defaultMode: "auto"` in [settings](</docs/en/settings-reference#all-settings>) and a terminal session starts in Manual mode with no error, the setting is likely in `.claude/settings.json` or `.claude/settings.local.json`. `auto` doesn’t take effect from those files. Move it to `~/.claude/settings.json`. For a conversation the VS Code extension started, check the extension’s own list in Switch permission modes instead.
@@ -451,6 +453,7 @@
* When Claude reads an [artifact someone else made](</docs/en/artifacts#read-an-artifact-shared-with-you>), the approval cases listed in that section apply
* A read from a [network path](</docs/en/permissions#network-paths>) prompts you
3. Everything else goes to the classifier, apart from critical-path removals under their default handling. The connector tools and `requiresUserInteraction` MCP tools that prompt you directly in step 1 never reach the classifier either, so neither an org-required approval nor a consent step is auto-approved
+ * With [Code Mode](</docs/en/code-mode#permission-checks>) on, Claude’s code goes to the classifier once before it runs, and the tool calls inside it don’t. You can still block a call with a `deny` rule or require a prompt with an `ask` rule, but Claude can run Bash commands in [forms the rules don’t match](</docs/en/permissions#bash-rule-limits>)
4. If the classifier blocks, Claude receives the reason. In most sessions the reason names the rule the classifier matched, such as `[Data Exfiltration]`, rather than giving a written explanation; see [Review denials](</docs/en/auto-mode-config#review-denials>)
A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can also approve an action. For the cases where its approval doesn’t get past your rules and hooks, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).For how [Claude in Chrome](</docs/en/chrome>) browser actions get approved in the VS Code extension, see [Permission prompts in VS Code sessions](</docs/en/chrome#permission-prompts-in-vs-code-sessions>).On entering auto mode, broad allow rules that grant arbitrary code execution are dropped:
--- a/permissions.md
+++ b/permissions.md
@@ -16,7 +16,7 @@
Deny rules
-If a deny rule from `disallowed_tools` or from a settings file the SDK loads matches, the call is denied and [`canUseTool`](</docs/en/agent-sdk/user-input>) isn’t called. The call is denied this way even in `bypassPermissions` mode and when a hook returned `allow`.In the TypeScript SDK, if you set the `permission_policy` of a [custom tool](</docs/en/agent-sdk/custom-tools#require-approval-for-specific-tools>) to [`always_deny`](</docs/en/agent-sdk/typescript#mcpservertoolpolicy>), a call to that tool is denied at this step.
+If a deny rule from `disallowed_tools` or from a settings file the SDK loads matches, the call is denied and [`canUseTool`](</docs/en/agent-sdk/user-input>) isn’t called. The call is denied this way even in `bypassPermissions` mode and when a hook returned `allow`.
3
--- a/python.md
+++ b/python.md
@@ -767,7 +767,7 @@
`allowed_tools`| `list[str]`| `[]`| Tools to auto-approve without prompting, apart from reads from [network paths](</docs/en/permissions#network-paths>). This does not restrict Claude to only these tools. If you name one of the [task-tracking tools](</docs/en/agent-sdk/todo-tracking#model-availability>) here, Claude Code also opts the session in. Other unlisted tools fall through to `permission_mode` and `can_use_tool`. Use `disallowed_tools` to block tools. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>)
`system_prompt`| `str | SystemPromptPreset | SystemPromptCustom | SystemPromptFile | None`| `None`| System prompt configuration. Pass a string for a custom prompt, `{"type": "preset", "preset": "claude_code"}` for Claude Code’s system prompt with optional `"append"`, `{"type": "custom", "prompt": "..."}` for a custom prompt that can also set `"snapshot"`, or `{"type": "file", "path": "..."}` to load a large prompt from disk. See `SystemPromptPreset`, `SystemPromptCustom`, and `SystemPromptFile`
`mcp_servers`| `dict[str, McpServerConfig] | str | Path`| `{}`| MCP server configurations or path to config file
-`strict_mcp_config`| `bool`| `False`| When `True`, use only the servers passed in `mcp_servers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Maps to the CLI `--strict-mcp-config` flag
+`strict_mcp_config`| `bool`| `False`| When `True`, use the servers passed in `mcp_servers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Maps to the CLI `--strict-mcp-config` flag
`permission_mode`| `PermissionMode | None`| `None`| Permission mode for tool usage
`continue_conversation`| `bool`| `False`| Continue the most recent conversation
`resume`| `str | None`| `None`| Session ID to resume
@@ -787,7 +787,7 @@
`add_dirs`| `list[str | Path]`| `[]`| Additional directories Claude can access. The SDK passes each entry to Claude Code as `--add-dir`, so with the `project` setting source Claude Code also [loads the directory’s skills, commands, and subagents](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>)
`env`| `dict[str, str]`| `{}`| Environment variables merged on top of the inherited process environment. See [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads, and Handle slow or stalled API responses for timeout-related variables. Set `CLAUDE_AGENT_SDK_CLIENT_APP` to identify your app in the User-Agent header
`extra_args`| `dict[str, str | None]`| `{}`| Additional CLI arguments to pass directly to the CLI
-`max_buffer_size`| `int | None`| `None`| Maximum bytes when buffering CLI stdout
+`max_buffer_size`| `int | None`| `None`| Longest single message the SDK accepts from the CLI, in characters. `None` uses 1,048,576. A longer message raises `CLIJSONDecodeError`
`debug_stderr`| `Any`| `sys.stderr`| _Deprecated_ \- The SDK ignores this value. Use the `stderr` callback for CLI stderr output
`stderr`| `Callable[[str], None] | None`| `None`| Callback function for stderr output from CLI
`can_use_tool`| `CanUseTool` ` | None`| `None`| Tool permission callback, invoked only when the [permission flow](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>) falls through to a prompt. Not invoked for calls auto-approved by `allowed_tools`, allow rules, or `permission_mode`. An allow rule doesn’t pre-approve the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>). See `CanUseTool` for details
@@ -1088,7 +1088,7 @@
Field| Type| Description
---|---|---
`signal`| `Any | None`| Reserved for future abort signal support
-`suggestions`| `list[PermissionUpdate]`| Permission update suggestions from the CLI. Bash prompts include a suggestion with the `localSettings` destination, so returning it in `updated_permissions` writes the rule to `.claude/settings.local.json` and persists across sessions.
+`suggestions`| `list[PermissionUpdate]`| Permission update suggestions from the CLI. Bash prompts can include a suggestion with the `localSettings` destination, so returning it in `updated_permissions` writes the rule to `.claude/settings.local.json` and persists across sessions.
`tool_use_id`| `str | None`| Identifier of the specific tool call this prompt is for. Always populated when delivered to `can_use_tool`
`agent_id`| `str | None`| Sub-agent ID when the call originates from a subagent; `None` for the main agent
`blocked_path`| `str | None`| File path that triggered the permission request, when applicable. For example, when a Bash command tries to access a path outside allowed directories
@@ -1501,8 +1501,8 @@
* `is_error`: `True` when the conversation ended in an error state. Always `True` on the `error_*` subtypes. On `subtype="success"` it is `True` in three cases. Check `stop_reason` to tell them apart:
* `"refusal"`: the model declined to respond. Read the refusal text in `result`, or in the preceding `AssistantMessage` when `result` is empty.
* `"tool_deferred_unavailable"`: the [deferred tool](</docs/en/hooks#defer-a-tool-call-for-later>) was no longer available when you resumed the session, for example because its MCP server wasn’t connected. In the two cases below, a prompt you send after resuming counts the same as one passed with the resume:
- * No prompt: the call is still pending. Make the tool available and resume again without a prompt, and the call runs first.
- * A prompt: Claude Code answers it without the tool’s result, and the deferred call is gone. Send a new prompt if you still need the tool called.
+ * No prompt: by default, the call is still pending. Make the tool available and resume again without a prompt, and the call runs first.
+ * A prompt: by default, the prompt doesn’t reach Claude and the call is still pending. To continue without the tool, [drop the call](</docs/en/hooks#resume-when-a-deferred-tool-is-unavailable>).
* Any other value: the turn ended on an error that Claude Code reported in place of a model response, such as an API error. Read `terminal_reason` for the cause, `result` for the message, and `api_error_status` for the HTTP status when the API returned one.
* `api_error_status`: the HTTP status code of the terminating API error. `None` when the turn ended without one. Populated only on `subtype="success"`.
* `result`: text of the final assistant message on `subtype="success"`, or `None` on the `error_*` subtypes. When `subtype="success"` and `is_error=True`, this holds the API error string if one is available but can be empty, so check `api_error_status` and the preceding `AssistantMessage` content for detail.
@@ -1814,7 +1814,7 @@
### `CLIJSONDecodeError`
-Raised when JSON parsing fails.
+Raised when JSON parsing fails, or when one message from the CLI is longer than `max_buffer_size`. To raise the limit and pick up the stopped work, see [Large tool calls and results](</docs/en/agent-sdk/troubleshooting#large-tool-calls-and-results>).
class CLIJSONDecodeError(ClaudeSDKError):
def __init__(self, line: str, original_error: Exception):
@@ -2193,7 +2193,7 @@
### Hook Usage Example
-This example registers two hooks: one that blocks dangerous Bash commands like `rm -rf /`, and another that logs all tool usage for auditing. With its [`Bash` matcher](</docs/en/agent-sdk/hooks#matchers>), the security hook runs on Bash tool calls. The logging hook has no matcher, so it runs on every tool call.
+This example registers two hooks: one that blocks dangerous Bash commands like `rm -rf /`, and another that logs all tool usage for auditing. With its [`Bash` matcher](</docs/en/agent-sdk/hooks#matchers>), the security hook runs on Bash tool calls. The logging hook has no matcher, so it matches every tool.
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, HookMatcher, HookContext
@@ -3068,14 +3068,14 @@
Property| Type| Default| Description
---|---|---|---
`enabled`| `bool`| `False`| Enable sandbox mode for command execution
-`autoAllowBashIfSandboxed`| `bool`| `True`| Auto-approve bash commands when sandbox is enabled
+[`autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>)| `bool`| `False`| Auto-approve Bash commands when sandbox is enabled. The `False` default requires Python SDK v0.2.182 or later
`excludedCommands`| `list[str]`| `[]`| Commands that bypass sandbox restrictions, such as `["docker *"]`. These run unsandboxed automatically without model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies
`allowUnsandboxedCommands`| `bool`| `True`| Allow the model to request running commands outside the sandbox. When `True`, the model can set `dangerouslyDisableSandbox` in tool input, which falls back to the permissions system
`network`| `SandboxNetworkConfig`| `None`| Network-specific sandbox configuration
`ignoreViolations`| `SandboxIgnoreViolations`| `None`| Configure which sandbox violations to ignore
`enableWeakerNestedSandbox`| `bool`| `False`| Enable a weaker nested sandbox for compatibility
-The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. By default, when `enabled` is `True` but the sandbox can’t start, commands run unsandboxed with a warning on stderr. This default differs from the TypeScript SDK, where `failIfUnavailable` defaults to `true`.Set `"failIfUnavailable": True` in your sandbox settings to stop instead. The SDK forwards `failIfUnavailable` to Claude Code along with the declared `SandboxSettings` fields. `query()` then reports a `ResultMessage` with `subtype="error_during_execution"` and the reason in `errors`. Because this is a single-shot `query()` call, the SDK raises after yielding that error result, so wrap the loop in a try block to continue past it. See [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>) for the error contract.
+The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. By default, when `enabled` is `True` but the sandbox can’t start, commands run unsandboxed with a warning on stderr. This default differs from the TypeScript SDK, where `failIfUnavailable` defaults to `true`.Set `"failIfUnavailable": True` in your sandbox settings to stop instead. With `failIfUnavailable` set, `query()` raises a `ResultError` when the sandbox can’t start, so wrap your `async for` loop in a `try` block. The reason is in the exception’s `errors` list. The SDK forwards `failIfUnavailable` to Claude Code along with the declared `SandboxSettings` fields.
To keep sandboxed commands from writing to a file, list its absolute path under [`denyWrite`](</docs/en/settings-reference#sandbox-filesystem-denywrite>) in your sandbox settings, such as `"filesystem": {"denyWrite": ["/home/user/project/.env"]}`. The SDK forwards `filesystem` to Claude Code along with the declared `SandboxSettings` fields. Once the sandbox starts, it blocks writes to each absolute path you listed.
@@ -3100,8 +3100,8 @@
):
print(message)
except Exception as error:
- # A single-shot query() raises after yielding an error result,
- # such as when failIfUnavailable is set and the sandbox can't start.
+ # query() raises, for example, when failIfUnavailable is set
+ # and the sandbox can't start.
print(f"Session ended with an error: {error}")
asyncio.run(main())
--- a/quickstart.md
+++ b/quickstart.md
@@ -287,7 +287,7 @@
`Read`, `Edit`, `Glob`| Analyze and modify code
`Read`, `Edit`, `Bash`, `Glob`, `Grep`| Full automation
-**Permission modes** control how much human oversight you want. The SDK evaluates the active mode together with your allow and deny rules in a fixed order, described in [How permissions are evaluated](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>). For the full list of modes, their behavior, and when to use each, see [Permission mode in How the agent loop works](</docs/en/agent-sdk/agent-loop#permission-mode>).
+To limit the agent’s built-in tools to one of these sets, pass it as `tools`. If you list a set in `allowedTools` instead, you [pre-approve those tools](</docs/en/agent-sdk/custom-tools#configure-allowed-tools>), and the agent can still call the others, subject to your permission mode. **Permission modes** control how much human oversight you want. The SDK evaluates the active mode together with your allow and deny rules in a fixed order, described in [How permissions are evaluated](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>). For the full list of modes, their behavior, and when to use each, see [Permission mode in How the agent loop works](</docs/en/agent-sdk/agent-loop#permission-mode>).
## Next steps
--- a/reference.md
+++ b/reference.md
@@ -186,7 +186,18 @@
### Mods API calls
-Every mods API method is also an event, named for its namespace and method, such as `fs.read`, `model.complete`, or `ui.open`. A hook on one intercepts calls from the mods that run after it, and can return `next(e)`, `{ deny: reason }`, or `{ value }`.
+Every mods API method is also an event, named for its namespace and method, such as `fs.read`, `model.complete`, or `ui.open`. A hook on one can return `next(e)`, `{ deny: reason }`, or `{ value }`. Some of these events also fire for Claude Code’s own actions, so check whether `next.origin.plugin` is `engine` before you refuse one.
+
+#### Fields on Claude Code’s own `http.fetch` requests
+
+In an `http.fetch` hook, a `next.origin` of `{ plugin: 'engine', tier: 'core' }` marks one of Claude Code’s own requests, such as a model request, not a mod’s `$.http.fetch` call. Where the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) is loaded, your hook doesn’t get these events unless your mod [counts as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>). On these events, `e.init` and the `value` that `next(e)` resolves to can hold these fields, among others:
+
+Field| What it means
+---|---
+`e.init.compress`| Set when Claude Code compresses the body after your hook. `e.init.body` holds the uncompressed body. To send the body uncompressed, call `next({ ...e, init: { ...e.init, compress: undefined } })`.
+`value.isStreaming`| Set to `true` because Claude Code reads the response body itself, so `value.text` is empty. Read `value.status` and `value.headers` instead. To answer with your own `text`, return a `value` without `isStreaming`.
+
+These events and fields require Claude Code v2.1.321 or later.
## Mods API methods
@@ -198,7 +209,7 @@
[`$.ui`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `resolve`, `invalidate`, `open`, `close`, `panes`, [`place`](</docs/en/plugins/mods/interface#place-a-row-in-the-transcript>), `focus`, `scroll`, `toast`, `notify`, `status`, `log`, `notice`, `ask`, `copy`, `selection`, `blit`, `view`. `view` requires Claude Code v2.1.300 or later and `place` v2.1.314 or later.
[`$.theme`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `set`, `clear`: set a backdrop for the Desktop or mobile app to draw, and take the backdrop off. Requires Claude Code v2.1.319 or later.
[`$.command`](</docs/en/plugins/mods/api#add-a-command>)| `register`, `run`, `list`
-[`$.tool`](</docs/en/plugins/mods/api#add-a-tool>)| `register`, `call`, `check`, `list`
+[`$.tool`](</docs/en/plugins/mods/api#add-a-tool>)| `register`, `call`, `check`, `list`. When a `call` needs a person’s approval, such as one a hook or your organization answers with `ask`, it resolves with `{ deny: "<tool> wasn't run: this call needs a person's approval, and a mod's own call can't ask for it." }`, where `<tool>` is the tool’s name.
`$.agent`| `register`, `spawn`, `list`. `list()` returns this session’s subagents and teammates, each with a `status` of `pending`, `running`, `waiting`, `idle`, `completed`, `failed`, or `killed`, where `idle` and `waiting` require Claude Code v2.1.289 or later.
[`$.model`](</docs/en/plugins/mods/api#call-a-model>)| `complete`, `fork`, `classify`
[`$.prompt`](</docs/en/plugins/mods/api#start-a-turn-from-a-background-job>)| `submit`, `read`, `fill`, `suggest`, `compose`. Claude reads text from `submit({ text })` after a sentence that names your mod as the sender. `submit({ text, asUser: true })` sends the text as the user’s own words, without that sentence.
@@ -224,9 +235,10 @@
Site| `e.props`| `e.requestId`| Rendered on
---|---|---|---
[`Pane`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `title`, `isFocused`, `bodyColumns`, `placement`, `scroll`, `view`| The pane’s `id`| Terminal, Desktop, VS Code
-[`AbovePrompt`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `hasSurvey`, `isWorking`, `maxRows`, `bodyColumns`, `scroll`, `view`| One instance| Terminal, Desktop
+[`AbovePrompt`](</docs/en/plugins/mods/interface#pick-where-to-draw>)| `hasSurvey`, [`isCollapsed`](</docs/en/plugins/mods/interface#when-the-user-collapses-the-band>), `isWorking`, `maxRows`, `bodyColumns`, `scroll`, `view`| One instance| Terminal, Desktop
+`AbovePromptList`, the stack of `AbovePrompt` rows| `rows`, a list with one `{ plugin, tree }` for each mod’s row, plus the `AbovePrompt` props| One instance| Terminal, Desktop. Requires Claude Code v2.1.323 or later.
[`Placed`](</docs/en/plugins/mods/interface#place-a-row-in-the-transcript>)| `id`, `plugin`, `onScreen`| The `requestId` that `$.ui.place` returned| Terminal
-[`Backdrop`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `id`, `plugin`, `glass`, `colorScheme`| `backdrop`| `desktop` and `mobile` surfaces. Your hook runs when the Desktop or mobile app asks to draw a backdrop.
+[`Backdrop`](</docs/en/plugins/mods/interface#put-a-backdrop-behind-the-conversation>)| `scene`, `plugin`, `glass`, `overrideColorScheme`. Before v2.1.323, `scene` was `id` and `overrideColorScheme` was `colorScheme`.| `backdrop`| `desktop` and `mobile` surfaces. Your hook runs when the Desktop or mobile app asks to draw a backdrop.
`UserMessage`| `text`, `origin`, `isExpanded`, and `task` or `from` by origin| The drawn row’s id| Terminal, Desktop, VS Code
`AssistantMessage`| The reply’s text| The drawn row’s id| Terminal, Desktop, VS Code
`ToolUse`, `ToolResult`, `ToolGroup`| The tool’s name, input, and result| The tool call id| Terminal, Desktop, VS Code
@@ -271,7 +283,7 @@
* **`action`** : names one of Claude Code’s own [keybinding actions](</docs/en/keybindings>), and the user’s binding for it presses the button when that binding is a chord or a modified key
* **Digit hotkeys on the band** : a digit `hotkey` on a button in the band also fires when the user types that digit alone into an empty prompt and pauses
* **A collapsed band** : while the band is [collapsed](</docs/en/plugins/mods/interface#when-the-user-collapses-the-band>), neither an `action` binding nor a hotkey presses a button in it
- * **Two buttons on one hotkey** : when two buttons in one drawing name the same `hotkey`, the later one gets it
+ * **Two buttons on one hotkey** : when two of your buttons in one drawing name the same `hotkey`, the later one gets it. For another mod’s button on the same key, see [Hotkeys do nothing](</docs/en/plugins/mods/troubleshoot#hotkeys-do-nothing>).
* **`variant`** : `primary` or `secondary`, and any other value throws. In the terminal, a `primary` button draws in the accent color unless it’s `plain`.
* **`role`** : `dismiss` marks a close button, and any other value throws. Do the closing in your `onPress`. In a band that holds text and a row of buttons, the Desktop app can draw the row’s first `dismiss` button as its own close control. The terminal draws the button as it would without `role`.
@@ -367,6 +379,7 @@
Nesting depth of one tree| 32 levels below the root element
Elements and text children in one tree| 20,000
`Raster` cells in one tree, each `Raster`’s `columns` times its `rows`| 262,144
+The rows above the prompt, stacked| Elements, `Raster` cells, and `Image` bytes add up across the rows, against the limits for one tree
PNG or RGBA bytes of all the `Image`s in one tree| 2 MiB
`$.store`| 4 MiB of JSON in total
`$.session.messages()`| The newest 4,096 entries
@@ -378,7 +391,7 @@
Nesting depth of a changed event passed to `next`, outside async generator hooks such as one on `turn.step`| 28,000 levels. Past that, `next` rejects with a message ending `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later.
Nesting depth of a hook’s return value, outside `ui.render`, `ui.resolve`, and async generator hooks| 28,000 levels. Past that, the hook’s result is refused, and [the notice that reports it](</docs/en/plugins/mods/troubleshoot#find-out-why-a-mod-does-nothing>) includes `nesting deeper than 28000 levels is not supported`. Requires Claude Code v2.1.299 or later.
Scopes, such as functions, blocks, and loops, nested inside one another in one file of a hooks module| 2,000
-Command, tool, subagent type, and pane names, and the `id` of a placed row or a backdrop| Letters, digits, `_`, and `-`, up to 64 characters
+Command, tool, subagent type, and pane names, the `id` of a placed row, and the `scene` of a backdrop| Letters, digits, `_`, and `-`, up to 64 characters
One `claude plugin test` test| 5 seconds unless the test sets `timeoutMs`
## Settings and environment variables
@@ -388,7 +401,7 @@
Name| Where| What it does
---|---|---
`CLAUDE_CODE_PLUGIN_DIRS`| Environment, or `env` in `~/.claude/settings.json`| Plugin directories to load as `--plugin-dir` does, for apps you can’t pass a flag to. Absolute paths separated by `:`, or `;` on Windows.
-`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Environment| `1` makes a long-running non-interactive session reload `--plugin-dir` mods on save
+`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Environment| Whether mods reload on save. See the [environment variables reference](</docs/en/env-vars>) for the defaults and values
`prependPlugins`, `appendPlugins`| Managed settings. User settings only on a machine with no managed settings or [`managed-mcp.json`](</docs/en/managed-mcp#deploy-managed-mcp-json>) file, in a session whose credential isn’t a Team or Enterprise `/login`.| Lists of plugin ids, such as `acme-guard@acme-tools`. Mods in `prependPlugins` run before every mod a user installs, and mods in `appendPlugins` run after, in the listed order. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>).
`allowManagedModsOnly`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Only mods that [count as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>), and mods built into Claude Code, run their hooks. Users’ settings hooks keep running.
`allowModsToOverrideDenyRules`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Lets a mod a user installed approve a tool call past most of [the outcomes that stay in place by default](</docs/en/permissions#precedence-among-rules-hooks-and-mods>), including a `deny` rule
--- a/remote-control.md
+++ b/remote-control.md
@@ -132,6 +132,7 @@
A connected device shows the conversation in your terminal as it happens. These cases go beyond ordinary messages:
* **Compaction and`/clear`**: while Claude Code [compacts the conversation](</docs/en/context-window#what-survives-compaction>), connected devices show the progress and then where the conversation was compacted. When you run `/clear`, the conversation resets on connected devices too.
+ * **Disconnecting after`/resume` or `/teleport`**: if the connected session has a [share link](</docs/en/claude-code-on-the-web#share-sessions>), or Claude Code can’t check for one, Remote Control disconnects when either command opens another conversation. People with the link would otherwise see that conversation. To connect the new conversation, run `/remote-control` in your terminal. The share link check requires Claude Code v2.1.324 or later.
* **Switching conversations with`/resume`**: the connected device doesn’t receive the switched-to conversation’s title or earlier history, but new messages in both directions go to and from whichever conversation is open in your terminal. To work on the original conversation from the device again, run `/resume` in your terminal and switch back to it.
* **Pulling a session with`/teleport`**: when you pull a [cloud session](</docs/en/claude-code-on-the-web#from-cloud-to-terminal>) into your terminal with `/teleport`, the connected device doesn’t receive the pulled conversation’s earlier history. New messages in both directions go to and from the pulled conversation, which is now the one open in your terminal.
* **Messages from your other sessions** : with [cross-session messaging](</docs/en/cross-session-messaging>), the same connection carries messages between your own sessions on different machines.
@@ -293,14 +294,14 @@
* **Crashed sessions in server mode** : if a session served by `claude remote-control` crashes, send it a message from a connected device. Claude Code serves it again. You don’t have to restart the server. Requires Claude Code v2.1.238 or later.
* **HTTP 403 refusals on a connected session** : once an interactive session is connected, Claude Code keeps retrying for up to three minutes when something between your machine and Anthropic’s servers answers with HTTP 403, as can happen after a VPN or network change. If the refusals last longer, Claude Code disconnects, and the reason names what refused: a network edge, or a proxy, VPN, or firewall on your own network.
* **Extended network outage** : if your machine is awake but can’t reach the network, what you do next depends on the mode:
- * **Server mode** : Claude Code gives up after roughly 10 minutes and the `claude remote-control` process exits. Run `claude remote-control` again to start a new session.
+ * **Server mode** : Claude Code gives up after roughly 10 minutes and the `claude remote-control` process exits. To restart the server, see Resume sessions after stopping the server.
* **Interactive session** : keep working locally. Claude Code retries for as long as the outage lasts and reconnects on its own when the network returns.
* **Attachments that don’t download** : if a file you attach from your phone or browser can’t be downloaded to your machine, Claude still receives your message and the files that were downloaded. In place of the missing files, Claude Code adds a note such as `[1 of 3 attachments did not arrive]` to the message.
* **Presence heartbeats failing** : if an interactive session disconnects with `could not reach the Remote Control server for about 30 minutes`, run `/remote-control` to reconnect.
* **Forwarded dialogs expire** : Claude Code keeps permission prompts and `AskUserQuestion` questions open until you answer them. When Claude Code forwards another kind of dialog to the remote session, such as the model-choice prompt shown after a safety refusal, it waits five minutes by default, then closes the dialog and continues with the dialog’s no-action default. Set [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) to adjust or disable the deadline. Requires Claude Code v2.1.224 or later.
* **The Fable usage-credits consent prompt isn’t forwarded** : Claude Code shows the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) only where the session runs, not on your device. When the session runs in a terminal and nobody there answers before Claude Code closes the prompt, the turn ends without sending the request; see [The prompt to confirm went unanswered](</docs/en/errors#the-prompt-to-confirm-went-unanswered>).
* **Some commands are local-only** : commands that only run in the terminal interface, such as `/plugin` or `/resume`, work only from the local CLI, whether or not you pass an argument. `/claude-api` is also unavailable when you type it from mobile or web. Claude can still [load that skill on its own](</docs/en/skills#work-on-claude-api-projects>) there. The following work from mobile and web:
- * Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits`, `/recap`, and `/reload-plugins`. `/usage-credits` prints the billing URL instead of opening a browser. `/reload-plugins` works only when the session runs in an interactive terminal; a session without one declines it.
+ * Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits`, `/recap`, and `/reload-plugins`. `/usage-credits` replies in text, such as where to manage usage credits. `/reload-plugins` works only when the session runs in an interactive terminal; a session without one declines it.
* `/model`, `/effort`, `/fast`, `/color`, and `/rename`: pass the value as an argument, for example `/model sonnet` or `/effort high`. From mobile and web, `/model` and `/effort` take the argument in place of the terminal picker or slider.
* `/mcp`: from the mobile app, returns a text summary of server status instead of opening the picker. On the web, `/mcp` on its own opens a directory of [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) instead of returning the summary. The `reconnect`, `enable`, and `disable` [subcommands](</docs/en/commands#all-commands>) work from both when the session runs in an interactive terminal. `/mcp reconnect` with no server name retries every server that has failed or needs authentication. To authorize a claude.ai connector without the picker, see Authorize a connector again from your shell.
* `/config`: from the mobile app, pass `key=value` to set a setting, or run it with no argument to list the keys you can set. On the web, `/config` opens **Settings > Code** or **Settings > Claude Code** instead.
--- a/sandbox-environments.md
+++ b/sandbox-environments.md
@@ -25,7 +25,7 @@
You want to| Start with
---|---
-Reduce permission prompts during everyday work on your own machine| The [sandboxed Bash tool](</docs/en/sandboxing>), configured with `/sandbox`
+Reduce permission prompts during everyday work on your own machine| The [sandboxed Bash tool](</docs/en/sandboxing>) in auto-allow mode, configured with `/sandbox`
Let Claude work unattended with `--dangerously-skip-permissions` or auto mode| The preconfigured [dev container](</docs/en/devcontainer>), any container or VM, or the sandbox runtime
Isolate MCP servers and hooks as well as Bash, without Docker| The sandbox runtime
Standardize a sandboxed environment across a team| The preconfigured [dev container](</docs/en/devcontainer>), copied into your repository
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -1,4 +1,4 @@
-The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs on your machine. You set which files and network domains those commands can reach, and the limits apply to Bash, PowerShell, and Monitor commands and the processes they start. Because the operating system applies the limits while a command runs, Claude Code can run sandboxed commands without asking you to approve each one. The sandbox covers shell commands only. Claude’s file tools, MCP servers, and hooks run outside it. The sandbox runs on macOS, Linux, and WSL2. On native Windows, Claude Code runs commands unsandboxed. To use the sandbox on a Windows machine, run Claude Code inside a WSL2 distribution.
+The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs on your machine. You set which files and network domains those commands can reach, and the limits apply to Bash, PowerShell, and Monitor commands and the processes they start. Sandboxed commands still go through the regular permission flow unless you choose auto-allow mode, which can run them without asking you. The sandbox covers shell commands only. Claude’s file tools, MCP servers, and hooks run outside it. The sandbox runs on macOS, Linux, and WSL2. On native Windows, Claude Code runs commands unsandboxed. To use the sandbox on a Windows machine, run Claude Code inside a WSL2 distribution.
This page covers the sandbox around shell commands on your own machine. Other pages cover related questions:
@@ -304,10 +304,7 @@
`credentials.envVars` `deny` and `mask` entries| Enforced. Environment variable scrubbing is independent of the filesystem layer
`credentials.files` `mask` entries applied as masks| Enforced: masking is independent of the filesystem layer. An entry that fell back to `deny` is not enforced, like any `deny` entry
-Two other things change:
-
- * Sandboxed commands inherit your shell’s `$TMPDIR` instead of the per-user temp directory, because every temp directory is writable and Claude Code no longer redirects commands to the per-user one. On Linux the variable is often unset in the parent shell. The Bash tool guidance tells Claude to create scratch directories with `mktemp -d` instead of relying on `$TMPDIR`.
- * [`autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) still defaults to `true`, so sandboxed commands keep running without prompts. Set it to `false` to prompt for sandboxed commands.
+Sandboxed commands also inherit your shell’s `$TMPDIR` instead of the per-user temp directory, because every temp directory is writable and Claude Code no longer redirects commands to the per-user one. On Linux the variable is often unset in the parent shell. The Bash tool guidance tells Claude to create scratch directories with `mktemp -d` instead of relying on `$TMPDIR`.
### Protect credentials
@@ -859,7 +856,7 @@
}
}
-This turns on auto-allow mode. For regular permissions mode, also set [`sandbox.autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) to `false`. The change takes effect in your running session at the next shell command Claude runs, and the **Mode** tab of `/sandbox` then marks the mode in effect.
+This turns on regular permissions mode. For auto-allow mode, also set [`sandbox.autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) to `true`. The change takes effect in your running session at the next shell command Claude runs, and the **Mode** tab of `/sandbox` then marks the mode in effect.
## Limitations
--- a/secure-deployment.md
+++ b/secure-deployment.md
@@ -86,7 +86,7 @@
--network none \
--memory 2g \
--cpus 2 \
- --pids-limit 100 \
+ --pids-limit 600 \
--user 1000:1000 \
-v /path/to/code:/workspace:ro \
-v /var/run/proxy.sock:/var/run/proxy.sock:ro \
@@ -103,7 +103,7 @@
`--tmpfs /tmp:...`| Provides a writable temporary directory that’s cleared when the container stops
`--network none`| Cuts the container off from external networks
`--memory 2g`| Limits memory usage to prevent resource exhaustion
-`--pids-limit 100`| Limits process count to prevent fork bombs
+`--pids-limit 600`| Limits processes and threads to prevent fork bombs
`--user 1000:1000`| Runs as a non-root user
`-v ...:/workspace:ro`| Mounts code read-only so the agent can analyze but not modify it. **Avoid mounting sensitive host directories like`~/.ssh`, `~/.aws`, or `~/.config`**
`-v .../proxy.sock:...`| Mounts a Unix socket connected to a proxy running outside the container (see below)
--- a/security.md
+++ b/security.md
@@ -17,7 +17,7 @@
To mitigate risks in agentic systems:
- * **Sandboxed bash tool** : [Sandbox](</docs/en/sandboxing>) bash commands with filesystem and network isolation, reducing permission prompts while maintaining security. Configure with `/sandbox` to define boundaries where Claude Code can work autonomously
+ * **Sandboxed Bash tool** : [Sandbox](</docs/en/sandboxing>) Bash commands with filesystem and network isolation. Configure with `/sandbox`
* **Working directory boundary** : In Manual mode, Claude Code asks you before its file tools read or write outside the folder where it was started and its subfolders. The boundary is a permission prompt, so a Bash command you approve can still write anywhere your user account can
* To read a folder without the prompt, add it as an [additional directory](</docs/en/permissions#working-directories>)
* To restrict Bash commands at the operating system level, turn on [sandboxing](</docs/en/sandboxing#filesystem-isolation>)
@@ -54,7 +54,7 @@
* **Trust verification** : In an interactive session, Claude Code shows the workspace trust dialog when you start it in a folder you haven’t trusted. Servers in a project’s `.mcp.json` have their own approval prompt, and [Project scope](</docs/en/mcp#project-scope>) lists the sessions that skip it
* Note: A `-p` session shows neither prompt. [What runs before you trust a folder](</docs/en/permissions#what-runs-before-you-trust-a-folder>) lists what a repository’s files can run there
* Note: When you start Claude Code directly in your home directory, trust acceptance is held for the current session only and is not written to disk, so the prompt reappears on each launch. There is no setting to persist it. Start Claude Code from a project subdirectory instead, where trust acceptance is saved per directory
- * **Command injection detection** : In Manual mode, Claude Code asks before running a Bash command it can’t fully analyze. An allow rule for part of a command, such as `Bash(git *)`, doesn’t skip that prompt. [Sandboxed commands](</docs/en/permissions#how-permissions-interact-with-sandboxing>) can run without it
+ * **Command injection detection** : In Manual mode, Claude Code asks before running a Bash command it can’t fully analyze. An allow rule for part of a command, such as `Bash(git *)`, doesn’t skip that prompt. [Sandboxed commands](</docs/en/permissions#how-permissions-interact-with-sandboxing>) in [auto-allow mode](</docs/en/sandboxing#auto-allow-mode>) can run without it
* **Fail-closed matching** : In Manual mode, unmatched commands require approval by default
* **Secure credential storage** : API keys and tokens are stored in the macOS Keychain when available. On Linux they’re stored in a file with mode `0600`, and on Windows in a file that inherits the access controls of your user profile directory. See [Credential Management](</docs/en/authentication#credential-management>)
--- a/self-hosted-environments-deploy.md
+++ b/self-hosted-environments-deploy.md
@@ -95,7 +95,7 @@
* **Listener** : the listener is a forward proxy on `127.0.0.1`. The runner starts the listener before registering with the control plane, and exits at startup if the listener can’t start.
* **Proxy variables** : the runner rewrites whichever of `HTTPS_PROXY` and `HTTP_PROXY` you set so that it points at the listener. That rewritten value reaches the runner itself, its lifecycle hooks, and every session it runs.
- * **Token rotation** : a rotated token takes effect without a restart. For each connection the listener opens to your proxy, the runner runs your command or reads your file again and adds the result as the header.
+ * **Token rotation** : when you rotate the token, new connections carry the new one without a runner restart. For each connection the listener opens to your proxy, the runner runs your command or reads your file again and adds the result as the header. A connection that’s already open stays usable with the old token until your proxy closes it or the runner exits.
* **Session environment** : a session reaches your proxy only through the listener. In each session’s environment the runner removes `ALL_PROXY`, removes any spelling of `HTTPS_PROXY` or `HTTP_PROXY` that you didn’t set, and pins `NO_PROXY` to the runner’s own value.
* **Logs** : the runner never logs the header value.
@@ -724,11 +724,17 @@
### Some sessions don’t count as idle
-A session holding a background task that keeps running doesn’t count as idle, so `--release-idle-session-min` won’t release that session’s slot. A session that’s waiting on an approval requested from inside a running tool call also doesn’t count as idle. Set `--kill-session-after-min` alongside it as a hard backstop. `--kill-session-after-min` is a backstop for runaway sessions. On a runner on v2.1.260 or later, a session that reaches the limit isn’t terminated outright. The runner gives it a grace window, 15 minutes by default, which you can change with [`SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS`](</docs/en/self-hosted-environments-reference#environment-variable-only-settings>):
+While a session doesn’t count as idle, it keeps its slot past the `--release-idle-session-min` limit, so also set `--kill-session-after-min`. A session counts as idle after its turn ends or while its turn waits on its user, but not in cases such as these:
+
+ * Its turn has ended and it isn’t waiting on its user, but a background task keeps running
+ * Its turn waits on an approval that a non-MCP tool requests while that tool runs
+ * Its turn waits on an MCP server’s [`elicitation/create` request](</docs/en/mcp#respond-to-mcp-elicitation-requests>)
+
+`--kill-session-after-min` is a backstop for runaway sessions. On a runner on v2.1.260 or later, a session that reaches the limit isn’t terminated outright. The runner gives it a grace window, 15 minutes by default, which you can change with [`SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS`](</docs/en/self-hosted-environments-reference#environment-variable-only-settings>):
* If the session is waiting on its user, the runner releases it. If its turn has ended and it holds only background tasks, the runner waits up to 60 seconds for those tasks to finish and then releases it. The session resumes when its user sends their next message.
* If a turn is still running, the runner waits for the turn to finish, or for the session to next wait on its user, and then releases it.
- * If the session is still on the runner when the grace window ends, the runner terminates it, and any running turn’s work is lost. A turn waiting on an approval requested from inside a running tool call is one way a session outlasts the window.
+ * If the session is still on the runner when the grace window ends, the runner terminates it, and any running turn’s work is lost. For example, a session can stay on the runner until then if its turn waits on an approval that a non-MCP tool requests while that tool runs. A session can also stay there while its turn waits on an MCP server’s `elicitation/create` request.
A released session resumes from a fresh clone, so work it hadn’t pushed is gone either way; see Resumed sessions lose unpushed work. Before v2.1.260, the runner terminated every session at the limit, after waiting at most the grace window for a running turn to finish. Set the flag above your longest expected session, such as `--kill-session-after-min 480` for 8 hours. To free slots from conversations that go idle, use `--release-idle-session-min` instead.
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -197,7 +197,9 @@
* On a machine where an [endpoint-managed source](</docs/en/managed-settings#choose-a-delivery-mechanism>) lists or enables plugins of its own, a plugin that only a cached list enables counts as [the user’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>), not your organization’s, until the fetch confirms the payload
* Claude Code fetches fresh settings in the background
* If a session’s provider isn’t on the cached [`allowedProviders`](</docs/en/settings-reference#allowedproviders>) list, Claude Code can wait for that fetch and check again before refusing. If the fetch fails, the session is refused
- * Cached settings persist through network failures. If the startup fetch fails, Claude Code warns in interactive sessions and in the Code tab that the cached policy is in effect
+ * Plan for cached settings to expire 24 hours after the last successful fetch
+ * If the startup fetch fails before cached settings expire, Claude Code warns in interactive sessions and in the Code tab that the cached policy is in effect
+ * If the startup fetch fails after cached settings expire, the session starts without server-managed settings, and the warning says that no remote policy applies. To have Claude Code exit instead, set `forceRemoteSettingsRefresh`
* Until a fetch succeeds, the values withheld at startup stay withheld
Claude Code withholds several categories of variables in the cached `env` block until the server confirms the payload for the session. This keeps a cached proxy, certificate authority, endpoint, or credential value from redirecting, intercepting, or re-authenticating the settings fetch that confirms the payload. The hardening applies only to the server-fetched settings cache: [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) deployed through MDM or `managed-settings.json` are unaffected. The withheld categories include:
@@ -208,7 +210,13 @@
* The configuration-directory selector `CLAUDE_CONFIG_DIR`
* Credential-source and configuration-directory selectors, in Claude Code v2.1.223 or later: the Workload Identity Federation variables such as `ANTHROPIC_FEDERATION_RULE_ID` and `ANTHROPIC_IDENTITY_TOKEN`, the profile and configuration-directory selectors `ANTHROPIC_PROFILE` and `ANTHROPIC_CONFIG_DIR`, and the operating-system directory variables `HOME`, `XDG_CONFIG_HOME`, `APPDATA`, and `USERPROFILE`
-Claude Code reads the Workload Identity Federation variables and the `ANTHROPIC_PROFILE` and `ANTHROPIC_CONFIG_DIR` selectors only at startup, so a server-delivered value for them doesn’t switch the session’s credential source even after the fetch succeeds. To deliver those selectors on Claude Code v2.1.223 or later, use [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) such as MDM or `managed-settings.json`. For `CLAUDE_CONFIG_DIR` and the operating-system directory variables, the withholding itself is the protection: the cached value stays out of the environment until the server confirms the payload. Every other key in the cached `env` block applies at startup. Once the server confirms the payload, and you approve it if it needs security approval, the withheld variables apply for the rest of the session. If your organization needs a proxy to reach `api.anthropic.com`, the withholding only affects the server-delivered `env` block itself: a proxy set in an [endpoint-managed](</docs/en/managed-settings#delivery-mechanisms>) `env` block through MDM or `managed-settings.json`, in the shell environment, or in [user settings](</docs/en/settings#where-settings-live>) reaches the settings fetch. The endpoint-managed source requires Claude Code v2.1.223 or later: the cached server-managed proxy value is withheld until the fetch confirms it, so the endpoint-managed value fills in per key and reaches the fetch itself. Before v2.1.223, use the shell environment or user settings so the proxy applies alongside a cached server payload. The first launch has no cache, so an endpoint-managed source, the shell environment, or user settings is still required for the initial fetch. Claude Code applies most settings updates to running sessions without a restart. Some updates apply only at the next launch, including OpenTelemetry exporter configuration, the `model` key, and the removal of a variable from the `env` block.
+Claude Code reads the Workload Identity Federation variables and the `ANTHROPIC_PROFILE` and `ANTHROPIC_CONFIG_DIR` selectors only at startup, so a server-delivered value for them doesn’t switch the session’s credential source even after the fetch succeeds. To deliver those selectors on Claude Code v2.1.223 or later, use [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) such as MDM or `managed-settings.json`. For `CLAUDE_CONFIG_DIR` and the operating-system directory variables, the withholding itself is the protection: the cached value stays out of the environment until the server confirms the payload. Every other key in the cached `env` block applies at startup. Once the server confirms the payload, and you approve it if it needs security approval, the withheld variables apply for the rest of the session. If the fetch needs a proxy, set `HTTPS_PROXY` in one of:
+
+ * An [endpoint-managed](</docs/en/managed-settings#delivery-mechanisms>) `env` block through MDM or `managed-settings.json`. This source requires Claude Code v2.1.223 or later. Before v2.1.223, use the shell environment or user settings so the proxy applies alongside a cached server payload.
+ * The shell environment
+ * [User settings](</docs/en/settings#where-settings-live>)
+
+Set `HTTPS_PROXY` even if `ALL_PROXY` already names the proxy. Claude Code applies most settings updates to running sessions without a restart. Some updates apply only at the next launch, including OpenTelemetry exporter configuration, the `model` key, and the removal of a variable from the `env` block.
### Invalid entries in delivered settings
@@ -229,7 +237,7 @@
### Enforce fail-closed startup
-By default, if the remote settings fetch fails at startup, the CLI continues with the settings cached from the last successful fetch. The values Claude Code withholds stay withheld until a fetch succeeds. On a machine that has never fetched them, the CLI continues without server-managed settings and still applies any [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) on the device. Anthropic can require the settings instead. To stop clients from starting on cached or absent server-managed settings, set `forceRemoteSettingsRefresh: true` in your managed settings. Clients signed in through a Claude apps gateway wait for the startup fetch whether or not you set this, and handle a failed fetch as follows:
+By default, if the remote settings fetch fails at startup, the CLI continues with the settings cached from the last successful fetch, unless they’ve expired. The values Claude Code withholds stay withheld until a fetch succeeds. With expired or no cached settings, the CLI continues without server-managed settings and still applies any [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) on the device. Anthropic can require the settings instead. To stop clients from starting on cached or absent server-managed settings, set `forceRemoteSettingsRefresh: true` in your managed settings. Clients signed in through a Claude apps gateway wait for the startup fetch whether or not you set this, and handle a failed fetch as follows:
* If the gateway answers an attended interactive launch with a `401` and this setting is off, the gateway has ended that sign-in. Claude Code prints [`Cloud gateway session expired — run /login to reconnect.`](</docs/en/errors#cloud-gateway-session-expired>) and opens the session signed out of the gateway until the user runs `/login`.
* When the fetch fails in any other way, or in any other kind of launch except a `claude auth` subcommand, the client exits with an error.
@@ -319,11 +327,11 @@
Scenario| Behavior
---|---
-User edits the cached settings file| Tampered file applies at startup, except for the values Claude Code withholds until the server confirms the payload. The next server fetch restores the correct settings, except for the keys that apply only at the next launch, such as `model` or a variable added to the `env` block, which stay in effect until relaunch
+User edits the cached settings file| A tampered file can apply at startup, except for the values Claude Code withholds until the server confirms the payload. The next server fetch restores the correct settings. A tampered value for a key that applies only at the next launch, such as `model` or a variable added to the `env` block, lasts until relaunch
User deletes the cached settings file| First-launch behavior occurs
User runs a modified Claude Code binary| A user who can run a modified client can bypass any client-side control
User runs an older Claude Code version| Versions that predate server-managed settings don’t fetch or apply them
-API is unavailable| Cached settings apply if available. Without a cache, Claude Code enforces no server-managed settings until the next successful fetch. Fetch and caching behavior lists the exceptions, including when Anthropic requires the settings. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing, except for `claude auth` subcommands. Clients signed in through a Claude apps gateway exit at startup without that setting, with the same `claude auth` exemption
+API is unavailable| Cached settings apply if available and not expired. Without them, Claude Code enforces no server-managed settings until the next successful fetch. Fetch and caching behavior lists the exceptions, including when Anthropic requires the settings. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing, except for `claude auth` subcommands. Clients signed in through a Claude apps gateway exit at startup without that setting, with the same `claude auth` exemption
User authenticates with a different organization| Settings are not delivered for accounts outside the managed organization, including a session that authenticates with a Console API key
User configures a third-party model provider| Server-managed settings are bypassed. This includes setting `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_MANTLE`, `CLAUDE_CODE_USE_VERTEX`, `CLAUDE_CODE_USE_FOUNDRY`, `CLAUDE_CODE_USE_ANTHROPIC_AWS`, or a non-default `ANTHROPIC_BASE_URL`
Network traffic is intercepted or redirected| Disabled TLS validation or intercepted traffic can alter the settings the client receives
--- a/settings-example.md
+++ b/settings-example.md
@@ -230,7 +230,7 @@
* [`allowManagedPermissionRulesOnly`](</docs/en/settings-reference#allowmanagedpermissionrulesonly>) and [`allowManagedMcpServersOnly`](</docs/en/settings-reference#allowmanagedmcpserversonly>) make the managed permission and MCP allowlists the only ones that apply
* `allowedMcpServers` pins the MCP server by URL
* `strictKnownMarketplaces` allows one plugin marketplace
- * `sandbox` sandboxes commands with a fixed network allowlist and no unsandboxed retry. Its `failIfUnavailable` key [stops Claude Code from starting where the sandbox can’t run](</docs/en/sandboxing#enforce-sandboxing-with-managed-settings>)
+ * `sandbox` sandboxes commands with a fixed network allowlist and no unsandboxed retry. Its `failIfUnavailable` key [stops Claude Code from starting where the sandbox can’t run](</docs/en/sandboxing#enforce-sandboxing-with-managed-settings>), except in an Anthropic-hosted environment
* `requiredMinimumVersion` sets a minimum Claude Code version
* `cleanupPeriodDays` shortens retention of session transcripts and other local data to seven days
* `companyAnnouncements` shows a message at startup
Show diff (189 lines)
--- a/settings-reference.md
+++ b/settings-reference.md
@@ -178,7 +178,7 @@
`sandbox.enableWeakerNestedSandbox`| Run the Linux [sandbox](</docs/en/sandboxing>) inside an unprivileged container| Sandbox settings| Any file
`sandbox.enableWeakerNetworkIsolation`| Let `gh`, `gcloud`, and `terraform` verify TLS behind a MITM proxy inside the [sandbox](</docs/en/sandboxing#go-based-clis-fail-tls-verification-on-macos>) on macOS| Sandbox settings| Any file
`sandbox.excludedCommands`| Name commands Claude Code can run outside the [sandbox](</docs/en/sandboxing>)| Sandbox settings| Any file
-`sandbox.failIfUnavailable`| Refuse to start when the [sandbox](</docs/en/sandboxing>) can’t, instead of running unsandboxed| Sandbox settings| Any file
+`sandbox.failIfUnavailable`| Refuse to start when the [sandbox](</docs/en/sandboxing>) can’t, instead of running unsandboxed, except in an Anthropic-hosted environment| Sandbox settings| Any file
`sandbox.filesystem`| Control which paths [sandboxed](</docs/en/sandboxing#filesystem-isolation>) commands can read and write| Sandbox settings| Any file
`sandbox.filesystem.allowManagedReadPathsOnly`| Stop developers from re-opening [read paths your organization blocked](</docs/en/sandboxing#keep-developers-from-widening-the-policy>)| Sandbox settings| Managed
`sandbox.filesystem.allowRead`| Re-open reading inside a region `denyRead` blocks| Sandbox settings| Any file
@@ -275,7 +275,7 @@
"advisorModel": "opus"
}
-The key has no effect on providers where the advisor [isn’t available](</docs/en/advisor#requirements>), such as Amazon Bedrock. On Claude Platform on AWS, the key requires Claude Code v2.1.300 or later. `"fable"` requires [Fable access](</docs/en/advisor#choose-an-advisor-model>).
+The key has no effect on providers where the advisor [isn’t available](</docs/en/advisor#requirements>), such as Amazon Bedrock. On Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>), the key requires Claude Code v2.1.300 or later. `"fable"` requires [Fable access](</docs/en/advisor#choose-an-advisor-model>).
### `alwaysThinkingEnabled`
@@ -407,12 +407,12 @@
* **Default** : unset, so a failed request isn’t retried on another model
* **Per-session overrides** : `--fallback-model` takes precedence over this key for one session
-This example tries Sonnet 5 first, then Haiku 4.5, when your primary model fails:
-
-settings.json
-
- {
- "fallbackModel": ["claude-sonnet-5", "claude-haiku-4-5"]
+This example tries Sonnet 5 first, then Haiku 5.5, when your primary model fails:
+
+settings.json
+
+ {
+ "fallbackModel": ["claude-sonnet-5", "claude-haiku-5-5"]
}
Unlike most array settings, this key doesn’t merge across settings files: the highest-precedence file that defines it supplies the whole chain. If your project file sets `["claude-sonnet-5"]` and your user file sets `["claude-haiku-4-5"]`, the chain is `["claude-sonnet-5"]` only. Claude Code keeps at most three distinct allowed models from the list and ignores the rest. See [Fallback model chains](</docs/en/model-config#fallback-model-chains>).
@@ -824,7 +824,7 @@
}
}
-See [Route all shell commands through the classifier](</docs/en/auto-mode-config#route-all-shell-commands-through-the-classifier>).
+This key works differently in a Code Mode session. See [Suspend shell allow rules](</docs/en/auto-mode-config#route-all-shell-commands-through-the-classifier>).
### `disableAutoMode`
@@ -1238,7 +1238,7 @@
* **Scope** : `Any file`, with [limits on project and local settings](</docs/en/sandboxing#repository-settings-under-an-admin-required-sandbox>)
* **Type** : Boolean
- * `true`: Claude Code exits with an error at startup when `sandbox.enabled` is `true` but the sandbox can’t start. If the sandbox passes that check and then fails to initialize, the session keeps running and Claude Code [refuses each sandboxed command](</docs/en/sandboxing#commands-refused-with-sandbox-is-required>)
+ * `true`: Claude Code exits with an error at startup when `sandbox.enabled` is `true` but the sandbox can’t start. If the sandbox passes that check and then fails to initialize, the session keeps running. Claude Code then [refuses each sandboxed command](</docs/en/sandboxing#commands-refused-with-sandbox-is-required>). A session in an Anthropic-hosted environment can start anyway, with a warning, and doesn’t enforce your `sandbox.filesystem` or `sandbox.network` rules
* `false`: Claude Code runs commands unsandboxed when the sandbox can’t start
* **Default** : `false`
@@ -1257,22 +1257,22 @@
### `sandbox.autoAllowBashIfSandboxed`
-Let Claude Code run sandboxed Bash commands without a permission prompt. Commands that can’t run in the sandbox still go through the regular permission flow, and `deny` rules and content-scoped `ask` rules such as `Bash(git push *)` still apply; a bare `Bash` ask rule is skipped for sandboxed commands. Set it to `false` to send sandboxed commands through the regular permission flow too, which the `/sandbox` **Mode** tab calls regular permissions mode.
+Let Claude Code run sandboxed Bash commands without a permission prompt. Commands that can’t run in the sandbox still go through the regular permission flow. `deny` rules and content-scoped `ask` rules such as `Bash(git push *)` still apply, but a bare `Bash` ask rule is skipped for sandboxed commands. To set it to `true` in managed settings, add it to the `sandbox` block of your [highest-ranked managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>).
* **Scope** : `Any file`
* **Type** : Boolean
* `true`: Claude Code runs sandboxed Bash commands without a permission prompt, except in the cases that [Auto-allow mode](</docs/en/sandboxing#auto-allow-mode>) describes; `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` turns auto-allow off
* `false`: sandboxed commands go through the regular permission flow, so your allow rules and permission mode decide. The `/sandbox` **Mode** tab calls this regular permissions mode
- * **Default** : `true`
-
-This keeps the sandbox on and sends sandboxed commands through the regular permission flow:
+ * **Default** : `false`. Before v2.1.324, the default was `true`
+
+To keep the sandbox on and run sandboxed commands without a permission prompt, set both keys in your `sandbox` block:
settings.json
{
"sandbox": {
"enabled": true,
- "autoAllowBashIfSandboxed": false
+ "autoAllowBashIfSandboxed": true
}
}
@@ -1533,7 +1533,7 @@
}
}
-With the layer off, Claude Code doesn’t enforce `denyRead` or `credentials.files` `deny` entries, while `credentials.envVars` entries and applied `mask` entries keep working. `autoAllowBashIfSandboxed` still defaults to `true`, so set it to `false` to keep prompting. See [Disable filesystem isolation](</docs/en/sandboxing#disable-filesystem-isolation>) for the full list of sources that can set it and what changes when isolation is off.
+With the layer off, Claude Code doesn’t enforce `denyRead` or `credentials.files` `deny` entries, while `credentials.envVars` entries and applied `mask` entries keep working. See [Disable filesystem isolation](</docs/en/sandboxing#disable-filesystem-isolation>) for the full list of sources that can set it and what changes when isolation is off.
### `sandbox.ignoreViolations`
@@ -2324,8 +2324,8 @@
#### How `env` values interact with your shell
- * A value here overwrites the same variable exported in your shell, and when more than one settings file sets a variable, the [highest-precedence](</docs/en/settings#settings-precedence>) one applies. Variables Claude Code ignores in `env` lists the exceptions for project and local settings.
- * When the Claude Desktop app or a [self-hosted environment](</docs/en/self-hosted-environments>) runner starts the session, the launch environment it builds takes precedence instead: Claude Code ignores an `env` value from any settings file for a variable the launch environment already sets. The [debug log](</docs/en/debug-your-config>) names each ignored variable.
+ * A value here overwrites the same variable exported in your shell, and when more than one settings file sets a variable, the [highest-precedence](</docs/en/settings#settings-precedence>) one applies. Variables Claude Code ignores in `env` lists the exceptions.
+ * When the Claude Desktop app or a [self-hosted environment](</docs/en/self-hosted-environments>) runner starts the session, the launch environment it builds takes precedence instead. Claude Code ignores an `env` value from a settings file for a variable that environment already sets. The [debug log](</docs/en/debug-your-config>) can name an ignored variable.
* To cancel a shell export, set the variable to `""`. Claude Code treats an empty value as unset for provider selection, and subprocesses inherit the empty value.
* `NO_COLOR` and `FORCE_COLOR` set here reach only subprocesses. To change Claude Code’s own interface colors, set them in your shell before launching `claude`.
* Values here are plain text in the settings file and reach every subprocess Claude Code starts. For an OTLP bearer token that rotates, use `otelHeadersHelper`; for API credentials, use `apiKeyHelper`.
@@ -2357,6 +2357,7 @@
* [`CLAUDE_CODE_DISABLE_ATTACHMENTS`](</docs/en/env-vars#variables>), which turns off attachment processing.
* [`CLAUDE_CODE_DISABLE_FILE_MENTIONS`](</docs/en/env-vars#variables>), which stops Claude Code from expanding `@` mentions of files and directories.
Before v2.1.251, project and local settings could also set the variables in this list that choose where Claude Code writes its files or that export session content, except `HOME` and `XDG_CONFIG_HOME`. Before v2.1.290, they could also set the dialog timer variables and `CLAUDE_CODE_DISABLE_ATTACHMENTS`.
+ * You can turn on [Code Mode](</docs/en/code-mode>) with [`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`](</docs/en/env-vars#variables>) from your shell, user settings, or a `--settings` file, and not from managed, project, or local settings. With a `0` in any of the first three or in managed settings, Code Mode stays off whatever you set elsewhere. When managed settings contain a `1`, set your own `1` in user settings, because a `1` in your shell is ignored
* Identity variables that Claude Code’s hosting environments own, such as `CLAUDE_CODE_REMOTE` and `CLAUDE_CODE_ACCOUNT_UUID`, are ignored from every file.
* [`CLAUDE_CODE_MESSAGING_SOCKET` and `CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>), which Claude Code exports itself, are ignored from every file. Ignoring the socket variable requires Claude Code v2.1.224 or later, and ignoring the token requires v2.1.228 or later.
* [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>), which Claude Code reads from the launch environment only, is ignored from every file; requires v2.1.234 or later.
@@ -3842,7 +3843,7 @@
Source| Example entry| Fields
---|---|---
-`github`| `{ "source": "github", "repo": "acme-corp/plugins", "ref": "main", "path": "marketplace" }`| `repo` required; `ref` is a branch or tag; `path` is a subdirectory
+`github`| `{ "source": "github", "repo": "acme-corp/plugins", "ref": "main", "path": "marketplace" }`| `repo` required; `ref` is a branch, tag, or commit SHA; `path` is a subdirectory
`git`| `{ "source": "git", "url": "https://gitlab.example.com/tools/plugins.git", "ref": "production" }`| `url` required; `ref` and `path` as for `github`
`url`| `{ "source": "url", "url": "https://plugins.example.com/marketplace.json", "headers": { "Authorization": "Bearer ${TOKEN}" } }`| `url` required; `headers` adds HTTP headers for authenticated access
`file`| `{ "source": "file", "path": "/opt/acme-corp/plugins/marketplace.json" }`| `path` required, the absolute path to a `marketplace.json` file
@@ -4635,7 +4636,7 @@
### `agentPushNotifEnabled`
-Allow Claude to send a push notification to your phone when it decides one is worth sending, for example when a long task finishes. In a local session, Claude can send one while [Remote Control](</docs/en/remote-control>) is connected. Appears in `/config` as **Push when Claude decides**. When you change it there, Claude Code also saves the value to your account.
+Allow Claude to send a push notification to your phone when it decides one is worth sending, for example when a long task finishes. In a local session, Claude can send one while [Remote Control](</docs/en/remote-control>) is connected. Appears in `/config` as **Push when Claude decides**.
* **Scope** : `Any file`. Claude Code also reads a value left in `~/.claude.json` by older versions.
* **Type** : Boolean
@@ -4649,7 +4650,7 @@
"agentPushNotifEnabled": true
}
-If you run sessions under a [`claude remote-control`](</docs/en/remote-control#start-a-remote-control-session>) server, they follow the value saved to your account rather than this key. To change that value, run `/config` in a Claude Code session in your terminal and turn **Push when Claude decides** on or off. If the toggle already shows the value you want, change it and change it back so that Claude Code saves that value to your account. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>).
+You don’t receive notifications with this key alone. To set them up, follow the steps in [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). If you run sessions under a [`claude remote-control`](</docs/en/remote-control#start-a-remote-control-session>) server, they follow the value saved to your account rather than this key. To change that value, run `/config` in a Claude Code session in your terminal and turn **Push when Claude decides** on or off. If the toggle already shows the value you want, change it and change it back so that Claude Code saves that value to your account.
### `awaySummaryEnabled`
@@ -4798,7 +4799,7 @@
"inputNeededNotifEnabled": true
}
-See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>).
+You don’t receive notifications with this key alone. To set them up, follow the steps in [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>).
### `preferredNotifChannel`
@@ -4935,11 +4936,12 @@
* **Scope** : `Managed`. A list that the machine’s own admin sources set, MDM policies and managed settings files, keeps applying when server-managed settings also deliver one: a session may then use only the providers on both lists, so a server-managed list can narrow what the machine allows but never widen it. Which machine source’s `allowedProviders` counts follows [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). A list delivered through server-managed settings alone reaches only the sessions that [fetch server-managed settings](</docs/en/server-managed-settings#platform-availability>).
* **Type** : array of strings, each one of:
- * `"anthropic"`: the Anthropic API on Anthropic’s own host, through a claude.ai or Console sign-in or an API key. Pair it with `forceLoginMethod` or `forceLoginOrgUUID` to also restrict the sign-in
+ * `"anthropic"`: the Anthropic API on Anthropic’s own host, through a claude.ai or Console sign-in or an API key. Pair it with `forceLoginMethod` or `forceLoginOrgUUID` to also restrict the sign-in. Desktop’s Cowork [on the user’s machine](</docs/en/managed-settings#where-and-when-a-policy-applies>) counts as `"anthropic"` when signed in to claude.ai, so without it in the machine’s list, Cowork [is refused at start](</docs/en/errors#managed-settings-dont-allow-this-api-provider>). To let Cowork start, add it, which also opens this list to direct Anthropic sessions.
* `"bedrock"`: [Amazon Bedrock](</docs/en/amazon-bedrock>)
* `"vertex"`: [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), formerly Vertex AI
* `"foundry"`: [Microsoft Foundry](</docs/en/microsoft-foundry>)
* `"anthropicAws"`: [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
+ * `"anthropicGoogleCloud"`: [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>)
* `"mantle"`: the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). A session that [runs Mantle alongside the Invoke API](</docs/en/amazon-bedrock#run-mantle-alongside-the-invoke-api>) uses both providers, so list `"bedrock"` and `"mantle"` together for it
* `"customEndpoint"`: the Anthropic API or a cloud provider’s API sent to another host, such as an [LLM gateway](</docs/en/llm-gateway>) named by `ANTHROPIC_BASE_URL` or by a provider’s endpoint variable such as `ANTHROPIC_BEDROCK_BASE_URL`. Claude Code admits it only for the exact value a managed `env` block pins
* `"gateway"`: a [Cloud gateway](</docs/en/claude-apps-gateway>) sign-in
@@ -5148,19 +5150,19 @@
### `minimumVersion`
-Keep background auto-updates and `claude update` from installing any version below this one, so moving to the `"stable"` channel doesn’t downgrade you from a newer `"latest"` build. Claude Code writes this key for you when you choose to stay on your current version while switching channels in `/config`, and clears it when you switch back to `"latest"`.
-
- * **Scope** : `Any file`. Set it in managed settings to pin an organization-wide minimum that user and project settings can’t lower.
- * **Type** : string, a version number such as `"2.1.100"`; a value that isn’t a valid version is ignored
+Keep background auto-updates and `claude update` from installing any version below the one you set. Claude Code writes this key for you when you choose to stay on your current version while switching channels in `/config`. Claude Code clears the key when you switch back to `"latest"` in `/config`.
+
+ * **Scope** : `Any file`. Set this key in managed settings to pin an organization-wide minimum that user and project settings can’t override.
+ * **Type** : string, a version number such as `"2.1.323"`; a value that isn’t a valid version is ignored
* **Default** : unset, so updates can install any version the channel offers
-This example follows the stable channel and refuses to install any version below 2.1.100:
+This example follows the stable channel and refuses to install any version below 2.1.323:
settings.json
{
"autoUpdatesChannel": "stable",
- "minimumVersion": "2.1.100"
+ "minimumVersion": "2.1.323"
}
This key only constrains updates. To make Claude Code refuse to start below a version, use `requiredMinimumVersion` instead. See [Pin a minimum version](</docs/en/setup#pin-a-minimum-version>).
--- a/setup.md
+++ b/setup.md
@@ -138,18 +138,27 @@
"autoUpdatesChannel": "stable"
}
-A newly launched model can require a Claude Code version newer than the stable channel serves. To run the model now, move to the latest channel. For enterprise deployments, you can enforce a consistent release channel across your organization using [managed settings](</docs/en/managed-settings>). Homebrew installations choose a channel by cask name instead of this setting: `claude-code` tracks stable and `claude-code@latest` tracks latest. Installations from the apt, dnf, and apk repositories choose a channel by repository instead of this setting. To switch one, follow Install with Linux package managers.
+With this setting, a native installation updates to the stable version even when that version is older than yours. To avoid the downgrade, also pin a minimum version. A newly launched model can require a Claude Code version newer than the stable channel serves. To run the model now, move to the latest channel. For enterprise deployments, you can enforce a consistent release channel across your organization using [managed settings](</docs/en/managed-settings>). Homebrew installations choose a channel by cask name instead of this setting: `claude-code` tracks stable and `claude-code@latest` tracks latest. Installations from the apt, dnf, and apk repositories choose a channel by repository instead of this setting. To switch one, follow Install with Linux package managers.
### Pin a minimum version
-The `minimumVersion` setting establishes a floor. Background auto-updates and `claude update` refuse to install any version below this value, so moving to the `"stable"` channel does not downgrade you if you are already on a newer `"latest"` build. Switching from `"latest"` to `"stable"` via `/config` prompts you to either stay on the current version or allow the downgrade. Choosing to stay sets `minimumVersion` to that version. Switching back to `"latest"` clears it. Add it to your [settings.json file](</docs/en/settings>) to pin a floor explicitly:
+To move a native installation to the `"stable"` release channel without a downgrade, set [`minimumVersion`](</docs/en/settings-reference#minimumversion>) to the version you’re running. Background auto-updates and `claude update` refuse to install any version below the minimum. Set the minimum in `/config` to have Claude Code fill in your current version, or in your settings file to type the number yourself:
+
+ * **In`/config`**: switch **Auto-update channel** to stable, then select **Stay on current version**. If you switch back to latest in `/config`, Claude Code clears the minimum.
+ * **In your[settings file](</docs/en/settings>)**: run `claude --version` in your shell, and set `minimumVersion` to the number at the start of the output. In the same edit, set `autoUpdatesChannel` to `"stable"`.
+
+This `~/.claude/settings.json` switches an installation on version 2.1.323 to stable:
{
"autoUpdatesChannel": "stable",
- "minimumVersion": "2.1.100"
+ "minimumVersion": "2.1.323"
}
-In [managed settings](</docs/en/managed-settings>), this enforces an organization-wide minimum that user and project settings cannot override. The `minimumVersion` pin only constrains updates. To make Claude Code refuse to start outside a version range, use the managed settings `requiredMinimumVersion` and `requiredMaximumVersion` instead. Updates also respect the `requiredMaximumVersion` ceiling. See [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>) and [`requiredMaximumVersion`](</docs/en/settings-reference#requiredmaximumversion>).
+The installation stays on 2.1.323 until the stable channel serves a newer version.
+
+#### Set version limits for your organization
+
+In [managed settings](</docs/en/managed-settings>), `minimumVersion` enforces an organization-wide minimum that user and project settings can’t override. The `minimumVersion` pin only constrains updates. To make Claude Code refuse to start outside a version range, use the managed settings `requiredMinimumVersion` and `requiredMaximumVersion` instead. Updates also respect the `requiredMaximumVersion` ceiling. See [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>) and [`requiredMaximumVersion`](</docs/en/settings-reference#requiredmaximumversion>).
### Disable auto-updates
@@ -295,9 +304,9 @@
If `npm --version` prints a version starting with `12` in your shell, follow [Fix an npm 12 install](</docs/en/troubleshoot-install#fix-an-npm-12-install>) instead. Don’t install with `sudo`. Claude Code runs npm without `sudo` when it updates itself, so an install that needs `sudo` can’t update automatically.
-You can also install Claude Code as a global npm package. The npm package requires [Node.js 22 or later](<https://nodejs.org/en/download>). On an older Node.js version, npm prints an `EBADENGINE` warning during install rather than failing; the install completes and `claude` still runs, since the package downloads a native binary that doesn’t use your Node.js at runtime.
-
- npm install -g @anthropic-ai/claude-code
+You can also install Claude Code as a global npm package. The npm package requires [Node.js 22 or later](<https://nodejs.org/en/download>). On an older Node.js version, npm by default prints an `EBADENGINE` warning and completes the install rather than failing. The installed `claude` still runs, since the package downloads a native binary that doesn’t use your Node.js at runtime.
+
+ npm install -g @anthropic-ai/claude-code@latest
The npm package installs the same native binary as the standalone installer. npm pulls the binary in through a per-platform optional dependency such as `@anthropic-ai/claude-code-darwin-arm64`, and a postinstall step links it into place. The installed `claude` binary does not itself invoke Node. Supported npm install platforms are `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Your package manager must allow optional dependencies. See [troubleshooting](</docs/en/troubleshoot-install#native-binary-not-found-after-npm-install>) if the binary is missing after install. To upgrade an npm installation, run `npm install -g @anthropic-ai/claude-code@latest`. Avoid `npm update -g`, which respects the semver range from the original install and may not move you to the newest release.
--- a/statusline.md
+++ b/statusline.md
@@ -148,7 +148,7 @@
`cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds
`cost.total_lines_added`, `cost.total_lines_removed`| Lines of code changed
`context_window.total_input_tokens`, `context_window.total_output_tokens`| Token counts currently in the context window, from the most recent API response. Input includes cache reads and writes
-`context_window.context_window_size`| Maximum context window size in tokens. 200000 by default, or 1000000 for models with extended context.
+`context_window.context_window_size`| Maximum context window size in tokens
`context_window.used_percentage`| Pre-calculated percentage of context window used
`context_window.remaining_percentage`| Pre-calculated percentage of context window remaining
`context_window.current_usage`| Token counts from the last API call, described in context window fields
Show diff (187 lines)
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -26,9 +26,9 @@
A fast, read-only agent optimized for searching and analyzing codebases.
- * **Model** : the main conversation’s model. When the main conversation runs Fable, Explore’s model depends on how you connect:
+ * **Model** : the parent conversation’s model. When the parent conversation runs Fable, Explore runs on Opus or stays on Fable, based on how you connect.
* With a Claude subscription, an Anthropic Console account, or an [LLM gateway](</docs/en/llm-gateway>) reached through `ANTHROPIC_BASE_URL`, Explore runs on the Opus model that the [`opus` alias](</docs/en/model-config#model-aliases>) resolves to.
- * On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or a [Claude apps gateway](</docs/en/claude-apps-gateway>), Explore stays on the main conversation’s model.
+ * On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or a [Claude apps gateway](</docs/en/claude-apps-gateway>), Explore stays on Fable.
* **Tools** : read-only tools; Write and Edit are denied
* **Purpose** : file discovery, code search, codebase exploration
@@ -36,7 +36,7 @@
A research agent used during [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) to gather context before presenting a plan.
- * **Model** : inherits from the main conversation, unless you set `CLAUDE_CODE_SUBAGENT_MODEL` and force it onto every subagent
+ * **Model** : inherits from the parent conversation, unless you set `CLAUDE_CODE_SUBAGENT_MODEL` and force it onto every subagent
* **Tools** : read-only tools; Write and Edit are denied
* **Purpose** : codebase research for planning
@@ -44,7 +44,7 @@
A capable agent for complex, multi-step tasks that require both exploration and action.
- * **Model** : the `CLAUDE_CODE_SUBAGENT_MODEL` model if you set one and nothing assigns a model another way, otherwise the main conversation’s model; Choose a model states the full order, and Run every subagent on one model shows how to make the variable override those sources
+ * **Model** : the parent conversation’s model by default, following the model order
* **Tools** : every tool available to subagents
* **Purpose** : complex research, multi-step operations, code modifications
@@ -263,39 +263,38 @@
### Choose a model
-The `model` field controls which model the subagent uses:
-
- * **Model alias** : use one of the available aliases: `sonnet`, `opus`, `haiku`, or `fable`
- * **Full model ID** : use a full model ID such as `claude-opus-5-5` or `claude-sonnet-5`. Accepts the same values as the `--model` flag
- * **inherit** : use the same model as the main conversation
-
-When Claude invokes a subagent, it can also pass a `model` parameter for that specific invocation. On an Agent tool call, that parameter takes a model alias: `sonnet`, `opus`, `haiku`, or `fable`. Claude can’t pass a full model ID or `inherit` on that call. Claude Code resolves the subagent’s model in this order:
-
- 1. The per-invocation `model` parameter
- 2. The subagent definition’s `model` frontmatter, where `inherit` selects the main conversation’s model
- 3. The [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>) environment variable, when you set it to a model alias or model ID
- 4. The main conversation’s model
-
-If an installed [mod](</docs/en/plugins/mods/overview>) sets a model in its [`agent.spawn`](</docs/en/plugins/mods/reference#subagents>) hook, Claude Code uses that model in place of the per-invocation parameter. In two cases, a family alias such as `opus` in the per-invocation parameter or the frontmatter resolves to the main conversation’s model instead of the [version the alias points to](</docs/en/model-config#model-aliases>):
-
- * **The main conversation’s model belongs to that family** : the subagent runs on the main conversation’s exact model, including any `[1m]` suffix, so it gets the same [extended context](</docs/en/model-config#extended-context>) window as the main conversation.
- * **Claude Code can’t tell the main conversation’s model family, on[a provider other than the Anthropic API](</docs/en/third-party-integrations>)**: this can happen with an [application inference profile ARN](</docs/en/amazon-bedrock#iam-configuration>) on Amazon Bedrock that Claude Code hasn’t resolved to a backing model. This case covers only the `opus` alias, and doesn’t apply when you set [`ANTHROPIC_DEFAULT_OPUS_MODEL`](</docs/en/model-config#environment-variables>), since `opus` then resolves to the model you set.
-
-An alias in `CLAUDE_CODE_SUBAGENT_MODEL` always resolves to the version the alias points to, even when it names the main conversation’s family. Setting the variable to `inherit` is the same as leaving it unset. Setting `CLAUDE_CODE_SUBAGENT_MODEL` by itself doesn’t change the model the built-in Explore and Plan subagents run on. To change it, see Run every subagent on one model. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order and overrode both the per-invocation parameter and the frontmatter, including `model: inherit`. Claude Code checks the per-invocation parameter, frontmatter, and environment variable values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. For a blocked value, it substitutes another model:
-
- * When the blocked value is a family alias such as `opus`, Claude Code runs the subagent on the newest version of that family the allowlist permits, following the same [substitution rules and provider scope](</docs/en/model-config#restrict-model-selection>) as `/model`. Before v2.1.222, Claude Code ran the subagent on the inherited model for a blocked family alias as well.
- * For any other blocked value, on providers where that substitution doesn’t operate, or when the allowlist permits no version of the family, Claude Code runs the subagent on the inherited model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules.
-
-In interactive sessions, Claude Code shows a warning naming the requested model and the model the subagent runs on, for either substitution. To check which model a subagent is running on, run [`/tasks`](</docs/en/commands>). Claude Code names the model on the subagent’s row, and adds the [effort level](</docs/en/model-config#adjust-effort-level>) set for that subagent, if any. Requires Claude Code v2.1.242 or later. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting.
+By default, a subagent you define runs on the same model as the conversation that starts it. To choose its model yourself, set the `model` field in its definition to one of these values:
+
+ * **Model alias** : `sonnet`, `opus`, `haiku`, or `fable`
+ * **Full model ID** : a value the [`--model`](</docs/en/cli-reference#cli-flags>) flag accepts, such as `claude-opus-5-5` or `claude-sonnet-5`
+ * **`inherit`** : the main conversation’s model, or the spawning subagent’s model for a nested subagent
+
+When more than one source sets a model, Claude Code uses the first in this order:
+
+ 1. The per-invocation `model` parameter, which Claude can pass when it starts the subagent. On an Agent tool call, the parameter takes a model alias, not a full model ID or `inherit`.
+ 2. The `model` field in the subagent’s definition, including `inherit`
+ 3. The [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>) environment variable
+ 4. The main conversation’s model, or the spawning subagent’s model for a nested subagent
+
+If Claude passed an alias, the subagent keeps that alias when it resumes or receives a follow-up message. If an installed [mod](</docs/en/plugins/mods/overview>) sets a model in its [`agent.spawn`](</docs/en/plugins/mods/reference#subagents>) hook, Claude Code uses that model in place of the per-invocation parameter. Setting `CLAUDE_CODE_SUBAGENT_MODEL` by itself doesn’t change the model the built-in Explore and Plan subagents run on. To change it, see Run every subagent on one model.
+
+#### Which model a nested subagent runs on
+
+By default, a nested subagent you define runs on the model of its parent, the subagent that spawned it. To run the nested subagent on another model, set its `model` field to that model. For example, suppose your main conversation runs on Opus and starts a reviewer subagent on Haiku. By default, these subagents run on Haiku, not Opus, when the reviewer spawns them:
+
+ * A subagent with `model: inherit` or no `model` field
+ * The built-in Explore, Plan, and general-purpose subagents
+ * A fork
+
+In plan mode, these subagents run on Opus if you set your session’s model to [`opusplan`](</docs/en/model-config#opusplan-model-setting>), or on Sonnet if you set it to `haiku`.
+
+#### Check a subagent’s model
+
+To check which model a subagent is running on, run [`/tasks`](</docs/en/commands>). Claude Code names the model on the subagent’s row, and adds the [effort level](</docs/en/model-config#adjust-effort-level>) set for that subagent, if any. Requires Claude Code v2.1.242 or later.
#### Run every subagent on one model
-`CLAUDE_CODE_SUBAGENT_MODEL` is a default, so a subagent’s definition or a model Claude passes still takes precedence over it. To apply one model to every subagent, [teammate](</docs/en/agent-teams#specify-teammates-and-models>), and [workflow agent](</docs/en/workflows>), also set `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` to `1`. Requires Claude Code v2.1.257 or later.
-
- * If you set both variables, subagents run on the model in `CLAUDE_CODE_SUBAGENT_MODEL`.
- * If you set only `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`, subagents run on the main conversation’s model, except that the built-in Explore subagent runs on the model listed for it under Built-in subagents.
-
-For example, to run every subagent on Haiku, set both variables in the `env` block of a [settings file](</docs/en/settings>):
+To apply one model to every subagent, [teammate](</docs/en/agent-teams#specify-teammates-and-models>), and [workflow agent](</docs/en/workflows>), set `CLAUDE_CODE_SUBAGENT_MODEL` to that model and `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` to `1`. Requires Claude Code v2.1.257 or later. For example, to run every subagent on Haiku, set both variables in the `env` block of a [settings file](</docs/en/settings>):
{
"env": {
@@ -304,11 +303,34 @@
}
}
-To check that the setting took effect, run [`/tasks`](</docs/en/commands>) while a subagent is running. The subagent’s row shows the model it runs on. While `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` is [on](</docs/en/env-vars>), Claude Code ignores the `model` field in subagent definitions, and Claude can’t pass a model when it starts a subagent. These subagents still run on the main conversation’s model:
+To check that the setting took effect, run [`/tasks`](</docs/en/commands>) while a subagent is running. The subagent’s row shows the model it runs on. While `CLAUDE_CODE_SUBAGENT_MODEL_FORCE` is [on](</docs/en/env-vars>), Claude Code ignores the `model` field in subagent definitions, and Claude can’t pass a model when it starts a subagent. The following subagents still run on their parent conversation’s model:
* A fork
* A [skill that runs in a subagent](</docs/en/skills#run-skills-in-a-subagent>) with `model: inherit`
+If you set only `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`, subagents run on the main conversation’s model, except that the built-in Explore subagent runs on the model listed for it under Built-in subagents.
+
+#### Which version a model alias selects
+
+By default, a subagent with a model alias runs on the [version the alias points to](</docs/en/model-config#model-aliases>). With a family alias such as `opus` in the `model` field or per-invocation parameter, the subagent runs on its parent conversation’s model in two cases:
+
+ * **Same family** : for example, if your main conversation runs on `claude-opus-4-7`, a subagent with `model: opus` runs on that version too. To run another version, set a full model ID in the `model` field.
+ * **Unknown family** : Claude Code can’t tell the parent model’s family, such as with an Amazon Bedrock ARN it [can’t look up](</docs/en/amazon-bedrock#iam-configuration>). This case applies only to the `opus` alias on [a provider other than the Anthropic API](</docs/en/third-party-integrations>). To choose the Opus version, set [`ANTHROPIC_DEFAULT_OPUS_MODEL`](</docs/en/model-config#environment-variables>).
+
+#### When an allowlist blocks a subagent model
+
+If your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist blocks the model set for a subagent, the subagent runs on the first of these that applies:
+
+ 1. For a blocked family alias, the newest permitted version in that family, on [providers that support this substitution](</docs/en/model-config#restrict-model-selection>)
+ 2. The model in `CLAUDE_CODE_SUBAGENT_MODEL`, if you set it, under these same rules
+ 3. The main conversation’s model, or the spawning subagent’s model for a nested subagent
+
+For a top-level subagent in an interactive session, a warning names the requested model and its replacement. To run a particular model, change the blocked value to one the allowlist permits.
+
+### Extended thinking in subagents
+
+Subagents inherit your main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration. There is no per-subagent thinking setting.
+
### Choose an effort level
To run a subagent at its own [effort level](</docs/en/model-config#adjust-effort-level>), set the `effort` field in its definition. When you ask Claude to run a non-fork subagent at a specific effort level, it can also pass an `effort` parameter for that invocation. The parameter overrides the `effort` field and stays in effect when the subagent is resumed. The [`CLAUDE_CODE_EFFORT_LEVEL`](</docs/en/env-vars#variables>) environment variable takes precedence over both. The per-invocation parameter requires Claude Code v2.1.292 or later.
@@ -323,7 +345,7 @@
#### Available tools
-Subagents inherit the [built-in tools](</docs/en/tools-reference>) and MCP tools available in the main conversation, narrowed by two filters: the first removes a short list of tools from every subagent, and the second reduces the built-in tool set for subagents that run in the background, which is the default. On macOS, Linux, and WSL, a subagent can also receive the Glob and Grep tools when the main conversation doesn’t have them, as described under [Glob tool behavior](</docs/en/tools-reference#glob-tool-behavior>). Forks skip both filters and receive the main conversation’s exact tool pool. The first filter removes these tools, even when listed in the `tools` field:
+Subagents inherit the [built-in tools](</docs/en/tools-reference>) and MCP tools available in the main conversation, narrowed by two filters. The first removes a short list of tools from every subagent. The second reduces the built-in tool set for subagents that run in the background, which is the default. On macOS, Linux, and WSL, a subagent can also receive the Glob and Grep tools when the main conversation doesn’t have them, as described under [Glob tool behavior](</docs/en/tools-reference#glob-tool-behavior>). Forks skip both filters and receive their parent conversation’s exact tool pool. The first filter removes these tools, even when listed in the `tools` field:
* `Agent`, when the subagent is at the depth limit; in a fork the tool stays listed but returns an error instead of spawning
* `AskUserQuestion`
@@ -825,7 +847,7 @@
}
}
-With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. A nested subagent is configured the same way as a top-level one and resolves from the same scopes. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. In the terminal, Claude Code shows nested subagents as a tree in the subagent panel below the prompt input and marks each row that still has descendants in the panel with a `(+N)` count of them. Open a row to see that subagent’s siblings and direct children with a path back to `main`.
+With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. Define a nested subagent in the same scopes as a top-level one. By default, a nested subagent you define runs on the spawning subagent’s model. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. In the terminal, Claude Code shows nested subagents as a tree in the subagent panel below the prompt input and marks each row that still has descendants in the panel with a `(+N)` count of them. Open a row to see that subagent’s siblings and direct children with a path back to `main`.
### Concurrent subagent limit
@@ -917,7 +939,12 @@
When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` starts the forked subagent instead; otherwise `/fork` copies the whole session into a new [background session](</docs/en/agent-view#from-inside-a-session>).
-A fork is a subagent that inherits the entire conversation so far instead of starting fresh. This drops the input isolation that subagents otherwise provide: a fork sees the same system prompt, tools, model, and message history as the main session, so you can hand it a side task without re-explaining the situation. The fork’s own tool calls still stay out of your conversation and only its final result comes back, so your main context window stays clean. Use a fork when any other subagent would need too much background to be useful, or when you want to try several approaches in parallel from the same starting point. Claude can start a fork on its own while fork mode is on, as it is by default. To stop forks, see Turn fork mode off. You can start a fork yourself with `/subtask` followed by a task, whether or not fork mode is on. Claude Code names the fork from the first words of the task. The following example forks the conversation to draft test cases while you continue with the implementation in the main session:
+A fork is a subagent that inherits the entire conversation so far instead of starting fresh. Use a fork when any other subagent would need too much background to be useful, or when you want to try several approaches in parallel from the same starting point.
+
+ * **Input** : a fork sees the same system prompt, tools, model, and message history as its parent conversation
+ * **Output** : the fork’s own tool calls stay out of its parent conversation and only its final result comes back
+
+Claude can start a fork on its own while fork mode is on, as it is by default. To stop forks, see Turn fork mode off. You can start a fork yourself with `/subtask` followed by a task, whether or not fork mode is on. Claude Code names the fork from the first words of the task. The following example forks the conversation to draft test cases while you continue with the implementation in the main session:
/subtask draft unit tests for the parser changes so far
@@ -943,14 +970,12 @@
### How forks differ from other subagents
-A fork inherits everything the main session has at the moment it spawns. Any other subagent starts fresh from its definition.
-
| Fork| Non-fork subagent
---|---|---
Context| Full conversation history| Fresh context with the prompt you pass
-System prompt and tools| Same as main session| From the subagent’s definition file, filtered for background runs
-Model| Same as main session| From the subagent’s `model` field
-Prompt cache| Shared with main session| Separate cache
+System prompt and tools| Same as the parent conversation| From the subagent’s definition file, filtered for background runs
+Model| Same as the parent conversation| Follows the subagent model order
+Prompt cache| Shared with the parent conversation| Separate cache
Because a fork’s system prompt and tool definitions are identical to the parent, its first request reuses the parent’s [prompt cache](</docs/en/prompt-caching#subagents-and-the-cache>). Because of that reuse, a fork costs less than a fresh subagent for tasks that need the same context. When Claude spawns a fork through the Agent tool, it can pass `isolation: "worktree"` so the fork’s file edits are written to a separate git worktree instead of your checkout. A fork can’t spawn further forks.
--- a/subagents.md
+++ b/subagents.md
@@ -131,7 +131,7 @@
`prompt`| `string`| Yes| The agent’s system prompt defining its role and behavior
`tools`| `string[]`| No| Array of allowed tool names. If omitted, inherits every [tool available to subagents](</docs/en/sub-agents#available-tools>)
`disallowedTools`| `string[]`| No| Array of tool names to remove from the agent’s tool set. MCP server-level patterns are also accepted: `mcp__server` or `mcp__server__*` removes every tool from that server, and `mcp__*` removes every MCP tool from any server
-`model`| `string`| No| Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the main model. When you omit it, Claude Code picks the model in the [subagent model order](</docs/en/sub-agents#choose-a-model>)
+`model`| `string`| No| Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the model of the agent that spawned this one. When you omit `model`, Claude Code picks the model in the [subagent model order](</docs/en/sub-agents#choose-a-model>)
`skills`| `string[]`| No| List of skill names to preload into the agent’s context at startup. At most the [first 32 distinct names](</docs/en/sub-agents#preload-skills-into-subagents>) in the list are preloaded. Unlisted skills remain invocable through the Skill tool
`memory`| `'user' | 'project' | 'local'`| No| Memory source for this agent
`mcpServers`| `(string | object)[]`| No| MCP servers available to this agent, by name or inline config
--- a/test.md
+++ b/test.md
@@ -95,8 +95,6 @@
### Follow the test kit’s rules
-The test kit has a few rules of its own, and breaking one produces the errors new test authors hit first:
-
* **Register every stub before the test’s first call on`$`.** Calling `on` after that throws an error such as `on("ui.render") after the test first called $`.
* **[`session.start`](</docs/en/plugins/mods/reference#session>) doesn’t run by itself.** Each test starts with your module freshly loaded and none of its hooks called, so module-level variables hold their initial values. If a hook depends on what `session.start` sets up, fire it first:
@@ -108,12 +106,12 @@
await $.session.start({ surface: 'terminal', isInteractive: true, cwd: '/work' })
The second stub answers the `$.command.register` call that a `session.start` hook such as the [tutorial’s](</docs/en/plugins/mods/create#write-a-mod-yourself>) makes. Without it, that call rejects with `no implementation for command.register` and the kit skips your hook, so nothing after the call in the hook runs. The test doesn’t fail at that point. The skipped hook is listed under `the engine reported:` only if a later check fails.
- * **A hook that returns`next(e)` needs a stub to answer.** When your [`ui.render`](</docs/en/plugins/mods/reference#interface>) hook returns `next(e)`, for example to draw nothing while Claude is idle, mounting it fails with `no implementation for ui.render`. Register a stub that returns an element as plain data:
+ * **Register a`ui.render` stub to choose what `next(e)` returns.** When your [`ui.render`](</docs/en/plugins/mods/reference#interface>) hook returns `next(e)`, for example to draw nothing while Claude is idle, the mount succeeds with no stub. To make `next(e)` return an element you pick, register a stub that returns it as plain data:
// Stands for what Claude Code would draw at the site
on('ui.render', () => ({ type: 'Text', props: {}, children: ['drawn by Claude Code'] }))
-With the stub registered, the mount succeeds, and `ui.find({ type: 'Text' })` returns that element whenever your hook returned `next(e)`.
+Where the site [can draw that element](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>), `ui.find({ type: 'Text' })` returns it when your hook returned `next(e)`. On v2.1.323 or later, for the band, pass your mod’s name as the second argument to `on`, as in `{ plugin: 'my-mod' }`. Without it, the stub doesn’t answer your `next(e)`. Before v2.1.321, the mount fails with `no implementation for ui.render` unless you register the stub.
* **A stub for`turn.step` is an async generator**, and the test reads the stream to its end to get the result:
on('turn.step', async function* ($, e) {
@@ -160,7 +158,7 @@
`$.session.id`, `$.agent.list`| `() => ({ value: 'abc123' })`, `() => ({ value: [] })`
`session.send`| `() => ({ isDelivered: true })`. `e.to` arrives as a string even when your mod passed `{ sessionId }`.
`session.receive`| `($, e) => ({ text: e.text })`. Fire it with `$.session.receive({ origin: { kind: 'peer-send-message' }, text })`.
-`ui.render`| `() => ({ type: 'Text', props: {}, children: ['...'] })`
+`ui.render`| `() => ({ type: 'Text', props: {}, children: ['...'] })`. For the band, see the matcher in Follow the test kit’s rules.
### Check a result with `expect`
@@ -280,6 +278,7 @@
`press({ key: 'more' })`| Presses the `Button` with that key
`input({ key: 'new-note', text: 'buy milk' })`| Types the text into the `Input` with that key and presses Enter. Add `kind: 'change'` to type without submitting. For a field with `rows`, the text can hold `\n`.
`select({ key: 'size', value: 'large' })`| Picks the option with that value in the `Select` with that key
+`keepsBeneath()`| In a test with no `ui.render` stub, it resolves to `true` when the drawing includes what `next(e)` returned, and `false` when your hook left it out. In a test that registers one, use `find` to look for what the stub drew. Requires Claude Code v2.1.321 or later.
`find({ key: 'more' })` or `find({ type: 'Text', text: 'Count: 2' })`| Returns the first matching element as `{ type, props, children }`, or `undefined`. `text` can be a string or a regular expression.
`unmount()`| Removes the drawing
--- a/third-party-integrations.md
+++ b/third-party-integrations.md
@@ -20,6 +20,7 @@
* [Claude apps gateway](</docs/en/claude-apps-gateway>), a self-hosted gateway that adds IdP sign-in in front of Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, Microsoft Foundry, or the Anthropic API
* [Amazon Bedrock](</docs/en/amazon-bedrock>)
* [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
+ * [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>)
* [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>)
* [Microsoft Foundry](</docs/en/microsoft-foundry>)
@@ -56,6 +57,8 @@
Security teams can configure managed permissions for what Claude Code is and is not allowed to do, which cannot be overwritten by local configuration. [Learn more](</docs/en/security>). To limit which of these deployment options a managed machine may use, set [`allowedProviders`](</docs/en/settings-reference#allowedproviders>) in managed settings. For example, `["bedrock"]` allows Amazon Bedrock and nothing else; a Bedrock fleet that also enables the Mantle endpoint lists `"mantle"` too. The entry says which endpoint variables also need a managed `env` pin. Requires Claude Code v2.1.285 or later.
+With Desktop signed in to claude.ai, a Cowork session on the user’s machine counts as [`"anthropic"`](</docs/en/settings-reference#allowedproviders>). If you leave it out of this list in an MDM policy or managed settings file, that session is refused. With it in, sessions sent to Anthropic directly also pass this list.
+
### Use MCP for integrations
MCP is a great way to give Claude Code more information, such as connecting to ticket management systems or error logs. Have one central team configure MCP servers and check a `.mcp.json` configuration into the codebase so that all users benefit. [Learn more](</docs/en/mcp>).
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -35,7 +35,7 @@
`SendMessage`| Sends a message to another agent: an [agent team](</docs/en/agent-teams>) teammate, a [subagent it resumes](</docs/en/sub-agents#resume-subagents>) by agent ID or name, or one of your other Claude Code sessions, on this machine or beyond it. Messaging other sessions requires Claude Code v2.1.224 or later. [Cross-session messaging](</docs/en/cross-session-messaging>) covers which sessions Claude can reach, [what a message looks like when it arrives](</docs/en/cross-session-messaging#what-a-message-looks-like>), and [how Claude gets a notice when another session goes idle](</docs/en/cross-session-messaging#get-a-notice-when-another-session-goes-idle>). Claude can include an optional `summary` input, typically 5-10 words, that Claude Code shows as a one-line preview. When Claude omits it on a [plain-text message](</docs/en/cross-session-messaging#limitations>), Claude Code uses the first line of the message as the summary. Claude Code truncates a summary longer than 200 characters with an ellipsis| No
`SendUserFile`| Sends files from the session to you with an optional caption, so a generated report, diagram, screenshot, or built artifact reaches your device instead of only being mentioned in the transcript. The optional `display` input controls presentation: `render` opens the file inline in the client, `attach` shows a download card only, and when unset the client decides by file type. Available when a [Remote Control](</docs/en/remote-control>) client is connected or in a [cloud session](</docs/en/claude-code-on-the-web>). Delivery runs through Anthropic-hosted infrastructure, so the tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No
`ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Team and Enterprise plans| Yes
-`Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation| Yes
+`Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation. Can prompt for skills that set `allowed-tools`, `disallowed-tools`, or `hooks`| Some skills
`SubagentHandback`| Delivers a subagent’s final report to whichever conversation receives that subagent’s result. Provided only in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), to subagents that the Agent tool runs locally other than [forks](</docs/en/sub-agents#fork-the-current-conversation>), and available in the terminal CLI, IDE extensions, cloud sessions, and the Agent SDK; the classifier reviews the report before it’s delivered. Requires Claude Code v2.1.271 or later| No
`TaskCreate`| Creates a new task in the task list. Provided by default only on the models listed under Task tool availability, and on other models when you opt in| No
`TaskGet`| Retrieves full details for a specific task. Provided by default only on the models listed under Task tool availability, and on other models when you opt in| No
@@ -155,7 +155,7 @@
* A command that Claude starts in the background gets 30 minutes, or the `timeout` Claude passes with `run_in_background`, up to a maximum of 2 hours
* A command that starts in the foreground and then moves to the background at its timeout gets 30 minutes from the move
-In a run with the `-p` flag whose prompt you pass as text rather than with `--input-format stream-json`, both defaults are 10 minutes instead of 30, because the run [waits for background commands after its result](</docs/en/headless#background-tasks-at-exit>). When a background command reaches its time limit, Claude Code stops it and tells Claude why, and Claude can start the command again with a longer `timeout` if the work still needs it. The stop notice reads `Background command "<description>" was stopped after reaching its background time limit`.
+In a run with the `-p` flag whose prompt you pass as text rather than with `--input-format stream-json`, both defaults are 10 minutes instead of 30. When a background command reaches its time limit, Claude Code stops it and tells Claude why, and Claude can start the command again with a longer `timeout` if the work still needs it. The stop notice reads `Background command "<description>" was stopped after reaching its background time limit`.
#### Raise the time limit for background commands
@@ -205,6 +205,10 @@
* **Uniqueness** : `old_string` must appear exactly once. When it appears more than once, Claude either supplies a longer string with enough surrounding context to pin down one occurrence, or sets `replace_all: true` to replace them all.
A file that changed on disk after Claude last read it can still be edited when `old_string` matches the current content exactly and unambiguously and Claude Code can read the file without prompting. Matching against the file’s current content keeps this safe, and the result notes that the file carries other changes so Claude re-reads it before edits that depend on surrounding content. In any other case, such as a stale `old_string` or one that matches more than once without `replace_all`, Claude reads the file again before editing. Claude can also edit a file without a separate Read after viewing it with a Bash command such as `cat` or `grep`. Those commands are `cat`, `nl`, `bat`, `batcat`, `head`, `tail`, `sed -n 'X,Yp'`, `grep`, `egrep`, `fgrep`, and `rg`, each run on one file with no pipes or redirects. If the command printed none of the file’s text, as when a search matches nothing, the read-before-edit check still applies. When Claude views a file this way, Claude Code also loads any [subdirectory `CLAUDE.md`](</docs/en/memory#how-claude-md-files-load>) and [path-scoped rules](</docs/en/memory#path-specific-rules>) that apply to that file. See [Read and Edit permission rules](</docs/en/permissions#read-and-edit>) for which Bash commands your `Read` and `Edit` deny rules cover.
+
+### Protect read-only files in Perforce
+
+To keep Edit, Write, and NotebookEdit from overwriting read-only files in a Perforce workspace, set [`CLAUDE_CODE_PERFORCE_MODE`](</docs/en/env-vars#variables>) to `1`. Those tools then refuse to change read-only files and tell Claude to run `p4 edit` first.
### Non-UTF-8 files
@@ -518,7 +522,7 @@
WebSearch runs a query against Anthropic’s [web search](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool>) backend and returns result titles and URLs. It doesn’t fetch the result pages. To read a page Claude finds in search results, it follows up with WebFetch. The tool may issue up to eight backend searches per call, refining the search internally before returning results. Claude can scope results with `allowed_domains` to include only certain hosts, or `blocked_domains` to exclude them. The two lists can’t be combined in a single call. When the search request hits an overloaded API, Claude Code retries it with backoff; a call that still fails returns an error result. WebSearch permission rules take no specifier. A bare `WebSearch` entry in `allow` or `deny` is the only form. The search backend is not configurable. To search with a different provider, add an [MCP server](</docs/en/mcp>) that exposes a search tool.
-WebSearch is available on the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Microsoft Foundry. On Google Cloud’s Agent Platform it works with Opus 4, Sonnet 4, Haiku 4.5, and later models. Amazon Bedrock doesn’t expose the server-side web search tool.
+WebSearch is available on the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>), and Microsoft Foundry. On Google Cloud’s Agent Platform it works with Opus 4, Sonnet 4, Haiku 4.5, and later models. Amazon Bedrock doesn’t expose the server-side web search tool.
### Session search limit
Show diff (128 lines)
--- a/troubleshoot.md
+++ b/troubleshoot.md
@@ -5,8 +5,8 @@
When a mod does nothing, check what Claude Code reads from the mod’s files, and the line it writes when it skips something. For the first, in your shell run [`claude plugin validate`](</docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod>) with the mod’s directory, as in `claude plugin validate ./first-mod`. It catches a misspelled event, a bad manifest, and a module Claude Code can’t read, without starting a session. When a module doesn’t load, a hook is skipped, or another mod refuses yours, Claude Code writes one line that names your mod. Where you read that line depends on the session:
* **A session that hot-reloads a plugin directory** : a dim line in the transcript. That’s an interactive session you started with `--plugin-dir`, or one where [hot reloading is on](</docs/en/plugins/mods/create#ask-claude-for-a-mod>) for mods Claude wrote.
- * **Any other interactive session, such as one that runs a mod you installed from a marketplace** : the debug log only. To get one, start the session with `claude --debug`.
- * **A`claude -p` run with `--plugin-dir`**: stderr, in the default text output format. A refusal by another mod goes to the debug log only.
+ * **Any other interactive session, such as one that runs a mod you installed from a marketplace** : the debug log. To get one, start the session with `claude --debug`.
+ * **A`claude -p` run with `--plugin-dir`**: stderr, in the default text output format. A refusal by another mod goes to the debug log.
## Check whether mods can load
@@ -52,13 +52,13 @@
### Messages from the built-in guard
-Where the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) loads, it can refuse a mod or one of its answers. Each message names the option your organization’s administrator sets to change the rule.
+Where the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) loads, it can refuse a mod or one of its answers. Some messages name the option your organization’s administrator sets to change the rule.
Message contains| What it means| Where it appears
---|---|---
`mods are limited to your organization's by policy (allowManagedModsOnly)`| Your organization allows only [its own mods](</docs/en/plugins/mods/admin#install-your-organizations-mods>), so yours was refused| The debug log, and the transcript in a session that hot-reloads a plugin directory
-`tried to lift a deny rule in your settings`| Your mod’s [`tool.check`](</docs/en/plugins/mods/reference#tools>) hook approved a call that a `deny` rule refuses. The call stays denied.| The transcript and the debug log, once for each mod in a session. In a `claude -p` run, the debug log only.
-`the deny rules in your settings could not be checked for this call, so it is refused`| The guard failed while checking a call that a mod approved, so it refused the call| The reason Claude reads for the denied call
+`tried to lift a deny rule in your settings`| Your mod’s [`tool.check`](</docs/en/plugins/mods/reference#tools>) hook approved a call that a `deny` rule refuses. The call stays denied.| The transcript and the debug log, once for each mod in a session. In a `claude -p` run, the debug log.
+`the rules and hooks in your settings could not be checked for this call, so it is refused`| The guard failed while checking a call that a mod approved, so it refused the call| The reason Claude reads for the denied call
### `validate` passes and lists no `hooks` line
@@ -103,8 +103,6 @@
## A hook is skipped or a mod is unloaded
-The mod loaded, and then Claude Code skipped one of its hooks or unloaded it.
-
### `hook skipped`
The line names the mod and the event, then says `hook skipped:` and a reason, as in `first-mod: tool.call hook skipped: threw Error: boom`. A hook threw, exceeded its [time limit](</docs/en/plugins/mods/reference#limits>), or returned a result of the wrong shape. The line appears once for each event and kind of failure until the mod reloads. Fix the error. The debug log has a line for every occurrence.
@@ -135,6 +133,15 @@
Claude doesn’t see this line, so paste it into your next message when you ask Claude for a fix.
+### `reload failed`
+
+Match the line to find out whether your mod’s last working version is still loaded:
+
+ * `reload failed, the previous version stays loaded: <reason>`: your mod keeps running its last working version. If your change still fails to load the next time Claude Code reloads all plugins, such as when you run `/reload-plugins`, the last working version unloads.
+ * `reload failed: <reason>`: run `/plugin` at the Claude Code prompt, and widen the terminal if the [`mods active` line](</docs/en/plugins/mods/overview#see-which-mods-a-session-loaded>) cuts off names. If it names the mod, its last working version is still loaded. If it doesn’t, or there’s no such line, no version is.
+
+Fix what the reason names and save your change. A `reloaded` line shows that it loaded.
+
### `$.agent.register refused: the hooks module that made the call is no longer loaded`
The line starts with your mod’s name, as in `first-mod: $.agent.register refused: the hooks module that made the call is no longer loaded (it was reloaded or removed)`, and the agent isn’t registered. Your mod was reloaded or unloaded before the call. A reload loads a fresh copy of the hooks module, and this call came from code still running in the old copy, such as a hook that hadn’t returned yet. If that hook doesn’t catch the rejection, it fails and Claude Code skips it. To register the agent from the copy that stays loaded, make the call in your [`session.start`](</docs/en/plugins/mods/reference#session>) hook, which runs again in each fresh copy after a reload.
@@ -155,7 +162,7 @@
### A message about the deny rules in your settings
-`tried to lift a deny rule in your settings` and `the deny rules in your settings could not be checked for this call, so it is refused` both come from the built-in guard. Look them up in Messages from the built-in guard.
+`tried to lift a deny rule in your settings` and `the rules and hooks in your settings could not be checked for this call, so it is refused` both come from the built-in guard. Look them up in Messages from the built-in guard.
## A toast appears after a turn is stopped
@@ -169,13 +176,17 @@
### Another mod’s band shows and yours doesn’t
-There is one band above the prompt, and every mod shares it. A mod that runs [before yours](</docs/en/plugins/mods/events#the-order-mods-run-in>) replaces your band when it returns a tree without the result of `next(e)` in it. To show both bands, change that mod’s hook, or ask its author to:
-
- * **Keep the bands after it** : put the result of `await next(e)` among the children of a `Box` in its tree, as in the Band above the prompt tab of [Pick where to draw](</docs/en/plugins/mods/interface#pick-where-to-draw>)
+Each mod that draws above the prompt gets its own row, so when yours is missing while another’s shows, check for these causes:
+
+ * **Your tree doesn’t validate** : write a debug log, search it for `ui.render hook skipped` or `does not validate`, and fix what the line names.
+ * **The rows together exceed a limit** : write a debug log and search it for `past the limits of the band`. The rows [share one tree’s limits](</docs/en/plugins/mods/reference#limits>), so draw a smaller tree, or ask the other mods’ authors to.
+ * **Another mod hides or draws over your row** : if the log has none of these lines, [turn off](</docs/en/plugins/mods/overview#turn-mods-on-or-off>) the other mods one at a time. If your row comes back, ask that mod’s author to change it.
+
+Before v2.1.323, all mods shared one drawing in the band. A mod that ran [before yours](</docs/en/plugins/mods/events#the-order-mods-run-in>) replaced your drawing when it returned a tree without the result of `next(e)` in it. Update Claude Code, or ask that mod’s author to make these changes:
+
+ * **Keep later mods’ drawings** : put the result of `await next(e)` among the children of a `Box` in its tree
* **Keep the tree valid** : don’t give that `Box`, or any `Box` around it, a `width`, `height`, `minWidth`, `minHeight`, `position`, `top`, `left`, `right`, `bottom`, `display`, or `overflow` prop
-To find that mod, write a debug log and search it for `answered ui.render without next()`. A line such as `other-mod (user) answered ui.render without next()` names a mod that returned its tree without calling `next(e)`. It doesn’t name the [render site](</docs/en/plugins/mods/reference#render-sites>), so a pane-only mod can appear too. A mod that calls `next(e)` and drops the result gets no line, so check the hooks before yours too. A mod’s band is also missing when the tree its own hook returned doesn’t validate, and the other mods’ bands stay. To find which mod and why, write a debug log and search it for `ui.render hook skipped`.
-
### A pane or band is empty or shows Claude Code’s usual content
The [tree](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) your hook returned didn’t validate. A `hook skipped` line in the transcript or the debug log names your mod and the reason, as in this one for a `Box` in a pane:
@@ -186,11 +197,11 @@
### A `ui.render` line says `refused`
-`ui.render (<site>) refused:`, or `ui.render (<site>): the chain settled on a tree that does not validate` in the debug log, means the [tree](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) at that site exceeds a [size limit](</docs/en/plugins/mods/reference#limits>). Either line names the [render site](</docs/en/plugins/mods/reference#render-sites>) and then the reason, and the reason names the limit. Change the mods that draw at that site so their [`ui.render`](</docs/en/plugins/mods/reference#interface>) hooks return smaller trees, or ask their authors to. If the transcript line starts with `hooks`, more than one loaded mod has a `ui.render` hook for that site, so check each of those mods’ trees. For several mods whose bands above the prompt nest into a tree more than 32 levels deep, the line reads:
-
- hooks: ui.render (AbovePrompt) refused: deeper than 32; nothing was drawn
-
-Before v2.1.307, a `refused:` line for any site reported any tree that didn’t validate, and for `Pane` and `AbovePrompt` it ended `; the engine drew its own`. On those releases, fix what the reason names.
+`ui.render (<site>) refused:`, or `ui.render (<site>): the chain settled on a tree that does not validate` in the debug log, means the [tree](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) at that site exceeds a [size limit](</docs/en/plugins/mods/reference#limits>). Either line names the [render site](</docs/en/plugins/mods/reference#render-sites>) and then the reason. Change the mods that draw at that site so their [`ui.render`](</docs/en/plugins/mods/reference#interface>) hooks return smaller trees, or ask their authors to. If the transcript line starts with `hooks`, more than one loaded mod has a `ui.render` hook for that site, so check each of those mods’ trees. For rows above the prompt that don’t fit the band’s limits together, the line reads:
+
+ hooks: ui.render (AbovePrompt) refused: a row past the limits of the band; nothing was drawn
+
+Despite that ending, the rows that fit still draw. Before v2.1.307, a `refused:` line for any site reported any tree that didn’t validate, and for `Pane` and `AbovePrompt` it ended `; the engine drew its own`. On those releases, fix what the reason names.
### `needs a key`, `is drawn twice`, or `key each once`
@@ -231,11 +242,12 @@
### Hotkeys do nothing
-Your pane or band doesn’t have keyboard focus, your button is in a collapsed band, or the drawing is in the VS Code extension, where buttons have no hotkeys. Do the one that matches:
+Your pane or band doesn’t have keyboard focus, your button is in a collapsed band, another mod uses the same key, or the drawing is in the VS Code extension.
* **No keyboard focus** : press Ctrl+X then Tab or, in [fullscreen rendering](</docs/en/fullscreen>), click the pane or band. To have the pane take focus when it opens, open it with `focus: true` from a command.
* **The button is in a collapsed band** : the band shows one dim row that starts with `▸ plugin panel hidden`. Press the keys the row names, Ctrl+X then Ctrl+A by default, to expand it.
- * **In the VS Code extension** : click the button, or press Enter on it once it has focus
+ * **Another mod’s row in the band uses the same hotkey** : in the terminal, the key presses neither button. To check, [turn off](</docs/en/plugins/mods/overview#turn-mods-on-or-off>) the other mods that draw rows, one at a time, until the key works. Change your button’s `hotkey`, or ask that mod’s author to change theirs.
+ * **In the VS Code extension, where buttons have no hotkeys** : click the button, or press Enter on it once it has focus
### A drawing works in the terminal and not in the Desktop app or VS Code
@@ -318,7 +330,7 @@
hooks module first-mod@inline loaded (worker, environment 2, tier user); events: session.start,tool.call,command.run,ui.render
-To write your own lines in the log, call [`$.ui.log`](</docs/en/plugins/mods/api#show-something-without-starting-a-turn>) with a second argument, as in `$.ui.log('message', { to: 'debug' })`. Without the second argument, `$.ui.log` adds a dim line to the transcript. While you edit a mod loaded with `--plugin-dir`, the transcript shows a line for each reload that names the mod and lists its hooks. If a save breaks the module, the line says `reload failed, the previous version stays loaded:` with the reason, and the last working version keeps running until Claude Code next reloads plugins, such as when you run `/reload-plugins`.
+To write your own lines in the log, call [`$.ui.log`](</docs/en/plugins/mods/api#show-something-without-starting-a-turn>) with a second argument, as in `$.ui.log('message', { to: 'debug' })`. Without the second argument, `$.ui.log` adds a dim line to the transcript.
## Next steps
--- a/troubleshoot-install.md
+++ b/troubleshoot-install.md
@@ -706,7 +706,7 @@
### npm install errors in WSL
-These issues apply if you installed Claude Code with `npm install -g` inside WSL. If you used the [native installer](</docs/en/setup>), skip this section. On npm 12, install as Fix an npm 12 install describes. **OS or platform detection issues.** If npm reports a platform mismatch during install, WSL is likely picking up the Windows `npm`. Run `npm config set os linux` first, then install with `npm install -g @anthropic-ai/claude-code --force`. Do not use `sudo`. **`exec: node: not found` when running `claude`.** Your WSL environment is likely using the Windows installation of Node.js. Confirm with `which npm` and `which node`: paths starting with `/mnt/c/` are Windows binaries, while Linux paths start with `/usr/`. To fix this, install Node via your Linux distribution’s package manager or via [`nvm`](<https://github.com/nvm-sh/nvm>). **nvm version conflicts.** If you have nvm installed in both WSL and Windows, switching Node versions in WSL may break because WSL imports the Windows PATH by default and the Windows nvm takes priority. The most common cause is that nvm isn’t loaded in your shell. Add the nvm loader to `~/.bashrc` or `~/.zshrc`:
+These issues apply if you installed Claude Code with `npm install -g` inside WSL. If you used the [native installer](</docs/en/setup>), skip this section. On npm 12, install as Fix an npm 12 install describes. **OS or platform detection issues.** If npm reports a platform mismatch during install, run `npm config set os linux` first, then install with `npm install -g @anthropic-ai/claude-code@latest --force`. Do not use `sudo`. **`exec: node: not found` when running `claude`.** Your WSL environment is likely using the Windows installation of Node.js. Confirm with `which npm` and `which node`: paths starting with `/mnt/c/` are Windows binaries, while Linux paths start with `/usr/`. To fix this, install Node via your Linux distribution’s package manager or via [`nvm`](<https://github.com/nvm-sh/nvm>). **nvm version conflicts.** If you have nvm installed in both WSL and Windows, switching Node versions in WSL may break because WSL imports the Windows PATH by default and the Windows nvm takes priority. The most common cause is that nvm isn’t loaded in your shell. Add the nvm loader to `~/.bashrc` or `~/.zshrc`:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
@@ -764,7 +764,7 @@
3. Reinstall:
- npm install -g @anthropic-ai/claude-code
+ npm install -g @anthropic-ai/claude-code@latest
If this or step 1 fails with `EACCES`, switch to the native installer instead of rerunning it with `sudo`. Claude Code runs npm without `sudo` when it updates itself, so automatic updates would fail the same way.
4. If `claude --version` doesn’t print a version number, check the other causes.
@@ -772,7 +772,7 @@
### npm `ENOTEMPTY` error during update or reinstall
-When you run `npm install -g @anthropic-ai/claude-code` over an existing installation, npm can fail while moving the old package directory aside:
+When you run `npm install -g @anthropic-ai/claude-code@latest` over an existing installation, npm can fail while moving the old package directory aside:
npm error code ENOTEMPTY
npm error syscall rename
@@ -797,7 +797,7 @@
Then reinstall. On npm 12, follow Fix an npm 12 install. Otherwise, run:
- npm install -g @anthropic-ai/claude-code
+ npm install -g @anthropic-ai/claude-code@latest
Confirm with `claude --version`, which prints a version number such as `2.1.211 (Claude Code)`.
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -1,4 +1,4 @@
-This page covers Agent SDK errors in CLI startup, CLI process exit, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom:
+This page covers Agent SDK errors in CLI startup, CLI process exit, large tool calls and results, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom:
Symptom| Go to
---|---
@@ -10,7 +10,7 @@
Hook not firing, matcher not filtering as expected, hook timeout, tool blocked unexpectedly, modified input not applied, session hooks not available in Python, subagent permission prompts multiplying, recursive hook loops with subagents, `systemMessage` not appearing in output| [Fix common issues](</docs/en/agent-sdk/hooks#fix-common-issues>) on the hooks page
An agent that works on your machine fails in a deployed service or container| [Troubleshoot deployment failures](</docs/en/agent-sdk/hosting#troubleshoot-deployment-failures>)
`Not logged in`, `Invalid API key`, `API Error`, `429`, `There's an issue with the selected model`| [Error reference](</docs/en/errors#find-your-error>)
-`CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `structured_output` is `None`| CLI startup, CLI process exit, and Structured outputs on this page
+`CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `CLIJSONDecodeError`, `structured_output` is `None`| CLI startup, CLI process exit, Large tool calls and results, and Structured outputs on this page
## CLI startup
@@ -104,6 +104,28 @@
The text after the colon is the CLI’s report of what went wrong, so start there rather than with the exit itself. Python raises this as a [`ResultError`](</docs/en/agent-sdk/python#resulterror>), whose `data` attribute carries the full error result. TypeScript rejects the message loop with a plain `Error` carrying the same message shape.
+## Large tool calls and results
+
+### CLIJSONDecodeError: JSON message exceeded maximum buffer size
+
+The Python SDK raises this error when one message from Claude Code is longer than the [`max_buffer_size`](</docs/en/agent-sdk/python#claudeagentoptions>) option, which defaults to 1,048,576 characters. The error calls them bytes:
+
+ Failed to decode JSON: JSON message exceeded maximum buffer size of 1048576 bytes...
+
+For example, PDFs, screenshots, and text files can produce messages that reach that limit:
+
+ * **PDFs and screenshots** : when Claude reads a whole PDF of about 393 KB or more with the Read tool, the tool result can reach the limit, because it holds the file’s base64 twice. A tool result with a screenshot, from Read or an MCP tool, holds the base64 twice too.
+ * **Text files** : messages from the Edit and Write tools can reach the limit on a file well under 1 MB, depending on how much of the file changes.
+
+To stop the error, set a larger limit in `ClaudeAgentOptions`:
+
+ options = ClaudeAgentOptions(max_buffer_size=64 * 1024 * 1024)
+
+That value is enough for a screenshot, and for a Read of a whole PDF up to Read’s 20 MB limit. If the error comes back, for example on an Edit of a very large file, set a higher value. Any change a tool already made stays in place, and the tool call whose message was too long may have made one. To pick up the work that stopped:
+
+ 1. If you hold a `ClaudeSDKClient` open, call `disconnect()`. The client receives no more messages after this error, but Claude Code keeps running and can still make changes.
+ 2. Start a new `query()` or `ClaudeSDKClient` with the larger limit and [`continue_conversation=True`](</docs/en/agent-sdk/sessions#continue-resume-and-fork>), which picks the most recent session in the working directory. To pick a specific session, set `resume` to `data["session_id"]` from the init [`SystemMessage`](</docs/en/agent-sdk/python#systemmessage>).
+
## Structured outputs
### structured_output is None but the result says success
Show diff (144 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -76,6 +76,13 @@
`options`| `Options`| Optional configuration object. Same as the `options` parameter to `query()`
`initializeTimeoutMs`| `number`| Maximum time in milliseconds to wait for subprocess initialization. Defaults to `60000`. If initialization does not complete in time, the promise rejects with a timeout error
+Slow [SessionStart](</docs/en/hooks#sessionstart>) and [Setup](</docs/en/hooks#setup>) [command hooks](</docs/en/hooks#command-hook-fields>) get extra time only when `initializeTimeoutMs` is unset:
+
+ * **If you leave it unset:** time these hooks spend running doesn’t count toward the 60-second default, up to 10 minutes in total, so initialization can take 11 minutes at most.
+ * **If you set a value, including`60000`:** that value is the limit, even while a hook is running.
+
+The extra time requires TypeScript Agent SDK v0.3.304 or later.
+
#### Returns
Returns a `Promise<``WarmQuery``>` that resolves once the subprocess has spawned and completed its initialize handshake. Of the `hook_progress` messages a `SessionStart` or `Setup` hook emits before the handshake completes, you get only the newest, which carries all of the hook’s output so far. `startup()` holds that message, the hook’s `hook_started` message, and anything else the subprocess emits before the handshake completes. The held messages reach you once you call `.query()` on the `WarmQuery` and iterate the result.
@@ -96,14 +103,38 @@
### `prewarm()`
-_Alpha._ Starts a Claude Code process as a spare before you know which session it will serve, so you can bind it to a session later with `claim()`. Use it in an application that boots before the user picks a folder. Requires TypeScript Agent SDK v0.3.282 or later. `prewarm()` completes the same initialize handshake as `startup()`, with the process waiting in `options.cwd` when you set it and otherwise in a private temporary directory under your Claude Code config directory. The session’s working directory, its `SessionStart` hooks, its stdio MCP servers, and its CLAUDE.md and git context wait for the claim. A spare holds roughly 230 to 260 MB of memory while it waits. If your `spawnClaudeCodeProcess` runs Claude Code on another machine or in a container, set `options.cwd` to a directory that exists there for the spare to wait in.
+_Alpha._ Starts a Claude Code process as a spare before you know which session it will serve, so you can bind it to a session later with `claim()`. Requires TypeScript Agent SDK v0.3.282 or later. Use `prewarm()` when your application boots before the user picks a folder.
function prewarm(params?: {
options?: Options;
initializeTimeoutMs?: number;
}): Promise<SpareProcess>;
-`options` and `initializeTimeoutMs` mean the same as for `startup()`, except that `options.cwd` sets only the directory the spare waits in. The promise resolves with a `SpareProcess` once the process has completed its initialize handshake. `prewarm()` throws if `options` sets `resume`, `continue`, or `forkSession`, because a spare has no session yet. Everything a claim can’t set, such as `mcpServers`, `hooks`, `canUseTool`, `settingSources`, `systemPrompt`, and `plugins`, is fixed for the life of the spare, so keep one spare per distinct set of those options and prewarm again when they change.
+#### Parameters
+
+Parameter| Type| Description
+---|---|---
+`options`| `Options`| Optional configuration object, the same type that `startup()` takes
+`initializeTimeoutMs`| `number`| Maximum time in milliseconds to wait for the spare’s initialization. Defaults to `60000`. If initialization doesn’t complete in time, the promise rejects with a timeout error
+
+`prewarm()` counts time spent in [Setup](</docs/en/hooks#setup>) hooks toward `initializeTimeoutMs`, even when you leave it unset. To give slow Setup hooks more time, set a longer value.
+
+#### Returns
+
+Returns a `Promise<``SpareProcess``>` that resolves once the spare is ready to claim. The promise rejects if you ask for `resume`, `continue`, or `forkSession` in `options`, because a spare has no session yet.
+
+#### How a spare works
+
+ * **Where a spare waits:** in a private temporary directory under your Claude Code config directory, or in `options.cwd` if you set it in `prewarm()`.
+ * **If your`spawnClaudeCodeProcess` runs Claude Code on another machine or in a container:** pass `prewarm()` an `options.cwd` that exists there, because the default temporary directory is created on your machine.
+ * **Memory:** each spare uses roughly 230 to 260 MB while it waits.
+ * **What doesn’t happen until you call`claim()`:**
+ * Moving to the working directory you pass to `claim()`
+ * Running SessionStart hooks
+ * Starting stdio MCP servers
+ * Loading CLAUDE.md and git context
+ * **What a claim can’t change:** options such as `mcpServers`, `hooks`, `canUseTool`, `settingSources`, and `plugins` keep their values from `prewarm()`. `SpareProcess` lists what a claim can set.
+ * **If sessions need different values for these:** keep a separate spare for each set of values.
#### Example
@@ -422,6 +453,15 @@
console.log(`Cleanup period: ${effective.cleanupPeriodDays} days`);
console.log(`Set by: ${provenance.cleanupPeriodDays?.source}`);
+
+### `matchDeniedModels()`
+
+Reports which of `models` a [`deniedModels`](</docs/en/settings-reference#deniedmodels>) list blocks. `denied` holds one Boolean per model, `true` when an entry blocks it. `warnings` flags ignored input and entries that block more or less than they appear to. A `false` doesn’t mean the model is allowed, because Claude Code also checks aliases and model overrides. This function is alpha and requires Agent SDK v0.3.323 or later.
+
+ function matchDeniedModels(
+ models: readonly string[],
+ deniedModels: readonly string[] | undefined
+ ): Promise<{ denied: boolean[]; warnings: string[] }>;
## Types
@@ -488,7 +528,7 @@
`skills`| `string[] | 'all'`| `undefined`| Skills available to the session. Pass `'all'` to enable every discovered skill, or a list of skill names. Pass exact names only. On Agent SDK v0.3.221 or later, the SDK rejects malformed and wildcard-form names with an error before starting the Claude Code process. When set, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass `tools`, include `'Skill'` in that list. See [Skills](</docs/en/agent-sdk/skills>)
`spawnClaudeCodeProcess`| `(options: SpawnOptions) => SpawnedProcess`| `undefined`| Custom function to spawn the Claude Code process. Use to run Claude Code in VMs, containers, or remote environments
`stderr`| `(data: string) => void`| `undefined`| Callback for stderr output
-`strictMcpConfig`| `boolean`| `false`| Use only the servers passed in `mcpServers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>)
+`strictMcpConfig`| `boolean`| `false`| Use the servers passed in `mcpServers` and ignore project `.mcp.json`, user settings, plugin-provided MCP servers, and [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>)
`systemPrompt`| `string | string[] | { type: 'custom'; prompt: string | string[]; snapshot?: boolean } | { type: 'preset'; preset: 'claude_code'; append?: string; excludeDynamicSections?: boolean; snapshot?: boolean }`| `undefined` (minimal prompt)| System prompt configuration. Pass a string for a custom prompt, or `{ type: 'preset', preset: 'claude_code' }` to use Claude Code’s system prompt. Pass an array of strings with the exported `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` constant between the static and per-request parts to [cache the static part of a custom prompt](</docs/en/agent-sdk/modifying-system-prompts#cache-the-static-part-of-a-custom-prompt>). When using the preset object form, add `append` to extend it with additional instructions, and set `excludeDynamicSections: true` to move per-session context into the first user message for [better prompt-cache reuse across machines](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>). Set `snapshot: false` to rebuild the prompt on every request instead of [reusing the prompt the session recorded on its first request](</docs/en/agent-sdk/modifying-system-prompts#change-the-prompt-of-an-existing-session>). To set `snapshot` on a custom prompt, pass the `{ type: 'custom', prompt }` form. The `{ type: 'custom' }` form and the `snapshot` field require TypeScript Agent SDK v0.3.257 or later
`taskBudget`| `{ total: number }`| `undefined`| _Alpha._ API-side task budget in tokens. When set, the model is told its remaining token budget so it can pace tool use and wrap up before the limit
`thinking`| `ThinkingConfig`| `{ type: 'adaptive' }` for supported models| Controls Claude’s thinking/reasoning behavior. See `ThinkingConfig` for options
@@ -1078,7 +1118,7 @@
`tools`| No| Array of allowed tool names. If omitted, inherits every [tool available to subagents](</docs/en/sub-agents#available-tools>). To preload Skills into the agent’s context, use the `skills` field rather than listing `'Skill'` here
`disallowedTools`| No| Array of tool names to explicitly disallow for this agent. MCP server-level patterns are also accepted: `mcp__server` or `mcp__server__*` removes every tool from that server, and `mcp__*` removes every MCP tool from any server
`prompt`| Yes| The agent’s system prompt
-`model`| No| Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the main model. When you omit it, Claude Code picks the model in the [subagent model order](</docs/en/sub-agents#choose-a-model>)
+`model`| No| Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the model of the agent that spawned this one. When you omit `model`, Claude Code picks the model in the [subagent model order](</docs/en/sub-agents#choose-a-model>)
`mcpServers`| No| MCP server specifications for this agent
`skills`| No| Array of skill names to preload into the agent context
`initialPrompt`| No| Auto-submitted as the first user turn when this agent runs as the main thread agent
@@ -1190,7 +1230,7 @@
Option| Type| Description
---|---|---
`signal`| `AbortSignal`| Signaled if the operation should be aborted
-`suggestions`| `PermissionUpdate``[]`| Suggested permission updates so the user is not prompted again for this tool. Bash prompts include a suggestion with the `localSettings` destination, so returning it in `updatedPermissions` writes the rule to `.claude/settings.local.json` and persists across sessions.
+`suggestions`| `PermissionUpdate``[]`| Suggested permission updates so the user is not prompted again for this tool. Bash prompts can include a suggestion with the `localSettings` destination, so returning it in `updatedPermissions` writes the rule to `.claude/settings.local.json` and persists across sessions.
`blockedPath`| `string`| The file path that triggered the permission request, if applicable
`mcpServer`| `{ name: string; source: string }`| For an `mcp__*` tool, the MCP server that serves it and where that server’s definition came from, with the fields of `McpServerProvenance`. Absent for other tools. Requires Agent SDK v0.3.274 or later
`decisionReason`| `string`| Explains why this permission request was triggered
@@ -1349,7 +1389,7 @@
Choose `always_ask` to approve each call yourself, or `always_deny` to block the tool outright:
* **`always_ask`** : each call to the tool [needs approval](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>), even if an `allowedTools` entry or allow rule covers it. The call goes to your `canUseTool` callback or `permissionPromptToolName` tool, unless it’s settled first. A [mod](</docs/en/plugins/mods/overview>) in a plugin you load [can approve it first](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Otherwise, in `dontAsk` mode it’s denied, and in `auto`, `plan`, and `bypassPermissions` mode it can be approved before it reaches your callback
- * **`always_deny`** : a call to the tool [is denied](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>) in every permission mode, including `bypassPermissions`, but a mod in a plugin you load [can still approve it](</docs/en/permissions#precedence-among-rules-hooks-and-mods>)
+ * **`always_deny`** : Claude Code removes the tool from Claude’s context in every permission mode, including `bypassPermissions`. Removal requires Claude Code v2.1.324 or later
If you pass neither `canUseTool` nor `permissionPromptToolName`, or set `permissionPrompts` to `'none'`, an `always_ask` call that isn’t settled first is denied unless a [`PermissionRequest` hook](</docs/en/hooks#permissionrequest>) allows it.
@@ -1468,6 +1508,7 @@
user_message_uuid?: string;
user_message_uuids?: string[];
resume_reason?: string;
+ supersedes?: UUID[];
};
The `message` field is a [`BetaMessage`](<https://platform.claude.com/docs/en/api/messages/create>) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'oauth_org_not_allowed'`, `'account_on_hold'`, `'billing_error'`, `'rate_limit'`, `'overloaded'`, `'invalid_request'`, `'model_not_found'`, `'server_error'`, `'max_output_tokens'`, `'cloud_credential_error'`, or `'unknown'`. Four of these values mean more than their names say:
@@ -1477,7 +1518,7 @@
* `'account_on_hold'`: [your account is on hold](</docs/en/errors#your-account-is-on-hold>)
* `'cloud_credential_error'`: Claude Code couldn’t obtain usable AWS or Google Cloud credentials on the machine it runs on, so no request reached the cloud provider. The usual cause is a cloud sign-in that expired or was never completed on that machine, though a briefly unreachable credential service reports the same value. See [Could not load AWS or Google Cloud credentials](</docs/en/errors#could-not-load-aws-or-google-cloud-credentials>). Requires TypeScript Agent SDK v0.3.267 or later, which bundles Claude Code v2.1.267
-`aborted` is `true` when an interrupt or abort truncated the assistant message before the stream completed: the message has no `stop_reason` and the content may end mid-word. The field is absent on normally completed messages. It requires Agent SDK v0.3.214 or later. `agent_id` identifies the subagent that produced the message and is absent on main-thread messages. The value equals the `task_id` on that subagent’s `task_started` and other task events, and is unchanged when the subagent is [resumed](</docs/en/agent-sdk/subagents#resume-subagents>). On messages from a [nested subagent](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), it names the nested subagent, not the subagent that spawned it. The field requires Agent SDK v0.3.292 or later. Match a subagent’s messages to its task events on `agent_id` rather than pairing a message’s `parent_tool_use_id` with a task event’s `tool_use_id`. When a tool call resumes the subagent, the task events carry that call’s `tool_use_id`, while the messages keep the `parent_tool_use_id` of the tool call that first started the subagent, so the two no longer match. Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn’s first assistant message, under the conditions in `user_message_uuid`. When the turn continues one that a restart interrupted, the assistant messages that carry those fields also carry `resume_reason`. `timestamp` is the ISO 8601 time when the message’s content finished generating on the process that produced it. The value comes from that machine’s clock, so use it for display only and don’t order messages by it. One API turn can produce several assistant messages that share a `message.id`, each with its own `timestamp`. When the field is absent, fall back to the time you received the message. `context_usage` is a structured copy of the `/context` report, typed as `SDKContextUsage`, and requires Agent SDK v0.3.232 or later. When you send `/context` as a prompt, Claude Code delivers the report as an assistant message whose `message.content` holds the markdown table, and attaches `context_usage` to that same message. Claude Code doesn’t set the field on any other assistant message, and earlier versions deliver the `/context` table without it, so read the breakdown from the field when it’s present and fall back to the markdown text when it isn’t. `usage_report` is a structured copy of the `/usage` report, typed as `SDKUsageReport`, and requires Agent SDK v0.3.273 or later. When you send `/usage` as a prompt, Claude Code delivers the report as an assistant message whose `message.content` holds the text. It attaches `usage_report` to that same message only when the session meets all of these conditions:
+`aborted` is `true` when an interrupt or abort truncated the assistant message before the stream completed: the message has no `stop_reason` and the content may end mid-word. The field is absent on normally completed messages. It requires Agent SDK v0.3.214 or later. `supersedes` lists the UUIDs of earlier messages that this message replaces. Remove those messages from your display when this one arrives. `agent_id` identifies the subagent that produced the message and is absent on main-thread messages. The value equals the `task_id` on that subagent’s `task_started` and other task events, and is unchanged when the subagent is [resumed](</docs/en/agent-sdk/subagents#resume-subagents>). On messages from a [nested subagent](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), it names the nested subagent, not the subagent that spawned it. The field requires Agent SDK v0.3.292 or later. Match a subagent’s messages to its task events on `agent_id` rather than pairing a message’s `parent_tool_use_id` with a task event’s `tool_use_id`. When a tool call resumes the subagent, the task events carry that call’s `tool_use_id`, while the messages keep the `parent_tool_use_id` of the tool call that first started the subagent, so the two no longer match. Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn’s first assistant message, under the conditions in `user_message_uuid`. When the turn continues one that a restart interrupted, the assistant messages that carry those fields also carry `resume_reason`. `timestamp` is the ISO 8601 time when the message’s content finished generating on the process that produced it. The value comes from that machine’s clock, so use it for display only and don’t order messages by it. One API turn can produce several assistant messages that share a `message.id`, each with its own `timestamp`. When the field is absent, fall back to the time you received the message. `context_usage` is a structured copy of the `/context` report, typed as `SDKContextUsage`, and requires Agent SDK v0.3.232 or later. When you send `/context` as a prompt, Claude Code delivers the report as an assistant message whose `message.content` holds the markdown table, and attaches `context_usage` to that same message. Claude Code doesn’t set the field on any other assistant message, and earlier versions deliver the `/context` table without it, so read the breakdown from the field when it’s present and fall back to the markdown text when it isn’t. `usage_report` is a structured copy of the `/usage` report, typed as `SDKUsageReport`, and requires Agent SDK v0.3.273 or later. When you send `/usage` as a prompt, Claude Code delivers the report as an assistant message whose `message.content` holds the text. It attaches `usage_report` to that same message only when the session meets all of these conditions:
* The session authenticates with a claude.ai credential
* The credential shows a known plan type or carries the `user:profile` scope
@@ -4968,7 +5009,7 @@
session_id: string;
};
-While a tool call runs in the main conversation, Claude Code emits a `tool_progress` message every 30 seconds with `heartbeat: true`. Each heartbeat carries the tool name and elapsed seconds, so you can distinguish a long-running call from a stalled session. Claude Code doesn’t emit heartbeats for tool calls inside a subagent. The `heartbeat` field requires Agent SDK v0.3.214 or later. Before v2.1.257, Claude Code didn’t emit heartbeats for a foreground Agent tool call either. On `tool_progress` messages for the Agent tool other than heartbeats, `subagent_type` names the running subagent type, such as `general-purpose`. `subagent_retry` is present while that subagent waits out an API error backoff, such as a rate limit or overload, with one message per retry attempt. Both fields require Agent SDK v0.3.214 or later. To render a retry indicator from `subagent_retry`:
+While a tool call runs in the main conversation, Claude Code emits a `tool_progress` message every 30 seconds with `heartbeat: true`. Each heartbeat carries the tool name and elapsed seconds, so you can distinguish a long-running call from a stalled session. Claude Code doesn’t emit heartbeats for tool calls inside a subagent. The `heartbeat` field requires Agent SDK v0.3.214 or later. Before v2.1.257, Claude Code didn’t emit heartbeats for a foreground Agent tool call either. On Agent SDK v0.3.323 or later, a heartbeat whose `tool_use_id` starts with `hook-` comes from a long-running hook, not a tool call. Its `tool_name` is the hook event name, such as `PreToolUse`. On `tool_progress` messages for the Agent tool other than heartbeats, `subagent_type` names the running subagent type, such as `general-purpose`. `subagent_retry` is present while that subagent waits out an API error backoff, such as a rate limit or overload, with one message per retry attempt. Both fields require Agent SDK v0.3.214 or later. To render a retry indicator from `subagent_retry`:
* Track the indicator by `parent_tool_use_id`, which is unique per subagent. `tool_use_id` is shared by parallel subagents from one assistant turn, so tracking by it would let one subagent’s update clear another’s indicator.
* Clear the indicator when a later `tool_progress` for the same `parent_tool_use_id` arrives with neither `subagent_retry` nor `heartbeat: true`, or when the tool’s result message arrives. Frames with `heartbeat: true` report liveness only, so keep the indicator when one arrives. `attempt` can exceed `max_retries` under persistent retry, so don’t derive clearing from the counters.
@@ -5266,7 +5307,7 @@
---|---|---|---
`enabled`| `boolean`| `false`| Enable sandbox mode for command execution
`failIfUnavailable`| `boolean`| `true`| Stop at startup if `enabled` is `true` but the sandbox can’t start. Set `false` to fall back to unsandboxed execution with a warning on stderr
-`autoAllowBashIfSandboxed`| `boolean`| `true`| Auto-approve Bash commands when sandbox is enabled
+[`autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>)| `boolean`| `false`| Auto-approve Bash commands when sandbox is enabled. The `false` default requires Agent SDK v0.3.324 or later
`excludedCommands`| `string[]`| `[]`| Commands that bypass sandbox restrictions, such as `['docker *']`. These run unsandboxed automatically without model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies
`allowUnsandboxedCommands`| `boolean`| `true`| Allow the model to request running commands outside the sandbox. When `true`, the model can set `dangerouslyDisableSandbox` in tool input, which falls back to the permissions system
`network`| `SandboxNetworkConfig`| `undefined`| Network-specific sandbox configuration
--- a/vs-code.md
+++ b/vs-code.md
@@ -122,6 +122,15 @@
* **Extended thinking** : lets Claude spend more time reasoning through complex problems. To turn it off or back on, use the **Thinking** switch in the Model section of the command menu (`/`). On models where [thinking can’t be turned off](</docs/en/model-config#extended-thinking>), the menu has no **Thinking** switch and thinking stays on. A thinking block that shows only a label, such as `Thought for 12s`, has no text and doesn’t open when you click it. To see thinking summaries, set [`showThinkingSummaries`](</docs/en/settings-reference#showthinkingsummaries>) to `true` in `~/.claude/settings.json`, then run **Developer: Reload Window** from the Command Palette. Thinking blocks you already have stay empty. In responses after the reload, click a block or press `Ctrl+O` to expand them all.
* **Multi-line input** : press `Shift+Enter` to add a new line without sending. This also works in the “Other” free-text input of question dialogs.
+### Use or turn off suggested prompts
+
+After Claude replies, the panel can show a suggested next prompt as gray italic text in the empty prompt box. Each suggestion uses a [short background request](</docs/en/interactive-mode#prompt-suggestions>) that counts toward your plan’s usage limits or API costs.
+
+ * **Use the suggestion** : press `Tab` to turn it into editable text, then send it. Pressing `Enter` before you accept it doesn’t send the suggestion.
+ * **Write your own prompt** : start typing, which hides the suggestion.
+
+To turn suggestions off, set [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) to `false` in `~/.claude/settings.json`. You stop seeing them in new conversations, or in open ones after you run **Developer: Reload Window** from the Command Palette. If you set [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) to `true`, change it to `false` where you set it, or you keep seeing suggestions.
+
### Reference files and folders
Use @-mentions to give Claude context about specific files or folders. When you type `@` followed by a file or folder name, Claude reads that content and can answer questions about it or make changes to it. Claude Code supports fuzzy matching, so you can type partial names to find what you need:
@@ -738,6 +747,7 @@
`SSL certificate verification failed` or `Self-signed certificate detected`| [SSL certificate errors](</docs/en/errors#ssl-certificate-errors>)
`Dictation error: WebSocket error:` followed by a certificate error such as `unable to get local issuer certificate`, or `Remote server is not connected` on the Web tab| Dictation or the Web tab fails behind a TLS-inspecting proxy
`Claude Code process exited with code 1`, or another code| [Claude Code process exited with code N](</docs/en/errors#claude-code-process-exited-with-code-n>)
+`Claude Code did not finish starting` or `Subprocess initialization did not complete within 60000ms`| [Subprocess initialization did not complete within 60000ms](</docs/en/errors#subprocess-initialization-did-not-complete-within-60000ms>)
`Could not locate the Claude CLI on PATH`| [Could not locate the Claude CLI on PATH](</docs/en/errors#could-not-locate-the-claude-cli-on-path>)
`The connection to Claude Code ended before this message completed`| [The connection to Claude Code ended before this message completed](</docs/en/errors#the-connection-to-claude-code-ended-before-this-message-completed>)
`The Claude Code program for this computer, the <build> build, could not be found`| [The Claude Code program for this computer could not be found](</docs/en/errors#the-claude-code-program-for-this-computer-could-not-be-found>)
--- a/workflows.md
+++ b/workflows.md
@@ -348,7 +348,7 @@
* Check `/model` before a large run if you usually switch to a smaller model for routine work
* Ask Claude to use a smaller model for stages that don’t need the strongest one when you describe the task
-When your organization’s [`availableModels` allowlist](</docs/en/model-config#restrict-model-selection>) blocks a model the script requests for an agent, that agent runs on a substituted model instead, following the same [substitution rules as subagents](</docs/en/sub-agents#choose-a-model>).
+When your organization’s [`availableModels` allowlist](</docs/en/model-config#restrict-model-selection>) blocks a model the script requests for an agent, that agent runs on a substituted model instead, following the same [substitution rules as subagents](</docs/en/sub-agents#when-an-allowlist-blocks-a-subagent-model>).
### Set a size guideline
--- a/worktrees.md
+++ b/worktrees.md
@@ -162,16 +162,19 @@
If a worktree with the name you pass to `--worktree` already exists, Claude Code opens it instead of creating a new one. If Claude Code stops with an error containing `belongs to a different repository` or `is a leftover worktree`, see The worktree directory `belongs to a different repository`. With the default `"fresh"` base, a reopened worktree resets to the repository’s default branch instead of continuing at its old tip when all of the following hold:
- * It has no uncommitted changes or untracked files.
+ * The [sandbox](</docs/en/sandboxing#filesystem-isolation>) isn’t restricting file writes in your session, and neither the worktree’s nor the main checkout’s `.claude` settings files enable the sandbox.
+ * The worktree has no uncommitted changes or untracked files.
* It is still on the branch Claude Code created for it.
* It has no commits of its own, or its pull request or merge request was merged and its remote branch deleted.
Claude Code detects the merged case from git state alone: the remote branch the worktree pushed to no longer exists, and every commit in the worktree is already on the default branch. In every other case, Claude Code reopens the worktree at its old tip:
- * The worktree fails any of the conditions.
+ * The worktree or session fails any of the conditions.
* Claude Code can’t verify the worktree’s state.
* `worktree.baseRef` is `"head"`.
* The name is a pull request or merge request reference.
+
+If you use the sandbox with the `"fresh"` base, run `git fetch origin`, then pass a new name to `--worktree` to start from the latest default branch.
### Replace worktree creation with a hook
--- a/zero-data-retention.md
+++ b/zero-data-retention.md
@@ -34,6 +34,7 @@
Chat on claude.ai| Chat conversations through the Claude for Enterprise web interface are not covered by ZDR.
Cowork| Cowork sessions are not covered by ZDR.
Artifacts| Artifacts in chat conversations and Cowork sessions are not covered by ZDR, and are kept until deleted unless your organization sets a retention period for them. Artifacts are not available in Claude Code with ZDR.
+Claude in Chrome| The [Claude in Chrome](<https://support.claude.com/en/articles/13065128-claude-in-chrome-admin-controls>) browser extension is not covered by ZDR. It is [not available in Claude Code](</docs/en/chrome#chrome-availability-with-hipaa-or-zero-data-retention>) with ZDR, but members can still use it outside Claude Code where your organization allows it.
Claude Code Analytics| Does not store prompts or model responses, but collects productivity metadata such as account emails and usage statistics. Contribution metrics are not available for ZDR organizations; the [analytics dashboard](</docs/en/analytics>) shows usage metrics only.
User and seat management| Administrative data such as account emails and seat assignments is retained under standard policies.
Third-party integrations| Data processed by third-party tools, MCP servers, or other external integrations is not covered by ZDR. Review those services’ data handling practices independently.