Changes on
79 changes detected
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -83,7 +83,7 @@
[Starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>)| Choose the permission mode your developers’ terminal sessions start in instead of the built-in starting permission mode, or remove auto mode. The VS Code extension reads a `defaultMode` you set only on Pro, Max, and Team plans; [Switch permission modes](</docs/en/permission-modes#switch-permission-modes>) lists what the extension reads| `permissions.defaultMode`, `permissions.disableAutoMode`
[Sandboxing](</docs/en/sandboxing>)| OS-level filesystem and network isolation with domain allowlists| `sandbox.enabled`, `sandbox.network.allowedDomains`
[Managed policy CLAUDE.md](</docs/en/memory#deploy-organization-wide-claude-md>)| Org-wide instructions loaded in every session, can’t be excluded| File at the managed policy path
-[MCP server control](</docs/en/managed-mcp>)| Restrict which MCP servers users can add or connect to, or deploy a fixed set| `allowedMcpServers`, `deniedMcpServers`, `allowManagedMcpServersOnly`, or a deployed `managed-mcp.json` file
+[MCP server control](</docs/en/managed-mcp>)| Restrict which MCP servers users can add or connect to, deploy a fixed set, or provide remote servers to every user alongside their own| `allowedMcpServers`, `deniedMcpServers`, `allowManagedMcpServersOnly`, `managedMcpServers`, or a deployed `managed-mcp.json` file
[Plugin marketplace control](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| Restrict which marketplace sources users can add and install from, reject the CLI flags that sideload plugins, agents, and MCP servers for a single run, block [`command` plugin sources](</docs/en/plugin-marketplaces#command-sources>), and allowlist which marketplaces’ plugins can be suggested| `strictKnownMarketplaces`, `blockedMarketplaces`, `disableSideloadFlags`, `disableCommandPluginSources`, `pluginSuggestionMarketplaces`
[Customization lockdown](</docs/en/settings-reference#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings| `strictPluginOnlyCustomization`
[Hook restrictions](</docs/en/settings-reference#allowmanagedhooksonly>)| Restrict which hooks run and restrict HTTP hook URLs; see [what runs under `allowManagedHooksOnly`](</docs/en/settings-reference#what-runs-under-allowmanagedhooksonly>) for the full effect list| `allowManagedHooksOnly`, `allowedHttpHookUrls`
@@ -91,11 +91,18 @@
[Disable agent view](</docs/en/agent-view#how-background-sessions-are-hosted>)| Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor| `disableAgentView`
[Configure the corporate launcher](</docs/en/corporate-launcher>)| Prefix the [background-agent supervisor](</docs/en/agent-view#how-background-sessions-are-hosted>), its workers, and the [other covered background processes](</docs/en/corporate-launcher#what-the-launcher-covers>) with a required corporate launcher instead of turning agent view off| `processWrapper`
[Model restrictions](</docs/en/model-config#restrict-model-selection>)| `availableModels` filters which models appear in the picker. Adding `enforceAvailableModels` also constrains the auto-selected default model. See [surface coverage](</docs/en/model-config#surface-coverage>) for how this setting reaches the CLI, web, and IDE| `availableModels`, `enforceAvailableModels`
+[Effort cap](</docs/en/settings-reference#maxeffortlevel>)| Cap the [effort level](</docs/en/model-config#adjust-effort-level>) for every model or per model, on every provider| `maxEffortLevel`
[Version floor](</docs/en/settings-reference#minimumversion>)| Prevent auto-update from installing below an org-wide minimum| `minimumVersion`
[Required version range](</docs/en/settings-reference#requiredminimumversion>)| Refuse to start at all when the running version is outside an org-approved range. Stronger than `minimumVersion`, which only blocks downgrades| `requiredMinimumVersion`, `requiredMaximumVersion`
[Telemetry opt-out](</docs/en/data-usage#telemetry-services>)| Turn off Anthropic-bound usage metrics, error reports, and surveys on every device| `env` with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` set to `1`; the linked section lists the per-category variables
-Organizations whose members authenticate through claude.ai or the Anthropic API can also govern models without deploying settings: [organization model restrictions](</docs/en/model-config#organization-model-restrictions>) disable individual models, an [organization default model](</docs/en/model-config#organization-default-model>) sets which model new sessions start on, and [organization effort limits](</docs/en/model-config#organization-effort-limits>) cap effort levels per role. All three controls require a Claude Enterprise plan. Model restrictions and effort limits are enforced server-side; the default model is a starting point that users can change, unless the organization enforces it. Enforcement is available to a limited set of organizations; ask your Anthropic account team about availability. None of these controls reach sessions on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>); on those providers, use `availableModels` above for restrictions and the `model` key in managed settings for a default. [Claude Code on the web](</docs/en/claude-code-on-the-web>) has its own admin surface: on the Cloud environments page in admin settings, Owners create [organization-shared environments](</docs/en/cloud-environments#organization-shared-environments>) that set the [network access level](</docs/en/cloud-environments#network-access>), environment variables, and setup script for members’ cloud sessions. Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Permission rules and sandboxing cover different layers. Denying WebFetch blocks Claude’s fetch tool, but if Bash is allowed, `curl` and `wget` can still reach any URL. Sandboxing closes that gap with a network domain allowlist enforced at the OS level. For the threat model these controls defend against, see [Security](</docs/en/security>).
+If your members sign in through claude.ai or the Anthropic API and you’re on a Claude Enterprise plan, you can also govern models from your organization’s admin settings without deploying anything:
+
+ * [Organization model restrictions](</docs/en/model-config#organization-model-restrictions>): disable individual models. Enforced server-side.
+ * [Organization default model](</docs/en/model-config#organization-default-model>): set which model new sessions start on. Users can change it unless your organization enforces the default, which is available to a limited set of organizations; ask your Anthropic account team.
+ * [Organization effort limits](</docs/en/model-config#organization-effort-limits>): cap effort levels per role. Enforced server-side.
+
+None of these controls reach sessions on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On those providers, use managed settings instead: `availableModels` for restrictions, `model` for a default, and [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) for an effort cap. [Claude Code on the web](</docs/en/claude-code-on-the-web>) has its own admin surface: on the Cloud environments page in admin settings, Owners create [organization-shared environments](</docs/en/cloud-environments#organization-shared-environments>) that set the [network access level](</docs/en/cloud-environments#network-access>), environment variables, and setup script for members’ cloud sessions. Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Permission rules and sandboxing cover different layers. Denying WebFetch blocks Claude’s fetch tool, but if Bash is allowed, `curl` and `wget` can still reach any URL. Sandboxing closes that gap with a network domain allowlist enforced at the OS level. For the threat model these controls defend against, see [Security](</docs/en/security>).
##
--- a/advisor.md
+++ b/advisor.md
@@ -34,7 +34,13 @@
/advisor opus
-The command confirms with `Advisor set to` followed by the advisor model name. Your selection is saved to `advisorModel` in your user settings and persists across sessions. Claude Code doesn’t invoke a saved advisor that your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes. To use the advisor, pick an allowed model with `/advisor`. Claude Code still saves an advisor that your current main model doesn’t support. That advisor activates after you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>). On some plans, Fable as the advisor also needs your one-time [consent to bill Fable usage to usage credits](</docs/en/model-config#fable-and-usage-credits>). For what `/advisor fable` does before you have given that consent, see Fable advisor and usage credits.
+The command confirms with `Advisor set to` followed by the advisor model name. Your selection is saved to `advisorModel` in your user settings and persists across sessions, except in the cases the [`advisorModel` entry](</docs/en/settings-reference#advisormodel>) lists as applying to the current session only. The command also works where there is no terminal picker: in [non-interactive mode](</docs/en/headless>) with `-p`, in the Agent SDK, in the desktop app, and over [Remote Control](</docs/en/remote-control>). This requires Claude Code v2.1.260 or later. On those surfaces:
+
+ * Run `/advisor` with no argument to print the current advisor model and the aliases it accepts.
+ * Run `/advisor` with a model, such as `/advisor opus`, to set it.
+ * Run `/advisor off` to turn it off.
+
+Claude Code doesn’t invoke a saved advisor that your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes. To use the advisor, pick an allowed model with `/advisor`. Claude Code still saves an advisor that your current main model doesn’t support. That advisor activates after you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>). On some plans, Fable as the advisor also needs your one-time [consent to bill Fable usage to usage credits](</docs/en/model-config#fable-and-usage-credits>). For what `/advisor fable` does before you have given that consent, see Fable advisor and usage credits.
###
@@ -84,7 +90,7 @@
Opus 4.7 or later| Fable, and Opus 4.7 or later| Opus 4.7 and later Opus models are ranked as equally capable, so any of them accepts another as an advisor. An Opus 4.7 main with an Opus 4.6 or Sonnet 5 advisor is rejected
Fable 5.1 or Fable 5| Fable 5.1, or the same Fable version| An Opus or Sonnet advisor is rejected, and so is a Fable 5 advisor for a Fable 5.1 main model
-Fable 5.1 requires Claude Code v2.1.255 or later and Fable 5 requires v2.1.170 or later, plus [Fable access](</docs/en/model-config#work-with-fable>). Set the advisor as `fable`, `opus`, or `sonnet`. These aliases resolve to Claude Code’s built-in default version for each model family, which advances with new Claude Code releases. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request:
+Fable 5.1 requires Claude Code v2.1.257 or later, and Fable 5 requires v2.1.170 or later. Both require [Fable access](</docs/en/model-config#work-with-fable>). Set the advisor as `fable`, `opus`, or `sonnet`. These aliases resolve to Claude Code’s built-in default version for each model family, which advances with new Claude Code releases. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request:
* If the advisor is less capable than the main model, the advisor is not attached to the main model’s requests. The `/advisor` command output and a notification show this. Subagents whose own model satisfies the pairing may still use the advisor.
* If the main model or the advisor is a model Claude Code does not recognize, the advisor is not attached.
@@ -141,7 +147,12 @@
Cost
-When Claude calls the advisor, the advisor model reads the conversation, so each call consumes tokens at the advisor model’s rates in addition to your main model’s usage. With API billing, you pay the advisor model’s input and output rates for advisor tokens. On subscription plans, advisor usage counts toward your plan’s usage limits, except that a Fable advisor bills to [usage credits](</docs/en/model-config#fable-and-usage-credits>) on plans where Fable usage does. If your account requires the usage-credits consent, a Fable advisor bills nothing before you give it, because Claude Code doesn’t apply the selection until then. Claude calls the advisor at decision points rather than on every turn, so pairing a faster main model with a stronger advisor typically costs less than running the stronger model throughout. Advisor usage counts toward the session totals shown by [`/usage`](</docs/en/costs#track-your-costs>). For how advisor tokens are reported in API responses, see [Usage and billing](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/advisor-tool#usage-and-billing>) in the Claude API documentation.
+When Claude calls the advisor, the advisor model reads the conversation, so each call consumes tokens at the advisor model’s rates in addition to your main model’s usage. How those advisor tokens are billed depends on how you pay:
+
+ * **API billing** : you pay the advisor model’s input and output rates for advisor tokens
+ * **Subscription plans** : advisor usage counts toward your plan’s usage limits, except that a Fable advisor bills to [usage credits](</docs/en/model-config#fable-and-usage-credits>) on plans where Fable usage does
+
+If your account requires the usage-credits consent, a Fable advisor bills nothing before you give it, because Claude Code doesn’t apply the selection until then. Claude calls the advisor at decision points rather than on every turn, so pairing a faster main model with a stronger advisor typically costs less than running the stronger model throughout. Advisor usage counts toward the session totals shown by [`/usage`](</docs/en/costs#track-your-costs>). For how advisor tokens are reported in API responses, see [Usage and billing](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/advisor-tool#usage-and-billing>) in the Claude API documentation.
##
@@ -169,7 +180,7 @@
Turn the advisor off
-To stop using the advisor and clear your saved `advisorModel`, run `/advisor off` or choose **No advisor** in the `/advisor` picker:
+To stop using the advisor, run `/advisor off` or choose **No advisor** in the `/advisor` picker:
/advisor off
--- a/agent-loop.md
+++ b/agent-loop.md
@@ -9,7 +9,7 @@
Every agent session follows the same cycle:
1. **Receive prompt.** Claude receives your prompt, along with the system prompt, tool definitions, and conversation history. The SDK yields a `SystemMessage` with subtype `"init"` containing session metadata.
- 2. **Evaluate and respond.** Claude evaluates the current state and determines how to proceed. It may respond with text, request one or more tool calls, or both. The SDK yields an `AssistantMessage` containing the text and any tool call requests.
+ 2. **Evaluate and respond.** Claude evaluates the current state and determines how to proceed. It may respond with text, request one or more tool calls, or both. The SDK yields one or more `AssistantMessage` objects, one for each content block, such as a text block or a tool call request.
3. **Execute tools.** The SDK runs each requested tool and collects the results. Each set of tool results feeds back to Claude for the next decision. You can use [hooks](</docs/en/agent-sdk/hooks>) to intercept, modify, or block tool calls before they run.
4. **Repeat.** Steps 2 and 3 repeat as a cycle. Each full cycle is one turn. Claude continues calling tools and processing results until it produces a response with no tool calls.
5. **Return result.** The SDK yields a final `AssistantMessage` with the text response (no tool calls), followed by a `ResultMessage` with the final text, token usage, cost, and session ID.
@@ -25,8 +25,8 @@
A turn is one round trip inside the loop: Claude produces output that includes tool calls, the SDK executes those tools, and the results feed back to Claude automatically. This happens without yielding control back to your code. Turns continue until Claude produces output with no tool calls, at which point the loop ends and the final result is delivered. Consider what a full session might look like for the prompt “Fix the failing tests in auth.ts”. First, the SDK sends your prompt to Claude and yields a `SystemMessage` with the session metadata. Then the loop begins:
1. **Turn 1:** Claude calls `Bash` to run `npm test`. The SDK yields an `AssistantMessage` with the tool call, executes the command, then yields a `UserMessage` with the output (three failures).
- 2. **Turn 2:** Claude calls `Read` on `auth.ts` and `auth.test.ts`. The SDK returns the file contents and yields an `AssistantMessage`.
- 3. **Turn 3:** Claude calls `Edit` to fix `auth.ts`, then calls `Bash` to re-run `npm test`. All three tests pass. The SDK yields an `AssistantMessage`.
+ 2. **Turn 2:** Claude calls `Read` on `auth.ts` and `auth.test.ts`. The SDK yields an `AssistantMessage` for each call and returns the file contents.
+ 3. **Turn 3:** Claude calls `Edit` to fix `auth.ts`, then calls `Bash` to re-run `npm test`. All three tests pass. The SDK yields an `AssistantMessage` for each call.
4. **Final turn:** Claude produces a text-only response with no tool calls: “Fixed the auth bug, all three tests pass now.” The SDK yields a final `AssistantMessage` with this text, then a `ResultMessage` with the same text plus cost and usage.
That was four turns: three with tool calls, one final text-only response. You can cap the loop with `max_turns` / `maxTurns`, which counts tool-use turns only. For example, `max_turns=2` in the loop above would have stopped before the edit step. You can also use `max_budget_usd` / `maxBudgetUsd` to cap turns based on a spend threshold. Without limits, the loop runs until Claude finishes on its own, which is fine for well-scoped tasks but can run long on open-ended prompts (“improve this codebase”). Setting a budget is a good default for production agents. See Turns and budget below for the option reference.
@@ -45,7 +45,7 @@
* `"informational"`: plain-text status banners from the loop
* `"worker_shutting_down"`: the loop will end after the current turn because the host is exiting or Remote Control disconnected
In TypeScript, each subtype other than `"init"` is its own type in the [`SDKMessage` union](</docs/en/agent-sdk/typescript#sdkmessage>) rather than a subtype of `SDKSystemMessage`.
- * **`AssistantMessage`:** emitted after each Claude response, including the final text-only one. Contains text content blocks and tool call blocks from that turn.
+ * **`AssistantMessage`:** emitted for each content block in Claude’s responses, including the final text-only one. Each carries a single content block, such as text or a tool call, and the messages from one response share a message ID.
* **`UserMessage`:** emitted after each tool execution with the tool result content sent back to Claude. Also emitted for any user inputs you stream mid-loop.
* **`StreamEvent`:** only emitted when partial messages are enabled. Contains raw API streaming events (text deltas, tool input chunks). See [Stream responses](</docs/en/agent-sdk/streaming-output>).
* **`ResultMessage`:** marks the end of the agent loop. Contains the final text result, token usage, cost, and session ID. Check the `subtype` field to determine whether the task succeeded or hit a limit. A small number of trailing system events, such as `prompt_suggestion`, can arrive after it, so iterate the stream to completion rather than breaking on the result. See Handle the result.
@@ -76,13 +76,18 @@
TypeScript
import asyncio
- from claude_agent_sdk import query, AssistantMessage, ResultMessage
+ from claude_agent_sdk import query, AssistantMessage, ResultMessage, TextBlock, ToolUseBlock
async def main():
try:
async for message in query(prompt="Summarize this project"):
if isinstance(message, AssistantMessage):
- print(f"Turn completed: {len(message.content)} content blocks")
+ # Each AssistantMessage carries one content block
+ for block in message.content:
+ if isinstance(block, TextBlock):
+ print(f"Claude: {block.text}")
+ elif isinstance(block, ToolUseBlock):
+ print(f"Tool call: {block.name}")
if isinstance(message, ResultMessage):
if message.subtype == "success":
print(message.result)
@@ -101,7 +106,14 @@
try {
for await (const message of query({ prompt: "Summarize this project" })) {
if (message.type === "assistant") {
- console.log(`Turn completed: ${message.message.content.length} content blocks`);
+ // Each assistant message carries one content block
+ for (const block of message.message.content) {
+ if (block.type === "text") {
+ console.log(`Claude: ${block.text}`);
+ } else if (block.type === "tool_use") {
+ console.log(`Tool call: ${block.name}`);
+ }
+ }
}
if (message.type === "result") {
if (message.subtype === "success") {
--- a/agent-teams.md
+++ b/agent-teams.md
@@ -131,7 +131,7 @@
3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`.
4. The lead’s current model.
-[`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>) applies to teammates as well as to subagents. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order.
+If you set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1`](</docs/en/sub-agents#run-every-subagent-on-one-model>), the first two sources don’t apply. Claude Code picks every teammate’s model from `CLAUDE_CODE_SUBAGENT_MODEL` when it’s set to anything other than `inherit`, and from the lead’s current model otherwise. Requires Claude Code v2.1.257 or later. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order.
`teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead.
Show diff (171 lines)
--- a/agent-view.md
+++ b/agent-view.md
@@ -101,7 +101,7 @@
`∙`| The process has exited. You can still peek at the row, and when you reply or attach, Claude restarts from where it left off
`✢`| 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. 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.
+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.
###
@@ -160,7 +160,7 @@
Attach to a session
-Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. While you’re attached, `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list work normally, since a human at the terminal can complete their dialogs. When nobody is attached, these commands can’t open their dialogs, so the session appears under `Needs input` in agent view with a row such as `open this session to manage MCP servers`, and the transcript reply says the same. Attach and run the command again to continue; the needs-input row clears when you attach. `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` work without attaching either way. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view, whether you opened the session from agent view or with `claude attach <id>` from your shell. On Windows, if you press `←` within about half a second of attaching, Claude Code shows `Ambiguous ←, press again to detach`, because in that window the terminal can redeliver a press from before you attached. Press `←` again to detach. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`.
+Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. While you’re attached, `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list work normally, since a human at the terminal can complete their dialogs. When nobody is attached, these commands can’t open their dialogs, so the session appears under `Needs input` in agent view with a row such as `open this session to manage MCP servers`, and the transcript reply says the same. Attach and run the command again to continue; the needs-input row clears when you attach. `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` work without attaching either way. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view, whether you opened the session from agent view or with `claude attach <id>` from your shell. `←` also detaches while the [`/btw` overlay](</docs/en/interactive-mode#side-questions-with-%2Fbtw>) is open. Requires Claude Code v2.1.257 or later. A side question that’s still answering keeps running while you’re away. The next time you attach, the overlay reopens with it, or with its answer. On Windows, if you press `←` within about half a second of attaching, Claude Code shows `Ambiguous ←, press again to detach`, because in that window the terminal can redeliver a press from before you attached. Press `←` again to detach. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`.
####
@@ -242,6 +242,8 @@
`Ctrl+C`| Clear the input; press twice to exit
`?`| Show all shortcuts
+`Ctrl+S`, `Ctrl+T`, and `Ctrl+G` follow your [`keybindings.json`](</docs/en/keybindings>). Rebind or unbind `Ctrl+S` and `Ctrl+T` with the `agents:switchView` and `agents:togglePin` actions in the [`Agents` context](</docs/en/keybindings#agents-actions>), and `Ctrl+G` through the `Chat` context’s `chat:externalEditor` binding. The other shortcuts in the table can’t be rebound.
+
##
@@ -357,7 +359,11 @@
claude --agent code-reviewer --bg "address review comments on PR 1234"
-If the name doesn’t match any of your subagents, the launch fails: Claude Code prints a `no agent named` warning and still reports the session as backgrounded, but the session exits immediately with an `--agent '<name>' not found` error. When the backgrounded session later resumes or restarts, Claude Code restores the agent’s system prompt and tool restrictions. It searches the session’s own directory for the agent first, provided you’ve [trusted that workspace](</docs/en/permissions#project-allow-rules-and-workspace-trust>), so a project-scoped agent still loads when the session is resumed from another directory. If the agent no longer exists, the session continues with the default tools and system prompt and its transcript opens with a [warning naming the agent](</docs/en/errors#session-agent-no-longer-available>). Pass `--name` to set the session’s display name in agent view instead of the auto-generated one:
+If the name doesn’t match any of your subagents, the launch fails: Claude Code prints a `no agent named` warning and still reports the session as backgrounded, but the session exits immediately with an `--agent '<name>' not found` error. When the backgrounded session later resumes or restarts, Claude Code restores the agent and its tool restrictions; for its system prompt, see [System prompt flags in resumed conversations](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>). It searches the session’s own directory for the agent first, provided you’ve [trusted that workspace](</docs/en/permissions#project-allow-rules-and-workspace-trust>), so a project-scoped agent still loads when the session is resumed from another directory. If the agent no longer exists, the session continues with the default tools and its transcript opens with a [warning naming the agent](</docs/en/errors#session-agent-no-longer-available>). To continue an existing conversation in the background, pass its full session ID with `--resume`:
+
+ claude --resume 1f0e2c9a-6d0b-4c11-9f39-2a77c1d4e8b5 --bg "pick up where you left off and finish the migration"
+
+On Claude Code v2.1.257 or later, Claude Code either continues that session under the same ID, or starts a copy under a new ID and prints a `note:` line explaining why it couldn’t continue in place. When the session continues in place, `claude agents` shows one row for it. When you combine `--bg` with `--continue`, a bare `--resume`, or `--resume` with a name or file path, Claude Code always starts such a copy. Add `--fork-session` to start a copy on purpose, without the note. Pass `--name` to set the session’s display name in agent view instead of the auto-generated one:
claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test"
@@ -421,7 +427,11 @@
* 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 with commits Claude Code can’t confirm are saved elsewhere, or one that another running session is using or has locked. Claude Code keeps the worktree and the session, and names the kept directory and the 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. In agent view, a refused delete shows `not deleted` with the reason on the session’s row. Push the commits, merge them into that default branch, or close the other session, then delete again.
+ * 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.
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:
@@ -489,9 +499,18 @@
The [permission mode](</docs/en/permissions>) depends on how you started the session:
* **Backgrounded with`/bg` or `←`**: Claude Code keeps the permission mode the session was in, so one you switched to `acceptEdits` or `auto` stays there after detaching
- * **Dispatched from an agent view you opened with`←`**: the new session starts in the permission mode of the session you came from
+ * **Dispatched from an agent view you opened with`←`**: the target’s own configuration comes first, and the permission mode of the session you came from applies when nothing else sets one
* **Dispatched from`claude agents` started in a shell, or with `claude --bg`**: the new session starts the way a new `claude` session in that directory would, unless you dispatched it from an agent view you opened with dispatch defaults. [Which permission mode a session starts in](</docs/en/permission-modes#which-mode-a-session-starts-in>) lists the order
+For a session you dispatch from an agent view opened with `←`, Claude Code takes the permission mode from the first of these that applies:
+
+ 1. The target directory’s [`permissions.defaultMode`](</docs/en/settings-reference#permissions-defaultmode>). Two source rules apply:
+ * `auto` and `bypassPermissions` [take effect only from managed settings, a `--settings` file, or `~/.claude/settings.json`](</docs/en/settings-reference#permissions-defaultmode>).
+ * Claude Code refuses a `defaultMode` from the project’s `.claude/settings.json` or `.claude/settings.local.json` that selects a more permissive mode than the session you came from was in.
+ 2. The permission mode of the session you came from
+
+When Claude Code refuses a source’s mode as too permissive, the next source in the list decides. For example, if you dispatch from a plan-mode session into a directory whose checked-in settings ask for `acceptEdits`, the new session starts in plan mode. If you move that `defaultMode` to `~/.claude/settings.json`, it applies regardless of the permission mode of the session you came from. Permissiveness runs plan, then Manual and `dontAsk`, then `acceptEdits` and auto, which each count as more permissive than the other, then `bypassPermissions`.
+
####
@@ -510,7 +529,7 @@
What persists across restarts
-The permission mode, model, and effort you chose for a background session, along with the configuration flags it carries, all persist when the supervisor later stops and restarts its process. A session you launched with `claude --bg --dangerously-skip-permissions` or `claude --bg --permission-mode bypassPermissions` stays in `bypassPermissions` after that restart. A model or effort you changed mid-session with `/model` or `/effort` is kept too. If the session took its effort from your settings rather than from `--effort` or `/effort`, Claude Code reads your settings again each time it starts a process for the session. So when you edit the saved effort in `settings.json`, the change reaches sessions you background with `←` or `/bg`, and their later restarts. The saved effort is the [`effortLevel`](</docs/en/settings-reference#effortlevel>) key or a [`modelSettings`](</docs/en/settings-reference#modelsettings>) entry. Claude Code also keeps a name you set with [`/rename`](</docs/en/commands>) or `Ctrl+R` across that restart, so you can still run [`claude --resume <name>`](</docs/en/sessions#name-your-sessions>) to reach the session.
+The permission mode, model, and effort you chose for a background session, along with the configuration flags it carries, all persist when the supervisor later stops and restarts its process. A session you launched with `claude --bg --dangerously-skip-permissions` or `claude --bg --permission-mode bypassPermissions` stays in `bypassPermissions` after that restart. A model or effort you changed mid-session with `/model` or `/effort` is kept too. If the session took its effort from your settings rather than from `--effort` or `/effort`, Claude Code reads your settings again each time it starts a process for the session. So when you edit the saved effort in `settings.json`, the change reaches sessions you background with `←` or `/bg`, and their later restarts. The saved effort is the [`effortLevel`](</docs/en/settings-reference#effortlevel>) key or a [`modelSettings`](</docs/en/settings-reference#modelsettings>) entry. Claude Code also keeps a name you set with [`/rename`](</docs/en/commands>) or `Ctrl+R` across that restart, so you can still run [`claude --resume <name>`](</docs/en/sessions#name-your-sessions>) to reach the session. A prompt you stashed with [`Ctrl+S`](</docs/en/interactive-mode#general-controls>) while attached is kept with the session too. Reopen the session after its process was stopped or restarted, and `Ctrl+S` restores the stashed text. Pasted content in the stash doesn’t survive the restart.
###
@@ -553,6 +572,7 @@
`claude respawn <id>`| Restart a session, running or stopped, e.g. to pick up an updated Claude Code binary. The restarted session resumes its saved conversation; when none is on disk, it runs its original prompt again as a new conversation
`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 daemon status`| Print the supervisor’s state, version, socket directory, and worker count
`claude daemon stop --any`| Stop the supervisor process and the background sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. The next `claude agents` or `claude --bg` starts a fresh supervisor
@@ -568,11 +588,28 @@
---|---|---
`cwd`, `kind`, `startedAt`| Always| The working directory, `interactive` or `background`, and the start time in Unix milliseconds
`id`| Background sessions| Short ID, usable with `claude attach`, `claude logs`, and `claude stop`
-`state`| Background sessions| One of `working`, `blocked`, `done`, `failed`, or `stopped`
-`pid`, `status`| While the process is alive| Process ID and current status
+`state`| Background sessions| One of `working`, `blocked`, `done`, `failed`, or `stopped`. See Read session state from a script for what each value means
+`pid`, `status`| While the process is alive| Process ID and one of `busy`, `waiting`, or `idle`
`waitingFor`| When `status` is `waiting`| What the session is blocked on: `permission prompt` for an approval, `input needed` for a question from Claude or an MCP server’s input request, `sandbox request`, `worker request`, or `dialog open`
`sessionId`, `name`| When set| `sessionId` is the full session UUID, usable with [`claude --resume`](</docs/en/sessions>). An interactive session’s `name` is its [default display name](</docs/en/sessions#name-your-sessions>) until you name the session or accept a plan in it
+###
+
+
+
+Read session state from a script
+
+`claude agents --json` is the supported way to read session state from outside Claude Code, for example from a status bar, a scheduler, or another Claude session that supervises background work. Poll `claude agents --json --all`, which keeps listing sessions whose process has exited, and read each entry’s `state`, `status`, and `waitingFor`.
+
+`state`| What it means
+---|---
+`working`| A turn is running, or the session is between steps of work it drives on its own, such as a [`/loop`](</docs/en/scheduled-tasks>) iteration or a wait on CI. `status` tells you whether its process is `busy` right now
+`blocked`| The session is waiting on you: a question it asked, a permission or sandbox decision, an error only you can clear such as an expired login, or its first prompt if you started it without one. When the wait is an open prompt in a live process, `waitingFor` names it
+`done`| The last turn finished what you asked for and the session is ready for your next prompt, whether or not its process is still alive
+`failed`, `stopped`| The task ended with an error, or the session was stopped
+
+A session that finished its turn and is waiting for your next instruction reads `done`, not `blocked`. `blocked` always means the session needs something from you before it can continue. The files under `~/.claude/jobs/<id>/` are not a stable interface. Values that a session or another program writes to `state`, `detail`, `tempo`, or `needs` are replaced on the next update. If you want a session to report progress in its own words, have it write a file of its own, for example under `$CLAUDE_JOB_DIR/tmp`, instead of editing `state.json`.
+
##
@@ -589,8 +626,8 @@
The supervisor is a background service that runs your background sessions so they keep working after you close agent view or your terminal. Claude Code starts it the first time you background a session or open agent view, and you don’t need to manage it yourself. Each session is its own Claude Code process under the supervisor, and what happens to that process depends on the session’s state:
- * **Working, waiting on you, or attached** : the process keeps running. A running subagent, workflow, or monitor counts as working.
- * **Finished and unattached for about an hour** : the supervisor stops the process to free resources. The conversation stays on disk, and the next time you attach or reply, the session resumes where it left off. Pin a session with `Ctrl+T` to keep its process running while idle.
+ * **Working, paused on a permission prompt or other dialog, or attached** : the process keeps running. A running subagent, workflow, or monitor counts as working.
+ * **Finished or waiting for your next message, and unattached for about an hour** : the supervisor stops the process to free resources. A session that ended its turn by asking you a question counts as waiting for your next message. The conversation stays on disk, and the next time you attach or reply, the session resumes where it left off. Pin a session with `Ctrl+T` to keep its process running.
* **Exited unexpectedly while the supervisor is running** : the supervisor restarts the process. Ending a session you backgrounded yourself with `←` or `/background`, for example with `kill`, marks it stopped instead of restarting it. For sessions that ended with a shutdown, see Sessions show as failed or stopped after shutdown.
* **After an auto-update** : the supervisor restarts itself onto the new version and moves idle sessions over in the background. Sessions that are working, waiting on you, or attached aren’t interrupted.
@@ -608,8 +645,8 @@
---|---
`~/.claude/daemon.log`| Supervisor log
`~/.claude/daemon/roster.json`| List of running background sessions, used to reconnect after a restart
-`~/.claude/jobs/<id>/state.json`| Per-session state shown in agent view
-`~/.claude/jobs/<id>/tmp/`| Per-session scratch directory. Writes here don’t prompt for permission. Removed when the session is deleted
+`~/.claude/jobs/<id>/state.json`| Per-session state shown in agent view. Read it through `claude agents --json` instead of parsing the file
+`~/.claude/jobs/<id>/tmp/`| Per-session scratch directory. Claude’s `Write` and `Edit` calls here don’t prompt for permission. Removed when the session is deleted
Each background session has the `CLAUDE_JOB_DIR` environment variable set to its `~/.claude/jobs/<id>` directory, so shell commands the session runs can write temporary files to `$CLAUDE_JOB_DIR/tmp` without colliding with parallel sessions. To inspect this state without reading the files directly, run `claude daemon status`. It reports whether the supervisor is reachable, its process ID and version, the socket directory, and how many background sessions are live. The command also warns when the running supervisor is on a different version than the `claude` you invoked, which happens after an update the supervisor hasn’t restarted into yet. The warning shows both versions and tells you to run `claude daemon stop --any` to pick up the new version. When Claude Code is installed as an OS service, the suggested command is `claude daemon stop` without the flag. Sessions survive that version mismatch intact: an older Claude Code version that updates a session’s `state.json` preserves fields it doesn’t recognize and keeps the session listed. The session list in `roster.json` follows the same rule, so sessions started by the newer version stay reachable and keep accepting input after the supervisor restarts.
@@ -783,7 +820,7 @@
A session is slow to respond after attaching
-Once a session has finished and sat unattached for about an hour, the supervisor stops its process to free resources. Attaching starts a fresh process from where it left off and switches to the session immediately while the process restarts. Sessions that are working, waiting on you, or pinned aren’t stopped this way, so pin a session with `Ctrl+T` to keep it responsive. While the process starts, Claude Code shows the tail of the session’s transcript formatted the way the live session renders it, with markdown, highlighted code blocks, and tool calls as dimmed rows, above a dimmed prompt area with a `Session is starting` note. The live session replaces it as soon as it’s ready.
+When a session that has finished or is waiting for your next message stays unattached for about an hour, the supervisor stops its process to free resources. Attaching starts a fresh process from where it left off and switches to the session immediately while the process restarts. Sessions that are working, paused on a permission prompt or other dialog, or pinned aren’t stopped this way, so pin a session with `Ctrl+T` to keep it responsive. While the process starts, Claude Code shows the tail of the session’s transcript formatted the way the live session renders it, with markdown, highlighted code blocks, and tool calls as dimmed rows, above a dimmed prompt area with a `Session is starting` note. The live session replaces it as soon as it’s ready.
###
@@ -828,6 +865,16 @@
Version| Change
---|---
+v2.1.260| When you background a session, your other sessions’ [agent listing](</docs/en/cross-session-messaging#see-which-sessions-claude-can-reach>) shows the conversation once, as its background session, and their messages to it no longer reach the terminal you moved it from. Before this release, that terminal could stay listed as a second interactive session under the conversation’s name, and a session that had messaged the conversation before the move kept delivering to that terminal.
+v2.1.260| When a delete is refused over unpushed commits, the message names the worktree’s branch and how many commits are unpushed, and deleting the session again discards the worktree and its commits. Before this release, the refusal said only `worktree has commits that are not pushed anywhere`, deleting again was refused the same way, and deleting the session required pushing the commits or removing the worktree by hand.
+v2.1.257| `←` detaches from an attached session while the `/btw` overlay is open, even mid-answer, and the overlay reopens when you next attach. Before this release, `←` didn’t detach while the overlay was open.
+v2.1.257| When you run `claude --resume <session-id> --bg`, Claude Code continues that session under its own ID, or starts a copy under a new ID and prints a `note:` line explaining why. `--continue`, a bare `--resume`, and `--resume` with a name or path start a copy with the same note. Before this release, `--resume` with `--bg` always started a copy under a new ID and said nothing.
+v2.1.257| When you dispatch a session from an agent view you opened with `←`, Claude Code starts it in the permission mode the target directory configures through `permissions.defaultMode`. When the directory doesn’t set one, the permission mode of the session you came from applies. Before this release, the dispatched session always started in the permission mode of the session you came from, overriding it.
+v2.1.257| `Ctrl+S`, `Ctrl+T`, and `Ctrl+G` in agent view follow your `keybindings.json`: `Ctrl+S` and `Ctrl+T` through the `Agents` context’s `agents:switchView` and `agents:togglePin` actions, and `Ctrl+G` through the `Chat` context’s `chat:externalEditor` binding. Before this release, agent view ignored `keybindings.json` and these keys were fixed.
+v2.1.257| Starting the background service recovers from two failure causes. On a macOS npm installation, a start during a self-update [waits for the install](</docs/en/errors#eacces-when-starting-a-background-session>) instead of running the placeholder that npm lays down while replacing the binary. On Windows, a stale `daemon.lock` written before the machine last booted, or whose recorded process ID now belongs to a different process, is replaced. Before this release, the macOS start failed with `Error: claude native binary not installed.` during the install window, and the Windows lock made every start fail with [`exited before it became reachable`](</docs/en/errors#background-service-exited-before-it-became-reachable>) until you deleted `~/.claude/daemon.lock`.
+v2.1.257| When you open or dispatch a background session while another Claude Code process is downloading an npm update, Claude Code [keeps waiting up to two minutes](</docs/en/errors#eacces-when-starting-a-background-session>) while the install runs, then fails saying `Claude Code is being updated by npm on this machine`. Before this release, the wait stopped at ten seconds, so the open failed with `Couldn't start the background service` while the download was still running.
+v2.1.257| A background session holding a [cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>) for your approval shows `approve message from` on its `Needs input` row, with the sender’s address and the name the sender claims. Before this release, the row moved to `Needs input` but kept its previous text, so nothing in `claude agents` named the waiting message or its sender.
+v2.1.257| A prompt stashed with `Ctrl+S` inside an opened background session is kept with the session, so `Ctrl+S` restores it after the session’s process is stopped and started again. Before this release, the stash lived only in the running process and was lost when the session went idle long enough for its process to stop, or when it was stopped and then reopened.
v2.1.251| In a background session that hasn’t moved into a worktree, Claude and the subagents it spawns can edit files inside a linked git worktree.
v2.1.251| Claude Code forwards a cloud provider gateway exported in the shell you dispatch from, such as `ANTHROPIC_VERTEX_BASE_URL` or `ANTHROPIC_BEDROCK_BASE_URL` with its auth-bypass flag, to the session’s worker under the same conditions as `ANTHROPIC_BASE_URL`. Before this release, if you backgrounded or dispatched from a shell authenticated only through such a gateway, every request the session made failed, because the endpoint and flag were dropped from its environment.
v2.1.251| When a background session starts while another Claude Code process is refreshing a [plugin marketplace](</docs/en/plugin-marketplaces>), such as a sibling session running the [marketplace auto-update](</docs/en/discover-plugins#configure-auto-updates>), Claude Code keeps that marketplace’s plugins available. Before this release, such a session could start without any of that marketplace’s skills, agents, hooks, and MCP servers and stay that way for its whole run.
--- a/amazon-bedrock.md
+++ b/amazon-bedrock.md
@@ -102,7 +102,7 @@
Credential caching and resolution timeout
-Claude Code resolves the AWS default credential provider chain once and keeps the resolved credentials in memory. It reuses them until five minutes before they expire, or for one hour when they carry no expiration, so an SSO-backed profile requests credentials from IAM Identity Center about once per credential lifetime. A credential error from the API clears the cache, and the retry resolves fresh credentials. Requires Claude Code v2.1.207 or later. The cache covers every credential option above except an Amazon Bedrock API key, which doesn’t use the provider chain. To resolve the chain on every request instead, set [`CLAUDE_CODE_SKIP_AWS_CRED_CACHE=1`](</docs/en/env-vars>). Each resolve of the chain times out after 60 seconds. If a step in the chain stalls, for example a `credential_process` helper that waits for input it can’t receive, the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>). If your chain runs an interactive sign-in that legitimately needs longer, such as browser-based SSO with MFA through a wrapper like `aws-vault`, raise the limit in milliseconds with [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](</docs/en/env-vars>). Before v2.1.207, a stalled credential resolution left the request waiting indefinitely.
+Claude Code resolves the AWS default credential provider chain once and keeps the resolved credentials in memory. It reuses them until five minutes before they expire, or for one hour when they carry no expiration, so an SSO-backed profile requests credentials from IAM Identity Center about once per credential lifetime. A credential error from the API clears the cache, and the retry resolves fresh credentials. Requires Claude Code v2.1.207 or later. The cache covers every credential option above except an Amazon Bedrock API key, which doesn’t use the provider chain. To resolve the chain on every request instead, set [`CLAUDE_CODE_SKIP_AWS_CRED_CACHE=1`](</docs/en/env-vars>). Each resolve of the chain times out after 60 seconds. If a step in the chain stalls, for example a `credential_process` helper that waits for input it can’t receive, the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>). If your chain runs an interactive sign-in that legitimately needs longer, such as browser-based SSO with MFA through a wrapper like `aws-vault`, raise the limit in milliseconds with [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](</docs/en/env-vars>). Before v2.1.207, a stalled credential resolution left the request waiting indefinitely. Except when you authenticate with an Amazon Bedrock API key, the setup wizard applies the same limit to each AWS call it makes while verifying your credentials, and to the credential lookup before each model check. During credential verification, a check that exceeds it fails with [`Timed out after 60s waiting for AWS`](</docs/en/errors#bedrock-setup-verification-timed-out-waiting-for-aws>).
####
@@ -467,6 +467,21 @@
+Certificate errors behind a TLS-inspecting proxy
+
+Claude Code applies your [CA certificate store](</docs/en/network-config#ca-certificate-store>) configuration to its requests to AWS, including:
+
+ * Model discovery
+ * Token counting
+ * The STS and SSO role-credential calls that resolve your AWS credentials
+ * The setup wizard’s credential verification and model checks
+
+For these requests, a corporate root certificate in your OS trust store or `NODE_EXTRA_CA_CERTS` bundle needs no Amazon Bedrock-specific setup. Before v2.1.260, Claude Code applied your CA configuration to these requests only when they went through a configured proxy, and on a direct connection they trusted only the runtime’s default certificate store. Before v2.1.261, the credential lookup behind the setup wizard’s model checks with the **Use credentials already in my environment** option still trusted only the runtime’s default certificate store. Behind a TLS-inspecting proxy whose root certificate is only in the OS store, the affected requests failed with `unable to get local issuer certificate`, or the wizard showed models as `unreachable`, while inference requests succeeded. Update to v2.1.261 or later.
+
+###
+
+
+
Region issues
If you encounter region issues:
--- a/artifacts.md
+++ b/artifacts.md
@@ -46,11 +46,11 @@
After you approve an artifact once, Claude Code republishes it without asking, and asks again in some cases, including when:
- * Claude declares a runtime capability for the page, such as connector calls
+ * Claude declares a runtime capability for the page, such as connector calls or file downloads
* You have since shared it publicly
* You have since shared it with specific people or your organization with the latest version chosen as the version viewers see
-After the first publish, Claude prints the URL, and your browser opens to the new page. Press `Ctrl+]` at any time to reopen the most recent artifact from the terminal. Claude picks the artifact’s title and an emoji for its browser-tab icon. Both appear in your gallery of artifacts on claude.ai and in shared links, so ask Claude to use a specific title or icon if you want one. To stop the browser from opening automatically when a new artifact is published, set `CLAUDE_CODE_ARTIFACT_AUTO_OPEN=0` in your environment. If Claude responds that it cannot publish, or writes a local HTML file without a link, the tool is not enabled for your session. Check the Availability requirements.
+After the first publish, Claude prints the URL, and your browser opens to the new page. If you sent the prompt through [Remote Control](</docs/en/remote-control>) from claude.ai, Claude Desktop, or the Claude mobile app, no tab opens on the machine running the session. The browser opens there the next time Claude publishes the artifact from a prompt you type at the terminal. Press `Ctrl+]` at any time to reopen the session’s most recent artifact. Claude picks the artifact’s title and an emoji for its browser-tab icon. Both appear in your gallery of artifacts on claude.ai and in shared links, so ask Claude to use a specific title or icon if you want one. To stop the browser from opening automatically when a new artifact is published, set `CLAUDE_CODE_ARTIFACT_AUTO_OPEN=0` in your environment. If Claude responds that it cannot publish, or writes a local HTML file without a link, the tool is not enabled for your session. Check the Availability requirements.
##
@@ -92,6 +92,14 @@
Let someone edit with you
People you share with are viewers by default: they see each version you publish but can’t change the page. On Team and Enterprise plans, you can also make someone an editor. In the share dialog, add a person and switch their role from **viewer** to **editor**. An editor publishes new versions the same way you update the artifact from another session: they give Claude the artifact’s URL, or attach it from `/artifacts`, and Claude pulls the current content and republishes with their changes. Everyone with the page open sees each update live.
+
+##
+
+
+
+Read an artifact shared with you
+
+When someone shares an artifact with you, you can have Claude read it: give Claude its URL, or attach it from `/artifacts`. Claude reads a page someone else wrote the way it reads a web page with [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>): it gets a summary of what it asked about rather than the raw page, and the summary reports instructions written into the page instead of relaying them. Claude Code also saves the page’s full source to a local file, which Claude can open when it needs the exact content, such as to republish the artifact as an editor.
##
@@ -171,6 +179,19 @@
* **The viewer hasn’t connected the connector** : connectors are per-account, so each viewer needs their own connection to every connector the page calls. They can add one under **Settings > Connectors** on claude.ai, then reload the page.
* **The viewer declined the permission ask** : a denial lasts for the rest of that page load. Reloading the page brings the permission ask back.
* **Connector calls are turned off for the organization** : an Owner controls the **Enable artifact connectors** toggle in admin settings.
+ * **The page calls tool names the connector doesn’t expose** : the affected sections stay empty for everyone, including you. This can happen when a page names the individual tools behind a gateway-style connector that exposes only a few tools of its own. Ask Claude to fix the tool names the page calls and publish it again. When Claude publishes the page and that connector’s tools are available in your session, Claude Code checks the tool names the page declares against them, warns Claude about names that don’t match, and refuses the publish when none do. Before v2.1.265, it published the page without checking them.
+
+##
+
+
+
+Offer a file download
+
+An artifact can offer viewers a file the page generates, such as a CSV export of a table or a PNG of a chart. The viewer saves it through a download control on the page, such as a button. File downloads are a runtime capability that claude.ai enables per account, so Claude checks whether your account has it before it builds the control. Viewers can’t save a file from an ordinary download link or a script on the page, because the artifact viewer on claude.ai blocks any download the page starts itself, including links to `data:` or `blob:` URLs. If a page has download buttons built that way, ask Claude to rebuild them with the downloads capability. To offer a file, ask for the control and the file format in your prompt:
+
+ Add a button that downloads this table as a CSV file.
+
+Claude declares the downloads capability as part of publishing, the same way it declares connectors.
##
@@ -270,6 +291,7 @@
---|---
External requests| The page can load typefaces from Google Fonts, and scripts from four public CDN hosts: cdnjs, the Tailwind and jQuery CDNs, and selected paths on jsDelivr such as `/npm/`. The CSP blocks every external image and all other external scripts, stylesheets, and fonts, and lets `fetch`, XHR, and WebSocket calls reach only the page’s own origin and the Google Fonts hosts. Claude therefore loads any library the page needs from one of those CDNs, inlines all other CSS and JavaScript, and embeds images as data URIs. Connector calls go through claude.ai, which makes the network call itself.
No backend| An artifact is a static page. It can’t store data submitted through a form or authenticate viewers itself. Its only way to fetch data when someone views it is calling MCP connectors, not an API of its own.
+Downloads| The page can’t start a download itself. To let viewers save a file the page generates, Claude declares the downloads capability. See Offer a file download.
Single page| Relative links do not resolve, because nothing is deployed alongside the page. For multi-section content, Claude uses in-page anchors rather than separate files.
Source file types| The published file must be `.html`, `.htm`, or `.md`. Markdown files render as styled HTML.
Rendered size| The rendered page must be 16 MiB or smaller. Large embedded images are the usual cause when a publish fails for size.
--- a/authentication.md
+++ b/authentication.md
@@ -126,7 +126,7 @@
* **What it signs you out of** : Claude Code signs you out of any claude.ai login stored on the machine
* **How to undo it** : run `/logout`, which removes and revokes the credential this sign-in wrote
-Everything else about profiles applies to this sign-in, including where it ranks against your other credentials, the `Profile` row you get in `/status`, and the features that need a claude.ai login. See Anthropic profiles and federation credentials.
+If your organization uses [server-managed settings](</docs/en/server-managed-settings>), they apply to this sign-in on Claude Code v2.1.257 or later. Everything else about profiles applies to this sign-in, including where it ranks against your other credentials, the `Profile` row you get in `/status`, and the features that need a claude.ai login. See Anthropic profiles and federation credentials.
###
@@ -223,7 +223,7 @@
6. Anthropic profile and federation credentials, the credentials that the `ant` CLI and Workload Identity Federation use. A profile that `ant auth login` wrote ranks here only when you name it in `ANTHROPIC_PROFILE`; otherwise it ranks below `/login`. See Anthropic profiles and federation credentials.
7. Subscription OAuth credentials from `/login`. This is the default for Claude Pro, Max, Team, and Enterprise users.
-A signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) session sits outside this list: it is a provider selection like Amazon Bedrock or Google Cloud’s Agent Platform, and it outranks them. When a gateway session exists, the CLI authenticates with the gateway token even if `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set, and credential sources above such as the bearer token, API key, `apiKeyHelper`, and profiles are not used. If you have an active Claude subscription but also have `ANTHROPIC_API_KEY` set in your environment, the API key takes precedence once approved. This can cause authentication failures if the key belongs to a disabled or expired organization. Run `unset ANTHROPIC_API_KEY` to fall back to your subscription, and check `/status` to confirm which method is active. The `Login method` row shows your subscription account, and an `API key` row appears when an API key is in use. [Claude Code on the Web](</docs/en/claude-code-on-the-web>) always uses your subscription credentials. If you set `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` in the sandbox environment, it doesn’t override your subscription credentials.
+A signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) session sits outside this list: it is a provider selection like Amazon Bedrock or Google Cloud’s Agent Platform, and it outranks them. When a gateway session exists, the CLI authenticates with the gateway token even if `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set, and credential sources above such as the bearer token, API key, `apiKeyHelper`, and profiles are not used. If your machine’s [managed settings](</docs/en/managed-settings>) set [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) to `"gateway"` or set [`forceLoginGatewayUrl`](</docs/en/settings-reference#forcelogingatewayurl>), and you don’t select a cloud provider through a variable such as `CLAUDE_CODE_USE_BEDROCK` or `CLAUDE_CODE_USE_VERTEX`, your session uses only the gateway sign-in. Claude Code skips the other credential sources and asks you to sign in with `/login`. See [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>) for what you see with each leftover credential. Before v2.1.261, or before v2.1.265 on a machine that sets only `forceLoginGatewayUrl`, Claude Code used a leftover saved login on these machines until you signed in to the gateway. If you have an active Claude subscription but also have `ANTHROPIC_API_KEY` set in your environment, Claude Code uses the API key once you approve it. This can cause authentication failures if the key belongs to a disabled or expired organization. Run `unset ANTHROPIC_API_KEY` to fall back to your subscription, and check `/status` to confirm which method is active. When a login and an API key are both configured, `/status` marks the credential that isn’t in use. [Claude Code on the Web](</docs/en/claude-code-on-the-web>) always uses your subscription credentials. If you set `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` in the sandbox environment, it doesn’t override your subscription credentials.
####
@@ -239,7 +239,7 @@
Federation variables| `ANTHROPIC_FEDERATION_RULE_ID` and `ANTHROPIC_ORGANIZATION_ID`, both set| Above
Active profile| The [`active_config` file](<https://platform.claude.com/docs/en/manage-claude/wif-reference#active-profile>) in your configuration directory, or a profile named `default`| Above when its auth mode is `oidc_federation`; below a working `/login` credential when its auth mode is `user_oauth`
-The `user_oauth` rule keeps a leftover `ant auth login` profile from moving your requests off the account you signed in to with `/login`. For the federation variables, Claude Code also reads the other variables in the [WIF reference](<https://platform.claude.com/docs/en/manage-claude/wif-reference#environment-variables>), such as `ANTHROPIC_IDENTITY_TOKEN_FILE`, when it exchanges your identity token. For the profile file format, see the [WIF reference](<https://platform.claude.com/docs/en/manage-claude/wif-reference#profile-configuration-file>). To confirm which source Claude Code chose, run `/status`: a `Profile` row names the source in place of the `Login method` row. If you start Claude Code with `--debug`, it also writes a `Using Anthropic profile auth` line with the source name to the debug log at `~/.claude/debug/<session-id>.txt`. When Claude Code passes over a `user_oauth` active profile because you have a working `/login` credential, it writes a warning to the debug log saying it’s using the claude.ai login instead. When a `user_oauth` profile’s login has expired and Claude Code can’t renew it, requests fail with [Anthropic profile login expired](</docs/en/errors#anthropic-profile-login-expired>). Features that need your claude.ai login, such as [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) and [`/schedule`](</docs/en/routines>), aren’t available while one of these sources is selected. To stop Claude Code from selecting a source:
+The `user_oauth` rule keeps a leftover `ant auth login` profile from moving your requests off the account you signed in to with `/login`. For the federation variables, Claude Code also reads the other variables in the [WIF reference](<https://platform.claude.com/docs/en/manage-claude/wif-reference#environment-variables>), such as `ANTHROPIC_IDENTITY_TOKEN_FILE`, when it exchanges your identity token. For the profile file format, see the [WIF reference](<https://platform.claude.com/docs/en/manage-claude/wif-reference#profile-configuration-file>). To confirm which source Claude Code chose, run `/status`. A `Profile` row names the source in place of the `Login method` row. When the profile is the credential in use, `Organization` and `Email` rows show its account. If you start Claude Code with `--debug`, it also writes a `Using Anthropic profile auth` line with the source name to the debug log at `~/.claude/debug/<session-id>.txt`. When Claude Code skips a `user_oauth` active profile because you have a working `/login` credential, it writes a warning to the debug log saying it’s using the claude.ai login instead. When a `user_oauth` profile’s login has expired and Claude Code can’t renew it, requests fail with [Anthropic profile login expired](</docs/en/errors#anthropic-profile-login-expired>). Features that need your claude.ai login, such as [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) and [`/schedule`](</docs/en/routines>), aren’t available while one of these sources is selected. To stop Claude Code from selecting a source:
* **Named profile or federation variables** : unset `ANTHROPIC_PROFILE`, or unset either federation variable
* **Active profile** : run `/logout` for a `user_oauth` profile whose current credential you wrote by signing in to a Console account without an API key, run `ant auth logout` for one whose current credential `ant auth login` wrote, or delete the profile’s file from `configs/` in your configuration directory for either auth mode
--- a/auto-mode-config.md
+++ b/auto-mode-config.md
@@ -24,7 +24,7 @@
Before v2.1.211, the classifier allowed pushes only to your working branch, branches Claude created, and routine pushes to the default branch.
-If you want a human checkpoint before every push or pull request, add permission rules: the recipes below keep auto mode on for everything else.
+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.
###
@@ -43,11 +43,11 @@
}
}
-Pick the mechanism that matches how firm the boundary needs to be:
+These rules match commands that begin with `git push` or `gh pr create`. A push Claude writes another way, such as `git -C <dir> push` or `git -c <key>=<value> push`, [doesn’t match the rule](</docs/en/permissions#bash-rule-limits>), so it isn’t checkpointed. For a checkpoint that inspects the full command text, add a [PreToolUse hook](</docs/en/hooks#pretooluse>). Pick the mechanism that matches how firm the boundary needs to be:
Boundary| Mechanism| Behavior in auto mode
---|---|---
-Prompt before the action| `permissions.ask`| Always prompts for content-scoped rules like the recipe above. The classifier cannot auto-approve a matching action.
+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.
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.
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,64 @@
This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version.
+
+
+
+2.1.267
+
+September 9, 2026
+
+ * Added `maxEffortLevel` setting (top-level or per model under `modelSettings`): caps the effort level on every provider, including Bedrock, Vertex and Foundry; users can still pick a lower level
+ * Added `--system-prompt-snapshot off` to render the system prompt fresh on every request instead of reusing the conversation’s recorded prompt (for iterating on prompt text)
+ * Fixed Cowork scheduled tasks in the cloud failing at startup for organizations whose managed settings require sandboxing
+ * Fixed `/context` and other local command output rendering blank on mobile clients
+ * Fixed shift+enter and option+backspace not working after reconnecting to a tmux or ssh session inside an agent view
+ * Fixed the dim last-prompt header not appearing at the top of the conversation when scrolling up in fullscreen mode
+ * Fixed Workflow `agent()` calls with large output schemas being refused in auto mode instead of being checked by the safety classifier
+ * Fixed a case where a marketplace entry path containing a backslash could bypass the containment check for fetched marketplaces on macOS and Linux
+ * Fixed expired AWS or Google Cloud credentials under a host app such as Claude Desktop retrying ten times with a generic “request failed” before the re-authenticate error appeared
+ * Fixed resuming a session after `/compact` or another slash command ran via `-p --resume`: a spurious “Continue from where you left off.” turn is no longer inserted
+ * Fixed resuming a large session (transcript over 5 MB): parallel tool calls and their hook output are no longer dropped from the reloaded conversation
+ * Fixed managed `allowedHttpHookUrls`, `httpHookAllowedEnvVars` and `allowedChannelPlugins` to admit nothing, not everything, when unreadable
+ * Fixed `/login` on machines whose managed settings require Claude apps gateway sign-in: Esc now closes the dialog instead of doing nothing
+ * Fixed artifact publishes cut off by a dropped connection mid-upload: they now retry once when Claude Code can tell the upload never completed, instead of reporting an unknown outcome
+ * Fixed `effort:` frontmatter on custom commands, skills, and subagents being ignored on models whose default effort is still pinned (Opus 4.7, Opus 4.8, Fable 5)
+ * Fixed artifact publish failing with an unhelpful error when the page file isn’t valid UTF-8 or contains a replacement character (U+FFFD); the error now names the line and column to fix
+ * Fixed `claude agents` `@` directory menu not listing repositories created after the session started
+ * Fixed Remote Control clients that join a Claude Desktop or VS Code session showing a stale permission mode until it was changed again
+ * Fixed `claude remote-control` exiting and dropping every attached session when its server credential expires (about 30 days after start); the host now re-registers and keeps going
+ * Fixed the usage-limit warning flickering on and off during a session when requests for different models or modes report different limit windows
+ * Fixed earlier reasoning being dropped when an MCP server re-sends, or a built-in tool re-renders, a tool the model already loaded
+ * Fixed a tool that disappears mid-conversation, from a disconnected MCP server or an upgrade, rewriting the tool list and discarding earlier thinking
+ * Fixed a background worker forked from a conversation adding EnterWorktree to the conversation’s tool block mid-session, which broke prompt-cache reuse
+ * Fixed mid-session MCP and plugin tools being added to the tool list in sessions without ToolSearch, which broke prompt-cache reuse; supported models now receive them as deferred definitions
+ * Fixed switching models with /model re-sending every tool definition (a prompt-cache miss); commit and PR attribution text now arrives as a conversation note that updates on model changes
+ * Fixed resumed sessions rewriting the inline tool set when an MCP connector reconnects at a different moment than before
+ * Fixed resumed sessions re-rendering tool descriptions instead of replaying the recorded ones when the first turn ran a tool
+ * Fixed prompt-cache misses and dropped extended thinking when a claude.ai connector’s tools change between a session and its resume
+ * Fixed resumed sessions rewriting earlier MCP tool announcements (and dropping extended thinking) before their connectors reconnect
+ * Fixed a prompt-cache break when a print-mode (`-p`) conversation is resumed interactively: the system prompt prefix no longer changes
+ * Improved the `/diff` panel: it no longer flashes “0 files changed” and a spinner before settling, and its empty state is centered in the panel
+ * Improved the Bash tool’s description guidance so Claude describes what a command does in plain words instead of echoing the command
+ * Improved sandbox guidance so Claude suggests `/copy` when clipboard commands such as `pbcopy` fail inside the sandbox
+ * Improved `--resume` first-render time for sessions with many Bash tool calls
+ * Improved prompt input responsiveness: keystrokes no longer occasionally wait a frame behind spinner or streaming repaints
+ * Improved prompt-cache stability: subagents and sessions started with `--system-prompt` or `--append-system-prompt` now record the system prompt and tool definitions once instead of re-rendering them
+ * Improved Artifact tool publish errors: when a publish is refused, the message now says why and what to do about it
+ * Self-hosted runner: Changed `--use-anthropic-git-proxy` to be reported to the server at registration and to print a warning for each session that still clones through the legacy git proxy
+ * Gateway: Changed `forward_user_identity` upstreams to return a 429 as-is to a developer whose email was forwarded, instead of failing over to the next upstream, so the proxy’s per-user limits hold
+ * [VSCode] Fixed the extension host hanging at 100% CPU when forking, editing an earlier message, or rewinding in a conversation whose saved transcript contains a cyclic parent link
+ * [VSCode] Fixed pasting a screenshot on WSL2/WSLg inserting raw image bytes into the chat input; the image is now attached when the clipboard provides it, otherwise the paste is ignored
+ * [VSCode] Fixed chat diff blocks always rendering with a dark editor theme; they now follow the active VS Code color theme, including high contrast
+ * [VSCode] Fixed mixed right-to-left and English text rendering in the wrong order while typing in the message input
+ * [VSCode] Fixed accepting an edit in the diff view on a file with Windows (CRLF) line endings failing with “String not found in file”
+ * [VSCode] Fixed @-mentions dropping files whose paths contain spaces
+ * [VSCode] Fixed the sessions list view failing to load in windows connected over Remote-SSH when the workspace folder exists only on the remote host
+ * [VSCode] Fixed runaway ripgrep processes when viewing files in large or symlink-heavy workspaces
+ * [Claude Code on the web] Fixed GitHub Enterprise Server sessions showing your GitHub account as disconnected once its token expired; PR and issue operations now refresh it automatically
+ * [Claude Code on the web] Fixed `gh` and GitHub API calls failing in organizations without the Claude GitHub App; they now use your connected GitHub account and say so when none is connected
+ * [Claude Tag] Added a “Use a custom connector” link to the preset connection forms in Claude Tag admin settings, so you can switch to a custom connection without starting over
+ * [Claude Tag] Fixed Claude replying “The API rejected the request as invalid” when the organization has run out of usage credits; the reply now says so and explains how to add more
+ * [Claude Tag] Fixed thread requests to edit or delete a message Claude posted at the channel’s top level being answered with a correction instead of reaching the session that posted it
+ * [Claude Tag] Fixed **Connect** on Tool access requests under Admin settings > Review requests failing with “Authorization failed” or showing the requested access bundle as deleted
modified
Claude apps gateway for Amazon Bedrock, Claude Platform on AWS, Google Cloud, and Microsoft Foundry
View current →
--- a/claude-apps-gateway.md
+++ b/claude-apps-gateway.md
@@ -124,7 +124,7 @@
This config is enough for a working sign-in loop with the default Amazon Bedrock model catalog. Once it’s running, add per-group RBAC and managed settings via [`managed.policies`](</docs/en/claude-apps-gateway-config#managed>), telemetry fan-out via [`telemetry`](</docs/en/claude-apps-gateway-config#telemetry>), and multi-upstream failover, provisioned-throughput ARNs, or non-US regions via [`models`](</docs/en/claude-apps-gateway-config#models>).
-The Amazon Bedrock upstream needs an AWS principal with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the `inference-profile/us.anthropic.*` ARNs and the underlying `foundation-model/anthropic.*` ARNs, and Anthropic’s one-time use case form submitted for the account from the Bedrock console’s Model catalog. Supply the credential with IRSA on EKS, an ECS task role, or an EC2 instance profile rather than static keys. The [`upstreams` reference](</docs/en/claude-apps-gateway-config#upstreams>) has the full IAM details, the cross-cloud credential matrix, and the `auth` blocks for the other providers.
+The Amazon Bedrock upstream needs an AWS principal with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the `inference-profile/us.anthropic.*` ARNs and the underlying `foundation-model/anthropic.*` ARNs. It also needs Anthropic’s one-time use case form submitted for the account from the Bedrock console’s Model catalog.Supply the credential with IRSA on EKS, an ECS task role, or an EC2 instance profile rather than static keys. The [`upstreams` reference](</docs/en/claude-apps-gateway-config#upstreams>) has the full IAM details, the cross-cloud credential matrix, and the `auth` blocks for the other providers.
4
@@ -225,11 +225,11 @@
Connect developers
-Developers connect from their own laptops with one browser sign-in, using their corporate work account. They don’t need a claude.ai account, an API key, or a subscription, because requests to the model go through the gateway using the organization’s upstream credential. Connection is driven by the [client-side managed settings](</docs/en/claude-apps-gateway-config#client-side-managed-settings>) you push via MDM, so there is no manual setup on the developer side; this section covers what the admin configures. The CLI fingerprints the gateway’s TLS leaf certificate on first connect and pins it per hostname. Publish the expected SHA-256 fingerprint alongside the gateway URL so developers have something to compare against. The `/login` prompt shows the first 16 characters of the fingerprint as lowercase hexadecimal with no colons. To print the full fingerprint in that form from the certificate file, run:
+Developers connect from their own laptops with one browser sign-in, using their corporate work account. They don’t need a claude.ai account, an API key, or a subscription, because requests to the model go through the gateway using the organization’s upstream credential. Connection is driven by the [client-side managed settings](</docs/en/claude-apps-gateway-config#client-side-managed-settings>) you push via MDM, so there is no manual setup on the developer side; this section covers what the admin configures. The CLI fingerprints the gateway’s TLS leaf certificate on first connect and pins it per hostname. It checks that pin again during sign-in, on silent session refreshes, and on managed-settings fetches, while inference requests use standard TLS validation without the pin. Requests routed through an HTTPS proxy skip the pin check, so add the gateway host to `NO_PROXY` to keep them direct. Publish the expected SHA-256 fingerprint alongside the gateway URL so developers have something to compare against. The `/login` prompt shows the first 16 characters of the fingerprint as lowercase hexadecimal with no colons. To print the full fingerprint in that form from the certificate file, run:
openssl x509 -noout -fingerprint -sha256 -in cert.pem | cut -d= -f2 | tr -d : | tr 'A-F' 'a-f'
-When the certificate rotates, every developer sees the trust prompt again, so treat rotations as a planned event and republish the fingerprint. If your gateway policy includes [settings that need approval](</docs/en/server-managed-settings#security-approval-dialogs>), the developer also sees that approval dialog again after accepting the new certificate, because Claude Code keys [approval memory](</docs/en/server-managed-settings#approval-memory>) to the pinned certificate. Once signed in, the [model picker](</docs/en/model-config>) shows the models in the developer’s `availableModels` allowlist, managed settings apply at startup and refresh hourly, and telemetry routes to your collector. Sessions refresh silently before `ttl_hours` expiry, and a failed refresh after IdP deprovisioning prompts a re-login.
+When the certificate rotates, every developer sees the trust prompt again, so treat rotations as a planned event and republish the fingerprint. If your gateway policy includes [settings that need approval](</docs/en/server-managed-settings#security-approval-dialogs>), the developer also sees that approval dialog again after accepting the new certificate, because Claude Code keys [approval memory](</docs/en/server-managed-settings#approval-memory>) to the pinned certificate. Once the developer signs in, the [model picker](</docs/en/model-config>) shows the models in their `availableModels` allowlist. Managed settings apply at startup and refresh hourly, and telemetry routes to your collector. Sessions refresh silently before `ttl_hours` expiry. When a refresh fails after IdP deprovisioning, Claude Code prompts the developer to log in again.
###
@@ -245,7 +245,7 @@
"parentSettingsBehavior": "merge"
}
-The developer presses Enter to connect. The first-connect TLS fingerprint prompt still appears. A developer can’t set this up manually. The login picker has no gateway option, and `forceLoginGatewayUrl` is ignored in a developer’s own settings files. `forceLoginMethod` alone, without a URL, leaves the developer at a “Contact your IT administrator” message. The login keys belong in the file you push to machines, not in the gateway’s `managed.policies[].cli` block, which only reaches clients that are already connected.
+The developer presses Enter to connect. The first-connect TLS fingerprint prompt still appears. Once the file is on a machine, a developer who hasn’t completed the gateway sign-in sees one of the messages described under [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>). Developers who select a cloud provider through an environment variable such as `CLAUDE_CODE_USE_BEDROCK` don’t need the gateway sign-in. A developer can’t set this up manually. The login picker has no gateway option, and `forceLoginGatewayUrl` is ignored in a developer’s own settings files. `forceLoginMethod` alone, without a URL, leaves the developer at a “Contact your IT administrator” message. The login keys belong in the file you push to machines, not in the gateway’s `managed.policies[].cli` block, which only reaches clients that are already connected.
###
@@ -380,9 +380,10 @@
* **Model access** : requests for models the policy doesn’t grant return 400, and the `/model` picker is filtered to the policy’s `availableModels` allowlist. Set [`enforceAvailableModels: true`](</docs/en/model-config#default-model-behavior>) in the policy so the Default option resolves to a model inside `availableModels` instead of to Claude Code’s built-in default; without it, Default stays selectable and is rejected at request time if that model isn’t granted.
* **Telemetry destination** : in sessions signed in through `/login`, the CLI sends its OTLP/HTTP exports to the gateway regardless of any locally set `OTEL_EXPORTER_OTLP_ENDPOINT`, and the gateway relays them to the destinations in [`telemetry.forward_to`](</docs/en/claude-apps-gateway-config#telemetry>). In the embedded sessions Claude Desktop launches, the CLI sends its exports to the configured `OTEL_EXPORTER_OTLP_ENDPOINT`. The CLI attaches the gateway session token to those exports only when that endpoint points at the gateway itself. With no destination configured for a signal, the gateway accepts and discards it, so if you already collect Claude Code telemetry directly, add your collector as a `forward_to` destination.
- * **Credentials** : the gateway token is the session’s only credential. `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, `apiKeyHelper`, [Anthropic profiles](</docs/en/authentication#anthropic-profiles-and-federation-credentials>), and any earlier claude.ai login are ignored while signed in, so developers don’t need to log out of claude.ai first.
+ * **Credentials** : the gateway token is the session’s only credential. [Anthropic profiles](</docs/en/authentication#anthropic-profiles-and-federation-credentials>) and any earlier claude.ai login are ignored while signed in, so developers don’t need to log out of claude.ai first. For a configured `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` credential, see [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>).
* **Managed settings** : locked keys can’t be overridden locally. The CLI applies the policy at startup and applies changes on each hourly poll, apart from the [changes that apply only at the next launch](</docs/en/server-managed-settings#fetch-and-caching-behavior>).
- * **Startup** : signed-in sessions exit at startup with an error after about 10 seconds when the gateway is unreachable, rather than starting without their settings.
+ * **Startup with the gateway unreachable** : signed-in sessions exit at startup with an error after about 10 seconds rather than starting without their settings.
+ * **Startup after the gateway ends the session** : see [Enforce fail-closed startup](</docs/en/server-managed-settings#enforce-fail-closed-startup>) for the launches that open signed out of the gateway and the ones that exit when the gateway answers with a `401`.
* **Deprovisioning** : a session whose user is disabled in the IdP expires within `ttl_hours` when the next refresh fails.
###
--- a/claude-apps-gateway-config.md
+++ b/claude-apps-gateway-config.md
@@ -57,7 +57,7 @@
`port`| No| Bind port. Default `8080`.
`public_url`| Unless `host` is loopback| The externally visible `https://` origin, used to build the IdP `redirect_uri` and discovery metadata. Required whenever `host` isn’t a loopback address, whether TLS terminates at a proxy such as an ALB, Ingress, or Cloud Run or at the gateway itself through `tls`, because the gateway never derives its own origin from `X-Forwarded-*` headers; they are client-spoofable. Boot fails without it. `trusted_proxies` below governs client-IP resolution only. Also required to enable telemetry, because the gateway builds the OTLP endpoint it pushes to clients from this URL.
`tls.cert` / `tls.key`| No| PEM paths if the gateway terminates TLS itself
-`trusted_proxies`| No| CIDRs or IPs of load balancers in front of the gateway. When set, the gateway trusts `X-Forwarded-For` only from these peers and records the real client IP for per-IP rate limiting and audit. Equivalent to nginx `set_real_ip_from`.
+`trusted_proxies`| No| CIDRs or IPs of load balancers in front of the gateway. When set, the gateway trusts `X-Forwarded-For` only from these peers and records the real client IP for per-IP rate limiting and audit. Equivalent to nginx `set_real_ip_from`. `X-Forwarded-For` entries written as `ipv4:port` or `[ipv6]:port`, as some load balancers do, are read with the port dropped. An IPv6 address with a port appended and no brackets may be read as a different address or not read at all, so turn off the port option on any proxy that writes that form.
###
@@ -77,6 +77,7 @@
`google_groups`| No| Look up the signed-in user’s groups through the Google Workspace Admin SDK Directory API, because Google’s id_token carries no groups claim. Set `service_account_json_path` to a service-account key file with domain-wide delegation on the `https://www.googleapis.com/auth/admin.directory.group.readonly` scope, and `admin_email` to a Workspace administrator the service account impersonates; the Directory API requires a real admin subject. Each user’s group email addresses become their groups claim, so `allowed_groups` and `managed.policies.match.groups` match on group emails.
`email_claim`| No| Which id_token claim carries the user’s email. Default `email`. Some IdPs, such as ADFS and Entra B2C, emit `upn` or `preferred_username` instead. Accepts a flat key, a JSON Pointer, or a list of fallback keys where the first present key is used.
`scopes`| No| Full override of the OIDC scopes the gateway requests. Default `[openid, profile, email, offline_access]`. Set when your IdP rejects scopes it doesn’t recognize, or requires a custom scope to emit groups or email. Must include `openid`. Dropping `offline_access` disables refresh tokens, so developers re-run the browser login every `session.ttl_hours`. See [Identity provider setup](</docs/en/claude-apps-gateway-deploy#identity-provider-setup>) for per-IdP scope recipes such as Google’s refresh-token flow.
+`scope_on_refresh`| No| Also send `scope`, with the same list as the sign-in request, when the gateway exchanges a refresh token. Default `false`: the refresh request omits `scope`. Most IdPs return an id_token on every refresh and don’t need this. Set `true` when your IdP returns an id_token on refresh only if asked for `openid` again, which Okta documents for its refresh grant. Without an id_token, every refresh depends on the IdP’s userinfo endpoint accepting the refreshed access token. If you gate sign-in or match policies on groups and your IdP’s refresh-time id_token omits them, also set `userinfo_fallback: true` so the gateway fills them from the userinfo endpoint. An IdP that granted fewer scopes than requested can reject the refresh with `invalid_scope`, including for existing sessions if you add entries to `scopes` while this is on. Unset the key if refreshes start failing at `token_endpoint` after you set it. Requires Claude Code v2.1.260 or later on the gateway server.
`extra_auth_params`| No| Extra query parameters appended to the IdP authorization request, verbatim. This is the override mechanism for IdP-specific behavior, such as `access_type: offline` for Google refresh tokens, `domain_hint` for some Entra tenants, or `acr_values` for step-up flows. Cannot override the gateway-managed protocol params: `state`, `nonce`, `redirect_uri`, PKCE, `scope`, `response_type`, `response_mode`, and `client_id`.
`userinfo_fallback`| No| When the id_token omits email or groups, fetch them from `/userinfo`. Needed for Keycloak lightweight access tokens, the Okta org server, and ADFS minimal tokens. The id_token stays authoritative; userinfo only fills gaps. Default `false`.
`use_pkce`| No| Send a PKCE (S256) challenge on the authorization request. Default `true`. Set `false` only if your IdP rejects PKCE for this confidential client.
@@ -234,7 +235,7 @@
Setup| How
---|---
-IAM permissions| Grant the gateway’s principal `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the inference-profile ARNs and the underlying foundation-model ARNs. For the built-in catalog in US regions: `arn:aws:bedrock:<region>:<account>:inference-profile/us.anthropic.*` and `arn:aws:bedrock:*::foundation-model/anthropic.*`.
+IAM permissions| Grant the gateway’s principal `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the inference-profile ARNs and the underlying foundation-model ARNs. For the built-in catalog in US regions: `arn:aws:bedrock:<region>:<account>:inference-profile/us.anthropic.*` and `arn:aws:bedrock:*::foundation-model/anthropic.*`. Also grant `bedrock:CountTokens` on the foundation-model ARNs. The gateway uses it, at no charge, to count the input tokens of a request the client abandoned, so spend limits stay accurate. Without it the gateway falls back to a one-token Bedrock request for that count.
Model access| Amazon Bedrock enables model access by default in commercial regions. The remaining account-level gate is Anthropic’s one-time use case form: if no one in your AWS account has submitted it, open the Amazon Bedrock console, select an Anthropic model from the Model catalog, and complete the form. See [Submit use case details](</docs/en/amazon-bedrock#1-submit-use-case-details>) for the AWS Organizations form and the permissions the submitter needs.
EKS (IRSA)| Create an IAM role with the policy above and a trust policy for your cluster’s OIDC provider scoped to the gateway’s service account. Annotate the service account with `eks.amazonaws.com/role-arn: arn:aws:iam::<acct>:role/claude-gateway`. `auth: {}` picks it up.
ECS / EC2| Attach the IAM role to the task definition or instance profile. `auth: {}` picks it up.
@@ -600,6 +601,7 @@
`allowManagedPermissionRulesOnly`| CLI| When `true`, managed settings become the only settings source of permission rules. The [`allowManagedPermissionRulesOnly`](</docs/en/settings-reference#allowmanagedpermissionrulesonly>) entry lists every source Claude Code then ignores.
`env`| CLI| Environment variables merged into the CLI process. Use for telemetry, auto-update, and model-name overrides.
`hooks`| CLI| Org-wide [hooks](</docs/en/hooks>)
+`managedMcpServers`| CLI| Remote MCP servers [provided to every matching developer](</docs/en/managed-mcp#provide-servers-through-managed-settings>) alongside the servers they add themselves, `http` and `sse` only. See MCP servers in a policy. Requires Claude Code v2.1.259 or later on the gateway server and on clients. Earlier clients ignore the key.
Because these settings arrive over the network, the CLI shows each developer a security approval dialog before applying the settings listed below:
@@ -615,6 +617,14 @@
+MCP servers in a policy
+
+To provide MCP servers to the Claude Code clients a policy matches, set [`managedMcpServers`](</docs/en/managed-mcp#provide-servers-through-managed-settings>) in that policy’s `cli` block. You need Claude Code v2.1.259 or later on the gateway server and on clients. The gateway checks each entry at boot with [the same rules Claude Code applies on the client](</docs/en/managed-mcp#what-an-entry-can-contain>), and if an entry fails a check, the gateway refuses to start and names the entry. If you write a `${VAR}` reference in `gateway.yaml`, the gateway resolves it from its environment at boot through secret expansion before it runs the entry checks, so every matching client receives the literal value and can read it. The [header guidance for provided servers](</docs/en/managed-mcp#provide-servers-through-managed-settings>) applies to the expanded value. The gateway rejects the `.mcp.json` spelling `mcpServers` in a `cli` block, and its boot error names `managedMcpServers` as the key to use. Before v2.1.259, the gateway rejected any MCP server definition in a `cli` block.
+
+####
+
+
+
Claude Desktop overlay
If your organization also deploys [Claude Desktop](</docs/en/desktop>), the same gateway serves both clients. Point `bootstrapUrl`, in Claude Desktop’s [managed configuration](<https://claude.com/docs/third-party/claude-desktop/configuration>), at `<listen.public_url>/user/bootstrap`. Claude Desktop derives the OAuth issuer from that URL, runs the same device-code sign-in against this gateway, and fetches its configuration from the response.
@@ -626,9 +636,9 @@
* The model list, from `availableModels`
* Disabled tools, from bare tool-name `permissions.deny` entries. If you set `disabledBuiltinTools` in the policy’s `desktop` block, the gateway serves the union of your value and the derived list, so you can disable more tools this way but can’t re-enable one you disabled through `permissions.deny`
* The egress allowlist, from `sandbox.network.allowedDomains`. If you set `coworkEgressAllowedHosts` in the policy’s `desktop` block, the gateway uses that value instead of the derived list
- * An OTLP endpoint that points at the gateway itself, which fans out to your destinations, included when `telemetry` forwarding is configured
-
-To set `disabledBuiltinTools` or `coworkEgressAllowedHosts` in a policy’s `desktop` block, you need Claude Code v2.1.232 or later on the gateway server. The gateway omits keys with no Claude Desktop equivalent, such as `hooks` and scoped permission rules like `Bash(npm *)`, from the bootstrap response. Add the optional `desktop` block alongside `cli` to set Claude Desktop settings directly. Write settings from Claude Desktop’s [managed configuration reference](<https://claude.com/docs/third-party/claude-desktop/configuration>) as flat key names. Leave out keys Claude Desktop reads only from MDM or local files, such as `bootstrapUrl`; the gateway rejects them at boot. 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.
+ * An OTLP endpoint that points at the gateway itself, which fans out to your destinations, included when `telemetry` forwarding is configured. Claude Desktop exports every signal with one encoding: `http/protobuf`, or `http/json` when you set `OTEL_EXPORTER_OTLP_PROTOCOL` or one of its per-signal variants to `http/json` in the policy’s `env`. Before Claude Code v2.1.261 on the gateway server, the response set `http/json` regardless, so a collector that accepts only protobuf rejected Claude Desktop’s exports
+
+To set `disabledBuiltinTools`, `coworkEgressAllowedHosts`, or Claude Desktop’s own `managedMcpServers` setting in a policy’s `desktop` block, you need Claude Code v2.1.232 or later on the gateway server. Claude Desktop’s `managedMcpServers` takes an array value rather than an object. The gateway omits keys with no Claude Desktop equivalent, such as `hooks` and scoped permission rules like `Bash(npm *)`, from the bootstrap response. Add the optional `desktop` block alongside `cli` to set Claude Desktop settings directly. Write settings from Claude Desktop’s [managed configuration reference](<https://claude.com/docs/third-party/claude-desktop/configuration>) as flat key names. Leave out keys Claude Desktop reads only from MDM or local files, such as `bootstrapUrl`; the gateway rejects them at boot. 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.
managed:
policies:
@@ -643,11 +653,11 @@
Every key is optional; Claude Desktop applies its own default for any key you omit. 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
+ * 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.
* 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.
-As with the `cli` block, the gateway validates against the schema bundled with its installed version. To deliver a setting introduced by a newer Claude Desktop release, upgrade the gateway first. The gateway fills in keys a policy’s `desktop` block doesn’t set from the `match: {}` catch-all’s `desktop` block, the same way it fills in a policy’s `cli` block from the base. If you set `disabledBuiltinTools` or `builtinToolPolicy` in both the base and a role policy, the gateway keeps the base’s restriction:
+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. 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. If you set `orgPluginSettings` in a policy’s `desktop` block, the gateway serves it in the array form that Claude Desktop 1.15200.0 and later reads. Older desktops ignore the array and enforce no plugin tool policy, so update members to 1.15200.0 or later before you rely on it. The gateway fills in keys a policy’s `desktop` block doesn’t set from the `match: {}` catch-all’s `desktop` block, the same way it fills in a policy’s `cli` block from the base. If you set `disabledBuiltinTools` or `builtinToolPolicy` in both the base and a role policy, the gateway keeps the base’s restriction:
* `disabledBuiltinTools`: the gateway uses the union of the base’s list and the policy’s list
* `builtinToolPolicy`: if you set a tool to a value other than `allow` in the base, the gateway keeps that value even if you set `allow` for the same tool in a role policy
@@ -661,8 +671,6 @@
Precedence with other managed sources
If a device also has an MDM-delivered policy or a local `managed-settings.json`, gateway-delivered settings rank first. [Precedence within the managed tier](</docs/en/managed-settings#precedence-within-the-managed-tier>) on the managed settings page says when the local sources apply, and has the [keys Claude Code reads from every admin source](</docs/en/managed-settings#keys-read-from-every-admin-source>) regardless of which source it selected, such as the sandbox lock keys, `forceRemoteSettingsRefresh`, and the per-variable `env` merge. A [`policyHelper`](</docs/en/settings-reference#policyhelper>) configured in an MDM profile or the managed settings file runs only when the gateway delivers no settings; the entry says what its output replaces. Embedding hosts such as [Claude Desktop](</docs/en/desktop>) can supply policy through the SDK `managedSettings` option. [Parent settings from embedding hosts](</docs/en/managed-settings#parent-settings-from-embedding-hosts>) says when Claude Code applies it, and [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) lists which allow-direction settings still apply without the `allowManaged*Only` locks. Gateway policies apply to every Claude Code invocation on the machine, including non-interactive `claude -p` runs and sessions spawned by the Agent SDK. If the gateway is unreachable at startup, signed-in sessions exit with an error rather than running without their policy.
-
-At boot, the gateway rejects `mcpServers` inside a policy’s `cli` block. You can’t distribute MCP servers per group to Claude Code clients; deploy MCP servers via the file-based `managed-mcp.json` on each device or let developers add them locally. You can deliver Claude Desktop’s `managedMcpServers` setting to Claude Desktop clients through a policy’s `desktop` block. To set it, you need Claude Code v2.1.232 or later on the gateway server.
###
@@ -718,7 +726,7 @@
Block| Key| Default| Description
---|---|---|---
-`access_control`| `allow_cidrs` / `deny_cidrs`| empty| Inbound IP allow/deny by client address, after `trusted_proxies` resolution. `deny_cidrs` is checked first; a client it matches is rejected even if `allow_cidrs` also matches. If `allow_cidrs` is non-empty the gateway is default-deny. `/healthz` and `/readyz` are exempt from `allow_cidrs`.
+`access_control`| `allow_cidrs` / `deny_cidrs`| empty| Inbound IP allow/deny by client address, after `trusted_proxies` resolution. `deny_cidrs` is checked first; a client it matches is rejected even if `allow_cidrs` also matches. If `allow_cidrs` is non-empty the gateway is default-deny. `/healthz` and `/readyz` are exempt from `allow_cidrs`. When a trusted proxy sends an `X-Forwarded-For` entry that isn’t an IP address, the real client is unknown and the gateway logs a warning once naming what to check. Where either list applies to the request, it refuses it with `403` and audit reason `xff_unparseable`. Where neither does, it serves the request and uses the proxy’s own address as the client IP for per-IP rate limits and audit.
`limits`| `max_request_bytes`| 32 MiB| Max inbound request body; oversize requests get `413` before the body is buffered. Raise for large file or image requests.
`limits`| `max_request_header_bytes`| unset| When set, oversize headers return `431`
`limits`| `max_url_length`| unset| When set, an over-long URL returns `414`
--- a/claude-apps-gateway-deploy.md
+++ b/claude-apps-gateway-deploy.md
@@ -42,7 +42,7 @@
* **Multiple gateways** : each is a separate deployment with its own config, and the CLI stores trust and credentials per gateway hostname, so teams can use different gateways without conflict. To serve multiple OIDC issuers, run separate instances.
* **Serverless** : Cloud Run works if you set `min-instances: 1` to avoid cold OIDC discovery. Lambda and Cloud Functions don’t work, because the gateway is a long-running HTTP server.
-Every production topology here puts an L7 proxy, such as an Ingress, Cloud Run’s front end, or an ALB, in front of plain-HTTP replicas. Set [`listen.trusted_proxies`](</docs/en/claude-apps-gateway-config#listen>) to the proxy’s source ranges so the gateway reads client IPs from `X-Forwarded-For`. The gateway honors the header only when the TCP peer is trusted. The [Google Cloud](</docs/en/claude-apps-gateway-on-gcp>) and [AWS](</docs/en/claude-apps-gateway-on-aws>) worked examples have concrete values per topology. Without trusted proxies, every request appears to come from the proxy’s IP, which collapses per-IP rate limits into one shared bucket and records the proxy’s IP in audit events. Give the proxy any idle timeout longer than the gateway’s keepalive interval, which depends on the upstream:
+Every production topology here puts an L7 proxy, such as an Ingress, Cloud Run’s front end, or an ALB, in front of plain-HTTP replicas. Set [`listen.trusted_proxies`](</docs/en/claude-apps-gateway-config#listen>) to the proxy’s source ranges so the gateway reads client IPs from `X-Forwarded-For`. The gateway honors the header only when the TCP peer is trusted. The [Google Cloud](</docs/en/claude-apps-gateway-on-gcp>) and [AWS](</docs/en/claude-apps-gateway-on-aws>) worked examples have concrete values per topology. Without trusted proxies, every request appears to come from the proxy’s IP, which collapses per-IP rate limits into one shared bucket and records the proxy’s IP in audit events. Don’t redirect requests to the gateway’s device-authorization and token endpoints, for example with an HTTP-to-HTTPS or host-canonicalization rewrite at the ingress. Claude Code doesn’t follow redirects on those requests, so an ingress rule that redirects them breaks sign-in and token refresh. Give the proxy any idle timeout longer than the gateway’s keepalive interval, which depends on the upstream:
* On every upstream except `provider: anthropic`, the gateway writes an SSE `ping` once a stream has been silent for about 15 seconds.
* On `provider: anthropic`, the gateway passes the response through unchanged, including the Anthropic API’s own pings.
@@ -102,7 +102,7 @@
Push the gateway URL to developer machines
-Once the gateway is serving, push `forceLoginMethod`, `forceLoginGatewayUrl`, and `parentSettingsBehavior: "merge"` to each developer’s machine through managed settings, via MDM or by writing the per-OS `managed-settings.json` directly. Without this, `/login` shows the standard account picker with no gateway option. See [Client-side managed settings](</docs/en/claude-apps-gateway-config#client-side-managed-settings>) for the file paths and the Claude Desktop `bootstrapUrl` equivalent.
+Once the gateway is serving, push `forceLoginMethod`, `forceLoginGatewayUrl`, and `parentSettingsBehavior: "merge"` to each developer’s machine through managed settings, via MDM or by writing the per-OS `managed-settings.json` directly. Without this, `/login` shows the standard account picker with no gateway option. Once you deploy the keys, Claude Code stops using a leftover API key or claude.ai login on the machine, so plan the push together with your sign-in instructions. [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>) describes the messages developers see. See [Client-side managed settings](</docs/en/claude-apps-gateway-config#client-side-managed-settings>) for the file paths and the Claude Desktop `bootstrapUrl` equivalent.
##
@@ -122,7 +122,9 @@
* **Audit events** : single-line JSON per security-relevant event. Pipe stderr to your log aggregator. The events emitted include `config.load`, `session.mint`, `session.refresh`, `device.authorize`, `device.verify`, `device.callback`, `auth.denied`, `access.denied`, `inference`, `managed.serve`, `desktop_bootstrap.serve`, `desktop_bootstrap.denied`, `spend.blocked`, `admin.denied`, `admin.limit.upsert`, and `admin.limit.delete`. Fields vary by event:
* Successful mint and refresh events carry `sub`, `email`, `client_ip`, and the result
- * `auth.denied` and `access.denied` carry the reason and client IP, plus the request path for `auth.denied`, since no user identity exists at those denials
+ * `auth.denied` and `access.denied` carry the reason and client IP, plus the request path for `auth.denied`, since no user identity exists at those denials. Two `access.denied` reasons change what the event carries:
+ * `xff_unparseable`: the event also carries the `X-Forwarded-For` entry that couldn’t be read
+ * `client_ip_unknown`: the event carries no client IP, because the connection had no peer address while an `access_control` list was set
* `inference` records which upstream served the request and the response status
* `desktop_bootstrap.denied` records a rejected Claude Desktop bootstrap fetch with the reason (`not_configured`, `policy_not_opted_in`, or `no_policy_matched`) and the user’s identity
* `admin.denied` records a rejected admin-API auth attempt with the client IP, method, path, and a reason, without the presented key material: `invalid_key` when an `x-api-key` was presented but matched no configured key, `bearer_rejected` when only an `Authorization` header was presented and it didn’t verify as a gateway session in `admin.admin_groups`, or `no_credentials` when neither header was presented
@@ -272,8 +274,10 @@
Symptom| Cause| Fix
---|---|---
A developer’s `/login` shows the standard account picker instead of the **Cloud gateway** screen| `forceLoginMethod` or `forceLoginGatewayUrl` isn’t set in managed settings on that machine| Deploy the [managed settings file](</docs/en/claude-apps-gateway#set-the-gateway-url>) to the device; `/login` reads the gateway URL from there
+A developer’s requests fail with `Not signed in to the Cloud gateway — run /login.`| The machine’s managed settings set `forceLoginMethod: "gateway"` or `forceLoginGatewayUrl`, and the session has no gateway sign-in. A leftover claude.ai login doesn’t satisfy the requirement.| Have the developer run `/login` and complete the gateway sign-in. See also [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>).
Claude Desktop reports that its bootstrap configuration couldn’t be fetched| `/user/bootstrap` returned 404: the policy matching the user doesn’t carry a `desktop` key, or no policy matched. The gateway’s audit log records each rejection as `desktop_bootstrap.denied` with the reason.| Add a `desktop` block to the policy that matches the user, or to the `match: {}` base layer; an empty `desktop: {}` suffices. See [Claude Desktop overlay](</docs/en/claude-apps-gateway-config#claude-desktop-overlay>).
Startup shows `Gateway login is configured in managed settings, but this Claude Code build does not include Cloud gateway support.`| The installed Claude Code build predates gateway support| Have the developer update Claude Code to a release that includes Cloud gateway support
+Startup or `/login` reports `Claude Code may not be enabled for your organization` after a 403 on the managed settings load| The gateway, or something in front of it, answered the `/managed/settings` request with 403. The gateway’s own settings route never answers 403. The status comes from the [`access_control`](</docs/en/claude-apps-gateway-config#http-tuning>) IP checks or from a proxy or WAF in front of the gateway. The audit log records an IP-check denial as `access.denied` with the reason. The developer stays signed in.| Check the audit log for `access.denied` at the time of the failure and fix the `access_control` lists or the front end, then have the developer start `claude` again
CLI `/login`: `Gateway hosts must be on your organization's private network; <host> resolves to the public (or unrecognized) address <ip>`| The gateway hostname resolves to at least one public IP address. Claude Code checks each resolved address and requires every one to be private. A common cause is a dual-stack name where one family resolves to a public address, including AWS internal dual-stack load balancers, which return public-range AAAA addresses.| Have the gateway name resolve only to private addresses on developer machines. For a dual-stack name, drop the public-range record or serve a separate internal-only DNS name. See the [private-network prerequisite](</docs/en/claude-apps-gateway#prerequisites>).
CLI `/login`: `Gateway login would go through proxy <proxy>, which is not on a private network`| An `HTTPS_PROXY` or `HTTP_PROXY` applies to the gateway host and the proxy’s hostname resolves to a public address. A proxy whose host resolves only to private addresses is allowed and doesn’t trigger this error| Add the gateway host to `NO_PROXY` on the developer’s machine so the connection is direct, or use a proxy whose hostname resolves to private addresses. The message names the exact `NO_PROXY` entry to add
CLI `/login`: `Could not resolve the configured HTTP proxy`| The hostname in `HTTPS_PROXY` or `HTTP_PROXY` doesn’t resolve from the developer’s machine, typically because it isn’t connected to the corporate network| Have the developer connect to your network or VPN and retry, or fix the proxy URL
@@ -284,6 +288,7 @@
Boot exits with a Postgres permission error| The database role lacks DDL rights on its schema| Grant the role `CREATE` on the gateway’s schema so it can create and alter its tables at boot
`/oauth/callback` shows “Sign-in could not be completed”| Email domain rejected, id_token validation failed, or `email_verified` is explicitly `false`, which the gateway always rejects with no override| Check `allowed_email_domains` and that the IdP returns a verified `email` claim. For `email_verified: false`, fix the IdP-side verification. If your IdP emits email under a different claim name, set `oidc.email_claim`.
Log: `token exchange failed request_id=<id>: id_token missing email claim`| The IdP isn’t including `email` in the id_token by default. This rejection fires only when `allowed_email_domains` is set; without it, a missing email mints a session with no email| Configure the IdP to emit `email` in the id_token. Okta: add `email` to a custom authorization server’s ID-token claims. Entra: add `email` as an optional claim on the app registration. PingFederate: enable an OpenID Connect Policy that emits `email`. If the IdP serves `email` from the userinfo endpoint but won’t include it in the id_token, such as the Okta org authorization server, set `oidc.userinfo_fallback: true`.
+Log: `refresh failed request_id=<id>: invalid_token (…) (at userinfo_no_id_token, …)`, and developers see `Cloud gateway session expired` every `session.ttl_hours`| The IdP accepted the refresh token but returned no id_token with it, so the gateway asked the IdP’s userinfo endpoint for the user’s claims. The IdP rejected the refreshed access token there. The gateway answers `temporarily_unavailable`, so Claude Code keeps the refresh token but can’t renew the session. Gateway versions before v2.1.260 log the same line without the `(at …)` detail.| Set [`oidc.scope_on_refresh: true`](</docs/en/claude-apps-gateway-config#oidc>), available in gateway v2.1.260 or later, so the refresh request asks for `openid` again. Some IdPs, such as Okta, return an id_token on refresh only when asked. On PingFederate, enable **Return ID Token On Refresh Grant** under **Applications > OAuth > OpenID Connect Policy Management** instead. The key doesn’t change PingFederate’s behavior. For other IdPs that still omit it, check whether the userinfo endpoint accepts access tokens issued by a refresh. As a stopgap, raise [`session.ttl_hours`](</docs/en/claude-apps-gateway-config#session>). See Identity provider setup for the deprovisioning tradeoff.
Every Amazon Bedrock request returns 502; log shows `Could not load credentials from any providers`| On EC2, IMDSv2’s default hop limit of 1 blocks the instance-metadata request from inside the container. Boot and `/readyz` pass anyway because the AWS SDK resolves instance credentials on the first request, not at client construction| Raise the hop limit with `aws ec2 modify-instance-metadata-options --instance-id <id> --http-put-response-hop-limit 2`, or set it in the launch template. The change applies to every container on the instance. Prefer ECS task roles where available, which read credentials from the ECS container-credentials endpoint and avoid the change entirely, or apply the change on a dedicated gateway instance to limit the exposure.
IdP error: unknown or unsupported scope| The IdP rejects scopes it doesn’t recognize| Set `oidc.scopes` to exactly the list your IdP accepts; it must include `openid`. The default is `openid profile email offline_access`.
Sessions don’t silently renew after setting `oidc.scopes`| `offline_access` was dropped from the override| Add `offline_access` back if your IdP supports it. Without a refresh token, developers re-run the browser login every `session.ttl_hours`.
@@ -294,8 +299,9 @@
Developer sees the trust prompt repeatedly| TLS cert is rotating per replica or per request| Use a stable cert at the ingress, or terminate TLS once and run replicas over plain HTTP internally
CLI `/login`: “Could not verify the gateway’s TLS certificate” or `SELF_SIGNED_CERT_IN_CHAIN`| Gateway’s TLS chain is signed by a private CA not in the CLI host’s trust store| Claude Code reads the OS trust store by default on the native binary and on Node 22.15 or later; [`CLAUDE_CODE_CERT_STORE`](</docs/en/network-config#ca-certificate-store>) controls this behavior. If the CA is installed in the OS trust store, ensure developers are on a current runtime. Otherwise set `NODE_EXTRA_CA_CERTS` to the CA certificate PEM before launching. The first-connect fingerprint prompt still applies.
CLI `/login` completes the browser sign-in, then the session ends with `Cloud gateway sign-in was not completed` and a TLS certificate mismatch| On the first request after sign-in, the gateway presented a certificate that doesn’t match the fingerprint Claude Code pinned, so Claude Code kept no gateway credential. The usual causes are replicas behind one address that serve different certificates, or something on the network path that intercepts TLS.| Serve one certificate for the hostname, for example by terminating TLS once at the ingress, then have the developer run `/login` again. If that certificate differs from the pinned one, Claude Code shows the [trust prompt](</docs/en/claude-apps-gateway#connect-developers>) again with a warning that the certificate changed.
-
-The mismatch message includes the gateway hostname and the first 16 characters of each fingerprint, the pinned one and the presented one. If Claude Code reports `couldn't load your organization's managed settings` after a gateway sign-in, Claude Code names the reason, restarts in place, and resumes the conversation. If Claude Code can’t restart, for example in a background session, Claude Code ends the session and keeps the sign-in.
+CLI `/login` stops with `The gateway's TLS certificate changed during sign-in: it no longer matches the one you trusted`| A sign-in request reached a server whose certificate doesn’t match the one the developer accepted when `/login` started: replicas behind one address serving different certificates, TLS interception on the path, or a certificate rotation while the sign-in was in progress.| Serve one certificate for the hostname, then have the developer start the sign-in again and review the new certificate at the [trust prompt](</docs/en/claude-apps-gateway#connect-developers>).
+
+The `Cloud gateway sign-in was not completed` message names the gateway hostname. When Claude Code has both the pinned fingerprint and the presented one, the message also shows the first 16 characters of each. If Claude Code reports `couldn't load your organization's managed settings` after a gateway sign-in, Claude Code names the reason, restarts in place, and resumes the conversation. If Claude Code can’t restart, for example in a background session, Claude Code ends the session and keeps the sign-in.
##
--- a/claude-apps-gateway-on-aws.md
+++ b/claude-apps-gateway-on-aws.md
@@ -18,7 +18,7 @@
* **Amazon ECR** repository for the gateway image
* **Amazon RDS for PostgreSQL** instance in private subnets, not publicly accessible, for the gateway’s [store](</docs/en/claude-apps-gateway-config#store>)
* **AWS Secrets Manager** secrets for the JWT signing key, the OIDC client secret, and the Postgres URL
- * **IAM role** with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream`, attached as the ECS task role or bound via IAM Roles for Service Accounts (IRSA) on EKS
+ * **IAM role** with `bedrock:InvokeModel`, `bedrock:InvokeModelWithResponseStream`, and `bedrock:CountTokens`, attached as the ECS task role or bound via IAM Roles for Service Accounts (IRSA) on EKS
* **Internal Application Load Balancer** for HTTPS
##
@@ -98,7 +98,7 @@
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
- "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
+ "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream", "bedrock:CountTokens"],
"Resource": [
"arn:aws:bedrock:${AWS_REGION}:${ACCOUNT_ID}:inference-profile/us.anthropic.*",
"arn:aws:bedrock:*::foundation-model/anthropic.*"
@@ -195,7 +195,7 @@
* `public_url`: the external `https://` origin, required for any non-loopback bind; see the [`listen` reference](</docs/en/claude-apps-gateway-config#listen>). The gateway builds the IdP `redirect_uri` and its discovery document only from this value, never from `X-Forwarded-*` headers.
* `trusted_proxies`: the front end’s source ranges. The gateway honors `X-Forwarded-For` only when the TCP peer is in this list, then walks the chain past trusted hops, so per-IP sign-in rate limits and audit events record developer IPs instead of the load balancer’s.
-On both tracks the front end is an internal ALB, whether created directly or by the AWS Load Balancer Controller, and an ALB’s nodes take addresses from the subnets it is attached to, so set `trusted_proxies` to those subnets’ CIDRs. This trusts every host in those subnets as a proxy. Keep the ALB’s ingress source, your corporate CIDR, from overlapping them, and don’t share the subnets with untrusted workloads that could spoof client IPs via `X-Forwarded-For`.
+On both tracks the front end is an internal ALB, whether created directly or by the AWS Load Balancer Controller, and an ALB’s nodes take addresses from the subnets it is attached to, so set `trusted_proxies` to those subnets’ CIDRs. This trusts every host in those subnets as a proxy. Keep the ALB’s ingress source, your corporate CIDR, from overlapping them, and don’t share the subnets with untrusted workloads that could spoof client IPs via `X-Forwarded-For`.The ALB’s client port preservation attribute, `routing.http.xff_client_port.enabled`, can stay at either setting: with it on, the ALB writes the client as `203.0.113.7:54321` or `[2001:db8::1]:54321`, and the gateway reads both with the port dropped.
gateway.yaml
--- a/claude-code-features.md
+++ b/claude-code-features.md
@@ -77,7 +77,7 @@
Input| Behavior| To disable
---|---|---
-Managed policy settings| Endpoint-managed policy, such as an MDM plist, registry policy, or managed settings file, loads from the host. [Server-managed settings](</docs/en/server-managed-settings>) are fetched on an [eligible configuration](</docs/en/server-managed-settings#platform-availability>) when the session authenticates with an organization OAuth login or a directly configured API key| Endpoint policy: remove the managed settings file, plist, or registry policy from the host. Server-managed settings: controlled by your org admin; cannot be disabled from the SDK
+Managed policy settings| Endpoint-managed policy, such as an MDM plist, registry policy, or managed settings file, loads from the host. [Server-managed settings](</docs/en/server-managed-settings>) are fetched on an [eligible configuration](</docs/en/server-managed-settings#platform-availability>) when the session authenticates with a qualifying credential, such as an organization OAuth login, a directly configured API key, or a `user_oauth` [Anthropic profile](</docs/en/authentication#anthropic-profiles-and-federation-credentials>)| Endpoint policy: remove the managed settings file, plist, or registry policy from the host. Server-managed settings: an [Owner](</docs/en/server-managed-settings#access-control>) in your Claude organization controls them; you can’t disable them from the SDK
`~/.claude.json` global config| Always read| Relocate with `CLAUDE_CONFIG_DIR` in `env`
Auto memory at `~/.claude/projects/<project>/memory/`| Loaded into the system prompt at session start. The agent writes new memories there with the standard `Write` and `Edit` tools rather than a dedicated memory tool, so those tools must be enabled for the agent to save memories| Set `autoMemoryEnabled: false` in settings, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env`
[claude.ai MCP connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>)| Loaded when the session authenticates with your claude.ai login. Not loaded when `CLAUDE_CODE_OAUTH_TOKEN` holds a token from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), which can only make model requests. Passing `mcpServers: {}` does not suppress the connectors| Set `strictMcpConfig: true`, [`disableClaudeAiConnectors: true`](</docs/en/mcp#disable-claude-ai-connectors>) in settings, or `ENABLE_CLAUDEAI_MCP_SERVERS=false` in `env`
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -225,7 +225,7 @@
Review changes
-Each session shows a diff indicator with lines added and removed, like `+42 -18`. Select it to open the diff view, leave inline comments on specific lines, and send them to Claude with your next message. Claude Code computes these diffs, including the per-file diffs shown as Claude edits, from raw git blob content, so diff drivers and `textconv` filters configured in the repository don’t apply. See [Review and iterate](</docs/en/web-quickstart#review-and-iterate>) for the full walkthrough including PR creation. To have Claude monitor the PR for CI failures and review comments automatically, see Auto-fix pull requests.
+Each session shows a diff indicator with lines added and removed, like `+42 -18`. Select it to open the diff view, leave inline comments on specific lines, and send them to Claude with your next message. Claude Code computes these diffs, including the per-file diffs shown as Claude edits, from raw git blob content, so diff drivers and `textconv` filters configured in the repository don’t apply. For a file in a repository that isn’t one of the session’s own checkouts, such as one cloned inside the workspace during the session, the per-file diff shows Claude’s edit itself rather than a git comparison. See [Review and iterate](</docs/en/web-quickstart#review-and-iterate>) for the full walkthrough including PR creation. To have Claude monitor the PR for CI failures and review comments automatically, see Auto-fix pull requests.
###
@@ -367,7 +367,7 @@
Environment expired
-Cloud sessions stop after a period of inactivity and the session’s VM is reclaimed. On the web, the session is marked expired in the session list. Reopen the session from [claude.ai/code](<https://claude.ai/code>) to provision a fresh VM with your conversation history restored. Background work that was still running when the VM was reclaimed, such as subagents and shell commands, isn’t restored.
+Cloud sessions stop after a period of inactivity and the session’s VM is reclaimed. A session counts as inactive while it waits for you to approve an [MCP connector](</docs/en/cloud-environments#network-access>) tool call or to sign in to an MCP server, and it can expire during that wait. On the web, the session is marked expired in the session list. Reopen the session from [claude.ai/code](<https://claude.ai/code>) to provision a fresh VM with your conversation history restored. Background work that was still running when the VM was reclaimed, such as subagents and shell commands, isn’t restored.
##
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -73,7 +73,7 @@
`.worktreeinclude`| Project only| ✓| Gitignored files to copy into new worktrees| [Worktrees](</docs/en/worktrees#copy-gitignored-files-into-worktrees>)
`skills/<name>/SKILL.md`| Project and global| ✓| Reusable prompts invoked with `/name` or auto-invoked| [Skills](</docs/en/skills>)
`commands/*.md`| Project and global| ✓| Single-file prompts; same mechanism as skills| [Skills](</docs/en/skills>)
-`output-styles/*.md`| Project and global| ✓| Custom system-prompt sections| [Output styles](</docs/en/output-styles>)
+`output-styles/*.md`| Project and global| ✓| Custom instruction sets that adjust how Claude works| [Output styles](</docs/en/output-styles>)
`agents/*.md`| Project and global| ✓| Subagent definitions with their own prompt and tools| [Subagents](</docs/en/sub-agents>)
`workflows/*.js`| Project and global| ✓| Dynamic workflow scripts written by Claude and saved from `/workflows`; each file becomes a `/<name>` command| [Dynamic workflows](</docs/en/workflows>)
`agent-memory/<name>/`| Project and global| ✓| Persistent memory for subagents| [Persistent memory](</docs/en/sub-agents#enable-persistent-memory>)
--- a/claude-security.md
+++ b/claude-security.md
@@ -164,7 +164,7 @@
Troubleshooting
-**The`/claude-security` menu opens with a Python warning.** The plugin needs `python3` 3.9 or later on your `PATH`. When it can’t find `python3` at all, the menu warns that Claude Security won’t work until one is installed; when the first `python3` on your `PATH` is older, the warning names the version it found. Install Python 3, or put a newer `python3` first on your `PATH`, then start a new session. **You may see “Fable 5.1’s safeguards flagged this message” or “Fable 5’s safeguards flagged this message” when using a Fable model.** Due to Fable’s cybersecurity safety classifiers, certain model activities will be blocked and automatically downgraded to Opus. This is expected, and the scan should still complete successfully.
+**The`/claude-security` menu opens with a Python warning.** The plugin needs `python3` 3.9 or later on your `PATH`. When it can’t find `python3` at all, the menu warns that Claude Security won’t work until one is installed; when the first `python3` on your `PATH` is older, the warning names the version it found. Install Python 3, or put a newer `python3` first on your `PATH`, then start a new session. **You may see a “safeguards flagged this message” notice when scanning on a Fable model.** The message names the model, for example “Fable 5.1’s safeguards flagged this message”. Fable’s cybersecurity safety classifiers flag certain requests, and Claude Code re-runs a flagged request on an Opus model through [automatic model fallback](</docs/en/model-config#automatic-model-fallback>). This is expected, and the scan should still complete successfully.
##
Show diff (109 lines)
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -28,7 +28,7 @@
`claude daemon status`| Print the background-session [supervisor’s](</docs/en/agent-view#the-supervisor-process>) state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn’t running| `claude daemon status`
`claude daemon stop --any`| Stop the background-session [supervisor](</docs/en/agent-view#the-supervisor-process>) and the sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. `--any` confirms stopping an on-demand supervisor, which is the default. Use this to recover from an [unresponsive supervisor](</docs/en/agent-view#agent-view-says-the-background-service-did-not-respond>)| `claude daemon stop --any --keep-workers`
`claude doctor`| Print read-only installation and settings diagnostics from the terminal without starting a session, including install health, settings-file validation errors, and Remote Control eligibility. For the in-session setup checkup that can also apply fixes, run [`/doctor`](</docs/en/commands#all-commands>)| `claude doctor`
-`claude import [codex|gemini]`| Start an interactive session that runs [`/import`](</docs/en/commands#all-commands>) to bring configuration from other coding agents into Claude Code. Accepts the same `--dry-run` and `--yes` options as the command. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later| `claude import codex --dry-run`
+`claude import [source]`| Start an interactive session that runs [`/import`](</docs/en/commands#all-commands>) to bring configuration from other coding agents into Claude Code. Accepts the same `--dry-run` and `--yes` options as the command. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later| `claude import codex --dry-run`
`claude logs <id>`| Print recent output from a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>)| `claude logs 7c5dcf5d`
`claude mcp`| Configure Model Context Protocol (MCP) servers| See the [Claude Code MCP documentation](</docs/en/mcp>).
`claude mcp login <name>`| Run a configured MCP server’s OAuth flow without opening the interactive `/mcp` panel. Works for HTTP, SSE, and claude.ai connector servers. Add `--no-browser` over SSH to print the authorization URL instead of opening a browser, then paste the redirect URL back at the prompt. Requires Claude Code v2.1.186 or later. See [Authenticate from the command line](</docs/en/mcp#authenticate-from-the-command-line>)| `claude mcp login sentry`
@@ -37,11 +37,11 @@
`claude project 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 project 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. 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. 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. Accepts `--discard-unpushed <commit>@<worktree-id>` to discard the worktree and its commits; when a [delete is refused over unpushed commits](</docs/en/agent-view#what-deleting-a-session-removes>), the refusal prints the exact value to pass. `--discard-unpushed` requires Claude Code v2.1.260 or later. 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`
-`claude ultrareview [target]`| Run [ultrareview](</docs/en/ultrareview#run-ultrareview-non-interactively>) non-interactively. Prints findings to stdout and exits 0 on success or 1 on failure. Use `--json` for the raw payload and `--timeout <minutes>` to override the 30-minute default. Use `--post` on a `github.com` pull request target to post the finished findings to the PR as one plain comment from your GitHub account. `--no-post` is the default. Requires Claude Code v2.1.227 or later. See [Post findings to the pull request](</docs/en/ultrareview#post-findings-to-the-pull-request>)| `claude ultrareview 1234 --json`
+`claude ultrareview [target]`| Run [ultrareview](</docs/en/ultrareview#run-ultrareview-non-interactively>) non-interactively. Prints findings to stdout and exits 0 on success or 1 on failure. Use `--json` for the raw payload and `--timeout <minutes>` to override the 45-minute default. Use `--post` on a `github.com` pull request target to post the finished findings to the PR as one plain comment from your GitHub account. `--no-post` is the default. `--post` and `--no-post` require Claude Code v2.1.227 or later. See [Post findings to the pull request](</docs/en/ultrareview#post-findings-to-the-pull-request>)| `claude ultrareview 1234 --json`
If you mistype a subcommand, Claude Code suggests the closest match and exits without starting a session. For example, `claude udpate` prints `Did you mean claude update?`. As of v2.1.199, `claude --dangerously-skip-permissions daemon <subcommand>` runs the `daemon` subcommand. Earlier versions treated `daemon <subcommand>` as the prompt for a new interactive session, so the subcommand never ran when the flag came first, a common setup when `claude` is aliased to include the flag. Only a leading `--dangerously-skip-permissions` or `--allow-dangerously-skip-permissions` routes to `daemon` this way; any other leading flag still starts an interactive session.
@@ -69,17 +69,17 @@
`--ax-screen-reader`| Render screen-reader friendly output: flat text without decorative borders or animations. Forces the classic renderer, so the [`tui`](</docs/en/settings-reference#tui>) setting has no effect; attached [background sessions](</docs/en/agent-view>) still render fullscreen. Takes precedence over [`CLAUDE_AX_SCREEN_READER`](</docs/en/env-vars>) and the [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) setting. Requires Claude Code v2.1.181 or later| `claude --ax-screen-reader`
`--bare`| Minimal mode: skip auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Skills in a directory you pass with `--add-dir` still load. Claude has access to Bash, file read, and file edit tools. Sets [`CLAUDE_CODE_SIMPLE`](</docs/en/env-vars>). See [bare mode](</docs/en/headless#start-faster-with-bare-mode>)| `claude --bare -p "query"`
`--betas`| Beta headers to include in API requests (API key users only)| `claude --betas interleaved-thinking`
-`--bg`, `--background`| Start the session as a [background agent](</docs/en/agent-view>) and return immediately. Prints the session ID and management commands. Combine with `--exec` to run a shell command as a background job instead of a Claude session, or with `--agent` to run a specific subagent. Cannot be combined with `-p`/`--print`; see the [error reference](</docs/en/errors#command-line-errors>)| `claude --bg "investigate the flaky test"`
+`--bg`, `--background`| Start the session as a [background agent](</docs/en/agent-view>) and return immediately. Prints the session ID and management commands. Combine with `--exec` to run a shell command as a background job instead of a Claude session, or with `--agent` to run a specific subagent. Can’t be combined with `-p`/`--print`; see the [error reference](</docs/en/errors#command-line-errors>)| `claude --bg "investigate the flaky test"`
`--channels`| (Research preview) MCP servers whose [channel](</docs/en/channels>) notifications Claude should listen for in this session. Space-separated list of `plugin:<name>@<marketplace>` entries. Requires Anthropic authentication through claude.ai or a Console API key| `claude --channels plugin:my-notifier@my-marketplace`
`--chrome`| Enable [Chrome browser integration](</docs/en/chrome>) for web automation and testing| `claude --chrome`
`--cloud`| With a task description, create a new [web session](</docs/en/claude-code-on-the-web>) on claude.ai. With a session ID (`session_...` or `cse_...`) or a claude.ai/code URL, queue a message into that existing session instead, with `-p`. See [send a follow-up message](</docs/en/claude-code-on-the-web#send-follow-ups-from-the-cli>).| `claude --cloud "Fix the login bug"`
-`--continue`, `-c`| Load the most recent conversation in the current directory, skipping [background sessions, sessions created with `claude -p` or the Agent SDK, and sessions whose first prompt was `/loop`](</docs/en/sessions#resume-a-session>). `claude -p --continue` includes `-p`, SDK, and `/loop` sessions. Includes sessions that added this directory with `/add-dir`| `claude --continue`
+`--continue`, `-c`| Load the most recent conversation in the current directory, including a [background session that has finished](</docs/en/sessions#resume-a-session>); opening finished background sessions requires Claude Code v2.1.257 or later. Skips sessions created with `claude -p` or the Agent SDK, and sessions whose first prompt was `/loop`. `claude -p --continue` includes `-p`, SDK, and `/loop` sessions. Includes sessions that added this directory with `/add-dir`| `claude --continue`
`--dangerously-load-development-channels`| Enable [channels](</docs/en/channels-reference#test-during-the-research-preview>) that are not on the approved allowlist, for local development. Accepts `plugin:<name>@<marketplace>` and `server:<name>` entries. Prompts for confirmation| `claude --dangerously-load-development-channels server:webhook`
`--dangerously-skip-permissions`| Skip permission prompts. Equivalent to `--permission-mode bypassPermissions`. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) for what this does and does not skip. For sessions started with `--bg`, the mode [persists when the supervisor restarts the session](</docs/en/agent-view#permission-mode-model-and-effort>)| `claude --dangerously-skip-permissions`
`--debug`| Enable debug mode with optional category filtering, such as `--debug='mcp,startup'` or `--debug='!1p'`. The filter binds only in the `=` form; a space-separated filter enables debug mode without filtering| `claude --debug='mcp,startup'`
`--debug-file <path>`| Write debug logs to a specific file path. Implicitly enables debug mode. Takes precedence over `CLAUDE_CODE_DEBUG_LOGS_DIR`| `claude --debug-file /tmp/claude-debug.log`
`--disable-slash-commands`| Disable all skills and commands for this session| `claude --disable-slash-commands`
-`--disallowedTools`, `--disallowed-tools`| Deny rules. A bare tool name removes the matching tools from Claude’s context: `"Edit"` removes Edit, `"*"` removes every tool, and `"mcp__*"` removes every MCP tool. A scoped rule such as `Bash(rm *)` leaves the tool available and denies only matching calls. A rule naming [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) can’t remove it while any other tool remains| `"Bash(git log *)" "Bash(git diff *)" "Edit"`
+`--disallowedTools`, `--disallowed-tools`| Deny rules. A bare tool name removes the matching tools from Claude’s context: `"Edit"` removes Edit, `"*"` removes every tool, and `"mcp__*"` removes every MCP tool. A scoped rule such as `Bash(rm *)` leaves the tool available and denies only calls that match [as written](</docs/en/permissions#bash-rule-limits>). A rule naming [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) can’t remove it while any other tool remains| `"Bash(git log *)" "Bash(git diff *)" "Edit"`
`--effort`| Set the [effort level](</docs/en/model-config#adjust-effort-level>) for the current session. Options: `low`, `medium`, `high`, `xhigh`, `max`, or `ultracode`. Available levels depend on the model. `ultracode` starts the session at `xhigh` effort with [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>) turned on, and requires Claude Code v2.1.203 or later. Overrides the [`modelSettings`](</docs/en/settings-reference#modelsettings>) and [`effortLevel`](</docs/en/settings-reference#effortlevel>) settings for this session and does not persist| `claude --effort high`
`--enable-auto-mode`| Removed in v2.1.111. Auto mode is now in the `Shift+Tab` cycle by default; use `--permission-mode auto` to start in it| `claude --permission-mode auto`
`--environment <environment-id>`| Create a new cloud session that runs on the [self-hosted environment](</docs/en/self-hosted-environments>) with the given ID. Environment IDs start with `ccpool_`. See [`--environment` dispatch behavior](</docs/en/self-hosted-environments-testing#environment-dispatch-behavior>) for dispatch behavior and the flag combinations it rejects. Requires Claude Code v2.1.224 or later| `claude -p "Fix the login bug" --environment ccpool_abc123`
@@ -87,7 +87,7 @@
`--exec`| Run a shell command as a PTY-backed background job instead of starting a Claude session. Use with `--bg` to launch from the shell| `claude --bg --exec 'pytest -x'`
`--fallback-model`| Enable automatic fallback to the specified model(s) when the primary model is overloaded or not available, for example a retired model. Accepts a comma-separated list tried in order. See [Fallback model chains](</docs/en/model-config#fallback-model-chains>). To persist a chain across sessions, use the [`fallbackModel` setting](</docs/en/settings-reference#fallbackmodel>), which this flag overrides| `claude --fallback-model sonnet,haiku`
`--fork-session`| When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`)| `claude --resume abc123 --fork-session`
-`--forward-subagent-text`| Emit [subagent](</docs/en/sub-agents>) text and thinking blocks in the output stream as `assistant` and `user` messages with `parent_tool_use_id` set, so you can reconstruct each subagent’s transcript. Without this flag, Claude Code emits only subagent `tool_use` and `tool_result` blocks. Requires `--print` and `--output-format stream-json`. Claude Code also forwards messages from [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), setting `parent_tool_use_id` to the ID of the Agent tool call that spawned each one; this requires Claude Code v2.1.219 or later. The [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) environment variable enables the same behavior. Requires Claude Code v2.1.211 or later| `claude -p --output-format stream-json --verbose --forward-subagent-text "query"`
+`--forward-subagent-text`| Emit [subagent](</docs/en/sub-agents>) text and thinking blocks in the output stream as `assistant` and `user` messages with `parent_tool_use_id` set, so you can reconstruct each subagent’s transcript. Without this flag, Claude Code omits the text and thinking blocks of a subagent that runs in the [foreground](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Requires `--print` and `--output-format stream-json`. Claude Code also forwards messages from [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), setting `parent_tool_use_id` to the ID of the Agent tool call that spawned each one; this requires Claude Code v2.1.219 or later. The [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) environment variable enables the same behavior. Requires Claude Code v2.1.211 or later| `claude -p --output-format stream-json --verbose --forward-subagent-text "query"`
`--from-pr`| Open the session picker filtered to sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123`
`--ide`| Automatically connect to IDE on startup if exactly one valid IDE is available| `claude --ide`
`--init`| Run [Setup hooks](</docs/en/hooks#setup>) with the `init` matcher before the session (print mode only)| `claude -p --init "query"`
@@ -112,7 +112,7 @@
The prompt tool can’t approve an MCP tool marked as [requiring user interaction](</docs/en/mcp#require-approval-for-a-specific-tool>): Claude Code converts an `allow` result for one to a deny. This restriction requires Claude Code v2.1.199 or later| `claude -p --permission-prompt-tool mcp_auth_tool "query"`
`--permission-prompts`| Set who answers permission prompts in print mode. With the default `host`, Claude Code sends them to the Agent SDK host or the `--permission-prompt-tool` tool. Pass `none` when nobody can answer, and Claude Code denies them instead. See [Turn off permission prompts in unattended runs](</docs/en/headless#turn-off-permission-prompts-in-unattended-runs>). Requires Claude Code v2.1.259 or later| `claude -p --permission-prompts none "query"`
-`--plugin-dir`| Load a plugin from a directory or `.zip` archive for this session only. Each flag takes one path. Repeat the flag for multiple plugins: `--plugin-dir A --plugin-dir B.zip`| `claude --plugin-dir ./my-plugin`
+`--plugin-dir`| Load a plugin from a directory or `.zip` archive, or several from a [folder of plugins](</docs/en/plugins#test-your-plugins-locally>), for this session only. Each flag takes one path. Repeat the flag for more paths: `--plugin-dir A --plugin-dir B.zip`. Passing a folder of plugins requires Claude Code v2.1.265 or later| `claude --plugin-dir ./my-plugin`
`--plugin-url`| Fetch a plugin `.zip` archive from a URL for this session only. Repeat the flag for multiple plugins, or pass space-separated URLs in a single quoted value| `claude --plugin-url https://example.com/plugin.zip`
`--print`, `-p`| Print response without interactive mode (see [Agent SDK documentation](</docs/en/agent-sdk/overview>) for programmatic usage details)| `claude -p "query"`
`--prompt-suggestions`| Emit a `prompt_suggestion` message with a predicted next user prompt after each turn that generates one; very short conversations can produce none. Requires `--print`, `--output-format stream-json`, and `--verbose`. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>)| `claude -p --prompt-suggestions --output-format stream-json --verbose "query"`
@@ -122,7 +122,7 @@
`--remote-control-session-name-prefix <prefix>`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is set. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. Set `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX` for the same effect| `claude remote-control --remote-control-session-name-prefix dev-box`
`--replay-user-messages`| Re-emit user messages from stdin back on stdout for acknowledgment. Requires `--input-format stream-json` and `--output-format stream-json`| `claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages`
`--restricted`| Start in restricted mode. Use it when an evaluation harness drives `claude` on a shared machine and Claude Code must not run commands or read that machine’s user and project settings. Claude Code removes the built-in tools that run commands or code, and WebFetch, unless you name them individually in `--tools`, not through the `default` preset. It also confines the built-in file tools to the [working directories](</docs/en/permissions#working-directories>), loads only [managed settings](</docs/en/managed-settings>) and `--settings`, refuses [`bypassPermissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>), and [refuses to create cloud sessions](</docs/en/errors#cloud-sessions-cannot-be-created-from-a-restricted-session>). Requires Claude Code v2.1.248 or later| `claude --restricted -p "query"`
-`--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. The picker and name search include sessions that added this directory with `/add-dir`. When you pass a session ID, Claude Code searches the current project directory and its git worktrees, then every other project on this machine. Before v2.1.223, the ID search covered only the current project directory and its git worktrees. [Background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`| `claude --resume auth-refactor`
+`--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. In place of an ID, you can pass the absolute path to a session’s `.jsonl` [transcript file](</docs/en/sessions#where-transcripts-are-stored>). The picker and name search include sessions that added this directory with `/add-dir`. When you pass a session ID, Claude Code searches the current project directory and its git worktrees, then every other project on this machine. Before v2.1.223, the ID search covered only the current project directory and its git worktrees. [Background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`| `claude --resume auth-refactor`
`--safe-mode`| Start with all customizations disabled to troubleshoot a broken configuration: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load. Authentication, model selection, built-in tools, and permissions work normally, which differs from [`--bare`](</docs/en/headless#start-faster-with-bare-mode>). Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Useful for checking whether a customization is what triggers [automatic model fallback](</docs/en/model-config#automatic-model-fallback>). Sets [`CLAUDE_CODE_SAFE_MODE`](</docs/en/env-vars>)| `claude --safe-mode`
`--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`)| `claude --setting-sources user,project`
@@ -130,6 +130,7 @@
`--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`
`--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`
`--teleport`| Resume a [web session](</docs/en/claude-code-on-the-web>) in your local terminal| `claude --teleport`
`--teammate-mode`| Set how [agent team](</docs/en/agent-teams>) teammates display: `in-process` (default), `auto`, `tmux`, or `iterm2` (added in v2.1.186). Overrides the [`teammateMode`](</docs/en/settings-reference#teammatemode>) setting for this session. See [Choose a display mode](</docs/en/agent-teams#choose-a-display-mode>)| `claude --teammate-mode auto`
`--tmux`| Create a tmux session for the worktree. Requires `--worktree`. Uses iTerm2 native panes when available; pass `--tmux=classic` for traditional tmux| `claude -w feature-auth --tmux`
@@ -144,7 +145,7 @@
System prompt flags
-Claude Code provides four flags for customizing the system prompt. All four work in both interactive and non-interactive modes.
+Claude Code provides five flags for customizing the system prompt. Four set its text, and with `--system-prompt-snapshot` you control whether a conversation keeps the text it started with. All five work in both interactive and non-interactive modes.
Flag| Behavior| Example
---|---|---
@@ -152,8 +153,17 @@
`--system-prompt-file`| Replaces with file contents| `claude --system-prompt-file ./prompts/review.txt`
`--append-system-prompt`| Appends to the default prompt| `claude --append-system-prompt "Always use TypeScript"`
`--append-system-prompt-file`| Appends file contents to the default prompt| `claude --append-system-prompt-file ./style-rules.txt`
+`--system-prompt-snapshot`| With `off`, rebuilds the prompt on every request. With `on`, the default, reuses a recorded prompt where recording applies| `claude --append-system-prompt "Draft rules" --system-prompt-snapshot off`
-`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. These flags apply only to the current invocation. For persistent personas you can switch between and share across a project, use [output styles](</docs/en/output-styles>). For project conventions Claude should always follow, use [CLAUDE.md](</docs/en/memory>). The [Agent SDK guide on system prompts](</docs/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point>) covers the same decision in more depth.
+`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. For persistent personas you can switch between and share across a project, use [output styles](</docs/en/output-styles>). For project conventions Claude should always follow, use [CLAUDE.md](</docs/en/memory>). The [Agent SDK guide on system prompts](</docs/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point>) covers the same decision in more depth.
+
+####
+
+
+
+System prompt flags in resumed conversations
+
+By default, Claude Code builds the system prompt once, on a conversation’s first request, with the text from any system prompt flags applied, and records it in the session. Until the conversation is compacted, every later request uses that recorded prompt, including after you return to the conversation with `--resume` or `--continue`. If you pass different system prompt flag text, or none, on that later launch, it takes effect once the conversation is compacted or when you start a new conversation. Recording applies in sessions that [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), as sessions signed in with a claude.ai or Console account do by default. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and in other sessions that don’t fetch them, Claude Code rebuilds the prompt on every request and `--system-prompt-snapshot` has no effect. If you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>), by passing `--bare` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you pass `--system-prompt-snapshot on`. To rebuild the prompt on every request instead, for example while you iterate on its wording across `--continue` runs, pass `--system-prompt-snapshot off`. Before v2.1.265, passing any of the system prompt flags also turned recording off unless you passed `--system-prompt-snapshot on`.
##
--- a/code-review.md
+++ b/code-review.md
@@ -320,8 +320,10 @@
It reviews your branch’s commits ahead of its upstream plus any uncommitted changes, so it needs work on the branch or in the working tree to have something to report. To review something else, pass a target: a file path, a PR number, a branch name, or a ref range such as `main...my-feature`.You can also add flags:
* `--fix`: applies the findings to your working tree after the review
- * `--comment`: posts the findings as inline PR comments
+ * `--comment`: posts the findings on a GitHub pull request as inline comments, or on a GitLab merge request as a single note
* `--post`: on an `ultra` cloud review of a `github.com` pull request, preselects posting the finished findings to the PR in the launch dialog; see [Post findings to the pull request](</docs/en/ultrareview#post-findings-to-the-pull-request>). Requires Claude Code v2.1.227 or later
+
+When you pass `--comment` for a GitLab merge request, Claude Code posts the findings through GitLab’s `glab` CLI. Requires Claude Code v2.1.257 or later. When `glab` isn’t installed, Claude prints the findings in the terminal instead.Pass the merge request as its URL or a `!123` reference. Claude Code treats a bare number or branch name as a merge request only when the checkout’s origin is on `gitlab.com`. On a self-managed GitLab instance, pass the URL or `!123` form.
2
--- a/commands.md
+++ b/commands.md
@@ -28,7 +28,7 @@
Command| Purpose
---|---
`/add-dir <path>`| Add a working directory for file access during the current session. Type a partial path to see matching directory suggestions; press `Tab` to accept one. Most `.claude/` configuration [isn’t discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from the added directory. You can’t add most [network paths](</docs/en/errors#working-directory-is-a-network-path>), such as `\\server\share`. After a successful add, your [`DirectoryAdded` hooks](</docs/en/hooks#directoryadded>) run. When you run it while Claude is responding, Claude Code asks you to confirm the directory right away, and once you confirm, Claude’s next tool call in the same turn can access it. Before v2.1.234, Claude Code queued the command until the turn finished
-`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `fable`, `opus`, `sonnet`, or a full model ID. `fable` requires [Fable access](</docs/en/advisor#choose-an-advisor-model>). Without an argument, opens a picker
+`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `fable`, `opus`, `sonnet`, or a full model ID. `fable` requires [Fable access](</docs/en/advisor#choose-an-advisor-model>). Without an argument, opens a picker. In a session without an interactive terminal, or over [Remote Control](</docs/en/remote-control#limitations>), pass the model or `off` as an argument; with no argument there, the command prints the current advisor as text. These forms require Claude Code v2.1.260 or later
`/agents`| As of v2.1.198, running `/agents` prints a reminder to ask Claude to create or manage [subagents](</docs/en/sub-agents>), or to edit `.claude/agents/` or `~/.claude/agents/` directly. On v2.1.197 and earlier, opens an interactive interface for creating and managing subagent configurations
`/artifacts`| List the [artifacts](</docs/en/artifacts#find-an-artifact-again>) you own or that are shared with you, then attach one to the session, open it in your browser, or copy its link. Available where [artifacts](</docs/en/artifacts#availability>) are. Requires Claude Code v2.1.208 or later; attaching with `Enter` requires v2.1.216
`/auto-mode-setup`| [Draft `autoMode.environment` entries](</docs/en/auto-mode-config#generate-environment-entries>) from your project and recent sessions, then review the draft and save it to your user settings. Requires a Pro, Max, or Team plan and Claude Code v2.1.228 or later. On native Windows, requires v2.1.233 or later
@@ -41,9 +41,9 @@
`/bug [report]`| Report a bug or share your conversation. You choose how much session history to include and confirm on a consent screen before anything is sent. When you’re signed in to Anthropic on a first-party connection, the report goes to Anthropic; on a third-party provider, or without Anthropic credentials, Claude Code writes the report to a [local archive under `~/.claude/feedback-bundles/`](</docs/en/data-usage#telemetry-services>) that you forward yourself. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), `/bug` opens the extension’s own feedback dialog instead; requires Claude Code v2.1.229 or later. When you run it while Claude is responding, Claude Code opens the dialog immediately. Before v2.1.232, Claude Code queued the command until the turn finished. Alias: `/share`. Before v2.1.212, `/bug` and `/share` were aliases of `/feedback`
`/cd <path>`| Move this session to a new working directory, keeping the conversation. Type a partial path to see matching directory suggestions; press `Tab` to accept one. The suggestions require Claude Code v2.1.206 or later. For what Claude Code applies from the new directory as soon as you move, and how `/cd` differs from `/add-dir`, see [Move the session to another directory](</docs/en/permissions#move-the-session-to-another-directory>)
`/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings
-`/claude-api [migrate|upgrade|managed-agents-onboard|prompt-audit|cost-optimize]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `migrate` to update existing Claude API code to a newer model. Run `upgrade` to move your project’s Anthropic SDK dependency across a major version, currently the Python `anthropic` package from 0.x to 1.x. Run `managed-agents-onboard` for a walkthrough that creates a new Managed Agent. Run `prompt-audit` to flag instructions written for older models in your prompts, skills, and tool descriptions and propose fixes as a diff. Run `cost-optimize` to profile where your project’s Claude API spend goes and propose savings from options such as prompt caching, trimming unneeded input and output tokens, batch processing, effort, and model choice, one change at a time. The `prompt-audit` subcommand requires Claude Code v2.1.221 or later, `upgrade` requires v2.1.236 or later, and `cost-optimize` requires v2.1.247 or later
+`/claude-api [migrate|upgrade|managed-agents-onboard|prompt-audit|cost-optimize|build-eval|hillclimb]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `migrate` to update existing Claude API code to a newer model. Run `upgrade` to move your project’s Anthropic SDK dependency across a major version, currently the Python `anthropic` package from 0.x to 1.x. Run `managed-agents-onboard` for a walkthrough that creates a new Managed Agent. Run `prompt-audit` to flag instructions written for older models in your prompts, skills, and tool descriptions and propose fixes as a diff. Run `cost-optimize` to profile where your project’s Claude API spend goes and propose savings from options such as prompt caching, trimming unneeded input and output tokens, batch processing, effort, and model choice, one change at a time. Run `build-eval` to build an eval set for your Claude-powered app, and `hillclimb` to iteratively improve the app against an existing eval. The `prompt-audit` subcommand requires Claude Code v2.1.221 or later, `upgrade` requires v2.1.236 or later, `cost-optimize` requires v2.1.247 or later, and `build-eval` and `hillclimb` require v2.1.259 or later
`/clear [name]`| Start a new conversation with empty context. Pass a name to label the previous conversation in the `/resume` picker. To free up context while continuing the same conversation, use `/compact` instead. Resume the previous conversation with `/resume`, or, in the same Claude Code process, restore it from [the rewind menu’s previous-session entry](</docs/en/checkpointing#rewind-past-a-cleared-conversation>). The rewind entry requires Claude Code v2.1.191 or later. Aliases: `/reset`, `/new`
-`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [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 and cleanup opportunities. Pass `--fix` to apply findings, `--comment` to post them as inline GitHub PR comments, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). With `ultra` on a `github.com` PR target, `--post` preselects [posting the finished findings to the PR](</docs/en/ultrareview#post-findings-to-the-pull-request>) in the launch dialog. See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review`
+`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [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 and cleanup opportunities. Pass `--fix` to apply 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 a diff locally](</docs/en/code-review#review-a-diff-locally>) 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`); requires Claude Code v2.1.205 or later
`/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. From v2.1.181, pass one or more `key=value` pairs to set a setting directly without opening the interface, for example `/config thinking=false`. From v2.1.182, named shorthand keys are also accepted, such as `/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`
@@ -72,10 +72,10 @@
`/help`| Show help and available commands
`/hooks`| View [hook](</docs/en/hooks>) configurations for tool events
`/ide`| Manage IDE integrations and show status
-`/import [codex|gemini] [--dry-run] [--yes]`| Bring configuration from other coding agents on your machine, currently OpenAI Codex and Google Gemini CLI, into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later
-`/init`| Initialize project with a `CLAUDE.md` guide. Set `CLAUDE_CODE_NEW_INIT=1` for an interactive flow that also walks through skills, hooks, and personal memory files. If `/init` finds configuration from a coding agent that `/import` supports, it offers to carry it over with `/import`
+`/import [codex|gemini|cursor] [--dry-run] [--yes]`| Bring configuration from OpenAI Codex, Google Gemini CLI, or Cursor on your machine into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later. Importing from Cursor requires v2.1.265 or later
+`/init`| Initialize project with a `CLAUDE.md` guide. Set `CLAUDE_CODE_NEW_INIT=1` for an interactive flow that also walks through skills, hooks, and personal memory files. If `/init` finds OpenAI Codex or Google Gemini CLI configuration, it offers to carry it over with `/import`
`/insights`| Generate an HTML report analyzing your recent sessions on this machine: which projects you work in, how you use Claude Code, where things go wrong, and features to try. Not available in [cloud sessions](</docs/en/claude-code-on-the-web>). See [Analyze your usage patterns](</docs/en/costs#analyze-your-usage-patterns>) for the report location, retention, and cost
-`/install-github-app`| Install the Claude GitHub App for a repository, with an optional step to set up [GitHub Actions](</docs/en/github-actions>) workflows and secrets. Walks you through selecting a repo and configuring the integration
+`/install-github-app`| Install the Claude GitHub App for a repository, with an optional step to set up [GitHub Actions](</docs/en/github-actions>) workflows and secrets. Walks you through selecting a repo and configuring the integration. Works only with github.com repositories. When your repository’s git remote is on gitlab.com or bitbucket.org, the command prints a notice and exits instead of starting setup. To run Claude Code from GitLab pipelines, see [GitLab CI/CD](</docs/en/gitlab-ci-cd>)
`/install-slack-app`| Install the Claude Slack app. Opens a browser to complete the OAuth flow
`/keybindings`| Open your [keyboard shortcuts](</docs/en/keybindings>) file
`/list-agents`| List the subagents, [agent team](</docs/en/agent-teams>) teammates, and other Claude Code sessions Claude can message, with the name to use for each. See [cross-session messaging](</docs/en/cross-session-messaging>). Also available as `/peers`. Requires Claude Code v2.1.224 or later; earlier versions report `Unknown command: /list-agents`. Teammate rows and the first line showing this session’s own name require v2.1.239 or later. Available only in sessions where [cross-session messaging is enabled](</docs/en/cross-session-messaging#availability>)
@@ -97,7 +97,7 @@
`/rate-limit-options`| Show ways to keep working when a claude.ai usage limit blocks a request: wait and [continue automatically when the limit resets](</docs/en/interactive-mode#wait-for-a-usage-limit-to-reset>), add [usage credits](</docs/en/costs#add-usage-credits-to-your-subscription>), or upgrade your plan. Claude Code can also open this menu on its own when you hit a limit at your own terminal. See [Turn automatic continue off](</docs/en/interactive-mode#turn-automatic-continue-off>). Requires a claude.ai subscription. Doesn’t appear in the command menu; type it in full. The wait-and-continue rows require Claude Code v2.1.234 or later
`/recap`| Generate a one-line summary of the current session on demand. See [Session recap](</docs/en/interactive-mode#session-recap>) for the automatic recap that appears after you’ve been away
`/release-notes`| View the changelog in an interactive version picker. Select a specific version to see its release notes, or choose to show all versions. The notes appear in your transcript without entering the conversation Claude sees
-`/reload-plugins [--force]`| Reload all active [plugins](</docs/en/plugins>) to apply pending changes without restarting. Reports counts for each reloaded component and flags any load errors. When the reload would change which MCP tools are loaded and invalidate the prompt cache, the command warns and skips unless you pass `--force`
+`/reload-plugins [--force]`| Reload all active [plugins](</docs/en/plugins>) to apply pending changes without restarting. Reports counts for each reloaded component and flags any load errors. When the reload would change which MCP tools are loaded and invalidate the prompt cache, the command warns and skips unless you pass `--force`. Also available in non-interactive mode (`-p`), the Agent SDK, and the desktop app, where it runs only on input typed directly into the session and doesn’t apply plugin MCP server changes; requires Claude Code v2.1.260 or later. See [Apply plugin changes without restarting](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>)
`/reload-skills`| Re-scan [skill](</docs/en/skills>) and command directories so skills added or changed on disk during the session become available without restarting. Reports how many skills are available and how many were added or removed
`/remote-control`| Make this session available for [Remote Control](</docs/en/remote-control>) from claude.ai. Running it while signed out prints that Remote Control requires a claude.ai subscription and tells you how to sign in; before v2.1.206 it reported `Unknown command: /remote-control`. Alias: `/rc`
`/remote-env`| Choose the default environment for [cloud agents](</docs/en/cloud-environments#select-an-environment-from-the-cli>)
--- a/communications-kit.md
+++ b/communications-kit.md
@@ -214,7 +214,9 @@
mid-session. *Sonnet* is the workhorse default for everyday feature work,
bugs, tests, and reviews. Reach for *Opus* on large refactors, gnarly
debugging, or anything high-stakes. Drop to *Haiku* for quick questions,
- formatting, and mechanical edits where speed wins. *Fable* is the most
+ formatting, and mechanical edits where speed wins.
+
+ *Fable* is the most
capable model for your hardest, longest-running tasks; it is not the
default, so select it with `/model fable`, and note that cybersecurity and
biology content falls back to Opus automatically. Opus 5 runs its own
@@ -228,7 +230,7 @@
Model| Best for
---|---
-Fable| The hardest, longest-running tasks. Opt-in only: select it with `/model fable`. Cybersecurity or biology content [falls back to Opus](</docs/en/model-config#automatic-model-fallback>)
+Fable| The hardest, longest-running tasks. Opt-in only: select it with `/model fable`. Cybersecurity or biology content triggers [automatic model fallback to Opus](</docs/en/model-config#automatic-model-fallback>)
Opus| Large-scale refactors, complex debugging, architecture decisions, high-stakes changes. On Opus 5, cybersecurity or biology content triggers [automatic model fallback or a refusal](</docs/en/model-config#automatic-model-fallback>)
Sonnet| Everyday feature work, bug fixes, tests, documentation, code review. Recommended default.
Haiku| Quick questions, formatting, mechanical edits, rapid iteration
--- a/context-window.md
+++ b/context-window.md
@@ -8,7 +8,7 @@
The session walks through a realistic flow with representative token counts:
- * **Before you type anything** : CLAUDE.md, auto memory, MCP tool names, and skill descriptions all load into context. Your own setup may add more here, like an [output style](</docs/en/output-styles>) or text from [`--append-system-prompt`](</docs/en/cli-reference>), which both go into the system prompt the same way.
+ * **Before you type anything** : CLAUDE.md, auto memory, MCP tool names, and skill descriptions all load into context. Your own setup may add more here, like an [output style](</docs/en/output-styles>) or text from [`--append-system-prompt`](</docs/en/cli-reference>).
* **As Claude works** : each file read adds to context, [path-scoped rules](</docs/en/memory#path-specific-rules>) load automatically alongside matching files, and a [PostToolUse hook](</docs/en/hooks-guide>) fires after each edit.
* **The follow-up prompt** : a [subagent](</docs/en/sub-agents>) handles the research in its own separate context window, so the large file reads stay out of yours. Only the summary and a small metadata trailer come back.
* **At the end** : `/compact` replaces the conversation with a structured summary. Most startup content reloads automatically; the table below shows what happens to each mechanism.
@@ -23,7 +23,7 @@
Mechanism| After compaction
---|---
-System prompt and output style| Unchanged; not part of message history
+System prompt and output style| Both still apply
Project-root CLAUDE.md and unscoped rules| Re-injected from disk
Auto memory| Re-injected from disk
The plan Claude wrote in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>)| Re-injected from disk
@@ -50,7 +50,7 @@
* **Clear between tasks** : run `/clear` when switching to unrelated work. Old conversation crowds out the files you need next and costs tokens on every message.
* **Delegate large reads** : send research to a [subagent](</docs/en/sub-agents>) so the file contents stay in its context window, not yours.
-If you need a larger window rather than a smaller conversation, Fable 5.1, Fable 5, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window. See [Extended context](</docs/en/model-config#extended-context>) for availability by plan and how to select a `[1m]` model variant. Sonnet 5 runs at 1M with no `[1m]` variant to select; see [Sonnet 5 context window](</docs/en/model-config#sonnet-5-context-window>) for its auto-compaction thresholds and the LLM gateway exception. Compaction works the same way at the larger limit. The point where automatic compaction runs depends on your model and configuration. See [Default auto-compact thresholds](</docs/en/model-config#default-auto-compact-thresholds>) for the boundaries per model, and [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) if Claude Code assumes the wrong window for your model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias.
+If you need a larger window rather than a smaller conversation, Fable models, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window. See [Extended context](</docs/en/model-config#extended-context>) for availability by plan and how to select a `[1m]` model variant. Compaction works the same way at the larger limit. Sonnet 5 runs with the 1M context window and has no `[1m]` variant to select. See [Sonnet 5 context window](</docs/en/model-config#sonnet-5-context-window>) for its auto-compaction thresholds and the LLM gateway exception. The point where automatic compaction runs depends on your model and configuration. See [Default auto-compact thresholds](</docs/en/model-config#default-auto-compact-thresholds>) for the boundaries per model, and [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) if Claude Code assumes the wrong window for your model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias.
##
--- a/costs.md
+++ b/costs.md
@@ -348,7 +348,7 @@
Adjust extended thinking
-Extended thinking is enabled by default because it significantly improves performance on complex planning and reasoning tasks. Thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request depending on the model. For simpler tasks where deep reasoning isn’t needed, you can reduce costs by lowering the [effort level](</docs/en/model-config#adjust-effort-level>) with `/effort` or in `/model`, disabling thinking in `/config`, or, on models with a [fixed thinking budget](</docs/en/model-config#adaptive-reasoning-and-fixed-thinking-budgets>), lowering the budget by setting the `MAX_THINKING_TOKENS` [environment variable](</docs/en/env-vars>), for example `MAX_THINKING_TOKENS=8000`. Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead. Disabling thinking is not available on Fable models, which always use extended thinking.
+Extended thinking is enabled by default because it significantly improves performance on complex planning and reasoning tasks. Thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request depending on the model. For simpler tasks where deep reasoning isn’t needed, you can reduce costs by lowering the [effort level](</docs/en/model-config#adjust-effort-level>) with `/effort` or in `/model`, or by disabling thinking in `/config`. You can’t turn off thinking on Fable models, which always use extended thinking. On models with a [fixed thinking budget](</docs/en/model-config#adaptive-reasoning-and-fixed-thinking-budgets>), you can also lower the budget by setting the `MAX_THINKING_TOKENS` [environment variable](</docs/en/env-vars>), for example `MAX_THINKING_TOKENS=8000`. Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead.
###
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -149,7 +149,7 @@
On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection
On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session
-Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
+Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. You can message a session shown as `offline` in the listing, one whose Remote Control connection has dropped. The send goes through, but the message arrives only after that session’s machine reconnects. Claude is told as much when it sends. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk. When Claude lists or messages your local sessions, Claude Code reads those files to find the sessions, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A session inside WSL 2 and a native Windows session on the same computer can’t reach each other either, because they register under different home directories and listen on different socket types. While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`.
##
@@ -203,7 +203,8 @@
* **Approve** delivers that one message to Claude.
* **Deny** , or dismissing the dialog, drops it.
- * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
+ * When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes.
+ * While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, if the dialog stays unanswered for a full deadline period, Claude Code closes it and drops the message.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
* If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
@@ -312,6 +313,7 @@
* **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
* **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
+ * **Other-machine session`offline`**: a message to a session listed as `offline` goes through, but arrives only after that session’s machine reconnects.
* **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
--- a/custom-tools.md
+++ b/custom-tools.md
@@ -328,7 +328,7 @@
`tools: ["Read", "Grep"]`| Availability| Only the listed built-ins are in Claude’s context. Unlisted built-ins are removed. MCP tools are unaffected.
`tools: []`| Availability| All built-ins are removed. Claude can only use your MCP tools.
allowed tools| Permission| Listed tools run without a permission prompt. Other unlisted tools remain available; calls go through the [permission flow](</docs/en/agent-sdk/permissions>).
-disallowed tools| Both| A bare tool name such as `"Bash"` removes the tool from Claude’s context, the same as omitting it from `tools`. A scoped rule such as `"Bash(rm *)"` leaves the tool in context and denies only matching calls.
+disallowed tools| Both| A bare tool name such as `"Bash"` removes the tool from Claude’s context, the same as omitting it from `tools`. A scoped rule such as `"Bash(rm *)"` leaves the tool in context and denies only calls that match [as written](</docs/en/permissions#bash-rule-limits>).
To remove a built-in entirely, omit it from `tools` or list its bare name in `disallowedTools` (Python: `disallowed_tools`); both keep the tool out of context so Claude never attempts it. A scoped `disallowedTools` rule blocks matching calls but leaves the tool visible, so Claude may waste a turn trying it. See [Configure permissions](</docs/en/agent-sdk/permissions>) for the full evaluation order.
--- a/debug-your-config.md
+++ b/debug-your-config.md
@@ -57,7 +57,7 @@
* A misspelled tool name produces a matcher that matches nothing, so the hook fails silently.
* An array value is a schema error: Claude Code shows a settings error notice and rejects the whole user, project, or local settings file, `claude doctor` reports the validation failure, and no hook from that file appears in `/hooks`. In [managed settings](</docs/en/managed-settings>), Claude Code drops the whole `hooks` key from the file that contains the array, so none of that file’s hooks apply. The file’s other settings still apply, and `claude doctor` lists the dropped key.
-Edits to `settings.json` take effect in the running session after a brief file-stability delay. You don’t need to restart. If `/hooks` still shows the old definition a few seconds after saving, run `/hooks` again to refresh the view. If `/hooks` shows the hook but it still does not fire, the next step is to watch hook evaluation live. Start a session with `claude --debug` and trigger the tool call. The debug log records each event, which matchers were checked, and the hook’s exit code and output. See [Debug hooks](</docs/en/hooks#debug-hooks>) for the log format and [hooks troubleshooting](</docs/en/hooks-guide#limitations-and-troubleshooting>) for common failure patterns.
+When you edit `settings.json`, the change takes effect in the running session after a brief file-stability delay, even if you create the file or the project’s `.claude/` folder itself after the session started. You don’t need to restart. Before v2.1.257, Claude Code didn’t detect edits in a `.claude/` folder created after the session started. If `/hooks` still shows the old definition a few seconds after you save, run `/hooks` again to refresh the view. If `/hooks` shows the hook but it still does not fire, the next step is to watch hook evaluation live. Start a session with `claude --debug` and trigger the tool call. The debug log records each event, which matchers were checked, and the hook’s exit code and output. See [Debug hooks](</docs/en/hooks#debug-hooks>) for the log format and [hooks troubleshooting](</docs/en/hooks-guide#limitations-and-troubleshooting>) for common failure patterns.
##
@@ -102,7 +102,7 @@
Project MCP server added but doesn’t appear| The one-time approval prompt was dismissed| Project-scoped servers require approval. Run `/mcp` to see status and approve.
MCP server fails to start from some directories| `command` or `args` uses a relative file path| Use absolute paths for local scripts. Executables on your `PATH` like `npx` or `uvx` work as-is.
MCP server starts without expected environment variables| The server’s config entry doesn’t set them, and they aren’t in the environment Claude Code passes to stdio servers: its own environment, minus the [variables it strips from subprocesses](</docs/en/monitoring-usage#administrator-configuration>)| Set per-server `env` inside the server’s `.mcp.json` entry, which doesn’t depend on the launch environment or workspace trust.
-`Bash(rm *)` deny rule doesn’t block `/bin/rm` or `find -delete`| Prefix rules match the literal command string, not the underlying executable| Add explicit patterns for each variant, or use a [PreToolUse hook](</docs/en/hooks-guide>) or the [sandbox](</docs/en/sandboxing>) for a hard guarantee.
+`Bash(rm *)` deny rule doesn’t block `/bin/rm` or `find -delete`| Bash rules match the literal command string, not the underlying executable; see [what a Bash rule doesn’t match](</docs/en/permissions#bash-rule-limits>)| Use a [PreToolUse hook](</docs/en/hooks-guide>) or the [sandbox](</docs/en/sandboxing>) for a hard guarantee.
##
--- a/desktop.md
+++ b/desktop.md
@@ -84,7 +84,7 @@
**Auto**| `auto`| Claude executes all actions with background safety checks that verify alignment with your request. Reduces permission prompts while maintaining oversight. Appears when auto mode is available; there is no separate Settings toggle for it.
**Bypass permissions**| `bypassPermissions`| Claude runs without permission prompts, except for the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>), safety classifiers when Claude acts on external sites, or desktop actions where Claude always asks first, such as archiving a session. Equivalent to `--dangerously-skip-permissions` in the CLI. On Pro and Max plans, enable it in your Settings → Claude Code under “Allow bypass permissions mode”; on Team and Enterprise plans there is no Settings toggle, and organization policy controls it instead. Only use this in sandboxed containers or VMs.
-Earlier versions of the Code tab labeled these modes Ask permissions, Auto accept edits, and Plan mode. The `dontAsk` permission mode is available only in the [CLI](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>). Auto mode is available to all users on the Anthropic API and requires Claude Opus 4.6 or later, Sonnet 4.6 or later, or a Fable model. Organization administrators can turn auto mode off with the `disableAutoMode` key in managed settings. In Enterprise deployments that route Desktop to Google Cloud’s Agent Platform, auto mode is also available by default; see [Auto mode on Bedrock, Agent Platform, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>) for the supported models.
+Earlier versions of the Code tab labeled these modes Ask permissions, Auto accept edits, and Plan mode. The `dontAsk` permission mode is available only in the [CLI](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>). Auto mode is available to all users on the Anthropic API and requires Claude Opus 4.6 or later, Sonnet 4.6 or later, or a [Fable model](</docs/en/model-config#work-with-fable>). Organization administrators can turn auto mode off with the `disableAutoMode` key in managed settings. In Enterprise deployments that route Desktop to Google Cloud’s Agent Platform, auto mode is also available by default; see [Auto mode on Bedrock, Agent Platform, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>) for the supported models.
Start complex tasks in Plan so Claude maps out an approach before making changes. Once you approve the plan, switch to Accept edits or Manual to execute it. See [explore first, then plan, then code](</docs/en/best-practices#explore-first-then-plan-then-code>) for more on this workflow.
@@ -770,7 +770,7 @@
`sshConfigs`| pre-configure SSH connections that appear in the environment dropdown. Users cannot edit or delete managed connections.
`sshHostAllowlist`| restrict SSH sessions to hosts whose resolved hostname matches one of these patterns. An empty array disables SSH sessions. Read from managed settings only.
`disableDesktopLocalSessions`| set to `true` to turn off Code sessions that run on the device, leaving SSH sessions to other hosts and cloud sessions available. The value must be the JSON boolean `true`. Read from managed settings only. Requires Claude Desktop v1.37937.0 or later.
-`managedMcpServers`| push MCP server configurations to all users. Available in third-party (3P) Desktop deployments only. In each entry, set a transport of `"http"`, `"sse"`, or `"stdio"`, connection details, and optionally a `toolPolicy` map to restrict which of that server’s tools users can invoke. Deliver it through the managed settings file, MDM, or a Claude apps gateway policy’s [`desktop` block](</docs/en/claude-apps-gateway-config#claude-desktop-overlay>), since 3P deployments don’t receive admin-console settings. To deliver it through the gateway, you need Claude Code v2.1.232 or later on the gateway server.
+`managedMcpServers`| push MCP server configurations to all users. Available in third-party (3P) Desktop deployments only. In each entry, set a transport of `"http"`, `"sse"`, or `"stdio"`, connection details, and optionally a `toolPolicy` map to restrict which of that server’s tools users can invoke. Deliver it through the managed settings file, MDM, or a Claude apps gateway policy’s [`desktop` block](</docs/en/claude-apps-gateway-config#claude-desktop-overlay>), since 3P deployments don’t receive admin-console settings. To deliver it through the gateway, you need Claude Code v2.1.232 or later on the gateway server. This is the desktop app’s own key; Claude Code reads a [same-named managed setting](</docs/en/managed-mcp#provide-servers-through-managed-settings>) of its own, with a different entry shape.
Which managed settings reach a Desktop session depends on where that session runs. Model restrictions such as [`availableModels`](</docs/en/model-config#restrict-model-selection>) are enforced in Desktop’s Claude Code sessions the same way as in the terminal CLI; see [surface coverage](</docs/en/model-config#surface-coverage>).
--- a/discover-plugins.md
+++ b/discover-plugins.md
@@ -278,7 +278,7 @@
/plugin marketplace add https://example.com/marketplace.json
-URL-based marketplaces have some limitations compared to Git-based marketplaces. If you encounter “path not found” errors when installing plugins, see [Troubleshooting](</docs/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces>).
+URL-based marketplaces have some limitations compared to Git-based marketplaces. If plugin installs from a URL-based marketplace fail, see [Troubleshooting](</docs/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces>).
##
@@ -369,7 +369,12 @@
/reload-plugins
-When the reload would invalidate the prompt cache, the command warns and skips until you rerun it with `--force`. Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. In the skills count, Claude Code includes every skill a plugin provides: both its `commands/` entries and its `SKILL.md` skills. Before v2.1.246, Claude Code counted only `commands/` entries, so it could reload a plugin’s `SKILL.md` skills and still report `0 skills` in the summary. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details.
+When the reload would invalidate the prompt cache, the command warns and skips until you rerun it with `--force`. `/reload-plugins` also runs in sessions without an interactive terminal, such as the desktop app, the Agent SDK, and [non-interactive mode](</docs/en/headless>) with `-p`. Requires Claude Code v2.1.260 or later. Two limits apply in those sessions:
+
+ * The command runs only when you type it directly into the session, such as in the `-p` prompt or the desktop app’s prompt box. When you send it over a remote connection instead, such as [Remote Control](</docs/en/remote-control>) or a relayed chat message, the command declines without reloading anything.
+ * The reload doesn’t connect or disconnect plugin MCP servers. Those changes take effect in your next session.
+
+Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers, omitting the plugin MCP server count in a session without an interactive terminal. In the skills count, Claude Code includes every skill a plugin provides: both its `commands/` entries and its `SKILL.md` skills. Before v2.1.246, Claude Code counted only `commands/` entries, so it could reload a plugin’s `SKILL.md` skills and still report `0 skills` in the summary. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details.
##
Show diff (103 lines)
--- a/env-vars.md
+++ b/env-vars.md
@@ -157,7 +157,7 @@
`ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>)
`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise runs background tasks on the [default Sonnet model or the primary model](</docs/en/amazon-bedrock#4-pin-model-versions>) in the session region
`ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>)
-`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>)
+`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>)
`ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target
`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here
`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately
@@ -186,7 +186,7 @@
`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows
`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail
`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>))
-`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting
+`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published
`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later
`CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later
`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly
@@ -239,11 +239,11 @@
`CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later
`CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills
`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title
-`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. The variable’s behavior is unchanged from earlier versions; 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, which is also ineffective on [Fable models](</docs/en/model-config#extended-thinking>) since they can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there
+`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 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_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_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting
-`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>)
+`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>)
`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) and [`--append-subagent-system-prompt-file`](</docs/en/cli-reference#cli-flags>) flags supply the appended text and set this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later
`CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers
`CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle
@@ -290,6 +290,7 @@
`CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later
`CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings
`CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting
+`CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later
`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen`
`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments
`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set
@@ -358,7 +359,7 @@
`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings
`CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later
`CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later
-`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by 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
+`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
`CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
`CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>)
`CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>)
@@ -375,11 +376,12 @@
`CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`
`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>)
`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks
+`CLAUDE_JOB_DIR`| Set by Claude Code in each [background session](</docs/en/agent-view>) to that session’s `~/.claude/jobs/<id>` directory. Shell commands that the session runs inherit it. Write scratch files to [`$CLAUDE_JOB_DIR/tmp`](</docs/en/agent-view#where-state-is-stored>). Claude’s `Write` and `Edit` calls there don’t prompt for permission, and the directory is removed when the session is deleted
`CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later
`CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation
`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`| Deadline in milliseconds for the first response byte of a streaming request, on the connections where the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) runs. For how Claude Code clamps it, the extra time it adds for large request bodies, and how it picks the deadline when you leave this unset, see [No response from API](</docs/en/errors#no-response-from-api>). Requires Claude Code v2.1.242 or later
`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>)
-`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. When the subagent runs in the foreground, Claude Code also ends the command when that subagent gives its final response, regardless of this cap. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>). Claude Code doesn’t cap main-session background commands this way. For the memory-pressure limit that covers them, see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>)
+`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Removed in v2.1.260 and now a no-op. Previously capped how long a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started could run, in milliseconds, with a 60-minute default. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>)
`DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it
`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both
`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting
@@ -409,16 +411,16 @@
`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable
`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead
`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true`
-`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model
+`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make Claude Code stop retrying on repeated overload errors for every model when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, Claude Code stops retrying this way on models it recognizes as Opus, Fable, or Mythos models when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. On Claude Code v2.1.160 or later, Claude Code switches to your configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) on repeated overload errors for any primary model, so this variable doesn’t affect switching to a fallback model
`FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER`
-`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text
+`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text
`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings
`HTTP_PROXY`| Specify HTTP proxy server for network connections
`HTTPS_PROXY`| Specify HTTPS proxy server for network connections
`IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session
`MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000)
-`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5
-`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on [Fable models](</docs/en/model-config#extended-thinking>), which can’t have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set
+`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries
+`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off
`MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret`
`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception
`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt
@@ -463,7 +465,7 @@
`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219
`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197
`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170
-`VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.255
+`VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257
`VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform
Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
@@ -495,6 +497,7 @@
* 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
* Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
* Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>)
+ * Have a resumed conversation [keep its recorded system prompt](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>); Claude Code rebuilds the prompt on every request and `--system-prompt-snapshot` has no effect
###
Show diff (752 lines)
--- a/errors.md
+++ b/errors.md
@@ -59,6 +59,8 @@
`OAuth token revoked` / `OAuth token has expired`| Authentication
`API Error: 401 Invalid authentication credentials`| Authentication
`Login expired · Please run /login`| Authentication
+`Not signed in to the Cloud gateway — run /login.`| Authentication
+`Administrator policy requires a Cloud gateway sign-in on this machine`| Authentication
`Failed to authenticate: OAuth session expired and could not be refreshed`| Authentication
`Your account is on hold and can't use Claude Code. View details or appeal: https://claude.ai/restricted`| Authentication
`Your account is on hold and can't sign in to Claude Code. View details or appeal: https://claude.ai/restricted`| Authentication
@@ -67,10 +69,15 @@
`does not meet scope requirement user:profile`| Authentication
`claude.ai rejected the session token` / `session token rejected`| Authentication
`Issuer mismatch in authorization response (RFC 9207)`| Authentication
+`Cloud gateway session expired — run /login to reconnect.`| Authentication
+`Cloud gateway <url> no longer accepts this session`| Authentication
`AWS credentials expired or invalid`| Authentication
`AWS authentication failed`| Authentication
+`Could not load AWS credentials` / `Could not load Google Cloud credentials`| Authentication
`AWS default-chain credential resolve timed out`| Authentication
-`Could not load the default credentials` on Google Cloud’s Agent Platform| Automatic retries
+`Timed out after 60s waiting for AWS`| Authentication
+`A request to AWS timed out. Check your network and proxy settings, then try again.`| Authentication
+`Could not load the default credentials` on Google Cloud’s Agent Platform| Authentication
`Unable to connect to API`| Network
`Connection refused —` / `Can't reach the API server —` / `No internet route —` / `Couldn't connect through your proxy` / `Connection dropped`, each ending with an error code in parentheses| Network
`Unable to connect to Anthropic services` during setup| Network
@@ -81,6 +88,7 @@
`Bedrock streaming response has content-type "..."; expected "application/vnd.amazon.eventstream"`| Network
`SSL certificate verification failed`| Network
`SSL certificate error (...)` during login or startup| Network
+`unable to get local issuer certificate`| Network
`403` with `x-deny-reason: host_not_allowed` in a cloud or routine session| Network
`proxy refused the connection`| Network
`403` with `This GraphQL query is not enabled for this session` in a cloud session| [GitHub proxy](</docs/en/cloud-environments#github-proxy>)
@@ -97,6 +105,7 @@
`upstream rejected the request` / `request too large for this upstream` on a Claude apps gateway session| [Upstream error messages](</docs/en/claude-apps-gateway-config#upstream-error-messages>)
`upstream rate limit exceeded` on a Claude apps gateway session| [Upstream error messages](</docs/en/claude-apps-gateway-config#upstream-error-messages>)
`all upstreams failed (N attempted)` on a Claude apps gateway session| [Upstream error messages](</docs/en/claude-apps-gateway-config#upstream-error-messages>)
+`Claude Code may not be enabled for your organization` after a Claude apps gateway sign-in| [Claude apps gateway troubleshooting](</docs/en/claude-apps-gateway-deploy#troubleshooting>)
`Context exceeds the ...-token limit by ... tokens` in `/context` output| Request errors
`Error during compaction: Conversation too long`| Request errors
`Request too large`| Request errors
@@ -105,12 +114,16 @@
`Unable to resize image`| Request errors
`PDF too large` / `PDF is password protected`| Request errors
`Extra inputs are not permitted`| Request errors
-`API Error: 400 ... tools.N.custom.input_schema: JSON schema is invalid`| Request errors
+`API Error: 400 ... tools.N.custom.input_schema: JSON schema is invalid` / `Property keys should match pattern`| Request errors
`There's an issue with the selected model`| Request errors
`Model ... is not a recognized model id`| Request errors
+`Model ... not found`| Request errors
`Claude Opus is not available with the Claude Pro plan`| Request errors
`Claude Code ... does not support this model; version ... or newer is required`| Request errors
+`Claude Code ... is older than the minimum version required by your organization's policy`| Request errors
`Model ... is restricted by your organization's settings`| Request errors
+`Model switch ... blocked by a PreModelSwitch hook`| Request errors
+`couldn't save it as your default` / `couldn't confirm it was saved as your default`| Request errors
`thinking.type.enabled is not supported for this model`| Request errors
`Effort '<level>' isn't available with thinking turned off on this model`| Request errors
`effort '<level>' is not supported when thinking is disabled`| Request errors
@@ -131,20 +144,25 @@
`Error: Invalid --agents configuration:`| Command-line errors
`Error: Settings file exceeds the 2MiB limit`| Command-line errors
`The current directory no longer exists (it was deleted or moved)` / `Can't read the current directory`| Command-line errors
+`couldn't be resolved to a real location, so its skills, commands, and agents weren't loaded`| Command-line errors
`Error: Workspace not trusted` when starting Remote Control| Command-line errors
``<flag>` before `remote-control` is not carried over to the sessions Remote Control starts`| Command-line errors
``claude import` is not yet available in this build`| Command-line errors
`Could not read Claude Code config`| Command-line errors
`Could not import <server>: <reason>`| Command-line errors
+`Cannot add MCP server to scope: managed`| Command-line errors
`is Anthropic-hosted and doesn't support local OAuth`| Command-line errors
+`Can't read .mcp.json: it isn't a regular file or is larger than 2097152 bytes`| Command-line errors
`Server rejected the Authorization header minted by the configured headersHelper`| Command-line errors
`Error: MCP tool <name> (passed via --permission-prompt-tool) not found`| Command-line errors
+`OAuth callback port <port> is already in use — another process may be holding it`| 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
`Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found`| Command-line errors
`Input must be provided either through stdin or as a prompt argument when using --print`| Command-line errors
`Error: Input contained only whitespace`| Command-line errors
`Blank prompt — the message was only whitespace, so nothing was sent to the model.`| Command-line errors
+`Error: stream-json input carried over 256M characters with no newline`| Command-line errors
`Unknown command: /<name>`, with or without a `Did you mean` suggestion| Command-line errors
`Diff is too large for ultrareview` / `PR #<N> is too large for ultrareview`| Command-line errors
`Could not find merge-base with <branch>`| Command-line errors
@@ -165,6 +183,9 @@
`headersHelper for MCP server '<name>' references ${user_config.*}`| Plugin errors
`Plugin archive integrity check failed`| Plugin errors
`path escapes plugin directory`| Plugin errors
+`path could not be checked`| Plugin errors
+`its marketplace entry path does not stay inside the marketplace directory`| Plugin errors
+`Plugin source path refused`| Plugin errors
`Failed to load marketplace configuration`| Plugin errors
`Marketplace configuration file is corrupted`| Plugin errors
`would be spawned with zero tools — refusing`| Tool errors
@@ -185,6 +206,7 @@
`Refusing to search <path>: a path one of its Read deny rules is written through changed while the search was being prepared` / `Refusing to search <path>: it could not be opened`| Tool errors
`its permission check expired before it ran (too many concurrent file operations)` / `ripgrep was found only by name on PATH`| Tool errors
`task output swap refused (tasks dir moved or linked)`| Tool errors
+`Command killed: its output file was replaced or could no longer be verified`| Tool errors
`Can't open MCP settings while no terminal is attached to this background session`| Background session errors
`Can't open MCP settings in a background session`| Background session errors
`blocked because the path is spelled in a form that cannot be safely resolved`| Background session errors
@@ -193,6 +215,7 @@
`Can't open — this session is running in another terminal`| Background session errors
`This conversation is already open in another running Claude session`| Background session errors
`This session's saved conversation is no longer on disk`| Background session errors
+`kept <id> — <n> unpushed commits on <branch>`| Background session errors
`kept <id> — worktree has commits that are not pushed anywhere`| Background session errors
`terminal host process died — press Enter to restart` / `This session's terminal host process died`| Background session errors
`Session isn't responding` / `Press enter again to restart this session — it isn't responding`| Background session errors
@@ -202,6 +225,7 @@
`EUNKNOWN: unknown error, uv_spawn`| Background session errors
`EACCES: permission denied, posix_spawn`| Background session errors
`exited before it became reachable`| 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
`Could not locate the Claude CLI on PATH`| Wrapper and IDE errors
`Restored the code, but skipped N files`| Rewind warnings and errors
@@ -215,6 +239,7 @@
`Ignoring N permissions.allow entries from ... this workspace has not been trusted`| Configuration warnings
`is a network path, which cannot be added as a working directory`| Configuration warnings
`Remote managed settings failed to load (<cause>)`| Configuration warnings
+`Managed settings were not approved; exiting without applying them.`| Configuration warnings
`MCP server <name> is blocked by enterprise managed policy`| Configuration warnings
`Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.`| Configuration warnings
`Managed settings drop-in directory could not be read`| Configuration warnings
@@ -225,6 +250,7 @@
`... has a wildcard before the rest of the command`| Configuration warnings
`CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced`| Configuration warnings
`[claude-code:unrecognized_model]`| Configuration warnings
+`Stale sandbox mask files left by a killed session`| Configuration warnings
Responses seem lower quality than usual| Response quality
##
@@ -245,7 +271,7 @@
* A request rejected because the input plus `max_tokens` exceeds the context limit. Re-sending it unchanged would fail the same way, so Claude Code retries with a reduced `max_tokens`, and stops retrying and compacts instead in two cases:
* When no reduction can fit, for example when the conversation itself nearly fills the context window.
* When a retry can’t shrink `max_tokens` any further. Before v2.1.218, Claude Code could re-send a reduced request that still didn’t fit, such as when the extended thinking budget exceeded the remaining context, until the retry budget ran out.
- * An expired or missing Google Cloud credential on [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), which surfaces as an error such as `Could not load the default credentials`. Claude Code discards its cached credentials and retries up to two times, running your [`gcpAuthRefresh`](</docs/en/google-vertex-ai#advanced-credential-configuration>) command if you configured one, then reports the error so you can re-authenticate right away. [Google Cloud’s Agent Platform troubleshooting](</docs/en/google-vertex-ai#troubleshooting>) covers re-authenticating. Before v2.1.228, Claude Code retried a failing credential through the full retry budget before showing the error.
+ * An expired or missing Google Cloud credential on [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or AWS credentials that fail to load on your machine. Claude Code discards its cached credentials and retries up to two times, then reports the error so you can re-authenticate right away, as described under Could not load AWS or Google Cloud credentials. Before v2.1.228, Claude Code retried a failing Google Cloud credential through the full retry budget before showing the error.
* A `401` or `403` from the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>), while an [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) script supplies the credential. Claude Code re-runs the script and retries with its fresh output, within the full retry budget. When the script itself fails on the re-run, Claude Code shows Your apiKeyHelper script is failing instead.
Before v2.1.227, `Connection lost before a response was produced` read `Connection closed while thinking, before producing a response` and `The response stalled before a response was produced` read `Response stalled while thinking, before producing a response`. Claude Code doesn’t retry these failures:
@@ -533,7 +559,7 @@
Fable limit reached · continuing on Fable 5.1 uses usage credits, and the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
Fable 5.1 now uses usage credits · the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
-The messages name the session’s Fable model, so on Fable 5 they read `continuing on Fable 5` and `Fable 5 now uses usage credits`. Before v2.1.255, the first message began `Fable 5 limit reached`. This happens in [Remote Control](</docs/en/remote-control>) sessions, [background sessions](</docs/en/agent-view>), and [agent team](</docs/en/agent-teams>) teammate sessions. Claude Code shows the consent prompt only in the session’s own interactive view: the terminal where it runs, or, for a background session, the [agents view](</docs/en/agent-view>) once you attach. A Remote Control client can’t display it. Claude Code closes the prompt at the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, five minutes by default, or as soon as a new prompt arrives while nobody has typed at that terminal, such as a prompt sent from a Remote Control client. Typing at the terminal where the session runs cancels the deadline, and Claude Code waits for your answer. In a background session’s attached view, typing doesn’t cancel the deadline, and a new prompt still closes the consent prompt, so answer before either happens. Claude Code sends nothing and keeps your model, so when you send your next prompt, Claude Code shows the consent prompt again. **What to do:**
+The messages name the session’s Fable model, so on Fable 5 they read `continuing on Fable 5` and `Fable 5 now uses usage credits`. Before v2.1.257, the first message began `Fable 5 limit reached`. This happens in [Remote Control](</docs/en/remote-control>) sessions, [background sessions](</docs/en/agent-view>), and [agent team](</docs/en/agent-teams>) teammate sessions. Claude Code shows the consent prompt only in the session’s own interactive view: the terminal where it runs, or, for a background session, the [agents view](</docs/en/agent-view>) once you attach. A Remote Control client can’t display it. Claude Code closes the prompt at the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) deadline, five minutes by default, or as soon as a new prompt arrives while nobody has typed at that terminal, such as a prompt sent from a Remote Control client. Typing at the terminal where the session runs cancels the deadline, and Claude Code waits for your answer. In a background session’s attached view, typing doesn’t cancel the deadline, and a new prompt still closes the consent prompt, so answer before either happens. Claude Code sends nothing and keeps your model, so when you send your next prompt, Claude Code shows the consent prompt again. **What to do:**
* At the terminal where the session runs, send another prompt and answer the consent prompt when it reappears. For a background session, attach to it from the [agents view](</docs/en/agent-view>) first. Resending from a Remote Control client shows this message again, because the client can’t display the prompt.
* Run `/model` to switch to a model that doesn’t bill usage credits
@@ -698,7 +724,7 @@
Your apiKeyHelper script is failing · This usually means you need to re-authenticate with your provider · Run /status to see the script's error output
-Claude Code re-runs the script and retries the request up to two more times before showing this message, so the failure surfaces within three attempts. Before v2.1.208, Claude Code spent the full retry budget resending the request with the placeholder credential and then reported a generic `401` authentication error instead of the script failure. Running `/login` doesn’t help here: the helper’s output [takes precedence](</docs/en/authentication#authentication-precedence>) over a saved login for as long as the setting is present. **What to do:**
+In [non-interactive mode](</docs/en/headless>), stderr also carries the specific reason, prefixed with `apiKeyHelper failed:`. Claude Code re-runs the script and retries the request up to two more times before showing this message, so the failure surfaces within three attempts. Before v2.1.208, Claude Code spent the full retry budget resending the request with the placeholder credential and then reported a generic `401` authentication error instead of the script failure. Running `/login` doesn’t help here: the helper’s output [takes precedence](</docs/en/authentication#authentication-precedence>) over a saved login for as long as the setting is present. **What to do:**
* Run the command configured in `apiKeyHelper` directly in your shell to reproduce the failure
* If the command reports an expired session, re-authenticate with your credential provider, for example by signing in to your SSO or secrets vault again
@@ -924,7 +950,7 @@
**What to do:**
- * If `/status` shows an `API key` row, an approved [`ANTHROPIC_API_KEY`](</docs/en/authentication#authentication-precedence>) is the active credential and takes precedence over your login, so `/login` doesn’t replace it. Rotate the key in the Claude Console, or fall back to your subscription by running `unset ANTHROPIC_API_KEY`, or in PowerShell `Remove-Item Env:ANTHROPIC_API_KEY`.
+ * If `/status` shows an `API key` row that isn’t marked as not in use, an approved [`ANTHROPIC_API_KEY`](</docs/en/authentication#authentication-precedence>) is the active credential and takes precedence over your login, so `/login` doesn’t replace it. Rotate the key in the Claude Console, or fall back to your subscription by running `unset ANTHROPIC_API_KEY`, or in PowerShell `Remove-Item Env:ANTHROPIC_API_KEY`.
* If `/status` shows only your login, run `/login` once. If the credential was revoked, a fresh login replaces it.
* If the same message returns for the same login account, the account or organization is no longer active. Check the account and organization that `/status` reports, and ask your organization admin to restore access.
* If [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at an [LLM gateway](</docs/en/llm-gateway>), the text after `401` is your gateway’s message rather than Anthropic’s, and `/login` doesn’t change it. Fix the credential your gateway expects instead.
@@ -948,6 +974,30 @@
* Run `/login` to sign in again. Retrying without signing in shows the same message on every request.
* In non-interactive mode, run `claude` in the same environment, complete `/login`, then rerun your command. For automation that can’t sign in interactively, authenticate with `ANTHROPIC_API_KEY` or [generate a long-lived token with `claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>).
* If signing in keeps failing, see [Login and authentication](</docs/en/troubleshoot-install#login-and-authentication>)
+
+###
+
+
+
+Administrator policy requires a Cloud gateway sign-in
+
+An administrator’s [managed settings](</docs/en/managed-settings>) on this machine set [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) to `"gateway"` or set [`forceLoginGatewayUrl`](</docs/en/settings-reference#forcelogingatewayurl>). Unless you select a cloud provider through a variable such as `CLAUDE_CODE_USE_BEDROCK`, Claude Code then accepts only the [Claude apps gateway](</docs/en/claude-apps-gateway>) sign-in. You see one of two messages:
+
+ Not signed in to the Cloud gateway — run /login.
+
+Model requests fail with this message when the session has no gateway sign-in, for example because you haven’t run `/login` since the policy reached the machine. If you also have an `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` credential configured and the managed settings set `forceLoginMethod`, Claude Code exits at startup instead with a message that begins:
+
+ Administrator policy requires a Cloud gateway sign-in on this machine; the
+ Anthropic-issued credential configured here (ANTHROPIC_API_KEY,
+ ANTHROPIC_AUTH_TOKEN, or apiKeyHelper) is not used.
+
+**What to do:**
+
+ * Run `/login` and complete the sign-in on the **Cloud gateway** screen
+ * For the startup message, remove the `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` setting you configured, then start `claude` and run `/login`
+ * If you believe the machine shouldn’t require the gateway, ask the administrator who manages it to remove `forceLoginMethod` and `forceLoginGatewayUrl` from its managed settings
+
+On v2.1.265, a regression also showed the first message in some LLM-gateway and proxy configurations that authenticate with an API key, `apiKeyHelper`, or custom headers, even with no administrator requirement on the machine. Update to v2.1.266 or later. You don’t need to change your configuration. Before v2.1.261, on machines that set `forceLoginMethod` to `"gateway"`, Claude Code used a leftover saved login instead of failing model requests, and reported a configured environment credential with `This machine's managed settings require a first-party login` instead of the startup message. Before v2.1.265, a machine whose managed settings set only `forceLoginGatewayUrl` didn’t require the gateway sign-in, and Claude Code used a leftover credential there.
###
@@ -1073,17 +1123,72 @@
+Could not load AWS or Google Cloud credentials
+
+Claude Code couldn’t obtain usable credentials from the AWS credential provider chain or from your Google application default credentials on the machine it runs on, so no request reached your cloud provider. Claude Code clears its cached credentials and retries twice before showing this message. The detail after the `·` names the specific cause, such as an expired SSO session, missing application default credentials reported as `Could not load the default credentials`, or a revoked sign-in reported as `invalid_grant`:
+
+ API Error: Could not load AWS credentials · Could not load credentials from any providers. Check or refresh your AWS credentials and try again.
+ API Error: Could not load Google Cloud credentials · invalid_grant. Check or refresh your Google Cloud credentials and try again.
+
+In [non-interactive mode](</docs/en/headless>) with `-p` and in the [Agent SDK](</docs/en/agent-sdk/overview>), the structured error code is `cloud_credential_error`. Before v2.1.267, the message showed only the detail text after `API Error:`, and the structured code was `server_error` or `unknown`. **What to do:**
+
+ * Run your provider’s sign-in command, such as `aws sso login --profile myprofile` or `gcloud auth application-default login`, then retry. [Bedrock, Agent Platform, or Foundry credentials not loading](</docs/en/troubleshoot-install#bedrock-agent-platform-or-foundry-credentials-not-loading>) shows how to confirm the credentials outside Claude Code
+ * If the detail reads `AWS default-chain credential resolve timed out`, the chain hung rather than failed, so follow AWS default-chain credential resolve timed out instead
+
+###
+
+
+
AWS default-chain credential resolve timed out
-The AWS default credential provider chain didn’t produce credentials within 60 seconds, so Claude Code stopped the resolve and failed the request. The failure is local credential resolution: the request never reached [Amazon Bedrock](</docs/en/amazon-bedrock>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Claude Code clears its [credential cache](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>) and retries before this error surfaces, so by the time you see it the chain has stalled on repeated attempts.
-
- API Error: AWS default-chain credential resolve timed out
-
-Common causes are a `credential_process` command in your AWS profile that waits for input it can’t receive, and a container or VM whose instance metadata service (IMDS) never answers the chain’s probe. Before v2.1.207, a stalled chain left the request waiting indefinitely instead of failing with this message. **What to do:**
+The AWS default credential provider chain didn’t produce credentials within 60 seconds, so Claude Code stopped the resolve and failed the request. This timeout is one cause of Could not load AWS or Google Cloud credentials. The failure is local credential resolution: the request never reached [Amazon Bedrock](</docs/en/amazon-bedrock>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Claude Code clears its [credential cache](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>) and retries before this error surfaces, so by the time you see it the chain has stalled on repeated attempts.
+
+ API Error: Could not load AWS credentials · AWS default-chain credential resolve timed out. Check or refresh your AWS credentials and try again.
+
+Common causes are a `credential_process` command in your AWS profile that waits for input it can’t receive, and a container or VM whose instance metadata service (IMDS) never answers the chain’s probe. Before v2.1.267, the message read `API Error: AWS default-chain credential resolve timed out`. Before v2.1.207, a stalled chain left the request waiting indefinitely instead of failing. **What to do:**
* Run `aws sts get-caller-identity` in the same shell with the same `AWS_PROFILE`. If it also hangs, fix the profile; a `credential_process` command that prompts interactively is a common cause.
* Complete the sign-in step before starting Claude Code, for example `aws sso login --profile myprofile`, so the chain resolves from the local SSO cache instead of waiting on a browser flow
* If your chain runs an interactive sign-in that legitimately needs more than 60 seconds, such as SSO with MFA through a wrapper like `aws-vault`, raise the limit in milliseconds with [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](</docs/en/env-vars>)
+
+###
+
+
+
+Bedrock setup verification timed out waiting for AWS
+
+A call to AWS during the [Bedrock setup wizard](</docs/en/amazon-bedrock#sign-in-with-bedrock>)’s credential verification, such as the credential lookup or the identity check, didn’t finish within the 60-second limit. The wizard stops waiting and fails the verification step:
+
+ Timed out after 60s waiting for AWS. Check your network and proxy settings; if a credential helper needs longer to prompt you, raise CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS.
+
+The number reflects your limit: 60 seconds by default, or the value you set in [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](</docs/en/env-vars>). Common causes are a network or proxy that stalls requests to AWS, including the SSO token refresh, and a credential helper still waiting for input you can’t see. Raise the limit only when the helper legitimately needs more time. A single stalled request to AWS can also fail on its own per-request timeout, which shows a shorter message on the same step:
+
+ A request to AWS timed out. Check your network and proxy settings, then try again.
+
+When the same timeouts occur on the model pin step, the wizard marks a model as `unreachable` instead of showing either message. **What to do:**
+
+ * Run `aws sts get-caller-identity` in the same shell. If it also hangs, the stall is outside Claude Code, in your network, your proxy, or the credential helper in your AWS profile; fix that first.
+ * Complete any interactive sign-in before opening the wizard, for example `aws sso login --profile myprofile`
+ * If a credential helper in your AWS profile legitimately needs longer than 60 seconds to prompt you, raise the limit in milliseconds with [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](</docs/en/env-vars>)
+
+###
+
+
+
+Cloud gateway session expired
+
+You signed in through a [Claude apps gateway](</docs/en/claude-apps-gateway>), and the gateway session saved on this machine has expired and couldn’t be renewed, or the gateway no longer accepts it, for example after the gateway’s [JWT secret is replaced](</docs/en/claude-apps-gateway-deploy#jwt-secret-rotation>). If you see this line when you start `claude` interactively, the session has opened signed out of the gateway:
+
+ Cloud gateway session expired — run /login to reconnect.
+
+The same line can appear mid-session when the gateway credential expires and Claude Code can’t renew it. In a [non-interactive](</docs/en/headless>) run, a background or other unattended session, or a `claude` subcommand other than `claude auth`, Claude Code exits with this message instead when the gateway no longer accepts the session:
+
+ Cloud gateway <url> no longer accepts this session. Start `claude` and sign in again with /login.
+
+**What to do:**
+
+ * Run `/login` in the session and complete the browser sign-in
+ * For a non-interactive launch, start `claude` in the same environment, run `/login`, then rerun your command
##
@@ -1222,7 +1327,7 @@
SSL certificate error (UNABLE_TO_GET_ISSUER_CERT_LOCALLY). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run `claude doctor` for details.
-**What to do:**
+On [Amazon Bedrock](</docs/en/amazon-bedrock>), the requests Claude Code itself sends to AWS, such as the STS and SSO role-credential calls, model discovery, and the setup wizard’s checks, depend on the same certificate configuration. See [Certificate errors behind a TLS-inspecting proxy](</docs/en/amazon-bedrock#certificate-errors-behind-a-tls-inspecting-proxy>). **What to do:**
* Export your organization’s CA bundle and point Claude Code at it with `NODE_EXTRA_CA_CERTS=/path/to/ca-bundle.pem`
* See [Network configuration](</docs/en/network-config#custom-ca-certificates>) for full setup instructions
@@ -1527,8 +1632,9 @@
A tool in the request declared an `input_schema` that fails the API’s JSON Schema validation, so the API rejected the whole request. The number after `tools.` is the failing tool’s position in the request’s tool list, not a name you can look up.
API Error: 400 ... tools.N.custom.input_schema: JSON schema is invalid
-
-Claude Code [excludes MCP tools whose input schema would fail this validation](</docs/en/mcp#tools-with-invalid-input-schemas>) when it loads a server’s tools, so requests normally never include one. On a [deployment where flag fetching is off](</docs/en/env-vars#features-that-need-feature-flag-fetching>), or on a machine whose flags have never arrived, Claude Code records in the server’s log which tool would be rejected but sends it anyway, so this error can still occur. The error can also occur for a tool whose schema declares a JSON Schema dialect other than draft 2020-12 in `$schema`. Claude Code doesn’t check those schemas against the JSON Schema meta-schema, though the top-level property-name check still applies. Before v2.1.216, no deployment ran the exclusion checks. **What to do:**
+ API Error: 400 ... tools.N.custom.input_schema.properties: Property keys should match pattern '^[a-zA-Z0-9_.-]{1,64}$'
+
+The first form means the schema isn’t valid JSON Schema draft 2020-12. The second means a top-level property name doesn’t match the pattern the message quotes. Claude Code [excludes MCP tools whose input schema would fail this validation](</docs/en/mcp#tools-with-invalid-input-schemas>) when it loads a server’s tools, so requests normally never include one. On a [deployment where flag fetching is off](</docs/en/env-vars#features-that-need-feature-flag-fetching>), or on a machine whose flags have never arrived, Claude Code records in the server’s log which tool would be rejected but sends it anyway, so this error can still occur. The error can also occur for a tool whose schema declares a JSON Schema dialect other than draft 2020-12 in `$schema`. Claude Code doesn’t check those schemas against the JSON Schema meta-schema, though the top-level property-name check still applies. Before v2.1.216, no deployment ran the exclusion checks. **What to do:**
* If your Claude Code version is earlier than v2.1.216, run `claude update`.
* Remove or [disable](</docs/en/mcp#disable-a-server-without-removing-it>) the MCP server that declares the invalid schema. The error names the tool only by position. On v2.1.216 or later, check each server’s log for a line naming a tool whose input schema would be rejected. If no log names one, disable servers one at a time.
@@ -1565,7 +1671,7 @@
Model "claud-sonnet-5" is not a recognized model id. Did you mean 'claude-sonnet-5'?
-The trailing hint names the closest matching alias or model ID. When nothing is close enough, it reads `Run /model to see available models.` instead. Claude Code produces this error locally at the moment the switch is requested, before any API request is made. It applies when a model is set through the [Agent SDK](</docs/en/agent-sdk/typescript>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you. **What to do:**
+The trailing hint names the closest matching alias or model ID. When nothing is close enough, it reads `Run /model to see available models.` instead. Claude Code produces this error locally at the moment the switch is requested, before any API request is made. It applies when a model is set through the [Agent SDK](</docs/en/agent-sdk/typescript>) `setModel()` method, by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, or when you pick a model from a device connected through [Remote Control](</docs/en/remote-control>). Before v2.1.260, the check didn’t cover Remote Control picks, so Claude Code applied the pick and the next request failed with There’s an issue with the selected model. **What to do:**
* Run `/model` with no argument to open the picker and choose from the models available to your account, then pass the alias or ID shown there
* If you used an alias that a newer Claude Code version supports, run `claude update`. A full ID that starts with `claude-` passes this local check even when the model is newer than your Claude Code version. The server can still require a minimum version for that model; see Claude Code does not support this model.
@@ -1576,6 +1682,22 @@
+Model not found
+
+You picked a model with `/model <name>` and Claude Code couldn’t confirm that a model with that name exists. When the name isn’t a [model alias](</docs/en/model-config#model-aliases>) or another spelling Claude Code accepts locally, `/model` verifies it with a minimal API request, and this error is usually your API endpoint’s answer. A name that can’t be a model ID at all, such as one containing spaces, gets the same message.
+
+ Model 'claude-opus-9' not found
+
+On providers with provider-specific model IDs, the message may add a `Try '...' instead` suggestion that names your provider’s ID for a fallback model. **What to do:**
+
+ * Run `/model` with no argument and pick from the models available to your account, or use a [model alias](</docs/en/model-config#model-aliases>) such as `sonnet`, which resolves to a maintained default
+ * If you typed a full ID, check it against your provider’s model catalog. A newly launched model can be available on the Anthropic API before your provider or region offers it.
+ * Before v2.1.265, `/model` also rejected the `opusplan[1m]` alias spelling with this error. On those versions, update Claude Code, or set the model in [settings](</docs/en/model-config#setting-your-model>) or with `--model` instead.
+
+###
+
+
+
Claude Opus is not available with the Claude Pro plan
Your active subscription plan does not include the model you selected.
@@ -1594,14 +1716,19 @@
Claude Code does not support this model
-The model you selected requires a newer Claude Code version than the one making the request. The server checks this per model.
+The API refused the request with a 400 because your Claude Code version is below a required minimum. Either the model you selected requires a newer version, which the server checks per model, or your organization’s policy requires one. The 400 carries the error code `claude_code_version_too_old`, and the message says which minimum applies.
API Error: 400 Claude Code 2.1.219 does not support this model; version 2.1.255 or newer is required. Run 'claude update', or update the Claude desktop app, then try again.
-**What to do:**
-
- * Run `claude update`, or update the Claude desktop app, then start a new session on the model
- * To keep working in the current session, switch to another model with `/model`
+The organization-policy wording reads:
+
+ API Error: 400 Claude Code 2.1.240 is older than the minimum version required by your organization's policy. Run 'claude update', or update the Claude desktop app, to continue.
+
+**What to do:**
+
+ * Run `claude update`, or update the Claude desktop app, then start a new session
+ * For the per-model wording, you can keep working in the current session by switching to another model with `/model`
+ * For the organization-policy wording, update before you continue
###
@@ -1618,6 +1745,43 @@
* Run `/model` to pick from the models your organization allows. Restricted models are hidden from the picker.
* If the restricted model was set in `--model`, `ANTHROPIC_MODEL`, the `model` field of a settings file, or the `model` frontmatter of a [subagent](</docs/en/sub-agents#choose-a-model>), skill, or command, remove or update that value so the notice doesn’t recur
* If you need access to the restricted model, ask your organization admin to enable it. See [Organization model restrictions](</docs/en/model-config#organization-model-restrictions>).
+
+###
+
+
+
+Model switch was blocked by a PreModelSwitch hook
+
+A [PreModelSwitch hook](</docs/en/hooks#premodelswitch>) didn’t approve the model switch you or a client requested, so the session keeps its current model. When the switch came from an [Agent SDK](</docs/en/agent-sdk/overview>) host or [Remote Control](</docs/en/remote-control>) rather than a command you typed, the message reads `Model switch blocked by a PreModelSwitch hook` without naming the target model.
+
+ Model switch to Opus 4.6 was blocked by a PreModelSwitch hook: Opus 4.6 is retired for this project. Use a newer model.
+
+The reason after the colon says what refused the switch:
+
+ * **A reason a hook wrote** : a PreModelSwitch hook supplied that reason when it [denied the switch or asked for confirmation](</docs/en/hooks#premodelswitch-decision-control>). Address what it asks, or pick a model your hooks allow.
+ * **`PreModelSwitch hook<name> did not respond before its timeout`**: a hook that doesn’t answer before its [timeout](</docs/en/hooks#timeouts>) blocks the switch. Fix the hanging command or raise that hook’s `timeout`, then switch again.
+ * **`confirmation required, and this session cannot ask`** : a hook answered `ask` without a reason, and a control request has no way to show the confirmation prompt. A `/model` command in a [`-p` run](</docs/en/headless>) reports the same condition with `(run /model interactively to confirm)` after the reason. Make the switch from an interactive session, or change the hook’s decision for this model.
+ * **`so organization-managed PreModelSwitch hooks could not be checked`** : Claude Code couldn’t tell which PreModelSwitch hooks your organization’s [managed plugins](</docs/en/settings-reference#enabledplugins>) deliver, for example because a managed plugin failed to load. One of those hooks might block the switch, so Claude Code refuses rather than apply the switch unchecked. The start of the reason names what failed. Claude Code re-checks on every switch attempt, so a failure that has since cleared stops blocking; if it keeps failing, run `claude --debug` and switch again to capture the details, then fix the plugin or ask your admin to fix it.
+ * **`a PreModelSwitch hook failed before answering`** or **`PreModelSwitch hooks were cancelled (the control stream closed) before answering`** : the hook run ended without a verdict, and Claude Code doesn’t treat that as approval. Run `claude --debug` to see what failed, then switch again.
+
+Before v2.1.260, the managed-plugin refusal read `plugin hooks could not be loaded, so PreModelSwitch hooks could not be checked; see the debug log`. Claude Code retried the plugin load once and then refused later switches in the session, even when your organization managed no plugins. Restart the session to run the plugin load again on those versions.
+
+###
+
+
+
+Couldn’t save it as your default
+
+You picked a model to save as your default, for example with `/model <name>` or `Enter` in the `/model` picker, and Claude Code couldn’t write the pick to your user settings file, `~/.claude/settings.json`. The switch itself applied, so the current session runs on the model you picked, but your default is unchanged and the next session starts on the old value.
+
+ Set model to Fable 5.1 for this session only · couldn't save it as your default: ~/.claude/settings.json can't be written (EROFS)
+
+The reason after the file path says what failed:
+
+ * **`can't be written (<code>)`**: the write failed with the operating system error code in parentheses, such as `EROFS` when the file, or the file it links to, sits on a filesystem that refuses writes. Make the file writable and switch again. If another tool generates the file, set the `model` key in that tool instead; see [A change you made in Claude Code is lost in new sessions](</docs/en/settings#a-change-you-made-in-claude-code-is-lost-in-new-sessions>).
+ * **`isn't valid JSON`** : the file on disk doesn’t parse, and Claude Code leaves it untouched rather than overwrite content it can’t read back. Fix the syntax error, then switch again; see [Fix a broken settings file](</docs/en/settings#fix-a-broken-settings-file>).
+
+A notice ending `couldn't confirm it was saved as your default (~/.claude/settings.json is still being written)` means the write hadn’t finished after three seconds. It continues in the background, so the default may still be saved; check which model your next session starts on, or run `/model <name>` again. Before v2.1.265, the notice said the model was `saved as your default for new sessions` even when the write failed.
###
@@ -1874,11 +2038,29 @@
You started `claude` from a directory that was deleted or moved after your shell entered it, for example a worktree or temp directory another shell removed. Claude Code can’t read its working directory, so it exits with code 1 before starting the session, in interactive and [non-interactive](</docs/en/headless>) mode alike. Before v2.1.239, Claude Code crashed with minified bundle source and a raw `ENOENT ... uv_cwd` stack on stderr instead of this message.
The current directory no longer exists (it was deleted or moved). Start Claude Code from an existing directory.
-
-When Claude Code can’t read the working directory for a different reason, such as a permissions change, the message names the error code instead: `Can't read the current directory (EACCES). Start Claude Code from a different directory.` **What to do:**
+ error: The current working directory was deleted, so that command didn't work. Please cd into a different directory and try again.
+
+The cause and the fix are the same for both forms. When Claude Code can’t read the working directory for a different reason, such as a permissions change, the message names the error code instead: `Can't read the current directory (EACCES). Start Claude Code from a different directory.` **What to do:**
* Change to a directory that exists, such as your home or project directory, then run `claude` again
* If the directory was recreated at the same path, your shell still holds the deleted one. Run `cd "$PWD"` or leave and re-enter the directory, then run `claude` again
+
+###
+
+
+
+Directory couldn’t be resolved to a real location
+
+You ran `/add-dir` for a subdirectory of your working directory, and Claude Code couldn’t resolve the directory to its real location. You already have file access to a subdirectory of the working directory, so `/add-dir` only loads its skills, commands, and agents. Before loading them, Claude Code checks that the directory’s real location, with any symlinks resolved, is inside the working directory. When Claude Code can’t resolve that location, it loads nothing and shows this message:
+
+ packages/app couldn't be resolved to a real location, so its skills, commands, and agents weren't loaded. Check that it is a directory inside the working directory and try again.
+
+**What to do:**
+
+ * Check that the path names a real directory inside the working directory, then run `/add-dir` again
+ * The message doesn’t change your file access; it only reports that the directory’s `.claude/` content wasn’t loaded
+
+Before v2.1.261, this message also appeared for every `/add-dir <subdirectory>` when the working directory was on a `/net/<host>` automount, where Claude Code declines to resolve paths by design; the directory was fine and retrying couldn’t help.
###
@@ -1971,6 +2153,35 @@
+Cannot add MCP server to the managed scope
+
+You ran `claude mcp add` or `claude mcp add-json` with `--scope managed`. That scope holds the servers your organization provides through the [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) managed setting. Claude Code reads them from managed settings only, so the command can’t write a server to that scope.
+
+ Cannot add MCP server to scope: managed
+
+**What to do:**
+
+ * Add the server to a scope you can write: `local`, `user`, or `project`. Without `--scope`, the command uses `local`. See [MCP installation scopes](</docs/en/mcp#mcp-installation-scopes>)
+ * To provide the server to every user in your organization, add it to [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) in the managed settings you deploy
+
+###
+
+
+
+Can’t read .mcp.json
+
+A command that reads the project’s [`.mcp.json`](</docs/en/mcp#project-scope>), such as `claude mcp add` or `claude mcp add-json` with `--scope project`, or `claude mcp remove`, found that the file in your current directory isn’t a regular file or is larger than 2 MiB, so it exits with this error instead of reading the file.
+
+ Can't read .mcp.json: it isn't a regular file or is larger than 2097152 bytes. Fix or remove it, then run the command again.
+
+Before v2.1.257, a FIFO at `.mcp.json` left the command waiting forever with no output, and a symlink to a device file such as `/dev/zero` grew memory until the process was killed. **What to do:**
+
+ * Check what sits at `.mcp.json` in your current directory. Replace it with an ordinary JSON file in the [project-scope format](</docs/en/mcp#project-scope>), or delete it, then run the command again.
+
+###
+
+
+
Server is Anthropic-hosted and doesn’t support local OAuth
You started a sign-in for an MCP server whose URL points at an Anthropic-hosted connector host that authenticates through a third-party identity provider. These hosts include `microsoft365.mcp.claude.com`, `gmail.mcp.claude.com`, and `gcal.mcp.claude.com`. Claude Code refuses to start its local OAuth flow for these hosts from both the `/mcp` panel and `claude mcp login`, because [their sign-in works only through claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>).
@@ -2014,6 +2225,22 @@
* Check that the server starts and stays connected: run `claude mcp list` in the same directory and confirm the server is listed as connected
* Confirm the tool name matches the `mcp__<server>__<tool>` name the server exposes
* If the server needs longer than 30 seconds to start, raise [`MCP_TIMEOUT`](</docs/en/env-vars>)
+
+###
+
+
+
+OAuth callback port is already in use
+
+When you sign in to a remote MCP server with OAuth, Claude Code starts a local listener to receive the sign-in callback. If the port that listener needs is held by another process, the sign-in fails with this message. This mostly happens with a [fixed callback port](</docs/en/mcp#use-a-fixed-oauth-callback-port>) set through the [`MCP_OAUTH_CALLBACK_PORT`](</docs/en/env-vars>) variable or `--callback-port`, since without one Claude Code picks an available port.
+
+ OAuth callback port <port> is already in use — another process may be holding it. Run `lsof -ti:<port> -sTCP:LISTEN` to find it.
+
+On Windows, the suggested command is `netstat -ano | findstr :<port>` instead. **What to do:**
+
+ * Run the command from the message to find the process holding the port, and stop it or wait for it to finish
+ * If another program needs that port permanently, register a different redirect URI with the server and set its port with `MCP_OAUTH_CALLBACK_PORT` or `--callback-port`, whichever you use
+ * Then start the sign-in again, for example by selecting the server in `/mcp`
###
@@ -2073,6 +2300,21 @@
+stream-json input carried over 256M characters with no newline
+
+Your program sent more than 268,435,456 characters on stdin without a newline to a `claude -p --input-format stream-json` run, so Claude Code prints this error to stderr and exits with code 1 instead of buffering more input. The message states that budget as `256M`. Before v2.1.257, Claude Code buffered such input without limit, growing memory until the process crashed or was killed.
+
+ Error: stream-json input carried over 256M characters with no newline. Each stream-json message must be a single newline-terminated JSON line: either the producer is not newline-terminating its messages, or one message exceeded this budget.
+
+Input this long without a newline usually means the producer isn’t a stream-json producer at all, such as a binary file or plain log output piped in by accident. A single message over the budget fails the same check. **What to do:**
+
+ * Check what’s piped to stdin. With [`--input-format stream-json`](</docs/en/cli-reference#cli-flags>), every message must be one newline-terminated JSON line
+ * To send plain text instead, drop `--input-format stream-json`; `claude -p` reads a plain-text prompt from stdin by default
+
+###
+
+
+
Unknown command
You submitted a `/` name that doesn’t match any command in this session, so Claude Code reports the name instead of running anything:
@@ -2313,9 +2555,9 @@
Marketplace "claude-community" is registered from an untrusted source: The name 'claude-community' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/anthropics/' can use this name. To fix it, remove the marketplace and re-add it from the official source.
-**What to do:**
-
- * Run `claude plugin marketplace remove <name>`, then add the marketplace again from the official `github.com/anthropics` repository
+For a marketplace whose source isn’t a GitHub repository or a Git URL, such as a local directory, the middle sentence reads `can only be used with GitHub sources from the 'anthropics' organization` instead. `claude plugin marketplace add` runs the same check, and refuses a reserved name with `Failed to add marketplace:` followed by the same reserved-name sentence. **What to do:**
+
+ * If the marketplace is already registered, run `claude plugin marketplace remove <name>`, then add it again from the official `github.com/anthropics` repository
* If you publish a third-party marketplace that used the name before it became reserved, rename it and ask users to re-add it from your source
* See the reserved name list under [Marketplace schema](</docs/en/plugin-marketplaces#marketplace-schema>)
@@ -2377,11 +2619,71 @@
commands path escapes plugin directory: ./commands/deploy.md — it resolves to /home/user/shared/deploy.md, outside the plugin directory
+On macOS and Linux, Claude Code also rejects a component path that contains a backslash anywhere in it, even when the path stays inside the plugin. A plugin whose component paths use Windows-style separators loads on Windows and triggers this rejection on the other platforms:
+
+ commands path escapes plugin directory: ./commands\deploy.md — its path contains a backslash, which is not resolved reliably on this platform
+
Before v2.1.251, Claude Code loaded a `commands` path declared in a marketplace entry even when it pointed outside the plugin directory. Claude Code already rejected paths declared in `plugin.json` and the other component paths in a marketplace entry. Before v2.1.257, the check looked only at the path’s spelling, not at where a symlink leads. **What to do:**
* Move the referenced file inside the plugin directory and point the path at it with a `./` relative path
* If the path is a symlink to a file outside the plugin, replace the symlink with a copy of the file
+ * If the message says the path contains a backslash, write the path with forward slashes, for example `./commands/deploy.md`
* To share files with other plugins in the same marketplace, link them with a symlink inside the plugin directory, following the [symlink rules](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>)
+
+###
+
+
+
+Path could not be checked
+
+Claude Code asked the operating system whether a plugin path exists and got an error other than “not found”, so it doesn’t load what the path names. How much of the plugin loads depends on which path failed:
+
+ * One of a plugin’s [default component folders](</docs/en/plugins-reference#file-locations-reference>), such as `skills/` or `commands/`: the plugin’s other components still load
+ * The plugin’s own directory: nothing from that plugin loads
+
+You don’t see this error for a path that doesn’t exist at all. In `/plugin`, the error appears under the plugin and names the path and the code the operating system returned:
+
+ skills path could not be checked: /home/user/my-plugin/skills (ELOOP)
+
+In `claude plugin list`, the same error reads `Path not found: /home/user/my-plugin/skills (skills, ELOOP)`. Causes that produce this error include:
+
+ * `ELOOP`: a symlink in the path points at itself or forms a loop
+ * `EIO` or `ESTALE`: the path is on a network mount that is broken or stale
+ * `EACCES`: one of the directories above the path denies you permission to traverse it
+
+**What to do:**
+
+ * Replace a symlink that points at itself with a real folder, or delete it
+ * If the path is on a network mount, remount the share
+ * If the code is `EACCES`, restore your execute permission on the directories above the path
+ * Run `/reload-plugins` after fixing the path, or restart Claude Code, to load the plugin or component
+
+Before v2.1.265, Claude Code treated a default component folder it couldn’t check as absent and loaded the plugin without that component, with no error.
+
+###
+
+
+
+Marketplace entry path does not stay inside the marketplace directory
+
+The plugin’s [marketplace entry](</docs/en/plugin-marketplaces#plugin-entries>) declares a source path that Claude Code can’t resolve to a location inside the marketplace’s own directory, so the plugin doesn’t install or load. The refusal covers:
+
+ * An entry path that is absolute, climbs out of the marketplace with `..`, or is spelled like a network path
+ * An entry in a marketplace fetched from a remote source, such as git or a URL, that reaches its target through a symlink resolving outside the marketplace directory
+ * A relative entry in a marketplace added from a direct URL to its `marketplace.json`: Claude Code downloads only that file, so no local plugin files exist for the path to name. See [Plugins with relative paths fail in URL-based marketplaces](</docs/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces>)
+
+`claude plugin install` reports the refusal like this:
+
+ Cannot install my-plugin@my-marketplace: its marketplace entry path does not stay inside the marketplace directory (an absolute, climbing, network-shaped or link-traversing entry, an entry of a fetched marketplace that resolves outside its tree — or a relative entry in a url-catalog marketplace, which has no local directory)
+
+When an already-installed plugin’s entry fails the same check, `claude plugin list` shows the plugin as `failed to load` with:
+
+ Plugin source path refused: ./my-plugin does not stay inside its marketplace directory. Check that the marketplace entry has a plain relative path.
+
+**What to do:**
+
+ * If you maintain the marketplace, write the entry’s `source` as a plain relative path such as `./plugins/my-plugin`, and keep any symlink it crosses pointed inside the marketplace directory
+ * If you added the marketplace from a direct URL, relative entries can’t resolve. Ask the marketplace author to use [another plugin source](</docs/en/plugin-marketplaces#plugin-sources>), or add the marketplace from its git repository instead
###
@@ -2609,6 +2911,7 @@
* Usually nothing: the refusal reaches Claude as the tool result, and the refused operation doesn’t run
* If a symlink refusal repeats on one path, find what keeps rewriting a link there, such as a build tool or file watcher, or ask Claude to use the file’s resolved path instead of the linked one
+ * If this refusal appears for every file while Claude Code runs on Windows inside an AppContainer or restricted-token sandbox, upgrade to v2.1.265 or later
* For the ripgrep refusal, install ripgrep with your package manager so `rg` resolves to an absolute path on `PATH`, or keep searches under the working directory
Before v2.1.251, Claude Code re-checked a path’s resolution only for file writes, so a link replaced after the permission check could redirect a read or search to a different location without a message. Of these refusals, only the parent-directory write refusal appears on earlier versions.
@@ -2619,15 +2922,20 @@
Task output swap refused
-Claude Code saves each Bash command’s output to a file under its temp directory. This message means a directory on that file’s path is a symbolic link or has been moved, so Claude Code refused to run the command rather than write its output through that path. The message appears in the Bash tool result:
+Claude Code saves each Bash command’s output to a file under its temp directory. Every time it opens one of these files, it checks that the path still leads to the file it created, with no symbolic link, extra hard link, or moved directory redirecting it. This message means that check failed, so Claude Code refused the operation rather than write or read output through that path. The message appears in the Bash tool result:
task output swap refused (tasks dir moved or linked): /private/tmp/claude-501/-Users-you-my-project/1f0e62dc-4b0a-4f5e-9c2d-8a7b6c5d4e3f/tasks/b7k2f9m3q.output. To recover: restart Claude Code with CLAUDE_CODE_TMPDIR set to a fresh directory; or, if /private/tmp/claude-501/-Users-you-my-project is a stray directory or a symbolic link that should not be there, remove that entry itself (not what it points to) and restart.
+
+The parenthesized text names the check that failed. Reasons such as `output symlink was re-pointed`, `output file identity changed`, and `not a regular file` all report the same condition: something at or along the output path is no longer the file Claude Code created. Only some reasons carry a `To recover:` sentence. If the check fails while a command is still running, Claude Code stops the command, and its result reports:
+
+ Command killed: its output file was replaced or could no longer be verified
**What to do:**
* Upgrade to v2.1.260 or later. Earlier versions sometimes showed this message when no link or moved directory was present
* Restart Claude Code with [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) set to a fresh directory
* Or check your project’s directory under the Claude Code temp directory, `/private/tmp/claude-501/-Users-you-my-project` in the example message. If that path is a symbolic link, or a directory that shouldn’t be there, remove the link or directory itself rather than the link’s target, and restart Claude Code
+ * If the refusal repeats, a process is replacing, linking, or removing entries under Claude Code’s temp directory while the session runs. Set [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) to a directory nothing else manages and restart
##
@@ -2741,18 +3049,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. `claude rm` prints the kept path and the reason:
-
- kept 7c5dcf5d — worktree has commits that are not pushed anywhere
- worktree kept at /home/you/project/.claude/worktrees/fix-login
- resolve that (commit/push, or remove the worktree), then run 'claude rm 7c5dcf5d' again
-
-When you delete from [agent view](</docs/en/agent-view>) with a `Ctrl+X` double-press, you consent to discarding uncommitted changes, but not to discarding commits, so Claude Code refuses there too. After a refused delete, 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:**
-
- * Push the worktree’s branch, or merge it into the default branch checked out in your main checkout, then delete the session again
- * To delete the session without pushing or merging the commits, first note the branch that `git worktree list` shows for the path the message names. Remove the worktree yourself with `git worktree remove --force <path>`, as described in [Clean up subagent and background-session worktrees](</docs/en/worktrees#clean-up-subagent-and-background-session-worktrees>), then run `claude rm <id>` again. Neither step deletes that branch, so the commits stay on it until you run `git branch -D <branch>`.
-
-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.
+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:
+
+ kept 7c5dcf5d — 2 unpushed commits on claude/fix-login (a1b2c3d Fix login flow, … and 1 more)
+ worktree: /home/you/project/.claude/worktrees/fix-login
+ push them, or discard the worktree and its commits: claude rm 7c5dcf5d --discard-unpushed a1b2c3d000000000000000000000000000000000@0123456789abcdef0123456789abcdef
+
+When Claude Code can’t summarize the commits, the message reads `worktree has commits that are not pushed anywhere` 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 worktree has gained a commit since the refusal, Claude Code keeps it again and shows the updated state
+ * 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.260, the message didn’t name the branch or the commits, and deleting again was refused the same way: deleting the session without pushing meant removing the worktree yourself with `git worktree remove --force <path>`, then running `claude rm <id>` again. 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.
###
@@ -2817,7 +3126,7 @@
Session agent no longer available
-You resumed a session that was running a [custom agent](</docs/en/sub-agents#invoke-subagents-explicitly>), started with `--agent` or the `agent` setting, and Claude Code didn’t find an agent by that name. It searches the session’s original directory first, when you have [trusted that workspace](</docs/en/permissions#project-allow-rules-and-workspace-trust>), then the directory you resume from. The session still resumes, but with the default tools and system prompt, so the agent’s tool restrictions no longer apply:
+You resumed a session that was running a [custom agent](</docs/en/sub-agents#invoke-subagents-explicitly>), started with `--agent` or the `agent` setting, and Claude Code didn’t find an agent by that name. It searches the session’s original directory first, when you have [trusted that workspace](</docs/en/permissions#project-allow-rules-and-workspace-trust>), then the directory you resume from. The session still resumes, but with the default tools, so the agent’s tool restrictions no longer apply:
This session was running agent 'code-reviewer', which is no longer available (no agent by that name in /home/you/project). Continuing with the default tools and system prompt — the agent's tool restrictions no longer apply. To restore it, re-create the agent, or resume with an explicit --agent <name>.
@@ -2870,9 +3179,13 @@
Couldn't start the background service — spawn background service: EACCES: permission denied, posix_spawn '/usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude'
-When you start a session with `/background` or `claude --bg`, the same reason appears inside `Couldn't reach the background service (...)`. During the same reinstall window the error can name another code instead, such as `ENOENT` or `ENOEXEC`, or `EUNKNOWN` or `EPERM` on Windows; an `EUNKNOWN` that persists across retries has a different cause. On an npm installation, Claude Code waits up to ten seconds for the reinstall to finish and retries on its own, so you see the error only when the binary stays unrunnable for longer, such as while npm is still downloading the package. Before v2.1.246, Claude Code failed at once. **What to do:**
-
- * Wait a few seconds, then open the session or dispatch again.
+When you start a session with `/background` or `claude --bg`, the same reason appears inside `Couldn't reach the background service (...)`. During the same reinstall window the error can name another code instead, such as `ENOENT` or `ENOEXEC`, or `EUNKNOWN` or `EPERM` on Windows; an `EUNKNOWN` that persists across retries has a different cause. On an npm installation, Claude Code waits for the reinstall to finish and retries on its own: up to ten seconds, and up to two minutes while an npm install of Claude Code is visibly still running on the machine, which covers another Claude Code process downloading an update. When the install outlasts that wait, the failure names the update instead of the bare error code:
+
+ Claude Code is being updated by npm on this machine (still not runnable after 2 min, EACCES) — try again when the update finishes
+
+Before v2.1.257, the wait stopped at ten seconds in every case, so this error appeared while another Claude Code process was still downloading an update. Before v2.1.246, Claude Code failed at once, without waiting. **What to do:**
+
+ * Wait a few seconds, then open the session or dispatch again. When the message says Claude Code is being updated, retry after the update finishes.
* If the error persists while no npm install is running, your user can’t run the installed binary. Check its permissions and its directory’s, or reinstall Claude Code.
###
@@ -2885,7 +3198,12 @@
Couldn't reach the background service (background service exited before it became reachable (exit code N): <the service's first error line>) — run 'claude daemon status'
-When you open a session from [agent view](</docs/en/agent-view>), the same reason follows `Couldn't start the background service —`. When the service printed nothing before exiting, the message says `nothing on stderr` instead. Claude Code reports the failure with the service’s error line. Before v2.1.246, the failure surfaced only after a 45-second wait, as `background service did not become reachable within 45s`, without the service’s error line. **What to do:**
+When you open a session from [agent view](</docs/en/agent-view>), the same reason follows `Couldn't start the background service —`. When the service printed nothing before exiting, the message says `nothing on stderr` instead. Claude Code reports the failure with the service’s error line. Before v2.1.246, the failure surfaced only after a 45-second wait, as `background service did not become reachable within 45s`, without the service’s error line. Two quoted reasons have known causes:
+
+ * `Error: claude native binary not installed.`: an npm install was replacing the Claude Code binary at that moment, so the service ran npm’s placeholder instead. Retry after the install finishes; if the line persists with no install running, [complete the npm install](</docs/en/troubleshoot-install#native-binary-not-found-after-npm-install>). Before v2.1.257, a macOS npm self-update produced this failure on every start during the install window.
+ * `nothing on stderr` with exit code 1, on every start, on Windows: `daemon.lock` names a process that Claude Code can neither signal nor prove is gone, so each new service concludes another one holds the lock and exits. A lock whose writer Claude Code can prove is gone is replaced on its own and doesn’t produce this failure. When the failure repeats on every start, delete `~/.claude/daemon.lock`, then open the session or dispatch again. Before v2.1.257, such a lock blocked every start until you deleted the file.
+
+**What to do:**
* If the message quotes a line, fix what it names, then open the session or dispatch again. The next attempt starts the service again
* Run `claude daemon status` to check whether a service is running now
@@ -3156,6 +3474,21 @@
* Run `/status` or `claude doctor` for the full diagnostic
Before v2.1.248, Claude Code reported a failed settings fetch only in the debug log.
+
+###
+
+
+
+Managed settings were not approved
+
+Your organization’s [server-managed settings](</docs/en/server-managed-settings>) include settings that need your approval, and you declined the [security approval dialog](</docs/en/server-managed-settings#security-approval-dialogs>), so Claude Code exits without applying them:
+
+ Managed settings were not approved; exiting without applying them.
+
+**What to do:**
+
+ * Start Claude Code again and approve the dialog to continue under your organization’s settings. A declined dialog isn’t remembered, so it appears again at the next start.
+ * If you’re unsure about a setting the dialog lists, ask whoever maintains your organization’s managed settings before approving
###
@@ -3350,6 +3683,24 @@
Before v2.1.233, Claude Code wrote no line when it sent a request for a model ID it didn’t recognize.
+###
+
+
+
+Stale sandbox mask files left by a killed session
+
+`claude doctor` prints this warning in its diagnostics, and `/status` lists the same line. It appears on Linux and WSL2 when [sandboxing](</docs/en/sandboxing>) is enabled with filesystem isolation on. While a sandboxed command runs, the sandbox holds a write denial on a file that doesn’t exist yet by creating a 0-byte read-only placeholder there, and removes it afterward. A session killed before that cleanup runs, for example by SIGKILL, leaves the placeholders behind. Later sessions bind them read-only again on every start, so a settings write such as saving “Yes, and don’t ask again” fails where one sits.
+
+ - Stale sandbox mask files left by a killed session: /home/you/project/.claude/settings.local.json
+ Fix: Remove each with `rm <path>` while no other Claude Code session is running in that project — a 0-byte read-only file where a settings file belongs makes "Yes, and don't ask again" fail to save, and the sandbox binds it read-only again on every start
+
+**What to do:**
+
+ * Quit any other Claude Code session running in that project, then delete each listed file with `rm`. The warning names up to three files and counts the rest, so rerun `claude doctor` after deleting until the warning no longer appears. A placeholder that another session’s sandbox is still using is a live part of that session’s write protection
+ * If a permission choice you saved with “Yes, and don’t ask again” didn’t stick, save it again after deleting the placeholder
+
+Before v2.1.257, `claude doctor` didn’t flag these files; earlier versions leave the same placeholders behind when a session is killed.
+
##
--- a/fullscreen.md
+++ b/fullscreen.md
@@ -85,6 +85,7 @@
* **Click an option in a select menu** to choose it. This covers permission prompts, `/model`, `/config`, and other dialogs that show a list of options. Hovering shows a pointer on the row under your cursor. Requires Claude Code v2.1.187 or later.
* **Click an option in a multi-select menu** to toggle it, and click the submit button to confirm your choices. Clicking a free-text row, such as the `Other` row in a multiple-choice question, focuses its input field so you can type an answer. Requires Claude Code v2.1.208 or later.
* **Click a collapsed tool result** to expand it and see the full output. Click again to collapse. The tool call and its result expand together. Only messages that have more to show are clickable.
+ * Clicking also expands the output of a `!` shell command, whether an older truncated result or the live progress row while the command runs. Requires Claude Code v2.1.257 or later.
* **Hold`Cmd` on macOS, or `Ctrl` on Linux and Windows, and click a URL or file path** to open it. Plain `http://` and `https://` URLs open in your browser, and file paths in tool output, like the ones printed after an Edit or Write, open in your default application. A plain click without the modifier doesn’t open links, matching native terminal behavior.
* Claude Code renders a network (UNC) path, such as `\\server\share\file.ts`, as plain text with no link, because opening a network path can send your Windows credentials to the host it names.
* Some macOS terminals forward `Cmd`+click to the running app instead of opening the link themselves, and the terminal mouse protocol has no way to encode the `Cmd` key, so Claude Code receives a plain click. In Ghostty, and in Warp on macOS, Claude Code detects this and lets a plain click on a link open it, and holding `Cmd` still works.
--- a/github-actions.md
+++ b/github-actions.md
@@ -24,7 +24,7 @@
Quick setup
-Before you start, install the [GitHub CLI](<https://cli.github.com>) and authenticate it with `gh auth login`. Claude Code checks for it and warns you if it’s missing. Open `claude` in the repository you want to connect, run `/install-github-app`, and follow the prompts. Claude Code installs the Claude GitHub App, then sets up an authentication secret for the workflows:
+`/install-github-app` works only with github.com repositories. If your repository’s git remote is on gitlab.com or bitbucket.org, the command prints a notice and exits instead of starting setup. To run Claude Code from GitLab pipelines, see [Claude Code GitLab CI/CD](</docs/en/gitlab-ci-cd>). Before you start, install the [GitHub CLI](<https://cli.github.com>) and authenticate it with `gh auth login`. Claude Code checks for it and warns you if it’s missing. Open `claude` in the repository you want to connect, run `/install-github-app`, and follow the prompts. Claude Code installs the Claude GitHub App, then sets up an authentication secret for the workflows:
* If Claude Code already has an API key, it reuses that key, and offers to keep the repository’s existing `ANTHROPIC_API_KEY` secret if one is already set
* Otherwise, choose between creating a long-lived token with your Claude subscription and pasting in an API key
--- a/glossary.md
+++ b/glossary.md
@@ -180,7 +180,7 @@
Effort level
-A setting that controls how much of the adaptive-reasoning thinking budget Claude uses on each turn. Higher effort means more thinking tokens and deeper reasoning; lower effort is faster and cheaper. Effort is supported on Fable 5.1 and Fable 5, on Opus 4.6 and later, and on Sonnet 4.6 and later. Learn more: [Adjust effort level](</docs/en/model-config#adjust-effort-level>)
+A setting that controls adaptive reasoning, which lets the model decide whether and how much to think on each step. Higher effort means more thinking tokens and deeper reasoning; lower effort is faster and cheaper. Effort is supported on Fable models, on Opus 4.6 and later, and on Sonnet 4.6 and later. Learn more: [Adjust effort level](</docs/en/model-config#adjust-effort-level>)
###
@@ -274,7 +274,7 @@
Output style
-A configuration that modifies Claude’s system prompt to change response behavior, tone, or format. Unlike CLAUDE.md, which Claude Code delivers as a user message after the system prompt, an output style changes the system prompt itself. Learn more: [Output styles](</docs/en/output-styles>)
+A configuration that changes the instructions Claude Code gives Claude, to set response behavior, tone, or format. Unlike CLAUDE.md, which adds project context alongside Claude Code’s default instructions, a custom output style can replace the default software engineering instructions. Learn more: [Output styles](</docs/en/output-styles>)
##
--- a/goal.md
+++ b/goal.md
@@ -95,7 +95,7 @@
Resume with an active goal
-When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID or name, and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
+When you resume a session, Claude Code restores a goal that was still active when the session ended. Claude Code restores it on every resume route: `--continue`, `--resume` with a session ID, name, or [transcript file path](</docs/en/sessions#resume-a-session>), and the [session picker](</docs/en/sessions#use-the-session-picker>). Before v2.1.239, Claude Code restored the goal on every route except the `claude --resume` picker. Claude Code carries the condition over but resets the turn count, timer, and token-spend baseline. It doesn’t restore a goal that was already achieved or cleared.
###
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -95,7 +95,7 @@
Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file.
-Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Google Cloud’s Agent Platform requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account.
+Claude Code addresses Google Cloud’s Agent Platform requests to the project in `ANTHROPIC_VERTEX_PROJECT_ID`, even when `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` carries a different project.
####
@@ -112,7 +112,7 @@
}
}
-Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted.
+Before running the command, Claude Code requests an access token with your current credentials to confirm they’re actually expired, and skips the command when they still work. If the check doesn’t finish within five seconds, Claude Code also skips the command and runs it only after a request fails with a credential error. Before v2.1.261, a check that timed out counted as an expired credential, so the command could open your browser at startup even though your credentials were still valid. Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted.
###
--- a/headless.md
+++ b/headless.md
@@ -163,7 +163,12 @@
Follow subagent messages
-Messages from [subagents](</docs/en/sub-agents>) appear in the stream as `assistant` and `user` messages whose `parent_tool_use_id` field is the ID of the tool call that spawned the subagent. Messages from the main conversation carry `null` in that field. By default, Claude Code emits only subagent `tool_use` and `tool_result` blocks. Pass [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) or set [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) to also emit subagent text and thinking blocks, so you can reconstruct each subagent’s transcript. This requires Claude Code v2.1.211 or later. When you enable either option, Claude Code forwards messages from [subagents at every nesting depth](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>): when a subagent spawns its own subagent, the nested subagent’s messages carry the ID of the Agent tool call that spawned it in `parent_tool_use_id`, so you can rebuild the full nesting tree by following those IDs. Before v2.1.219, messages from nested subagents didn’t appear in the stream.
+Messages from [subagents](</docs/en/sub-agents>) appear in the stream as `assistant` and `user` messages whose `parent_tool_use_id` field is the ID of the tool call that spawned the subagent. Messages from the main conversation carry `null` in that field. The first message from a subagent running in the [foreground](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) is a `user` message carrying the prompt that drives it. After that first message, Claude Code emits:
+
+ * **By default** : the subagent’s `tool_use` and `tool_result` blocks.
+ * **With[`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) or [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>)**: the subagent’s text and thinking blocks too, so you can reconstruct each subagent’s transcript. This requires Claude Code v2.1.211 or later.
+
+When you enable either option, Claude Code forwards messages from [subagents at every nesting depth](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>): when a subagent spawns its own subagent, the nested subagent’s messages carry the ID of the Agent tool call that spawned it in `parent_tool_use_id`, so you can rebuild the full nesting tree by following those IDs. Before v2.1.219, messages from nested subagents didn’t appear in the stream. Skills that [run in a subagent](</docs/en/skills#run-skills-in-a-subagent>) appear in the stream the same way: the forked skill’s first message is a `user` message carrying the skill content that drives the run. If you enable either option, the stream also carries the forked skill’s text and thinking blocks. Before v2.1.265, only a forked skill’s `tool_use` and `tool_result` blocks appeared in the stream.
####
@@ -178,11 +183,11 @@
`type`| `"system"`| message type
`subtype`| `"api_retry"`| identifies this as a retry event
`attempt`| integer| current attempt number, starting at 1
-`max_retries`| integer| total retries permitted
+`max_retries`| integer| total retries permitted for this failure’s cause, which can be fewer than the session-wide budget
`retry_delay_ms`| integer| milliseconds until the next attempt
-`error_status`| integer or null| HTTP status code, or `null` for connection errors with no HTTP response
+`error_status`| integer or null| HTTP status code of the failed attempt, or `null` when the attempt got no HTTP response from the API
`no_response`| object, optional| present only when the failed attempt got [no response headers in time](</docs/en/errors#no-response-from-api>). `waited_ms` is how long that attempt waited and `retry_wait_ms` is how long the retry will wait. In these events, `max_retries` reflects the one retry this cause normally gets, not the session-wide budget. Requires Claude Code v2.1.261 or later
-`error`| string| error category: `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `rate_limit`, `overloaded`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, or `unknown`
+`error`| string| error category: `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`
`uuid`| string| unique event identifier
`session_id`| string| session the event belongs to
@@ -309,7 +314,7 @@
Continue conversations
-Use `--continue` to continue the most recent conversation, or `--resume` with a session ID to continue a specific conversation. `--continue` skips [background sessions](</docs/en/sessions#resume-a-session>). This example runs a review, then sends follow-up prompts:
+Use `--continue` to continue the most recent conversation, or `--resume` with a session ID to continue a specific conversation. On Claude Code v2.1.257 or later, when you pass `--continue`, Claude Code opens a [background session](</docs/en/sessions#resume-a-session>) that has finished, but not one that is still running. This example runs a review, then sends follow-up prompts:
# First request
claude -p "Review this codebase for performance issues"
@@ -323,7 +328,7 @@
session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')
claude -p "Continue that review" --resume "$session_id"
-You can run the two commands from different directories: Claude Code [finds the session by its ID](</docs/en/sessions#resume-a-session>) in any project on this machine. Before v2.1.223, Claude Code looked for the ID only in the current project directory and its git worktrees, so you had to run both commands from the same directory.
+You can run the two commands from different directories: Claude Code [finds the session by its ID](</docs/en/sessions#resume-a-session>) in any project on this machine. Before v2.1.223, Claude Code looked for the ID only in the current project directory and its git worktrees, so you had to run both commands from the same directory. In place of the session ID, you can pass `--resume` the absolute path to a session’s `.jsonl` [transcript file](</docs/en/sessions#where-transcripts-are-stored>), and Claude Code continues the conversation stored in that file.
##
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -645,7 +645,7 @@
`SubagentStop`| agent type| same values as `SubagentStart`
`ConfigChange`| configuration source| `user_settings`, `project_settings`, `local_settings`, `policy_settings`, `skills`
`DirectoryAdded`| how the directory was added| `slash_command`, `register_repo_root`
-`StopFailure`| error type| `rate_limit`, `overloaded`, `authentication_failed`, `oauth_org_not_allowed`, `account_on_hold`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, `unknown`
+`StopFailure`| error type| `rate_limit`, `overloaded`, `authentication_failed`, `oauth_org_not_allowed`, `account_on_hold`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, `cloud_credential_error`, `unknown`
`InstructionsLoaded`| load reason| `session_start`, `nested_traversal`, `path_glob_match`, `include`, `compact`
`Elicitation`| MCP server name| your configured MCP server names
`ElicitationResult`| MCP server name| same values as `Elicitation`
--- a/interactive-mode.md
+++ b/interactive-mode.md
@@ -137,6 +137,19 @@
Type `/` in Claude Code to see the commands available to you, or type `/` followed by any letters to filter. The `/` menu lists built-in commands, bundled and user-authored [skills](</docs/en/skills>), and commands contributed by [plugins](</docs/en/plugins>) and [MCP servers](</docs/en/mcp#use-mcp-prompts-as-commands>). Not all built-in commands are visible to every user since some depend on your platform or plan, and [a few available commands are hidden from the menu by design](</docs/en/commands#how-the-command-menu-matches-what-you-type>) and run when you type their full name. In [fullscreen rendering](</docs/en/fullscreen#use-the-mouse>), the `/` command and `@` file suggestion lists also respond to the mouse: hovering highlights a row and clicking accepts it. See the [commands reference](</docs/en/commands>) for the full list of commands included in Claude Code.
+###
+
+
+
+Complete a command mid-prompt
+
+Command completion also works partway through a prompt: type `/` after a space, then the first letters of a name, as in `run the tests, then /com`. Only commands whose names start with those letters match, so a file path such as `/tmp/notes.md` doesn’t keep a list open. Claude Code runs a command itself only when the command [starts your message](</docs/en/commands>).
+
+ * **In[fullscreen rendering](</docs/en/fullscreen>)**: the matches open as a list while you type, with no row highlighted, so `Enter` still sends your prompt as typed. Press `Tab` to insert the top match, or pick a row with the arrow keys and `Enter`.
+ * **Outside fullscreen** : the rest of the top match appears as ghost text at your cursor, with a count such as `+2` when more commands match. Press `Tab` to insert the only match, or to open the list when several match, then pick a row with the arrow keys and `Enter`.
+
+In both renderers, press `Tab` on a bare mid-prompt `/` to list every command. A plugin skill matches on its bare name too, so `/deploy` finds a skill named `myplugin:deploy-app`. When you insert the match, Claude Code writes the full `/myplugin:deploy-app`.
+
##
@@ -337,7 +350,8 @@
* Background tasks are automatically cleaned up when Claude Code exits. On macOS and Linux, when you stop a background task from [`/tasks`](</docs/en/commands>) or Claude Code stops it at exit, processes that detached from the task’s shell, such as ones started under `setsid` or `timeout`, stop too
* If you background the session instead of exiting it, your background tasks keep running in the background session. See [background a running session](</docs/en/agent-view#from-inside-a-session>)
* Background tasks are automatically terminated if output exceeds 5GB, with a note in stderr explaining why
- * On macOS and Linux, Claude Code terminates running background tasks when the operating system signals memory pressure, provided the session has been idle for at least 30 minutes and no turn or subagent is running. Set [`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`](</docs/en/env-vars>) to `1` to turn this off. Requires Claude Code v2.1.193 or later. Background commands owned by a [subagent](</docs/en/sub-agents>) are instead terminated after 60 minutes, configurable in milliseconds with [`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`](</docs/en/env-vars>). A command owned by a subagent running in the foreground also ends when that subagent gives its final response; see [Background commands](</docs/en/tools-reference#background-commands>) in the tools reference. Before v2.1.218, neither the memory-pressure reap nor the 60-minute limit covered commands moved to the background with `Ctrl+B`
+ * On macOS and Linux, Claude Code terminates running background tasks when the operating system signals memory pressure, provided the session has been idle for at least 30 minutes and no turn or subagent is running. Set [`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`](</docs/en/env-vars>) to `1` to turn this off. Requires Claude Code v2.1.193 or later
+ * Background commands owned by a [subagent](</docs/en/sub-agents>) have no time limit, except that a command owned by a subagent running in the foreground ends when that subagent gives its final response; see [Background commands](</docs/en/tools-reference#background-commands>) in the tools reference. Before v2.1.218, neither the memory-pressure reap nor the former 60-minute limit on subagent commands covered commands moved to the background with `Ctrl+B`
To disable all background task functionality, set the `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` environment variable to `1`. See [Environment variables](</docs/en/env-vars>) for details. **Common backgrounded commands:**
@@ -569,7 +583,7 @@
Review changes with /diff
-Run `/diff` to look over the changes in your working tree without leaving Claude Code. You see the edits Claude has made so far alongside anything else you haven’t committed. In [fullscreen rendering](</docs/en/fullscreen>), `/diff` opens the diff panel beside the conversation, which stays open and updates while you keep working. In the classic renderer, `/diff` opens the diff viewer in place of the prompt, and you close it when you’re done reading.
+Run `/diff` to look over the changes in your working tree without leaving Claude Code. You see the edits Claude has made so far alongside anything else you haven’t committed. In the changes `/diff` reads from git, a submodule appears as a single entry, and only when the commit it points to changes; edits to files inside the submodule don’t appear there. In [fullscreen rendering](</docs/en/fullscreen>), `/diff` opens the diff panel beside the conversation, which stays open and updates while you keep working. In the classic renderer, `/diff` opens the diff viewer in place of the prompt, and you close it when you’re done reading.
###
@@ -625,18 +639,18 @@
* **Single response** : there are no follow-up turns in the overlay. To continue the thread, ask another `/btw` question. To continue with full tool access in a local session, press `f` to fork this question and answer into a [background subagent](</docs/en/sub-agents#fork-the-current-conversation>).
* **Low cost** : while the conversation’s [prompt cache](</docs/en/prompt-caching>) is warm, a side question costs little beyond the answer itself.
-Your five newest earlier side questions appear as a dimmed list above the current answer, with a count of any older ones. They stay out of the conversation history. To return to the overlay after dismissing it, run `/btw` with no question. The overlay reopens on your most recent exchange. Press `Left` to step back through earlier answers. Before v2.1.212, `/btw` without a question printed a usage message instead. Once the answer appears, the overlay accepts these keys.
+Your five newest earlier side questions appear as a dimmed list above the current answer, with a count of any older ones. They stay out of the conversation history. To return to the overlay after dismissing it, run `/btw` with no question. The overlay reopens on your most recent exchange. Before v2.1.212, `/btw` without a question printed a usage message instead. Once the answer appears, the overlay accepts these keys.
Key| Action
---|---
`Space`, `Enter`, `Escape`| Dismiss the answer and return to the prompt
`Up` / `Down`| Scroll the answer
-`Left` / `Right`| Step between this answer and your earlier `/btw` answers. `Left` moves to older answers and `Right` returns toward the current one. Requires Claude Code v2.1.187 or later
+`Shift+Left` / `Shift+Right`| Step between this answer and your earlier `/btw` answers. `Shift+Left` moves to older answers and `Shift+Right` returns toward the current one. `[` and `]` do the same, for terminals that don’t report `Shift` with arrow keys. `Tab` / `Shift+Tab` cycle through the same answers. Requires Claude Code v2.1.257 or later. Between v2.1.187 and v2.1.256, the keys were plain `Left` / `Right`
`c`| Copy the answer to your clipboard as raw Markdown. Use this instead of mouse selection, which captures the hard-wrapped terminal rendering rather than the source text
`f`| Start a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) that inherits the parent conversation plus this question and answer, so it can continue with full tool access. You stay in the current session and find the fork in the [panel below your prompt](</docs/en/sub-agents#observe-and-steer-running-forks>). Available in local sessions only
`x`| Clear the list of earlier `/btw` exchanges shown above the current answer
-`/btw` sees your full conversation but has no tools. A [subagent](</docs/en/sub-agents>) has tools and starts from the prompt it receives, or, for a [fork](</docs/en/sub-agents#fork-the-current-conversation>), from a copy of this conversation. Use `/btw` to ask about what Claude already knows from this session; use a subagent to go find out something new.
+In an attached [background session](</docs/en/agent-view#attach-to-a-session>), `Left` detaches and returns you to agent view, even while the answer is still arriving. The side question keeps running while you’re away. The next time you attach to the session, the overlay reopens with the side question, or with its answer. Before v2.1.257, `Left` didn’t detach there. `/btw` sees your full conversation but has no tools. A [subagent](</docs/en/sub-agents>) has tools and starts from the prompt it receives, or, for a [fork](</docs/en/sub-agents#fork-the-current-conversation>), from a copy of this conversation. Use `/btw` to ask about what Claude already knows from this session; use a subagent to go find out something new.
##
@@ -751,13 +765,33 @@
* Yellow: any other open state
* Gray: draft
-The badge disappears once the merge request merges or closes. It refreshes as soon as a `glab mr create` or `git push` succeeds in the session. To get the badge, you need:
+The badge disappears once the merge request merges or closes. It refreshes as soon as a `git push`, or a `glab mr` command that changes the merge request, such as `glab mr create` or `glab mr merge`, succeeds in the session. To get the badge, you need:
* Claude Code v2.1.234 or later
* A repository remote that points at your GitLab host, either gitlab.com or a self-managed instance
* The [`glab` CLI](<https://gitlab.com/gitlab-org/cli>) on your `PATH`, authenticated with `glab auth login`
Claude Code ignores `glab`’s token environment variables, such as `GITLAB_TOKEN`, when it checks status, so you get no badge from an exported token alone. Claude Code also looks for `glab` and for its login once per session, so restart Claude Code after you install `glab` or run `glab auth login`.
+
+##
+
+
+
+Issue reference links
+
+When Claude mentions an issue as `owner/repo#123`, you can click the reference to open it, as long as your terminal supports hyperlinks. If Claude Code doesn’t detect hyperlink support in your terminal, set [`FORCE_HYPERLINK`](</docs/en/env-vars>) to `1` to turn the links on, or to `0` to keep references as plain text. You get a link only for the two-part `owner/repo#123` form. These stay plain text:
+
+ * A bare `#123`
+ * A nested GitLab path such as `group/subgroup/project#123`
+ * Any reference inside a code span or code block
+
+Claude Code builds the link for the host of the repository it identifies from your git remote, not for the repository the reference names:
+
+Your repository’s host| Where `owner/repo#123` links
+---|---
+github.com, a GitHub Enterprise host, or any host not listed below| `https://<host>/owner/repo/issues/123`
+gitlab.com| `https://gitlab.com/owner/repo/-/issues/123`
+bitbucket.org, codeberg.org, or gitea.com| No link; the reference stays plain text
##
--- a/keybindings.md
+++ b/keybindings.md
@@ -59,8 +59,10 @@
`DiffDialog`| Diff viewer navigation
`DiffPanel`| The [diff panel](</docs/en/interactive-mode#diff-panel>) is open
`ModelPicker`| Model picker effort level
+`EffortSlider`| Effort slider opened by `/effort`
`Select`| Generic select/list components
`Plugin`| Plugin dialog (browse, discover, manage)
+`Agents`| [Agent view](</docs/en/agent-view>) (`claude agents`)
`Scroll`| Conversation scrolling and text selection in fullscreen mode
Before v2.1.205, a `Doctor` context and a `doctor:fix` action existed for the `/doctor` diagnostics screen.
@@ -122,10 +124,10 @@
`chat:fastMode`| Meta+O| Toggle fast mode
`chat:thinkingToggle`| Meta+T| Toggle extended thinking
`chat:submit`| Enter| Submit message
-`chat:queueSubmit`| Ctrl+X Enter| Submit the message, marked to wait its turn: while Claude is working, Claude Code [queues it](</docs/en/interactive-mode#queue-messages-while-claude-works>) and never interrupts the turn. Unlike `chat:submit`, it submits the draft even while autocomplete suggestions are open. Requires v2.1.247 or later
+`chat:queueSubmit`| Ctrl+X Enter| Submit the message, marked to wait its turn: while Claude is working, Claude Code [queues it](</docs/en/interactive-mode#queue-messages-while-claude-works>) and never interrupts the turn. Unlike `chat:submit`, it submits the draft even while an autocomplete suggestion is highlighted. Requires v2.1.247 or later
`chat:newline`| Ctrl+J| Insert a newline without submitting
`chat:undo`| Ctrl+_, Ctrl+Shift+-| Undo last action
-`chat:externalEditor`| Ctrl+G, Ctrl+X Ctrl+E| Open in external editor
+`chat:externalEditor`| Ctrl+G, Ctrl+X Ctrl+E| Open in external editor. The [agent view dispatch input](</docs/en/agent-view#keyboard-shortcuts>) follows this action’s single-keystroke bindings too
`chat:stash`| Ctrl+S| Stash current prompt
`chat:imagePaste`| Ctrl+V (Alt+V on Windows and WSL)| Paste image from clipboard. On WSL, both shortcuts are bound by default
@@ -374,6 +376,18 @@
+Effort slider actions
+
+Actions available in the `EffortSlider` context, the slider that opens when you run `/effort` with no arguments. The slider’s Left, Right, Enter, and Escape keys can’t be rebound.
+
+Action| Default| Description
+---|---|---
+`effortSlider:thisSessionOnly`| s| Apply the focused [effort level](</docs/en/model-config#adjust-effort-level>) to this session only. Requires v2.1.257 or later
+
+###
+
+
+
Select actions
Actions available in the `Select` context:
@@ -419,6 +433,21 @@
`settings:retry`| R| Retry loading usage data on error
`select:accept`| Enter, Space| Change the selected setting or open its submenu
`confirm:no`| Escape| Close the panel. Changes are already saved
+
+###
+
+
+
+Agents actions
+
+Actions available in the `Agents` context, which applies in [agent view](</docs/en/agent-view>), opened with `claude agents`. Requires v2.1.257 or later.
+
+Action| Default| Description
+---|---|---
+`agents:switchView`| Ctrl+S| Switch [session grouping](</docs/en/agent-view#organize-the-list>) between state and directory
+`agents:togglePin`| Ctrl+T| [Pin or unpin](</docs/en/agent-view#organize-the-list>) the selected session
+
+While agent view is open, Claude Code uses the `Agents` binding for any key the `Agents` context binds, and it ignores a `Chat` or `Global` binding on the same key. For example, pressing Ctrl+S in agent view switches the session grouping rather than triggering the default `chat:stash`. The dispatch input’s external-editor shortcut isn’t an `Agents` action. Agent view follows the `Chat` context’s `chat:externalEditor` binding, Ctrl+G by default. Bindings fire on single keystrokes in agent view, so the Ctrl+X Ctrl+E chord bound to `chat:externalEditor` doesn’t open the editor there.
###
@@ -517,6 +546,8 @@
Chords are sequences of keystrokes separated by spaces:
ctrl+k ctrl+s Press Ctrl+K, release, then Ctrl+S
+
+Press each keystroke within 3 seconds of the one before it. If you wait longer, Claude Code cancels the chord and shows a brief notice saying so.
###
--- a/large-codebases.md
+++ b/large-codebases.md
@@ -158,20 +158,20 @@
Claude’s content searches respect `.gitignore` by default, so paths already listed there, such as `node_modules/`, `dist/`, and `build/`, stay out of search results without additional configuration. For paths that are checked in, such as a vendored SDK or committed generated code, add `Read` deny rules in `permissions.deny` to block Claude from opening those files. The deny rules can cover everyone working in the repository, only you, or every session on the machine, depending on which settings file you put them in:
* **Everyone working in the repository** : commit the rules to `.claude/settings.json`, at the repository root if you start Claude there, or in each package’s `.claude/` if you start from subdirectories. Like other project settings on this page, that file isn’t inherited from parent directories.
- * **Yourself only** : use `.claude/settings.local.json` at the repository root, which loads in every CLI session inside the repository regardless of starting directory, except in the cases where Claude Code [doesn’t use the repository root](</docs/en/settings#where-claude-code-looks-for-each-file>), such as on Windows. Relative patterns like the example’s `Read(./vendor/**)` still [anchor at the session’s current working directory](</docs/en/permissions#read-and-edit>) rather than the repository root, so if you start sessions from subdirectories, write the rules in this file as `//`-absolute paths, such as `Read(//absolute/path/to/repo/vendor/**)`. Before v2.1.211, `.claude/settings.local.json` also loaded only from the starting directory.
+ * **Yourself only** : use `.claude/settings.local.json` at the repository root, which loads in every CLI session inside the repository regardless of starting directory, except in the cases where Claude Code [doesn’t use the repository root](</docs/en/settings#where-claude-code-looks-for-each-file>), such as on Windows. Relative patterns like the example’s `Read(./**/vendor/**/*)` still [anchor at the session’s current working directory](</docs/en/permissions#read-and-edit>) rather than the repository root, so if you start sessions from subdirectories, write the rules in this file as `//`-absolute paths, such as `Read(//absolute/path/to/repo/**/vendor/**/*)`. Before v2.1.211, `.claude/settings.local.json` also loaded only from the starting directory.
* **Everyone, enforced in every session** : set the rules in [managed settings](</docs/en/managed-settings>), which user and project settings cannot override.
-The example below blocks build artifacts and a vendored SDK:
+The example below blocks build artifacts and a vendored SDK. Its directory patterns end with `/**/*` rather than `/**` so that each rule covers everything inside the directory but not the directory itself. Claude can then still list those directories or change into them, for example with `ls dist` or `cd build`.
.claude/settings.json
{
"permissions": {
"deny": [
- "Read(./**/dist/**)",
- "Read(./**/build/**)",
+ "Read(./**/dist/**/*)",
+ "Read(./**/build/**/*)",
"Read(./**/*.generated.*)",
- "Read(./vendor/**)"
+ "Read(./**/vendor/**/*)"
]
}
}
@@ -387,8 +387,8 @@
"../shared"
],
"deny": [
- "Read(./**/dist/**)",
- "Read(./**/build/**)"
+ "Read(./**/dist/**/*)",
+ "Read(./**/build/**/*)"
]
}
}
@@ -400,8 +400,8 @@
{
"permissions": {
"deny": [
- "Read(./**/dist/**)",
- "Read(./**/build/**)"
+ "Read(./**/dist/**/*)",
+ "Read(./**/build/**/*)"
]
}
}
--- a/llm-gateway-connect.md
+++ b/llm-gateway-connect.md
@@ -496,7 +496,7 @@
---|---|---
A startup warning naming two credential sources and ending in `auth may not work as expected`. Older versions show `Auth conflict: Both a token (SOURCE) and an API key (SOURCE) are set` instead.| A gateway credential and a saved login are both active; the variable is used for requests, but the stale login can cause unexpected auth behavior| Unset the variable to use the saved login, or run `/logout` to use the gateway credential
`401` errors naming an invalid or unrecognized token| The credential isn’t one the gateway issued, or it’s in a header the gateway doesn’t read| Confirm the variable matches your credential kind in the credential table, and regenerate the key at the gateway if it was revoked
-`Your apiKeyHelper script is failing`| The command in the [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) setting didn’t produce a usable key, so requests carry a placeholder key| Run the command directly to see why it fails, and re-authenticate with your credential provider if it reports an expired session; see [the error reference](</docs/en/errors#your-apikeyhelper-script-is-failing>)
+`Your apiKeyHelper script is failing`, or `apiKeyHelper failed:` on stderr in non-interactive mode| The command in the [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) setting didn’t produce a usable key, so requests carry a placeholder key| Run the command directly to see why it fails, and re-authenticate with your credential provider if it reports an expired session; see [the error reference](</docs/en/errors#your-apikeyhelper-script-is-failing>)
`Connection refused — a firewall or proxy may be blocking it (ConnectionRefused)` when nothing answers at the address, or `Can't reach the API server — check your internet or DNS (ENOTFOUND)` when the hostname doesn’t resolve, often after a silent pause while Claude Code [retries with backoff](</docs/en/errors#automatic-retries>). The code in parentheses varies; [Unable to connect to API](</docs/en/errors#unable-to-connect-to-api>) covers the code spellings and the earlier wording| Nothing answered at the base URL: the address is wrong, or a VPN or firewall blocks the path to the gateway| Run the curl test above, which fails immediately with the same cause, and confirm the URL and network path with your gateway team
`API returned an empty or malformed response (HTTP 200)`| The gateway or an intermediate proxy returned a non-API response, often an HTML error or login page| Test with the curl request above; fix the gateway route that answers with something other than a Claude API response. [The error reference](</docs/en/errors#api-returned-an-empty-or-malformed-response>) explains the detail the message reports
`400` errors naming `context_management`, `Extra inputs are not permitted`, or other unrecognized fields| The gateway forwards requests to an upstream that rejects fields Claude Code sends to Anthropic-format endpoints| Set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`, which suppresses most pre-release fields; see [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>). Some betas aren’t gated by this flag; for those, set the matching `CLAUDE_CODE_USE_*` provider variable so Claude Code sends only what that provider accepts
--- a/llm-gateway-protocol.md
+++ b/llm-gateway-protocol.md
@@ -46,7 +46,12 @@
Optional endpoints and startup traffic
-Token-counting endpoints are the only optional ones: when they’re absent, Claude Code falls back to counting context usage through the inference endpoint instead. Inference requests post to `/v1/messages?beta=true`, so match on the path, not the full URL. The Google Cloud’s Agent Platform method suffixes attach to the publisher model path, as in `/projects/{project}/locations/{location}/publishers/anthropic/models/{model}:streamRawPredict`. A gateway also sees best-effort startup traffic it can reject without breaking anything. An Anthropic Messages-format gateway receives a `HEAD /api/hello` connection-warming probe, which Claude Code skips when an HTTP proxy or client certificate is configured. An Amazon Bedrock-format gateway receives a `GET /inference-profiles?type=SYSTEM_DEFINED` request and, when the configured model is an inference profile, `GET /inference-profiles/{profile}` lookups. The [fast mode](</docs/en/fast-mode>) availability check never appears in gateway logs: it calls `api.anthropic.com` directly rather than following `ANTHROPIC_BASE_URL`, so on a network that blocks direct egress to `api.anthropic.com`, fast mode can report a connectivity error while inference through the gateway keeps working. The [WebFetch domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) also calls `api.anthropic.com` directly. [Use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) covers the variables that restore it.
+Token-counting endpoints are the only optional ones: when they’re absent, Claude Code falls back to a character-based estimate of context usage. Match on the path, not the full URL:
+
+ * Inference requests post to `/v1/messages?beta=true`
+ * The Google Cloud’s Agent Platform method suffixes attach to the publisher model path, as in `/projects/{project}/locations/{location}/publishers/anthropic/models/{model}:streamRawPredict`
+
+A gateway also sees best-effort startup traffic it can reject without breaking anything. An Anthropic Messages-format gateway receives a `HEAD /api/hello` connection-warming probe, which Claude Code skips when an HTTP proxy or client certificate is configured. An Amazon Bedrock-format gateway receives a `GET /inference-profiles?type=SYSTEM_DEFINED` request and, when the configured model is an inference profile, `GET /inference-profiles/{profile}` lookups. The [fast mode](</docs/en/fast-mode>) availability check never appears in gateway logs: it calls `api.anthropic.com` directly rather than following `ANTHROPIC_BASE_URL`, so on a network that blocks direct egress to `api.anthropic.com`, fast mode can report a connectivity error while inference through the gateway keeps working. The [WebFetch domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) also calls `api.anthropic.com` directly. [Use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) covers the variables that restore it.
###
@@ -134,7 +139,7 @@
Beta [tool fields](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview>)| Tool-related beta headers pair with tool schema fields such as `strict` and `defer_loading`| `400` naming the unrecognized tool schema field when the body passes through without its header| Forward both, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`
[Effort](<https://platform.claude.com/docs/en/build-with-claude/effort>) and [structured outputs](<https://platform.claude.com/docs/en/build-with-claude/structured-outputs>)| The `output_config` body field carries effort, structured-output format, and task budget settings; each pairs with its own beta header| `400` naming `output_config`, often `Extra inputs are not permitted`, on Amazon Bedrock and Google Cloud’s Agent Platform upstreams| Forward the field and its headers together
[Prompt caching](</docs/en/prompt-caching>)| No beta pairing. Claude Code attaches `cache_control` markers to `system` blocks and to `messages` entries, including `role: "system"` entries appended mid-conversation| No error: the conversation bills as uncached input on every turn, visible as high `input_tokens` with little or no cache activity in `usage`| Forward `cache_control` unchanged wherever it appears, and don’t convert block-form `system` or message content to plain strings
-[Token counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>)| No beta pairing; uses the `count_tokens` endpoint| Claude Code falls back to counting context usage through the messages endpoint| Expose the endpoint so token counts don’t consume inference requests
+[Token counting](<https://platform.claude.com/docs/en/build-with-claude/token-counting>)| No beta pairing; uses the `count_tokens` endpoint| No error: Claude Code falls back to a character-based estimate, so `/context` shows approximate counts| Expose the endpoint for exact token counts
The `ANTHROPIC_DEFAULT_*_MODEL_SUPPORTED_CAPABILITIES` [variables](</docs/en/model-config>) declare model capabilities only in the provider configurations: `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, `CLAUDE_CODE_USE_FOUNDRY`, and [`CLAUDE_CODE_USE_MANTLE`](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). They have no effect behind an `ANTHROPIC_BASE_URL` gateway.
@@ -144,7 +149,13 @@
Automatic retry and error forwarding
-When the upstream rejects the `thinking` field, a [thinking signature](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>), a mid-conversation system message, or the `cache_control` marker on one of those messages, Claude Code retries the request and disables the rejected capability for the rest of the conversation. Claude Code doesn’t retry context management or tool schema field rejections; those `400` errors reach the developer. The retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`.
+What Claude Code does after an upstream rejection depends on what was rejected:
+
+ * When the upstream rejects the `thinking` field, a mid-conversation system message, or the `cache_control` marker on such a message, Claude Code retries the request and disables the rejected capability for the rest of the conversation
+ * When the upstream rejects a [thinking signature](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>), Claude Code retries the request without the conversation’s earlier thinking blocks and keeps them out of every later request. New responses still include thinking
+ * Claude Code doesn’t retry rejections of context management or tool schema fields, so those `400` errors reach the developer
+
+The retry logic matches on the upstream’s error wording, so forward error response bodies unmodified. A gateway that wraps upstream errors in its own envelope breaks the recovery path, even when it preserves the status code, unless the envelope’s message carries a stable `capability_rejected:` token. [Claude apps gateway substitutes those tokens for cloud providers’ error wording](</docs/en/claude-apps-gateway-config#upstream-error-messages>), for example `capability_rejected: prompt_too_long`.
###
--- a/llm-gateway-rollout.md
+++ b/llm-gateway-rollout.md
@@ -183,7 +183,7 @@
"apiKeyHelper": "/usr/local/bin/get-gateway-key"
}
-Add the conditional variables from the table to the same `env` block. A managed `ANTHROPIC_BASE_URL` is enforced and cannot be overridden by a developer’s shell export, since Claude Code applies it over the process environment and lower-precedence settings. Do not include `forceLoginMethod` or `forceLoginOrgUUID` in managed settings alongside a gateway credential. Either key, with any value, blocks `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `apiKeyHelper` at startup, so developers see `This machine's managed settings require a first-party login` and cannot proceed. [Server-managed settings](</docs/en/server-managed-settings#platform-availability>) delivery requires a direct connection to `api.anthropic.com`, so it does not reach gateway-routed sessions. Gateway deployments use this file-based managed settings path, which enforces the same keys. For the credential, distribute one [`apiKeyHelper`](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) command in the managed settings file as shown above; the command authenticates to your secrets store as the local developer, so each machine receives its own key. Alternatively, deliver each developer their key through your existing secrets process and have them set `ANTHROPIC_AUTH_TOKEN` themselves. Some environments need separate delivery:
+Add the conditional variables from the table to the same `env` block. A managed `ANTHROPIC_BASE_URL` is enforced and cannot be overridden by a developer’s shell export, since Claude Code applies it over the process environment and lower-precedence settings. Don’t include `forceLoginMethod` or `forceLoginOrgUUID` in managed settings alongside a gateway credential. Either key, with any value, blocks `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `apiKeyHelper` at startup, and developers can’t proceed. They see `This machine's managed settings require a first-party login`, or [`Administrator policy requires a Cloud gateway sign-in`](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>) under a `"gateway"` value. [Server-managed settings](</docs/en/server-managed-settings#platform-availability>) delivery requires a direct connection to `api.anthropic.com`, so it does not reach gateway-routed sessions. Gateway deployments use this file-based managed settings path, which enforces the same keys. For the credential, distribute one [`apiKeyHelper`](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) command in the managed settings file as shown above; the command authenticates to your secrets store as the local developer, so each machine receives its own key. Alternatively, deliver each developer their key through your existing secrets process and have them set `ANTHROPIC_AUTH_TOKEN` themselves. Some environments need separate delivery:
* The desktop app reads gateway routing from its third-party inference configuration, not from managed settings; deploy that file through MDM alongside managed settings so desktop sessions route through the gateway too. See the [desktop third-party configuration docs](<https://claude.com/docs/third-party/claude-desktop/configuration>) and the [desktop gateway docs](<https://claude.com/docs/third-party/claude-desktop/gateway>)
* CI runners need `ANTHROPIC_BASE_URL` and the credential set in the [runner’s environment](</docs/en/llm-gateway-connect#configure-each-surface>)
Show diff (249 lines)
--- a/managed-mcp.md
+++ b/managed-mcp.md
@@ -1,7 +1,8 @@
-By default, anyone running Claude Code can connect any [MCP server](</docs/en/mcp>) they choose. Anthropic reviews connectors against its [listing criteria](<https://claude.com/docs/connectors/building/review-criteria>) before adding them to the [Anthropic Directory](<https://claude.ai/directory>), but doesn’t security-audit or manage any MCP server. As an administrator, you can restrict which servers run in your organization, from deploying a fixed approved set to disabling MCP entirely. These restrictions cover the servers Claude Code loads itself, including the connectors it fetches from claude.ai. Connectors the desktop app delivers to its local and SSH sessions arrive in-process and are governed from your claude.ai organization settings instead; [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) shows which controls apply to connectors in each kind of session, including cloud sessions. This page covers how to:
+By default, anyone running Claude Code can connect any [MCP server](</docs/en/mcp>) they choose. Anthropic reviews connectors against its [listing criteria](<https://claude.com/docs/connectors/building/review-criteria>) before adding them to the [Anthropic Directory](<https://claude.ai/directory>), but doesn’t security-audit or manage any MCP server. As an administrator, you can restrict which servers run in your organization, from deploying a fixed approved set to disabling MCP entirely, and you can provide servers to every user. These restrictions cover the servers Claude Code loads itself, including the connectors it fetches from claude.ai. Connectors the desktop app delivers to its local and SSH sessions arrive in-process and are governed from your claude.ai organization settings instead; [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) shows which controls apply to connectors in each kind of session, including cloud sessions. This page covers how to:
* Choose a pattern that matches how much control you need
* Deploy a fixed server set with `managed-mcp.json`, including how to disable MCP entirely
+ * Provide servers through managed settings while users keep their own
* Control servers with allowlists and denylists
* Tell users what to expect when a restriction blocks a server
* Monitor which servers your organization actually uses
@@ -14,12 +15,13 @@
Choose a pattern
-Claude Code supports a range of restriction levels. Each pattern uses one or both of the mechanisms covered below: `managed-mcp.json` for deploying a fixed set, and `allowedMcpServers`/`deniedMcpServers` for filtering what users configure.
+Claude Code supports a range of restriction levels. Each pattern uses one or more of the mechanisms covered below: `managed-mcp.json` for deploying a fixed set, the `managedMcpServers` managed setting for providing servers alongside the ones users add, and `allowedMcpServers`/`deniedMcpServers` for filtering what users configure.
Pattern| What it does| Configure
---|---|---
-**Disable MCP**| No servers load, apart from in-process servers the app that started the session registers| `managed-mcp.json` with an empty server map
+**Disable MCP**| No servers load, apart from in-process servers the app that started the session registers and any you provide through `managedMcpServers`| `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
+**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`; plugin servers still load| [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) with `mcp` in the list
**Soft allowlist**| Enforce an allowlist that users can broaden in their own settings| `allowedMcpServers` without `allowManagedMcpServersOnly`
@@ -34,17 +36,15 @@
Exclusive control with managed-mcp.json
-If you deploy a `managed-mcp.json` file, Claude Code loads only the servers that file defines, plus any in-process servers 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>). 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. What a user sees when a session does receive `--mcp-config` servers depends on where the session runs:
-
- * On a workstation, Claude Code exits at startup with `You cannot dynamically configure MCP servers when an enterprise MCP config is present`.
- * In [cloud sessions](</docs/en/claude-code-on-the-web>) on a host where the file is deployed, such as a [self-hosted runner](</docs/en/self-hosted-environments-configuration#mcp-servers>), Claude Code starts with the managed servers only and skips the claude.ai connectors and other servers the cloud host delivers through `--mcp-config`. Nothing in the session tells the user which servers were left out. Claude Code names them in a warning on its stderr, which a self-hosted runner records at the `debug` log level. Before v2.1.229, these sessions exited with the same error a workstation shows.
-
-If a user passes `--strict-mcp-config`, Claude Code exits at startup on a workstation and in a cloud session alike, because that flag asks to replace the managed set. Two other settings can further filter the managed set:
-
- * `allowedMcpServers` and `deniedMcpServers` apply to managed servers too, so a managed server that doesn’t pass them won’t load.
- * A user’s own `deniedMcpServers` merges in from their settings, so users can block a managed server for themselves.
-
-See How a server is evaluated for the full order of checks. `managed-mcp.json` is a standalone file, so it cannot be delivered through [server-managed settings](</docs/en/server-managed-settings>). Any process that can write to a system path with administrator privileges can deploy it. Across a fleet, that’s usually through device management tooling, such as Jamf or a configuration profile on macOS, Group Policy or Intune on Windows, or your fleet management of choice on Linux. Claude Code looks for the file at one of these paths:
+If you deploy a `managed-mcp.json` file, Claude Code loads only the servers that file defines, the servers you provide through `managedMcpServers`, plus any in-process servers 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>). 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.
+
+###
+
+
+
+Deploy managed-mcp.json
+
+`managed-mcp.json` is a standalone file, so it cannot be delivered through [server-managed settings](</docs/en/server-managed-settings>). To deliver servers through managed settings instead, without exclusive control, use `managedMcpServers`. Any process that can write to a system path with administrator privileges can deploy the file. Across a fleet, that’s usually through device management tooling, such as Jamf or a configuration profile on macOS, Group Policy or Intune on Windows, or your fleet management of choice on Linux. Claude Code looks for the file at one of these paths:
Platform| Path
---|---
@@ -91,11 +91,37 @@
+Servers passed with `--mcp-config` or `--strict-mcp-config`
+
+When a session receives servers through `--mcp-config` while `managed-mcp.json` is deployed, what the user sees differs between a workstation and a cloud session:
+
+ * On a workstation, Claude Code exits at startup with `You cannot dynamically configure MCP servers when an enterprise MCP config is present`.
+ * In [cloud sessions](</docs/en/claude-code-on-the-web>) on a host where the file is deployed, such as a [self-hosted runner](</docs/en/self-hosted-environments-configuration#mcp-servers>), Claude Code starts with the managed servers only and skips the claude.ai connectors and other servers the cloud host delivers through `--mcp-config`. Nothing in the session tells the user which servers were left out. Claude Code names them in a warning on its stderr, which a self-hosted runner records at the `debug` log level.
+
+If a user passes `--strict-mcp-config`, Claude Code exits at startup on a workstation and in a cloud session alike, because that flag asks to replace the managed set.
+
+###
+
+
+
+How allowlists and denylists apply to the managed set
+
+The denylist can further filter the servers in `managed-mcp.json`:
+
+ * `deniedMcpServers` applies to managed servers too, so a managed server that matches an entry won’t load.
+ * A user’s own `deniedMcpServers` merges in from their settings, so users can block a managed server for themselves.
+
+`allowedMcpServers` doesn’t apply to the servers in `managed-mcp.json`, with one exception: Claude Code still checks a server whose definition uses [`${VAR}` expansion](</docs/en/mcp#environment-variable-expansion-in-mcp-json>) against the allowlist, because that server’s effective configuration comes from each user’s environment rather than from the file alone. Before v2.1.259, every managed server had to pass the allowlist whenever one was set. See How a server is evaluated for which fields trigger the `${VAR}` check and the full order of checks. If you used `allowedMcpServers` to keep some of your own `managed-mcp.json` servers from loading, those servers start loading on each user’s first launch of v2.1.259 or later unless they use `${VAR}` expansion, with no prompt or notice: only `deniedMcpServers` still subtracts from those servers. Add denylist entries for them, or deploy a separate `managed-mcp.json` per group, before your users upgrade.
+
+###
+
+
+
Validate the configuration
To confirm the file is in effect, run two checks on a managed machine:
- 1. `claude mcp list` shows only the servers in `managed-mcp.json`. If a user’s own servers still appear, the file isn’t being read; check the path and permissions.
+ 1. `claude mcp list` shows only the servers in `managed-mcp.json`, plus any you provide through `managedMcpServers`. If a user’s own servers still appear, the file isn’t being read; check the path and permissions.
2. `claude mcp add --transport http test https://example.com/mcp` fails with `Cannot add MCP server: enterprise MCP configuration is active and has exclusive control over MCP servers`. The URL doesn’t need to be a real server, since the policy check rejects the command before anything is contacted.
###
@@ -110,7 +136,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.
+`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` still load under an empty map, so leave that key unset as well to disable MCP completely.
###
@@ -124,9 +150,110 @@
+Provide servers through managed settings
+
+To give every user a set of remote MCP servers without taking exclusive control of MCP, list them under `managedMcpServers` in a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>): server-managed settings, a [Claude apps gateway](</docs/en/claude-apps-gateway-config#what-goes-in-cli>) policy, an MDM profile or registry policy, or `managed-settings.json`. Users keep the servers they add themselves and receive yours in addition. Requires Claude Code v2.1.259 or later. Earlier clients ignore the key. The value is an object keyed by server name. Each entry has the same shape as an HTTP or SSE server in a project [`.mcp.json`](</docs/en/mcp#project-scope>) file, including the optional `headers` and `oauth` members described in [Authenticate with remote MCP servers](</docs/en/mcp#authenticate-with-remote-mcp-servers>). This example provides a search server that each user signs in to with OAuth, and a records server that sends a header your organization issues:
+
+ {
+ "managedMcpServers": {
+ "search": {
+ "type": "http",
+ "url": "https://search.example.com/mcp"
+ },
+ "records": {
+ "type": "http",
+ "url": "https://records.example.com/mcp",
+ "headers": {
+ "X-Records-Key": "key-issued-for-all-claude-code-users"
+ }
+ }
+ }
+ }
+
+Anyone who can read the managed settings on a machine, including the user, can read a header value you set here. Use a credential issued for that whole audience, or leave `headers` out and let each user sign in with OAuth.
+
+###
+
+
+
+What an entry can contain
+
+Claude Code loads an entry only when it passes every check below. It drops an entry that fails one, records a notice you can read with `/status`, and still loads the other entries:
+
+ * `type` is `http` or `sse`. As in `.mcp.json`, `streamable-http` is accepted as an alias for `http`.
+ * `url` is an `https://` URL. Claude Code refuses a plain `http://` URL, including one that points at `localhost`.
+ * The entry has no `command`, `args`, `env`, or `headersHelper` member, so a managed settings document never names a program to run on a user’s machine.
+ * No value contains a `${VAR}` reference. Claude Code doesn’t expand environment variables in these entries, so write literal values.
+ * The server name contains only letters, numbers, hyphens, and underscores, and no key or value contains control or invisible formatting characters.
+
+Claude Desktop has a managed setting with the same name whose value is an array of a different entry shape, so don’t copy one into the other. Claude Code doesn’t accept the array form and records a notice instead of loading it. A Claude apps gateway runs the same checks when it boots; see [MCP servers in a policy](</docs/en/claude-apps-gateway-config#mcp-servers-in-a-policy>).
+
+###
+
+
+
+How provided servers load
+
+These rules decide what loads when a provided server overlaps with another server definition or with another setting on this page:
+
+ * A provided server takes precedence over a server with the same name in local, project, or user scope, and over a plugin server or claude.ai connector that points at the same URL.
+ * If you also deploy `managed-mcp.json`, Claude Code loads its servers and the provided servers together, and the file’s entry takes precedence when both define a name.
+ * Provided servers keep loading when [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) locks the `mcp` surface.
+ * `deniedMcpServers` applies to provided servers, including entries from a user’s own settings, so a user can block one for themselves. Provided servers need no `allowedMcpServers` entry.
+
+When you haven’t also deployed `managed-mcp.json`, the per-run flags keep their meaning:
+
+ * A server a user passes with `--mcp-config` under the same name replaces the provided one for that run and is checked against `allowedMcpServers`.
+ * `--strict-mcp-config` leaves provided servers out along with every other configured server.
+
+With `managed-mcp.json` deployed, both flags behave as Exclusive control with managed-mcp.json describes.
+
+###
+
+
+
+What users can see and change
+
+Users can’t edit or remove a provided server:
+
+ * `claude mcp remove` reports that the server is provided by the organization.
+ * When you haven’t also deployed `managed-mcp.json`, an entry a user adds under the same name is saved but not used while yours is present.
+ * Users can still turn a provided server off for themselves in [`/mcp`](</docs/en/mcp#disable-a-server-without-removing-it>), which lists provided servers under **Managed MCPs**.
+
+`claude mcp get` and `/mcp` show a provided server’s URL as its host only, for example `https://mcp.example.com/…`, and `claude mcp get` shows its header names without their values.
+
+###
+
+
+
+Where `managedMcpServers` applies
+
+Claude Code reads `managedMcpServers` from the managed source it selects under [How Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). When that source sets [`managedSourcesBehavior`](</docs/en/settings-reference#managedsourcesbehavior>) to `"merge"`, Claude Code provides the servers from every admin source instead, and when two sources define the same name, the higher-ranked source’s entry applies whole. It never reads the key from the user-writable HKCU registry, from [parent settings an embedding host supplies](</docs/en/managed-settings#parent-settings-from-embedding-hosts>), or from user, project, or local settings files, where it drops the key with a warning. Claude Code doesn’t read the key in the Claude Desktop app’s Code tab on a third-party deployment or in the app’s Cowork sessions, because Claude Desktop supplies and locks those sessions’ MCP servers itself. `/status` and `claude doctor` say so when your managed settings carry the key there.
+
+###
+
+
+
+When provided servers connect
+
+When `managedMcpServers` arrives through server-managed settings, its timing follows [Fetch and caching behavior](</docs/en/server-managed-settings#fetch-and-caching-behavior>):
+
+ * On a machine with cached settings, Claude Code withholds the cached copy of this key until the server confirms the settings for the session, and waits for that confirmation before it loads MCP servers. If the confirmation fails, the session continues without the provided servers and `/status` says they are withheld.
+ * On a machine’s first launch, with nothing cached yet, an interactive session that starts before the settings arrive connects the provided servers as soon as they do, and a `claude -p` run that has already started can finish without them.
+
+With [gateway sign-in](</docs/en/claude-apps-gateway-config#precedence-with-other-managed-sources>), Claude Code loads the policy before the session starts, so neither case delays or skips the provided servers. Interactive sessions that are already running apply your edits to the key:
+
+ * **Add a server** : Claude Code connects it when the updated settings arrive, without a restart.
+ * **Change a server’s entry** : those sessions reconnect to it with the new definition.
+ * **Remove a server** : a running interactive session disconnects it once it reads the changed settings. A non-interactive (`-p`) run keeps it until it ends.
+
+##
+
+
+
Policy-based control with allowlists and denylists
-Allowlists and denylists filter which configured servers are allowed to load. They aren’t a registry: a server still has to be added by a user, a plugin, or `managed-mcp.json` before the allowlist or denylist applies to it. To deploy servers to users, use `managed-mcp.json`. Both lists also filter servers passed with the [`--mcp-config` CLI flag](</docs/en/cli-reference#cli-flags>), other than in-process `type: "sdk"` entries; `--strict-mcp-config` limits which configuration files load and doesn’t bypass either list. To make the allowlist authoritative, set `allowedMcpServers` and `allowManagedMcpServersOnly: true` together in a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>), such as server-managed settings or a deployed `managed-settings.json` file. Restrict the allowlist to managed settings only shows the configuration. Without `allowManagedMcpServersOnly`, allowlists from every settings scope merge, including a user’s own `~/.claude/settings.json`, so a user can broaden what your allowlist permits. Denylists merge from every scope regardless.
+Allowlists and denylists filter which configured servers are allowed to load. They aren’t a registry: a server still has to be added by a user, a plugin, or your organization before either list applies to it. Servers your organization delivers through `managedMcpServers` load without an allowlist entry, and How a server is evaluated covers `managed-mcp.json` servers. The denylist applies to every server regardless of where it came from, other than in-process `type: "sdk"` entries. To deploy servers to users, use `managed-mcp.json` or `managedMcpServers`. Both lists also filter servers passed with the [`--mcp-config` CLI flag](</docs/en/cli-reference#cli-flags>), other than in-process `type: "sdk"` entries; `--strict-mcp-config` limits which configuration files load and doesn’t bypass either list. To make the allowlist authoritative, set `allowedMcpServers` and `allowManagedMcpServersOnly: true` together in a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>), such as server-managed settings or a deployed `managed-settings.json` file. Restrict the allowlist to managed settings only shows the configuration. Without `allowManagedMcpServersOnly`, allowlists from every settings scope merge, including a user’s own `~/.claude/settings.json`, so a user can broaden what your allowlist permits. Denylists merge from every scope regardless.
`allowManagedMcpServersOnly` is separate from `allowManagedPermissionRulesOnly`, which locks down [permission rules](</docs/en/permissions#managed-settings>) only. Setting that flag does not enforce the MCP allowlist.
@@ -148,7 +275,7 @@
Setting| Unset (default)| Empty array `[]`| Populated
---|---|---|---
-`allowedMcpServers`| All servers allowed| No servers allowed| Only matching servers allowed
+`allowedMcpServers`| All servers allowed| No servers allowed, apart from the organization’s own| Only matching servers allowed, apart from the organization’s own
`deniedMcpServers`| No servers blocked| No servers blocked| Matching servers blocked
See [Invalid entries in managed settings](</docs/en/managed-settings#invalid-entries-in-managed-settings>) for what happens when an entry fails schema validation.
@@ -172,7 +299,7 @@
1. **Merge the lists.** Allowlist and denylist entries from every settings scope combine into one allowlist and one denylist, with the managed scope’s lists coming from the [managed source or sources Claude Code applies](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). When `allowManagedMcpServersOnly` is `true`, only the managed allowlist is kept; the denylist always merges from every scope.
2. **Check the denylist.** A server that matches any denylist entry, by URL, command, or name, is blocked. Nothing overrides a denylist match.
- 3. **Check the allowlist.** If `allowedMcpServers` isn’t set anywhere, every server that passed the denylist loads. If it is set, what the server must match depends on its type, shown in the table below. Built-in servers such as Claude in Chrome, the `ide` server Claude Code connects to in a running VS Code or JetBrains IDE, and servers the CLI itself configures skip this check.
+ 3. **Check the allowlist.** If `allowedMcpServers` isn’t set anywhere, every server that passed the denylist loads. If it is set, what the server must match depends on its type, shown in the table below. The organization’s own servers skip this check: every `managedMcpServers` entry, and any `managed-mcp.json` entry whose values use no `${VAR}` expansion. Built-in servers skip it too, such as Claude in Chrome, the `ide` server Claude Code connects to in a running VS Code or JetBrains IDE, and servers the CLI itself configures. A `managed-mcp.json` server that uses `${VAR}` expansion in its command, arguments, `env`, URL, or headers is still checked, as is every server a user, a plugin, `--mcp-config`, or claude.ai adds.
Server type| Allowed when it matches
---|---
@@ -349,6 +476,7 @@
`managed-mcp.json` is present and the user runs `claude mcp add`| `Cannot add MCP server: enterprise MCP configuration is active and has exclusive control over MCP servers`
The server is on a denylist and the user runs `claude mcp add`| `Cannot add MCP server "<name>": server is explicitly blocked by enterprise policy`
The server isn’t on the allowlist and the user runs `claude mcp add`| `Cannot add MCP server "<name>": not allowed by enterprise policy`
+The user runs `claude mcp remove` on a server from `managedMcpServers`| `MCP server "<name>" is provided by your organization (managed settings) and cannot be removed locally.`
A previously configured server is now blocked by policy| The server silently disappears from `/mcp` and `claude mcp list` with no warning
A server becomes blocked while a session is running, and the user selects **Reconnect** or turns it back on in `/mcp`| [`MCP server <name> is blocked by enterprise managed policy`](</docs/en/errors#mcp-server-is-blocked-by-enterprise-managed-policy>)
@@ -373,6 +501,7 @@
Surface| What it controls| Where it lives| How to deliver
---|---|---|---
`managed-mcp.json`| Fixed server set, exclusive control| System path: `/Library/Application Support/ClaudeCode/`, `/etc/claude-code/`, or `C:\Program Files\ClaudeCode\`| MDM, GPO, fleet management, or any process with administrator privileges. Cannot be set through server-managed settings
+`managedMcpServers`| Remote servers provided to every user alongside their own| Managed settings sources only; the setting has no effect elsewhere| A [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>): server-managed settings, a gateway policy, `managed-settings.json`, MDM profile, or HKLM registry
`allowedMcpServers`| Allowlist of permitted servers| Any [settings scope](</docs/en/settings#where-settings-live>); Claude Code merges the lists from every scope unless `allowManagedMcpServersOnly` is set, and takes the managed scope’s list from the one [managed source it selects](</docs/en/managed-settings#precedence-within-the-managed-tier>) or [composes](</docs/en/managed-settings#compose-every-managed-source>)| For enforcement, a [managed settings source](</docs/en/admin-setup#decide-how-settings-reach-devices>): server-managed settings, `managed-settings.json`, MDM profile, or registry
`deniedMcpServers`| Denylist of blocked servers| Any settings scope; Claude Code merges the lists from every scope, and across managed sources as [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) describes| Same as `allowedMcpServers`
`allowManagedMcpServersOnly`| Locks the allowlist to managed sources only| Managed settings sources only; the setting has no effect elsewhere| Same as `allowedMcpServers`
--- a/managed-settings.md
+++ b/managed-settings.md
@@ -65,7 +65,7 @@
File-based| As `managed-settings.json` in a system directory on each machine; see where each mechanism stores the policy| Read at startup and reloaded when a file changes| Machines without MDM, Linux hosts, or images you build yourself
HKCU registry, Windows and WSL| As a Windows `HKCU` registry value; see where each mechanism stores the policy| Read at startup and checked for changes every 30 minutes; Claude Code uses it only when no other managed source delivers a policy key and no host-supplied parent settings supply a restrictive key| You can’t write the machine-level `HKLM` key
-Starter templates for Jamf, Iru, Intune, and Group Policy are in the [MDM examples repository](<https://github.com/anthropics/claude-code/tree/main/examples/mdm>). For managed MCP servers, which you deploy alongside any of these through `managed-mcp.json`, see [Managed MCP configuration](</docs/en/managed-mcp>).
+Starter templates for Jamf, Iru, Intune, and Group Policy are in the [MDM examples repository](<https://github.com/anthropics/claude-code/tree/main/examples/mdm>). For managed MCP servers, which you deploy alongside any of these through `managed-mcp.json` or provide through the [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key, see [Managed MCP configuration](</docs/en/managed-mcp>).
###
@@ -82,7 +82,9 @@
* **In a full VM sandbox** : when your Claude Desktop managed configuration sets [`requireCoworkFullVmSandbox`](<https://claude.com/docs/third-party/claude-desktop/configuration#requirecoworkfullvmsandbox>), Claude Code runs inside a virtual machine where the device’s MDM policy and managed settings file aren’t present.
* **Remote Cowork sessions** : these run on Anthropic-managed VMs, where Claude Code has no device policy to read.
The [surface coverage](</docs/en/model-config#surface-coverage>) table compares Cowork with the other surfaces.
- * **Running sessions** : a session picks up most changes on the schedule in the table without a restart. Claude Code reads [`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>) and [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>) only at session start, arms a new or changed [`policyHelper`](</docs/en/settings-reference#policyhelper>) entry at the next launch, and reads [some user-editable keys once at session start](</docs/en/settings#when-edits-take-effect>).
+ * **Running sessions** : most changes reach a running session on the schedule in the delivery mechanism table, without a restart.
+ * Changes to [`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>), [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>), and [some user-editable keys](</docs/en/settings#when-edits-take-effect>) take effect at the next session start.
+ * A new or changed [`policyHelper`](</docs/en/settings-reference#policyhelper>) entry takes effect at the next launch. If server-managed settings shadow the helper at that launch, the helper runs as soon as a fetch reports those settings removed.
* **Changes that need approval** : apart from the [updates that wait for the next launch](</docs/en/server-managed-settings#fetch-and-caching-behavior>), a server-managed change to a setting that [needs approval](</docs/en/server-managed-settings#security-approval-dialogs>), such as a hook or an `env` variable, waits for the developer to accept the dialog in an interactive session, and applies for the current run in a session an IDE extension or the Agent SDK hosts. Other server-managed changes apply on the next poll.
* **Long-lived sessions** : a session left open for weeks can still lag a rollout. [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>) blocks an outdated binary from starting and doesn’t end a session that’s already running.
@@ -112,7 +114,7 @@
* **Lists** , such as `permissions.deny` or `sandbox.network.allowedDomains`: the two lists combine, with duplicates removed
* **Nested blocks** , such as `env` or `sandbox`: the two blocks merge key by key, and each key inside follows these same rules
* **`fallbackModel`** : the later chain replaces the earlier one whole
- * **[`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>)** : a later entry with the same name replaces the earlier one whole
+ * **[`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>) and [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>)**: a later entry with the same name replaces the earlier one whole
* **[`modelPicker`](</docs/en/settings-reference#modelpicker>)** : the later lineup replaces the earlier one whole
##
@@ -155,6 +157,7 @@
* `sandbox.filesystem.disabled` and `sandbox.network.strictAllowlist`
* [`useAutoModeDuringPlan`](</docs/en/settings-reference#useautomodeduringplan>) and [`syncClaudeAiSkills`](</docs/en/settings-reference#syncclaudeaiskills>), where a `false` from any admin source turns the behavior off. A `false` in the developer’s user or local settings turns it off too; each key can only deny
* [`enableArtifact`](</docs/en/settings-reference#enableartifact>), where a `false` from any admin source turns the [Artifact tool](</docs/en/artifacts>) off. A `false` in the developer’s user, project, or local settings turns it off too, and no source turns it back on; see [which lower-level values still count](</docs/en/settings#exceptions-to-managed-settings-precedence>). Requires Claude Code v2.1.242 or later
+ * [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>), where the lowest cap in any admin source applies. If a developer sets a lower cap in their own settings or with `--settings`, Claude Code applies that one; no source can raise the cap. Requires Claude Code v2.1.267 or later
* A commit-trailer opt-out in `attribution`, or in the deprecated `includeCoAuthoredBy`, from any tier
* [`forceRemoteSettingsRefresh`](</docs/en/server-managed-settings>)
* `env`, merged per variable across the admin sources: each variable comes from the highest-priority source that defines it, so lower sources fill in variables the higher ones leave unset. A few variables follow their own rules; [Per-key exceptions across managed sources](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>) names each one. Requires Claude Code v2.1.223 or later. Before v2.1.223, Claude Code applied the selected source’s whole `env` block only
@@ -165,13 +168,15 @@
Compose every managed source
-To have Claude Code apply every admin source your organization delivers, set [`managedSourcesBehavior`](</docs/en/settings-reference#managedsourcesbehavior>) to `"merge"` in the highest-ranked source you deploy. Claude Code reads the key only from the highest-ranked source that carries either the key or a policy key, so a lower source can’t opt itself into merging with the source above it, and a machine that never receives server-managed settings needs the key in its MDM profile too. The user-writable HKCU registry never merges with another source. Requires Claude Code v2.1.242 or later. Under `"merge"`, Claude Code adds a lower source’s list entries, such as `permissions.allow` rules and hooks, to the policy, so turn it on only when every source ranked below your highest one is under an administrator’s control. This table shows how Claude Code combines each kind of key under `"merge"`; the [`managedSourcesBehavior` entry](</docs/en/settings-reference#managedsourcesbehavior>) names every key in the restriction allowlist and highest-source-only rows.
+To have Claude Code apply every admin source your organization delivers, set [`managedSourcesBehavior`](</docs/en/settings-reference#managedsourcesbehavior>) to `"merge"` in the highest-ranked source you deploy. Claude Code reads the key only from the highest-ranked source that carries either the key or a policy key, so a lower source can’t opt itself into merging with the source above it, and a machine that never receives server-managed settings needs the key in its MDM profile too. The user-writable HKCU registry never merges with another source. Requires Claude Code v2.1.242 or later. Under `"merge"`, Claude Code adds a lower source’s list entries, such as `permissions.allow` rules and hooks, to the policy, so turn it on only when every source ranked below your highest one is under an administrator’s control. This table shows how Claude Code combines each kind of key under `"merge"`. The [`managedSourcesBehavior` entry](</docs/en/settings-reference#managedsourcesbehavior>) names every key in three of the rows: restriction allowlists, values taken whole, and keys read from the highest-ranked source only.
Kind of key| How Claude Code combines it| Examples
---|---|---
Lists| Combines the entries from every source| `permissions.allow`, `hooks`, `sandbox.network.allowedDomains`, `deniedMcpServers`
Locks| Applies the strictest value any source sets; a looser value applies only from the highest-ranked source| `allowManagedHooksOnly`, `permissions.disableBypassPermissionsMode`, `crossSessionInbound`
Restriction allowlists| Takes the list whole from the highest-ranked source that sets it, without adding entries from lower sources| `availableModels`, `allowedMcpServers`, `strictKnownMarketplaces`, `allowedChannelPlugins`, and the `fallbackModel` chain
+Values taken whole| Takes the value whole from the highest-ranked source that sets it, without combining entries or fields from lower sources| `sandbox.credentials.awsPairs`, `sandbox.ripgrep`
+Provided MCP servers| Combines the server names from every source; when two sources set the same name, applies the higher-ranked source’s whole entry| `managedMcpServers`
Keys read from the highest-ranked source only| Ignores the key in every lower source, even when the highest-ranked source leaves it unset| Credential helpers such as `apiKeyHelper`, login pins such as `forceLoginOrgUUID`, `modelPicker`, `permissions.defaultMode`
`env`| Merges per variable across admin sources under either setting, as Keys read from every admin source describes|
Every other key| Takes the value from the highest-ranked source that sets it| `model`, `cleanupPeriodDays`
@@ -186,9 +191,9 @@
A [`policyHelper`](</docs/en/settings-reference#policyhelper>) is an executable your MDM policy or managed settings file names, and Claude Code runs it to compute managed settings at startup. When the selected source configures one and the helper emits a `managedSettings` object, that output changes what Claude Code reads:
- * **The emitted`managedSettings` object is the only managed settings for the session**, including for the keys it otherwise reads from every admin source, apart from `forceRemoteSettingsRefresh`, which Claude Code checks in every admin source at startup before the helper runs. For which helper runs fail, and what Claude Code does when one does, see [Helper failures](</docs/en/settings-reference#helper-failures>)
-
-Claude Code selects the source at startup, and that selection decides whether a helper runs. The [`policyHelper`](</docs/en/settings-reference#policyhelper>) entry says which sources can configure a helper.
+ * **The emitted`managedSettings` object is the only managed settings for the session**, including for the keys it otherwise reads from every admin source, apart from [`forceRemoteSettingsRefresh`, which has its own startup rule](</docs/en/settings-reference#forceremotesettingsrefresh>)
+
+For which helper runs fail, and what Claude Code does when one does, see [Helper failures](</docs/en/settings-reference#helper-failures>).
###
@@ -299,7 +304,10 @@
Field| Behavior when present but invalid
---|---
-`allowedMcpServers`| Enforced as an empty allowlist, so no MCP servers are admitted until the value is fixed. An individual invalid entry is stripped and the valid subset is enforced.
+`allowedMcpServers`| Enforced as an empty allowlist until the value is fixed, so no MCP servers that users add are admitted. Servers your organization delivers through [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) still load, and `managed-mcp.json` servers load per [How a server is evaluated](</docs/en/managed-mcp#how-a-server-is-evaluated>). An individual invalid entry is stripped and the valid subset is enforced.
+`allowedHttpHookUrls`| Claude Code enforces an empty [allowlist](</docs/en/settings-reference#allowedhttphookurls>) until you fix the value. If only an individual entry is invalid, it strips that entry and enforces the rest.
+`httpHookAllowedEnvVars`| Claude Code enforces an empty [allowlist](</docs/en/settings-reference#httphookallowedenvvars>) until you fix the value. If only an individual entry is invalid, it strips that entry and enforces the rest.
+`allowedChannelPlugins`| Claude Code enforces an empty allowlist until you fix the value, so no channel plugin passed to `--channels` is admitted. If only an individual entry is invalid, it strips that entry and enforces the rest.
`allowManagedHooksOnly`| Treated as `true` until fixed: the [hook restrictions](</docs/en/settings-reference#allowmanagedhooksonly>) apply and, unless `disableCommandPluginSources` is explicitly `false`, command-sourced plugins are disabled.
`allowManagedMcpServersOnly`| Treated as `true`.
`disableCommandPluginSources`| Treated as `true`, so command-sourced plugins stay disabled until the value is fixed.
@@ -310,7 +318,7 @@
`deniedMcpServers`| An individual invalid entry is stripped and the valid subset is enforced. A wholly invalid value is dropped with a warning, since denying every server would block servers the policy never named.
`sandbox.credentials`| A recoverable invalid entry is degraded to `mode: "deny"` with a warning; an unrecoverable one is stripped; valid entries stay enforced. See [invalid credential entries](</docs/en/settings-reference#invalid-credential-entries-in-managed-settings>)
-`requiredMinimumVersion` and `requiredMaximumVersion` fail open by design: an invalid value is dropped rather than enforced. This tolerance applies only to managed settings. User, project, and local settings files remain strict: a file whose JSON or top-level shape fails validation is rejected as a whole and reported, and an individual entry that fails, such as a malformed permission rule, is skipped with a warning while the rest of the file applies.
+Before v2.1.267, Claude Code dropped `allowedHttpHookUrls`, `httpHookAllowedEnvVars`, or `allowedChannelPlugins` whole when the value or any one entry was invalid, and behaved as if the key weren’t set. `requiredMinimumVersion` and `requiredMaximumVersion` fail open by design: an invalid value is dropped rather than enforced. This tolerance applies only to managed settings. User, project, and local settings files remain strict: a file whose JSON or top-level shape fails validation is rejected as a whole and reported, and an individual entry that fails, such as a malformed permission rule, is skipped with a warning while the rest of the file applies.
##
@@ -332,6 +340,7 @@
[`disableCommandPluginSources`](</docs/en/settings-reference#disablecommandpluginsources>)| When `true`, blocks [`command` plugin sources](</docs/en/plugin-marketplaces#command-sources>) entirely, so the marketplace-declared command never runs. Also blocks marketplace [`headersHelper` commands](</docs/en/plugin-marketplaces#authenticate-archive-downloads>), except for a marketplace that managed settings themselves declare. When unset, follows `allowManagedHooksOnly`. Requires Claude Code v2.1.229 or later, and the `headersHelper` block requires v2.1.238 or later
[`disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>)| Reject the `--plugin-dir`, `--plugin-url`, `--agents`, and `--mcp-config` flags at startup. In cloud sessions, Claude Code drops the MCP servers the server delivered through `--mcp-config`, other than in-process `type: "sdk"` entries, and starts the session. Requires Claude Code v2.1.193 or later
[`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>)| When `true`, blocks CLI startup until remote managed settings are freshly fetched and exits if the fetch fails. See [fail-closed enforcement](</docs/en/server-managed-settings#enforce-fail-closed-startup>)
+[`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>)| Remote MCP servers provided to every user alongside their own. It provides servers rather than locking anything down. See [Provide servers through managed settings](</docs/en/managed-mcp#provide-servers-through-managed-settings>). Requires Claude Code v2.1.259 or later
[`managedSourcesBehavior`](</docs/en/settings-reference#managedsourcesbehavior>)| Whether Claude Code applies only the highest-priority managed source or composes every one of them
[`parentSettingsBehavior`](</docs/en/settings-reference#parentsettingsbehavior>)| Whether host-supplied parent settings merge under the managed policy
[`pluginSuggestionMarketplaces`](</docs/en/settings-reference#pluginsuggestionmarketplaces>)| Marketplaces whose plugins Claude Code may suggest to users
--- a/mcp.md
+++ b/mcp.md
@@ -888,7 +888,7 @@
Tool output exceeds maximum allowed tokens
-The SDK applies the same MCP output limit as Claude Code. When a tool result is larger than 25,000 tokens, the full output is saved to a file and the tool result is replaced with an error message that names the file path, so the agent can read the output back in portions. Raise the limit with the [`MAX_MCP_OUTPUT_TOKENS`](</docs/en/env-vars>) environment variable. See [MCP output limits and warnings](</docs/en/mcp#mcp-output-limits-and-warnings>) for the full behavior, including how a server can declare a higher per-tool limit with the `anthropic/maxResultSizeChars` annotation.
+The SDK applies the same MCP output limit as Claude Code. When a tool result with no image content is larger than 25,000 tokens, Claude Code saves the output to a file and replaces the tool result with an error message that names the file path, so the agent can read the output back in portions. Raise the limit with the [`MAX_MCP_OUTPUT_TOKENS`](</docs/en/env-vars>) environment variable. See [MCP output limits and warnings](</docs/en/mcp#mcp-output-limits-and-warnings>) for the full behavior, including how a server can declare a higher per-tool limit with the `anthropic/maxResultSizeChars` annotation.
##
--- a/memory.md
+++ b/memory.md
@@ -411,7 +411,7 @@
* Make instructions more specific. “Use 2-space indentation” works better than “format code nicely.”
* Look for conflicting instructions across CLAUDE.md files. If two files give different guidance for the same behavior, Claude may pick one arbitrarily.
-If the instruction is something that must run at a specific point, such as before every commit or after each file edit, write it as a [hook](</docs/en/hooks-guide>) instead. Hooks execute as shell commands at fixed lifecycle events and apply regardless of what Claude decides to do. For instructions you want at the system prompt level, use [`--append-system-prompt`](</docs/en/cli-reference#system-prompt-flags>). This must be passed every invocation, so it’s better suited to scripts and automation than interactive use.
+If the instruction is something that must run at a specific point, such as before every commit or after each file edit, write it as a [hook](</docs/en/hooks-guide>) instead. Hooks execute as shell commands at fixed lifecycle events and apply regardless of what Claude decides to do. For instructions you want at the system prompt level, use [`--append-system-prompt`](</docs/en/cli-reference#system-prompt-flags>). You pass it at launch, so it’s better suited to scripts and automation than interactive use. For how it behaves when you resume a conversation, see [System prompt flags in resumed conversations](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>).
Use the [`InstructionsLoaded` hook](</docs/en/hooks#instructionsloaded>) to log exactly which instruction files are loaded, when they load, and why. This is useful for debugging path-specific rules or lazy-loaded files in subdirectories.
Show diff (193 lines)
--- a/model-config.md
+++ b/model-config.md
@@ -28,8 +28,8 @@
Model alias| Behavior
---|---
**`default`**| Special value that clears any model override and reverts to the runtime default for your account. Not itself a model alias
-**`best`**| Uses the latest Fable model where it’s available to you, otherwise the same model as `opus`
-**`fable`**| Uses the latest Fable model for your hardest and longest-running tasks
+**`best`**| Uses the model the `fable` alias resolves to where Fable is available to you, otherwise the same model as `opus`
+**`fable`**| Uses the Fable model for your provider for your hardest and longest-running tasks
**`sonnet`**| Uses the latest Sonnet model for daily coding tasks
**`opus`**| Uses the latest Opus model for complex reasoning tasks
**`haiku`**| Uses the fast and efficient Haiku model for simple tasks
@@ -46,7 +46,7 @@
Amazon Bedrock, Google Cloud’s Agent Platform| Opus 5| Sonnet 4.5
Microsoft Foundry| Opus 4.6| Sonnet 4.5
-Unless you set `ANTHROPIC_DEFAULT_FABLE_MODEL`, the `fable` alias resolves to Fable 5.1. Before v2.1.255, it resolved to Fable 5. Where an alias resolves to an older model, newer models are available by selecting the full model name explicitly or setting `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`. Before v2.1.219, `opus` resolved to Opus 4.8 on the Anthropic API 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, `opus` resolved to Opus 4.7 on Claude Platform on AWS and to Opus 4.6 on Amazon Bedrock and Google Cloud’s Agent Platform. Aliases point to the recommended version for your provider and update over time. To pin to a specific version, use the full model name, for example `claude-opus-5`, or set the corresponding environment variable like `ANTHROPIC_DEFAULT_OPUS_MODEL`.
+Unless you set `ANTHROPIC_DEFAULT_FABLE_MODEL`, the `fable` alias resolves to Fable 5.1, except in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, where `fable` and `best` resolve to Fable 5. Before v2.1.257, `fable` resolved to Fable 5 on every provider. A gateway that isn’t configured to serve `claude-fable-5-1` rejects requests for that model. To use Fable 5.1 through a gateway that serves it, select it with `/model claude-fable-5-1`. Where an alias resolves to an older model, newer models are available by selecting the full model name explicitly or setting `ANTHROPIC_DEFAULT_OPUS_MODEL` or `ANTHROPIC_DEFAULT_SONNET_MODEL`. Before v2.1.219, `opus` resolved to Opus 4.8 on the Anthropic API 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, `opus` resolved to Opus 4.7 on Claude Platform on AWS and to Opus 4.6 on Amazon Bedrock and Google Cloud’s Agent Platform. Aliases point to the recommended version for your provider and update over time. To pin to a specific version, use the full model name, for example `claude-opus-5`, or set the corresponding environment variable like `ANTHROPIC_DEFAULT_OPUS_MODEL`.
Opus 5 requires Claude Code v2.1.219 or later. Sonnet 5 requires v2.1.197 or later. Opus 4.8 requires v2.1.154 or later. Run `claude update` to upgrade.
@@ -58,17 +58,17 @@
[Claude Fable 5.1](<https://platform.claude.com/docs/en/about-claude/models/overview>) and Claude Fable 5 are the most capable models in Claude Code, suited to tasks larger than a single sitting. They sustain long autonomous sessions, investigate before acting, and verify their work more often than smaller models. Fable 5.1 is the newer release. Neither Fable model is the account-type default on any plan or provider. Select one explicitly:
- * **Fable 5.1** : run `/model fable`, or launch with `claude --model fable`.
+ * **Fable 5.1** : run `/model fable`, or launch with `claude --model fable`. In [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, where the alias resolves to Fable 5, run `/model claude-fable-5-1` instead.
* **Fable 5** : select it by model ID. On the Anthropic API, run `/model claude-fable-5` or launch with `claude --model claude-fable-5`. On other providers, use your provider’s Fable 5 model ID or pin it with `ANTHROPIC_DEFAULT_FABLE_MODEL`.
-If your user settings hold `claude-fable-5` or `claude-fable-5[1m]` as the model, for example because you selected Fable in the `/model` picker before v2.1.255, and you connect to the Anthropic API directly, Claude Code changes that saved value to the `fable` or `fable[1m]` alias the first time you run v2.1.255 or later, and the startup model line shows `(auto-updated)` once. A `claude-fable-5` value in project, local, or managed settings is left as it is. Requests that a Fable model’s safety classifiers flag, most often in cybersecurity and biology domains, trigger automatic model fallback. To get the most from Fable:
+If you connect to the Anthropic API directly and your user settings hold `claude-fable-5` or `claude-fable-5[1m]` as the model, for example because you selected Fable in the `/model` picker before v2.1.257, Claude Code changes that saved value to the `fable` or `fable[1m]` alias the first time you run v2.1.257 or later. The startup model line shows `(auto-updated)` once. A `claude-fable-5` value in project, local, or managed settings stays as it is. Requests that a Fable model’s safety classifiers flag, most often in cybersecurity and biology domains, trigger automatic model fallback. To get the most from Fable:
* **Describe the outcome, not the steps** : hand it the result you want and let it plan the path. To keep it working toward that outcome, [set a goal](</docs/en/goal>).
* **Hand it ambiguous problems** : root-cause investigations, outage debugging, and architecture decisions are where the extra investigation and verification pay off.
* **Skip the verification reminders** : it verifies its own work with less prompting, so reminders to test or check are usually unnecessary.
* **Size up larger tasks** : give it work you would normally break into pieces. It holds long sessions without losing the thread.
-Fable 5.1 requires Claude Code v2.1.255 or later. If a request for it from an older version fails, see [Claude Code does not support this model](</docs/en/errors#claude-code-does-not-support-this-model>). Fable 5 requires v2.1.170 or later. Run `claude update` to upgrade. For availability under zero data retention, see [Model availability under ZDR](</docs/en/zero-data-retention#model-availability-under-zdr>).
+Fable 5.1 requires Claude Code v2.1.257 or later. If a request for it from an older version fails, see [Claude Code does not support this model](</docs/en/errors#claude-code-does-not-support-this-model>). Fable 5 requires v2.1.170 or later. Run `claude update` to upgrade. For availability under zero data retention, see [Model availability under ZDR](</docs/en/zero-data-retention#model-availability-under-zdr>).
On the Anthropic API, the `/model` picker lists a Fable model only after the server reports it available for your organization. When you type `/model fable` or a Fable model ID, Claude Code checks availability with the server directly, so a typed selection can succeed even when the picker doesn’t list the entry.
@@ -110,7 +110,7 @@
* `Enter`: switch model and save as your default
* `s`: switch model for this session only
-Typing `/model <name>` directly behaves like `Enter`. A model set with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. On providers that use provider-specific deployment IDs rather than Anthropic model IDs, such as Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the transcript model isn’t restored at all and the session resolves its model through the normal precedence order. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. `ANTHROPIC_DEFAULT_MODEL` can too, under the conditions listed in its section. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. On platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>), the host’s model configuration takes precedence over managed model settings, while a managed `availableModels` allowlist stays in force unless the host supplies its own; [Exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>) says which keys and variables the host overrides. When a model switch is requested through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. On the Anthropic API, Claude Code recognizes:
+Typing `/model <name>` directly behaves like `Enter`. If you set a model with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, your choice applies to the current session only and isn’t saved as your default; `/model` in that mode requires Claude Code v2.1.205 or later. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. On providers that use provider-specific deployment IDs rather than Anthropic model IDs, such as Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the transcript model isn’t restored at all and the session resolves its model through the normal precedence order. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. `ANTHROPIC_DEFAULT_MODEL` can too, under the conditions listed in its section. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. On platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>), the host’s model configuration takes precedence over managed model settings, while a managed `availableModels` allowlist stays in force unless the host supplies its own; [Exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>) says which keys and variables the host overrides. If you or your organization configure [PreModelSwitch hooks](</docs/en/hooks#premodelswitch>), they run before a requested switch applies and can block it or ask you to confirm. When Claude Code can’t tell which PreModelSwitch hooks your organization’s [managed plugins](</docs/en/settings-reference#enabledplugins>) deliver, for example because a managed plugin failed to load, it refuses the switch rather than apply it unchecked, and it checks again on each new attempt. See [Model switch was blocked by a PreModelSwitch hook](</docs/en/errors#model-switch-was-blocked-by-a-premodelswitch-hook>) for the message and recovery. When you switch models through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or from a device connected through [Remote Control](</docs/en/remote-control>), or an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI switches for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. Checking a Remote Control pick requires Claude Code v2.1.260 or later on your machine. On the Anthropic API, Claude Code recognizes:
* a model alias
* an entry from the `/model` picker
@@ -333,7 +333,7 @@
Organization effort limits
-Organization admins on Claude Enterprise plans can set a maximum effort level per model for each custom role, alongside role-level organization model restrictions. Levels above the cap aren’t offered in the `/effort` picker, and naming a higher level with `--effort` or `/effort` runs at the cap instead. In interactive sessions and plain-text `--print` runs, a warning names the requested and applied levels; with `json` or `stream-json` output or in background agents, the clamp applies silently. Caps are per model, so switching models can change which levels are available. When several of your roles grant the same model, the least restrictive cap applies. Requires Claude Code v2.1.195 or later. Effort limits are delivered together with organization model restrictions and reach the same sessions.
+Your organization can cap the effort level in two ways. On a Claude Enterprise plan, organization admins set per-role effort limits, described below. On any plan and any provider, including Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) managed setting caps effort on the client instead. When both apply to a model, the lower cap applies. Organization admins on Claude Enterprise plans can set a maximum effort level per model for each custom role, alongside role-level organization model restrictions. Levels above the cap aren’t offered in the `/effort` picker, and naming a higher level with `--effort` or `/effort` runs at the cap instead. In interactive sessions and plain-text `--print` runs, a warning names the requested and applied levels; with `json` or `stream-json` output or in background agents, the clamp applies silently. Caps are per model, so switching models can change which levels are available. When several of your roles grant the same model, the least restrictive cap applies. Requires Claude Code v2.1.195 or later. Effort limits are delivered together with organization model restrictions and reach the same sessions.
##
@@ -354,7 +354,7 @@
* **Pro and Team Standard** : defaults to Sonnet 5
* **Microsoft Foundry** : defaults to Sonnet 4.5
-Before v2.1.219, `default` resolved to Opus 4.8 on the Anthropic API, Max, 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. When 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 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. Fable models are not the account-type default on any plan or provider. Choosing one with `/model` saves it as the selected model in your user settings, so later sessions start on it. For the one-time change Claude Code makes to a saved Fable 5 selection in v2.1.255, see Work with Fable.
+Before v2.1.219, `default` resolved to Opus 4.8 on the Anthropic API, Max, 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. When 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 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. Fable models are not the account-type default on any plan or provider. Choosing one with `/model` saves it as the selected model in your user settings, so later sessions start on it. For the one-time change Claude Code makes to a saved Fable 5 selection in v2.1.257, see Work with Fable.
###
@@ -367,7 +367,7 @@
* **In plan mode** : uses `opus` for complex reasoning and architecture decisions
* **In execution mode** : automatically switches to `sonnet` for code generation and implementation
-This pairs Opus’s reasoning for planning with Sonnet’s efficiency for execution. The plan-mode Opus phase uses the same context window as the `opus` model setting. On subscription tiers where Opus is automatically upgraded to 1M context, `opusplan` receives the upgrade in plan mode as well. To force 1M context for both phases when you are not on an auto-upgrade tier, set the model to `opusplan[1m]`. When `availableModels` excludes the newest Opus but permits an older version, for example `["sonnet", "claude-opus-4-6"]`, `opusplan` uses the newest permitted Opus for planning and stays on Sonnet only when every Opus is excluded. A Haiku session that would normally upgrade to Sonnet in plan mode likewise uses the newest permitted Sonnet, and stays on Haiku only when every Sonnet is excluded. Before v2.1.205, plan mode stayed on the session’s model whenever the newest version of the upgrade family was excluded, even when the allowlist permitted an older one. The substitution of an older permitted version applies on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Mantle, whose deployments use provider-specific model IDs, plan mode stays on the session’s model whenever the upgrade model is excluded. For a hybrid approach where Claude decides mid-task when to consult a second model rather than switching at the plan boundary, see the [advisor tool](</docs/en/advisor>).
+This pairs Opus’s reasoning for planning with Sonnet’s efficiency for execution. The plan-mode Opus phase uses the same context window as the `opus` model setting. On subscription tiers where Opus is automatically upgraded to 1M context, `opusplan` receives the upgrade in plan mode as well. To force 1M context for both phases when you aren’t on an auto-upgrade tier, set the model to `opusplan[1m]`, for example with `/model opusplan[1m]`. Setting it with `/model` requires Claude Code v2.1.265 or later; on earlier versions, use the `--model` flag or the `model` setting instead. When `availableModels` excludes the newest Opus but permits an older version, for example `["sonnet", "claude-opus-4-6"]`, `opusplan` uses the newest permitted Opus for planning and stays on Sonnet only when every Opus is excluded. A Haiku session that would normally upgrade to Sonnet in plan mode likewise uses the newest permitted Sonnet, and stays on Haiku only when every Sonnet is excluded. Before v2.1.205, plan mode stayed on the session’s model whenever the newest version of the upgrade family was excluded, even when the allowlist permitted an older one. The substitution of an older permitted version applies on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Mantle, whose deployments use provider-specific model IDs, plan mode stays on the session’s model whenever the upgrade model is excluded. For a hybrid approach where Claude decides mid-task when to consult a second model rather than switching at the plan boundary, see the [advisor tool](</docs/en/advisor>).
###
@@ -462,18 +462,25 @@
Opus 5, Sonnet 5, Opus 4.8, and Opus 4.7| `low`, `medium`, `high`, `xhigh`, `max`
Opus 4.6 and Sonnet 4.6| `low`, `medium`, `high`, `max`
-If you set a level the active model does not support, Claude Code falls back to the highest supported level at or below the one you set. For example, `xhigh` runs as `high` on Opus 4.6. Your organization can also cap which levels are available for a model; see Organization effort limits. With the [`ultracode`](</docs/en/settings-reference#ultracode>) setting off, Claude Code resolves the session’s effort level in this order, taking the first that applies:
+If you set a level the active model does not support, Claude Code falls back to the highest supported level at or below the one you set. For example, `xhigh` runs as `high` on Opus 4.6. Your organization or your own settings can also cap the levels a model offers; see Organization effort limits. With the [`ultracode`](</docs/en/settings-reference#ultracode>) setting off, Claude Code resolves the session’s effort level in this order, taking the first that applies:
1. An explicit choice: the [`CLAUDE_CODE_EFFORT_LEVEL`](</docs/en/env-vars#variables>) environment variable, launching with `--effort`, or `/effort` in the session (a non-interactive `/effort` has narrower effect)
- 2. The model’s default effort, on Fable 5, Opus 4.8, or Opus 4.7: from the first time you run one of these models, Claude Code holds that model’s default effort across sessions, even when your settings resolve a different level, until you change effort once, for example with an interactive `/effort`, the `/model` picker’s effort slider, or `--effort` at launch. Opus 5 and Fable 5.1 have no such hold
+ 2. The model’s default effort, on Fable 5, Opus 4.8, or Opus 4.7: from the first time you run one of these models, Claude Code holds that model’s default effort across sessions, even when your settings resolve a different level. Opus 5 and Fable 5.1 have no such hold. Whether a level you set ends the hold depends on how you set it, for example:
+ * **Ends the hold** : confirming a level interactively, with `Enter` in the `/effort` slider or the `/model` picker or with a level typed after `/effort`, or picking a level from a connected device’s [Remote Control](</docs/en/remote-control#what-connected-devices-see>) effort control
+ * **Leaves the hold in place for later sessions** : `--effort` at launch, or `s` in the `/effort` slider or the `/model` picker
3. Your settings: the level you saved for the model or an [`effortLevel`](</docs/en/settings-reference#effortlevel>) key, with the precedence between them and across settings files stated at [`modelSettings`](</docs/en/settings-reference#modelsettings>)
4. The model’s default effort: `high` on every model that supports effort, except that Opus 4.7 defaults to `xhigh` and, when your organization sets a default effort level for its organization default model, that level is the default when you run that model
-When you set `low`, `medium`, `high`, or `xhigh` in an interactive session on your machine, Claude Code saves the level and applies it in later sessions. It saves the level per model, under the [`modelSettings`](</docs/en/settings-reference#modelsettings>) key in your user settings, so each model keeps its own saved level. `max` is the deepest reasoning level. Unless you set it through the `CLAUDE_CODE_EFFORT_LEVEL` environment variable, Claude Code applies `max` to the current session only.
+When you set `low`, `medium`, `high`, or `xhigh` in an interactive session on your machine, you choose how long it lasts by how you confirm it:
+
+ * `Enter` in the `/effort` slider or the `/model` picker, or a level typed after `/effort`: save the level as your default and apply it in later sessions
+ * `s` in the `/effort` slider or the `/model` picker: apply the level to this session only. Requires Claude Code v2.1.257 or later
+
+Claude Code saves the level per model, under the [`modelSettings`](</docs/en/settings-reference#modelsettings>) key in your user settings, so each model keeps its own saved level. `max` is the deepest reasoning level. Unless you set it through the `CLAUDE_CODE_EFFORT_LEVEL` environment variable, Claude Code applies `max` to the current session only.
A level you pick from the effort control on a phone or browser connected through [Remote Control](</docs/en/remote-control#what-connected-devices-see>) applies to that session only.
-A level set with `/effort` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. It also doesn’t count as the one change that ends the model-default step above on Fable 5, Opus 4.8, or Opus 4.7: while that step is in effect, a non-interactive `/effort` reports `Not applied`, so pass `--effort` at launch instead. The `/effort` menu also offers `ultracode`. Ultracode is a Claude Code setting rather than a model effort level: it sends `xhigh` to the model and additionally has Claude orchestrate [dynamic workflows](</docs/en/workflows>) for substantive tasks. For where it can be set persistently, see the [`ultracode`](</docs/en/settings-reference#ultracode>) setting. You can turn on ultracode through any of the following:
+When you set a level with `/effort` in a [`-p` run](</docs/en/headless>), Claude Code applies it to that session only and doesn’t save it as your default. On Fable 5, Opus 4.8, and Opus 4.7, that level also neither ends the hold on the model’s default effort nor overrides it for the session. While that hold is in effect, a non-interactive `/effort` reports `Not applied`, so pass `--effort` at launch instead. The `/effort` menu also offers `ultracode`. Ultracode is a Claude Code setting rather than a model effort level: it sends `xhigh` to the model and additionally has Claude orchestrate [dynamic workflows](</docs/en/workflows>) for substantive tasks. For where it can be set persistently, see the [`ultracode`](</docs/en/settings-reference#ultracode>) setting. You can turn on ultracode through any of the following:
* **`/effort`** : run `/effort ultracode`, or select it from the menu
* **`--effort` flag**: launch with `claude --effort ultracode`, which starts the session at `xhigh` effort with ultracode on
@@ -521,11 +528,11 @@
* **In`/model`**: use left/right arrow keys to adjust the effort slider when selecting a model
* **`--effort` flag**: pass a level name to set it for a single session when launching Claude Code
* **Environment variable** : set `CLAUDE_CODE_EFFORT_LEVEL` to a level name or `auto`
- * **Settings** : set a per-model level in [`modelSettings`](</docs/en/settings-reference#modelsettings>), or set [`effortLevel`](</docs/en/settings-reference#effortlevel>) to `low`, `medium`, `high`, or `xhigh` as the default for models without one. `max` isn’t accepted in either key, and `ultracode` has its own [`ultracode`](</docs/en/settings-reference#ultracode>) key
- * **From a connected device** : in a [Remote Control](</docs/en/remote-control#what-connected-devices-see>) session, pick a level from the effort control on your phone or in your browser. The level applies to the current session only. Requires Claude Code v2.1.234 or later
+ * **Settings** : set a per-model level in [`modelSettings`](</docs/en/settings-reference#modelsettings>), or set [`effortLevel`](</docs/en/settings-reference#effortlevel>) to `low`, `medium`, `high`, or `xhigh` as the default for models without one. `max` isn’t accepted as a level in either key, and `ultracode` has its own [`ultracode`](</docs/en/settings-reference#ultracode>) key
+ * **From a connected device** : in a [Remote Control](</docs/en/remote-control#what-connected-devices-see>) session, pick a level from the effort control on your phone or in your browser. The level applies to the current session only, though it also ends the hold on the model’s default effort. Requires Claude Code v2.1.234 or later
* **Skill and subagent frontmatter** : set `effort` in a [skill](</docs/en/skills#frontmatter-reference>) or [subagent](</docs/en/sub-agents#supported-frontmatter-fields>) markdown file to override the effort level when that skill or subagent runs
-Frontmatter effort applies when that skill or subagent is active, overriding the session level but not the environment variable. The `effortLevel` key in [managed settings](</docs/en/managed-settings>) is a starting default, not enforcement: users can change it for a session with `/effort` or `--effort`, and the managed value re-asserts as the default in new sessions. The effort slider appears in `/model` when a supported model is selected. The current effort level is also shown in the session header next to the model name, for example “with low effort”, so you can confirm which setting is active without opening `/model`. The footer also briefly shows the effort level at startup and when it changes.
+Frontmatter effort applies when that skill or subagent is active, overriding the session level but not the environment variable. If you set `effortLevel` in [managed settings](</docs/en/managed-settings>), Claude Code applies it at the settings step of the effort resolution order, and users can still change the level with `/effort` or `--effort`. To keep users at or below a level, set [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>). The effort slider appears in `/model` when a supported model is selected. The current effort level is also shown in the session header next to the model name, for example “with low effort”, so you can confirm which setting is active without opening `/model`. The footer also briefly shows the effort level at startup and when it changes.
####
@@ -533,7 +540,7 @@
Adaptive reasoning and fixed thinking budgets
-Adaptive reasoning makes thinking optional on each step, so Claude can respond faster to routine prompts and reserve deeper thinking for steps that benefit from it. If you want Claude to think more or less often than the current level produces, you can say so directly in your prompt or in `CLAUDE.md`; the model responds to that guidance within its effort setting. Fable 5.1, Fable 5, Sonnet 5, and Opus 4.7 and later always use adaptive reasoning. The fixed thinking budget mode and `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` do not apply to them. On Opus 4.6 and Sonnet 4.6, you can set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` to revert to the previous fixed thinking budget controlled by `MAX_THINKING_TOKENS`. See [environment variables](</docs/en/env-vars>).
+Adaptive reasoning makes thinking optional on each step, so Claude can respond faster to routine prompts and reserve deeper thinking for steps that benefit from it. If you want Claude to think more or less often than the current level produces, you can say so directly in your prompt or in `CLAUDE.md`; the model responds to that guidance within its effort setting. Fable models, Sonnet 5, and Opus 4.7 and later always use adaptive reasoning. The fixed thinking budget mode and `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` don’t apply to them. On Opus 4.6 and Sonnet 4.6, you can set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` to revert to the previous fixed thinking budget controlled by `MAX_THINKING_TOKENS`. See [environment variables](</docs/en/env-vars>).
###
@@ -547,9 +554,9 @@
---|---
Toggle for the current session| Press `Option+T` on macOS or `Alt+T` on Windows and Linux
Set the global default| Run `/config` and toggle thinking mode. Saved as `alwaysThinkingEnabled` in `~/.claude/settings.json`
-Disable through an environment variable| Set [`MAX_THINKING_TOKENS=0`](</docs/en/env-vars>), which turns thinking off on the Anthropic API except on Fable 5.1 and Fable 5. On [third-party providers](</docs/en/third-party-integrations>) this omits the `thinking` parameter instead, and adaptive-reasoning models may still think. Other values apply only with a fixed thinking budget
-
-Thinking cannot be turned off on Fable 5.1 or Fable 5. The session toggle, `alwaysThinkingEnabled`, and `MAX_THINKING_TOKENS=0` have no effect there, and the model decides per step how much to think based on the effort level. Claude Code collapses thinking output by default. Press `Ctrl+O` to toggle verbose mode and see the reasoning as gray italic text. Interactive sessions on the Anthropic API receive redacted thinking blocks by default, so set `showThinkingSummaries: true` in [settings](</docs/en/settings>) if you want the full summaries available when you expand. You are charged for all thinking tokens generated, even when collapsed or redacted.
+Disable through an environment variable| Set [`MAX_THINKING_TOKENS=0`](</docs/en/env-vars>), which turns thinking off on the Anthropic API except on Fable models. On [third-party providers](</docs/en/third-party-integrations>), Claude Code omits the `thinking` parameter instead, and adaptive-reasoning models may still think. Other values apply only with a fixed thinking budget
+
+You can’t turn thinking off on Fable models. The session toggle, `alwaysThinkingEnabled`, and `MAX_THINKING_TOKENS=0` have no effect there, and a Fable model decides per step how much to think based on the effort level. Claude Code collapses thinking output by default. Press `Ctrl+O` to toggle verbose mode and see the reasoning as gray italic text. Interactive sessions on the Anthropic API receive redacted thinking blocks by default, so set `showThinkingSummaries: true` in [settings](</docs/en/settings>) if you want the full summaries available when you expand. You are charged for all thinking tokens generated, even when collapsed or redacted.
###
@@ -629,7 +636,7 @@
* [Cloud sessions](</docs/en/claude-code-on-the-web>) compact as the conversation approaches the model’s limit
* Sonnet 4.6 and Opus 4.6 without extended context compact at the 200K boundary, and so do Opus 4.8 and Opus 5 when they run with a 200K context window, such as on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry
* When you set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>), models with a native 1M window, such as Sonnet 5 and the Fable models, compact at the 200K boundary
- * Sonnet 5 compacts at the threshold for its configuration
+ * Models running with a native 1M window, such as Sonnet 5, the Fable models, and Opus 4.7 and later on the Anthropic API, compact before the window fills, at about 967K tokens by default. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, Pin models for third-party deployments says which models run with that window; for the configurations that budget Sonnet 5 at 200K instead, see Sonnet 5 context window
* Sessions on a model ID Claude Code doesn’t recognize, such as an [LLM gateway](</docs/en/llm-gateway>) alias, compact at the context window Claude Code assumes for the ID; see Correct the window for a gateway or custom model ID
###
@@ -638,11 +645,11 @@
Correct the window for a gateway or custom model ID
-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. [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](</docs/en/env-vars>) declares the window Claude Code should assume instead. How the variable applies depends on the ID. An unrecognized ID, an unrecognized `[1m]` ID, and an ID that starts with `claude-` or resolves to a Claude model are three separate cases:
-
- * If the ID doesn’t start with `claude-` or contain `[1m]`, in any casing, and Claude Code can’t resolve it to a Claude model, the variable applies directly and proactive compaction continues at the declared window.
- * If the ID doesn’t start with `claude-` but contains `[1m]`, in any casing, and Claude Code can’t resolve it to a Claude model, 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 a declared window above 200K, Claude Code then shows a [startup warning](</docs/en/errors#the-200k-limit-isnt-enforced>) that the 200K limit isn’t enforced. The warning is expected in this configuration.
- * If the ID starts with `claude-` in any casing or resolves to a Claude model, the variable takes effect only when [`DISABLE_COMPACT`](</docs/en/env-vars>) is also set, which disables all compaction. For example, Claude Code resolves an ID that contains a Claude model name, such as `anthropic/claude-opus-4-8` or `us.anthropic.claude-…-v1:0`, 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. 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, Claude Code then shows a [startup warning](</docs/en/errors#the-200k-limit-isnt-enforced>) that the 200K limit isn’t enforced. The warning 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.
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.
@@ -712,17 +719,17 @@
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. To enable extended context for a pinned model, append `[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. To enable extended context for a pinned model, append `[1m]` to the model ID in `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, or `ANTHROPIC_DEFAULT_FABLE_MODEL`:
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8[1m]'
-The `[1m]` suffix applies the 1M context window to all usage of the `opus` and `sonnet` aliases, including the plan-mode Opus phase of `opusplan`.
+With the `[1m]` suffix, the 1M context window applies to all usage of the pinned alias, including the plan-mode Opus phase of `opusplan` and [subagents](</docs/en/sub-agents#choose-a-model>) whose `model` frontmatter names the alias.
* Claude Code strips the suffix before sending the model ID to your provider.
* Only append `[1m]` when the underlying model [supports 1M context](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>).
* The suffix is read per variable, not per model. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, a model ID without `[1m]` in one variable uses 200K context even if another variable sets the same model with the suffix. Sonnet 5 always runs with the 1M window on these providers and never needs the suffix.
-An `availableModels` allowlist delivered through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>) still applies when using third-party providers; [server-managed settings are not delivered there](</docs/en/server-managed-settings#platform-availability>).Filtering matches on a model alias such as `opus`, a version prefix such as `claude-opus-4-8`, or the full provider-form model ID. Provider-specific prefixes such as `us.anthropic.` are not stripped, so to allow a specific model, list its full provider-form ID, or map it through `modelOverrides`. Any `[1m]` suffix is stripped from both the allowlist entry and the requested model before matching.
+An `availableModels` allowlist delivered through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>) still applies when using third-party providers; [server-managed settings are not delivered there](</docs/en/server-managed-settings#platform-availability>).Filtering matches on a model alias such as `opus`, a version prefix such as `claude-opus-4-8`, or the full provider-form model ID. Provider-specific prefixes such as `us.anthropic.` are not stripped, so to allow a specific model, list its full provider-form ID, or map it through `modelOverrides`. For a pinned model, that ID is the value you set in its `ANTHROPIC_DEFAULT_*_MODEL` variable. Any `[1m]` suffix is stripped from both the allowlist entry and the requested model before matching.
###
--- a/modifying-system-prompts.md
+++ b/modifying-system-prompts.md
@@ -42,7 +42,7 @@
Customize agent behavior
-Output styles, `append`, and a custom prompt string each change the system prompt directly. CLAUDE.md takes a different path: the SDK reads it and injects its content into the conversation as project context, not into the system prompt, so it shapes behavior alongside whichever system prompt you choose. [Skills](</docs/en/agent-sdk/skills>), [hooks](</docs/en/agent-sdk/hooks>), and [permissions](</docs/en/agent-sdk/permissions>) also shape behavior outside the system prompt and are covered on their own pages.
+`append` and a custom prompt string each change the system prompt directly, and an output style changes the instructions Claude Code gives Claude for every response. CLAUDE.md takes a different path: the SDK reads it and injects its content into the conversation as project context, so it shapes behavior alongside whichever system prompt you choose. [Skills](</docs/en/agent-sdk/skills>), [hooks](</docs/en/agent-sdk/hooks>), and [permissions](</docs/en/agent-sdk/permissions>) also shape behavior outside the system prompt and are covered on their own pages.
###
@@ -114,7 +114,7 @@
Output styles for persistent configurations
-Output styles are saved configurations that modify Claude’s system prompt. They’re stored as markdown files and can be reused across sessions and projects.
+Output styles are saved sets of instructions that change Claude’s role, tone, and output format. They’re stored as markdown files and can be reused across sessions and projects.
####
@@ -364,6 +364,14 @@
* The SDK joins the strings on each side of the marker with a blank line between them and removes the marker itself, so the marker text doesn’t reach Claude.
* If you include the marker more than once, the first one is the split and the SDK removes the others.
* If you leave the marker out, the SDK joins all the strings into one block, the same as passing one string.
+
+###
+
+
+
+Change the prompt of an existing session
+
+By default, Claude Code builds the system prompt once, on a session’s first request, with your `append` text or custom prompt included, and records it in the session. Until the session is compacted, every later request uses that recorded prompt, including after you return to the session with `resume` or `continue`. If you pass a different `append` or custom prompt on that later call, it takes effect once the session is compacted or in a new session. Recording applies in sessions that [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), as sessions using a claude.ai or Console account do by default. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and in other sessions that don’t fetch them, Claude Code rebuilds the prompt on every request. If you start Claude Code in [bare mode](</docs/en/headless#start-faster-with-bare-mode>) by passing `--bare` through `extraArgs` or setting `CLAUDE_CODE_SIMPLE=1`, recording stays off unless you set `snapshot: true` on the object form of `systemPrompt`. Recording an `append` or custom prompt by default requires Claude Code v2.1.265 or later, which the TypeScript Agent SDK bundles from v0.3.265. To rebuild the prompt on every request instead, set `snapshot: false` on the object form of `systemPrompt` in the TypeScript SDK: `{ type: "preset", preset: "claude_code", append, snapshot: false }` or `{ type: "custom", prompt, snapshot: false }`. Use this form while you iterate on prompt wording, or when your application changes `append` between calls that resume the same session. The `snapshot` field requires `@anthropic-ai/claude-agent-sdk` v0.3.257 or later and has no effect in sessions that don’t fetch feature flags.
##
--- a/network-config.md
+++ b/network-config.md
@@ -204,6 +204,7 @@
`bridge.claudeusercontent.com`| [Claude in Chrome](</docs/en/chrome>) extension WebSocket bridge
`*.frame.claudeusercontent.com`| [Artifact](</docs/en/artifacts>) content reads. The CLI fetches an artifact’s files from this host when Claude opens one, and only when the Artifact tool is [available](</docs/en/artifacts#availability>) for your account. To turn the tool off and drop this requirement, set [`"enableArtifact": false`](</docs/en/settings-reference#enableartifact>) or [`CLAUDE_CODE_DISABLE_ARTIFACT=1`](</docs/en/env-vars>); Claude Code also honors the deprecated [`disableArtifact`](</docs/en/settings-reference#disableartifact>) setting. See [Disable artifacts](</docs/en/artifacts#disable-artifacts>) for how these settings interact
`raw.githubusercontent.com`| Changelog feed for [`/release-notes`](</docs/en/commands>). In interactive sessions, Claude Code also fetches it in the background at startup when its cached changelog doesn’t yet cover the running version, such as the first start after an update; non-interactive and cloud sessions never fetch it
+`*-review.googlesource.com`| Gerrit change lookup on `googlesource.com` checkouts. When a Claude Desktop Code tab session starts or resumes on a [trusted](</docs/en/permissions#project-allow-rules-and-workspace-trust>) checkout whose `origin` is a `googlesource.com` host, Claude Code asks that host’s `-review` server anonymously for the open change matching HEAD’s `Change-Id`, once per start or resume. Other session types skip the lookup, and no other Gerrit host is contacted. Optional: disable with [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`](</docs/en/env-vars>)
`http-intake.logs.us5.datadoghq.com`| Operational telemetry events, sent only when the CLI uses the Anthropic API directly, never for Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. Optional: disable with [`DISABLE_TELEMETRY`](</docs/en/data-usage#telemetry-services>) or `DO_NOT_TRACK`
`browser-intake-us5-datadoghq.com`| Operational error reports, sent when the CLI uses the Anthropic API directly and a server-side rollout gate enables them. Optional: disable with `DISABLE_ERROR_REPORTING` or `DISABLE_TELEMETRY`; see [Telemetry services](</docs/en/data-usage#telemetry-services>)
`formulae.brew.sh`| Update version checks on Homebrew installs. Other install methods don’t contact this host
--- a/output-styles.md
+++ b/output-styles.md
@@ -1,4 +1,4 @@
-Output styles change how Claude responds, not what Claude knows. They modify the system prompt to set role, tone, and output format. Use one when you keep re-prompting for the same voice or format every turn, or when you want Claude to act as something other than a software engineer. A custom output style adds your instructions to the system prompt and lets you choose whether to keep Claude Code’s built-in software engineering instructions. Keep them when you’re changing how Claude communicates but still coding, like always answering with a diagram. Leave them out when Claude isn’t doing software engineering at all, like a writing assistant or data analyst. For instructions about your project, conventions, or codebase, use [CLAUDE.md](</docs/en/memory>) instead.
+Output styles change how Claude responds, not what Claude knows. They set Claude’s role, tone, and output format for every response. Use one when you keep re-prompting for the same voice or format every turn, or when you want Claude to act as something other than a software engineer. A custom output style gives Claude your own instructions and lets you choose whether to keep Claude Code’s built-in software engineering instructions. Keep them when you’re changing how Claude communicates but still coding, like always answering with a diagram. Leave them out when Claude isn’t doing software engineering at all, like a writing assistant or data analyst. For instructions about your project, conventions, or codebase, use [CLAUDE.md](</docs/en/memory>) instead.
##
@@ -6,7 +6,7 @@
Built-in output styles
-Claude Code’s **Default** output style is the existing system prompt, designed to help you complete software engineering tasks efficiently. There are four additional built-in output styles:
+Claude Code’s **Default** output style is its standard set of instructions, designed to help you complete software engineering tasks efficiently. There are four additional built-in output styles:
* **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This is stronger autonomous-execution guidance than [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) applies, and it works without changing your permission mode, so your permission mode still decides what runs without asking you.
* **Concise** : Claude leads with the result, skips preamble and narration, and keeps responses short by default, while doing the engineering work as thoroughly as in the Default style. When you ask for an explanation or more detail, Claude answers in full. Claude always keeps the complete content of error reports, security warnings, and confirmations for destructive actions. Requires Claude Code v2.1.237 or later.
@@ -33,7 +33,7 @@
"outputStyle": "Explanatory"
}
-When you switch styles mid-session, Claude uses the new style starting with your next message. The style is part of the system prompt, so that first message rebuilds the [prompt cache](</docs/en/prompt-caching#changing-output-style>) once. Before v2.1.251, the new style applied only after you ran `/clear` or started a new session.
+When you switch styles mid-session, Claude uses the new style starting with your next message. For what that first message costs in prompt caching, see [Changing output style](</docs/en/prompt-caching#changing-output-style>). Before v2.1.251, the new style applied only after you ran `/clear` or started a new session.
##
@@ -41,7 +41,7 @@
Create a custom output style
-A custom output style is a Markdown file: frontmatter for metadata, then the instructions to add to the system prompt.
+A custom output style is a Markdown file: frontmatter for metadata, then the instructions for Claude. In the VS Code extension, you can also create the file from the [**Output styles** menu](</docs/en/vs-code#use-the-prompt-box>) rather than writing it by hand. This requires Claude Code v2.1.261 or later.
1
@@ -102,13 +102,13 @@
How output styles work
-Output styles directly modify Claude Code’s system prompt.
+An output style changes the instructions Claude Code gives Claude.
- * Claude Code adds the output style’s custom instructions to the system prompt.
+ * Claude Code sends the active style’s instructions with every request.
* When you select a style other than Default, Claude Code also reminds Claude of the style during the conversation.
* Custom output styles leave out Claude Code’s built-in software engineering instructions, such as how to scope changes, write comments, and verify work, unless `keep-coding-instructions` is set to `true`.
-Output styles apply to the main conversation only: a [subagent runs its own system prompt](</docs/en/sub-agents#what-loads-at-startup>), so styles don’t change how subagents respond. A [fork](</docs/en/sub-agents#fork-the-current-conversation>) is the exception, because it inherits the parent’s full system prompt. Token usage depends on the style. Adding instructions to the system prompt increases input tokens, though prompt caching reduces this cost after the first request in a session. The built-in Explanatory and Learning styles produce longer responses than Default by design, which increases output tokens, and the Concise style does the opposite by instructing Claude to keep responses short by default. For custom styles, output token usage depends on what your instructions tell Claude to produce.
+Output styles apply to the main conversation and to a [fork](</docs/en/sub-agents#fork-the-current-conversation>), which inherits the parent’s full conversation and system prompt. Other [subagents run their own system prompt](</docs/en/sub-agents#what-loads-at-startup>), so styles don’t change how they respond. Token usage depends on the style. A style’s instructions add input tokens, though prompt caching reduces this cost after the first request in a session. The built-in Explanatory and Learning styles produce longer responses than Default by design, which increases output tokens. The Concise style does the opposite by instructing Claude to keep responses short by default. For custom styles, output token usage depends on what your instructions tell Claude to produce.
##
@@ -116,13 +116,13 @@
Comparisons to related features
-Several features customize how Claude Code behaves. Output styles modify the system prompt directly and apply to every response. The others add instructions without changing the default system prompt, or scope them to a specific task.
+Several features customize how Claude Code behaves. Output styles change Claude Code’s default instructions and apply to every response. The others add instructions without changing the defaults, or scope them to a specific task.
Feature| How it works| Use it when
---|---|---
-Output styles| Modifies the system prompt| You want a different role, tone, or default response format every turn
+Output styles| Changes Claude Code’s default instructions| You want a different role, tone, or default response format every turn
[CLAUDE.md](</docs/en/memory>)| Adds a user message after the system prompt| Claude should always know your project conventions and codebase context
-`--append-system-prompt`| Appends to the system prompt without removing anything| You want a one-off addition for a single invocation
+`--append-system-prompt`| Appends to the system prompt without removing anything| You want a one-off addition passed as a [CLI flag](</docs/en/cli-reference#system-prompt-flags>) at launch
[Agents](</docs/en/sub-agents>)| Runs a subagent with its own system prompt, model, and tools| You want a separately scoped helper for a focused task
[Skills](</docs/en/skills>)| Loads task-specific instructions when invoked or relevant| You have a reusable workflow
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -115,7 +115,7 @@
Switch permission modes
-Each interface has its own control for switching permission modes during a session and its own way of choosing the permission mode new sessions start in. Asking Claude in chat to change the permission mode doesn’t work. Select your interface to see its controls.
+Each interface has its own control for switching permission modes during a session and its own way of choosing the permission mode new sessions start in. Select your interface to see its controls.
* CLI
@@ -331,7 +331,7 @@
* Installing dependencies declared in your lock files or manifests
* Reading `.env` and sending credentials to their matching API
* Read-only HTTP requests
- * Pushing to any branch of the repository you’re working in, including the default branch. A non-default branch whose name marks it as a deploy or publication target, such as `production` or `gh-pages`, isn’t covered: the classifier judges a push there on its own terms. The push’s content is still checked against the other rules, [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) can still block pushes to specific branches outright in every mode, and the remote’s own branch protection still applies. Before v2.1.211, only pushes to the branch you started on, branches Claude created, and routine pushes to the default branch were allowed by default, and before v2.1.203 any direct push to the default branch was blocked
+ * Pushing to any branch of the repository you’re working in, including the default branch. A non-default branch whose name marks it as a deploy or publication target, such as `production` or `gh-pages`, isn’t covered: the classifier judges a push there on its own terms. The push’s content is still checked against the other rules, [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) can still block push commands [as written](</docs/en/permissions#bash-rule-limits>) in every mode, and the remote’s own branch protection still applies. Before v2.1.211, only pushes to the branch you started on, branches Claude created, and routine pushes to the default branch were allowed by default, and before v2.1.203 any direct push to the default branch was blocked
Claude Code v2.1.195 and later also allow these by default:
@@ -348,7 +348,7 @@
* A deny that the classifier reached by evaluating the request lasts for the turn in the interactive CLI. In [non-interactive mode](</docs/en/headless>) and Agent SDK sessions, Claude Code reuses that deny for the rest of the run, because those sessions have no turn boundary
* Changing your permission mode or rules drops all cached verdicts
-Run `claude auto-mode defaults` to print the full rule lists as JSON. If routine actions get blocked, an administrator can add trusted repos, buckets, and services via the `autoMode.environment` setting: see [Configure auto mode](</docs/en/auto-mode-config>). Pushing to any branch of the repository you’re working in and creating a pull request that matches your request run without a prompt, unless the push or pull request falls under the blocked list, such as secrets or sensitive data leaving the repository, or a pull request that targets a different repository or organization. To require a human checkpoint before these actions while staying in auto mode, add `permissions.ask` rules: see [Common boundaries](</docs/en/auto-mode-config#common-boundaries>).
+Run `claude auto-mode defaults` to print the full rule lists as JSON. If routine actions get blocked, an administrator can add trusted repos, buckets, and services via the `autoMode.environment` setting: see [Configure auto mode](</docs/en/auto-mode-config>). Pushing to any branch of the repository you’re working in and creating a pull request that matches your request run without a prompt, unless the push or pull request falls under the blocked list, such as secrets or sensitive data leaving the repository, or a pull request that targets a different repository or organization. To require a human checkpoint before these commands while staying in auto mode, add `permissions.ask` rules, which match the command [as written](</docs/en/permissions#bash-rule-limits>): see [Common boundaries](</docs/en/auto-mode-config#common-boundaries>).
###
--- a/permissions.md
+++ b/permissions.md
@@ -30,7 +30,12 @@
Permission mode
-Apply the active permission mode. `bypassPermissions` approves everything that reaches this step except `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>), which fall through instead. `acceptEdits` approves the file operations listed under Accept edits mode. `plan` routes file-edit and shell-write tools to your `canUseTool` callback regardless of allow rules, so write operations cannot be auto-approved while planning. Other modes fall through.
+Apply the active permission mode:
+
+ * In `bypassPermissions` mode, Claude Code approves everything that reaches this step except `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>), which fall through instead.
+ * In `acceptEdits` mode, Claude Code approves the file operations listed under Accept edits mode.
+ * In `plan` mode, Claude Code sends file-edit and shell-write tools to your `canUseTool` callback regardless of allow rules, so write operations can’t be auto-approved while planning.
+ * In other modes, the request falls through.
5
@@ -66,7 +71,7 @@
---|---
`allowed_tools=["Read", "Grep"]`| `Read` and `Grep` are auto-approved. Other tools not listed here still exist and fall through to the permission mode and `canUseTool`.
`disallowed_tools=["Bash"]`| The `Bash` tool definition is removed from the request. Claude does not see the tool and cannot attempt it.
-`disallowed_tools=["Bash(rm *)"]`| `Bash` stays available. Calls matching `rm *` are denied in every permission mode, including `bypassPermissions`. Other `Bash` calls fall through to the permission mode.
+`disallowed_tools=["Bash(rm *)"]`| `Bash` stays available. Calls matching `rm *` [as written](</docs/en/permissions#bash-rule-limits>) are denied in every permission mode, including `bypassPermissions`. Other `Bash` calls, including `/bin/rm`, fall through to the permission mode.
`disallowed_tools=["*"]`| Every tool definition is removed from the request. Tool-name globs are supported in deny rules: `"*"` matches every tool and `"mcp__*"` matches every MCP tool across all servers.
Allow rules accept tool-name globs only after a literal `mcp__<server>__` prefix. The server segment must be glob-free so the rule names a specific server you configured: `mcp__puppeteer__*` matches every tool from the `puppeteer` server, and `mcp__github__get_*` matches its `get_` tools. An unanchored entry like `allowed_tools=["*"]` or `allowed_tools=["mcp__*"]` is ignored with a startup warning and does not auto-approve anything. Scoped rules for `Read` and `Edit` take a path pattern. `Edit(path)` rules govern all built-in tools that write files, including `Write` and `NotebookEdit`; a `Write(path)` rule is never matched by the file permission checks. Use `//path` for an absolute filesystem path: a deny rule of `Edit(//secrets/**)` blocks writes anywhere under `/secrets` on disk. With a single leading slash, `Edit(/secrets/**)` anchors at the rule’s source instead. For rules passed through `allowed_tools` or `disallowed_tools`, that means the session’s working directory, so the rule doesn’t block `/secrets` on disk. See [Read and Edit rules](</docs/en/permissions#read-and-edit>) for the four anchor forms and how rules from settings files resolve.
@@ -109,7 +114,7 @@
`plan`| Planning mode| Claude explores and plans without editing your source files; file edits are never auto-approved and prompt through your `canUseTool` callback
`auto`| Model-classified approvals| A model classifier approves or denies permission prompts. See [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) for availability
-**Subagent inheritance:** Subagents inherit the parent session’s permission mode. An [`AgentDefinition`’s `permissionMode`](</docs/en/agent-sdk/typescript#agentdefinition>) can override it, except when the parent uses `bypassPermissions`, `acceptEdits`, or `auto`: those modes apply to every subagent and can’t be overridden per subagent. Claude Code also ignores a definition’s `permissionMode: "bypassPermissions"` when bypass mode is disabled by [`permissions.disableBypassPermissionsMode`](</docs/en/permissions#managed-settings>), so that subagent runs with the parent session’s mode.Subagents may have different system prompts and less constrained behavior than your main agent, so inheriting `bypassPermissions` grants them full, autonomous system access. The [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) still apply.
+**Subagent inheritance:** A subagent runs in the parent session’s permission mode unless you set `permissionMode` on its [`AgentDefinition`](</docs/en/agent-sdk/typescript#agentdefinition>) and the parent session is in `default`, `dontAsk`, or `plan` mode. Even then, Claude Code never applies a `"bypassPermissions"` value. A subagent runs in `bypassPermissions` mode only when the parent session itself does. The `bypassPermissions` exception requires Claude Code v2.1.267 or later.Subagents may have different system prompts and less constrained behavior than your main agent, so inheriting `bypassPermissions` grants them full, autonomous system access. The [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) still apply.
###
@@ -228,7 +233,13 @@
* File edits (Edit, Write tools)
* Filesystem commands: `mkdir`, `touch`, `rm`, `rmdir`, `mv`, `cp`, `sed`
-Both apply only to paths inside the working directory or `additionalDirectories`. Paths outside that scope, writes to protected paths, and `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>) still prompt. **Use when:** you trust Claude’s edits and want faster iteration, such as during prototyping or when working in an isolated directory.
+Both apply only to paths inside the working directory or `additionalDirectories`. In `acceptEdits` mode, Claude Code doesn’t auto-approve the request when Claude:
+
+ * Works on a path outside that scope
+ * Writes to a protected path
+ * Removes a [critical path](</docs/en/permission-modes#critical-paths>) with `rm` or `rmdir`
+
+**Use when:** you trust Claude’s edits and want faster iteration, such as during prototyping or when working in an isolated directory.
####
--- a/plugin-dependencies.md
+++ b/plugin-dependencies.md
@@ -103,7 +103,7 @@
claude --plugin-dir ./my-dependency --plugin-dir ./my-plugin
-The local copy of the dependency satisfies your plugin’s dependency entry, even when the entry names a marketplace, so you don’t need to install the dependency from its marketplace. Claude Code doesn’t check a version constraint against a local copy, so the local `plugin.json` doesn’t need a `version`. Before v2.1.242, a dependency entry that named a marketplace never matched the local copy, and Claude Code disabled your plugin at load. If you haven’t installed the dependency from its marketplace, your plugin stops loading when the local copy goes away:
+The local copy of the dependency satisfies your plugin’s dependency entry, even when the entry names a marketplace, so you don’t need to install the dependency from its marketplace. Claude Code doesn’t check a version constraint against a local copy, so the local `plugin.json` doesn’t need a `version`. Before v2.1.242, a dependency entry that named a marketplace never matched the local copy, and Claude Code disabled your plugin at load. When both plugins sit in one parent folder, you can pass that folder to `--plugin-dir` once. If the folder isn’t itself a plugin, Claude Code loads each child folder that has a `.claude-plugin/plugin.json`. Requires Claude Code v2.1.265 or later. If you haven’t installed the dependency from its marketplace, your plugin stops loading when the local copy goes away:
* **You disabled the local copy** : Claude Code disables your plugin at the next plugin load. For a dependency entry that names a marketplace, Claude Code reports `Dependency "<name>@inline" is disabled — enable it or remove the dependency`; for a bare-name entry, it reports the dependency by its bare name. `<name>@inline` is how Claude Code identifies every `--plugin-dir` and `--plugin-url` plugin.
* **You started a session without the dependency’s`--plugin-dir` flag**: Claude Code reports the dependency as not installed. Pass the flag again, or install the dependency from its marketplace.
--- a/plugin-marketplaces.md
+++ b/plugin-marketplaces.md
@@ -166,7 +166,7 @@
`owner`| object| Marketplace maintainer information (see fields below)|
`plugins`| array| List of available plugins| See below
-**Reserved names** : the following marketplace names are reserved for official Anthropic use and can’t be used by third-party marketplaces: `claude-code-marketplace`, `claude-code-plugins`, `claude-plugins-official`, `claude-plugins-community`, `claude-community`, `anthropic-marketplace`, `anthropic-plugins`, `agent-skills`, `anthropic-agent-skills`, `knowledge-work-plugins`, `life-sciences`, `claude-for-legal`, `claude-for-financial-services`, `financial-services-plugins`, `first-party-plugins`, `healthcare`. Names that impersonate official marketplaces, such as `official-claude-plugins` or `anthropic-plugins-v2`, are also blocked. Reserving these names prevents a third-party marketplace from presenting itself as an Anthropic-published source.Claude Code re-checks reserved names every time it loads a marketplace, not only when you add one. A marketplace that was registered under one of these names before the name became reserved stops loading and reports that it is [registered from an untrusted source](</docs/en/errors#marketplace-is-registered-from-an-untrusted-source>). Remove that marketplace and re-add it from the official Anthropic source. A third-party marketplace affected by a newly reserved name loads again as soon as you re-add it under a different name. Before v2.1.205, `first-party-plugins` and `healthcare` weren’t reserved, and a marketplace already registered under a reserved name kept loading.
+**Reserved names** : the following marketplace names are reserved for official Anthropic use and can’t be used by third-party marketplaces: `claude-code-marketplace`, `claude-code-plugins`, `claude-plugins-official`, `claude-plugins-community`, `claude-community`, `anthropic-marketplace`, `anthropic-plugins`, `agent-skills`, `anthropic-agent-skills`, `knowledge-work-plugins`, `life-sciences`, `claude-for-legal`, `claude-for-financial-services`, `financial-services-plugins`, `first-party-plugins`, `claude-tag-plugins`, `healthcare`. Names that impersonate official marketplaces, such as `official-claude-plugins` or `anthropic-plugins-v2`, are also blocked. Reserving these names prevents a third-party marketplace from presenting itself as an Anthropic-published source.Claude Code re-checks reserved names every time it loads a marketplace, not only when you add one. A marketplace that was registered under one of these names before the name became reserved stops loading and reports that it is [registered from an untrusted source](</docs/en/errors#marketplace-is-registered-from-an-untrusted-source>). Remove that marketplace and re-add it from the official Anthropic source. A third-party marketplace affected by a newly reserved name loads again as soon as you re-add it under a different name. Before v2.1.205, `first-party-plugins` and `healthcare` weren’t reserved, and a marketplace already registered under a reserved name kept loading. Before v2.1.265, `claude-tag-plugins` wasn’t reserved.
###
@@ -226,7 +226,7 @@
Field| Type| Description
---|---|---
-`displayName`| string| Human-readable name shown in UI surfaces. Falls back to `name` when omitted. May contain spaces and any casing. Not used for namespacing or lookup.
+`displayName`| string| Human-readable name shown in UI surfaces. When neither the entry nor the plugin’s `plugin.json` sets one, users see the plugin’s `name`. May contain spaces and any casing. Not used for namespacing or lookup.
`description`| string| Brief plugin description
`version`| string| Plugin version. If set (here or in `plugin.json`), the plugin is pinned to this string and users only receive updates when it changes. A plugin with a `command` source isn’t pinned by either field. If set in neither place, the version comes from the next source in [version management](</docs/en/plugins-reference#version-management>).
`author`| object| Plugin author information (`name` required; `email` and `url` optional)
@@ -241,7 +241,12 @@
`relevance`| object| Signals that tell Claude Code when to suggest this plugin to users. Takes effect only for marketplaces an administrator allowlists in managed settings. See [Recommend plugins for your org](</docs/en/plugin-relevance>).
`defaultEnabled`| boolean| Whether the plugin is enabled after install (default: true). Set to `false` to install the plugin disabled until the user opts in. Takes precedence over the same field in the plugin’s `plugin.json`. See [Default enablement](</docs/en/plugins-reference#default-enablement>).
-**Component configuration fields:**
+Both the entry and the plugin’s own `plugin.json` can set the display fields `displayName`, `description`, `author`, `homepage`, `repository`, `license`, and `keywords`. In plugin listings and details, before and after install:
+
+ * For a field you set on the entry, users see the entry’s value, even when `plugin.json` sets a different one.
+ * For a field the entry leaves unset, users see the `plugin.json` value.
+
+Before install, Claude Code can read `plugin.json` only for entries with a relative-path source, whose plugin files live inside the marketplace itself. For an entry with any other source type, users see only the entry’s own fields until they install the plugin. **Component configuration fields:**
Field| Type| Description
---|---|---
@@ -1449,7 +1454,7 @@
Plugins with relative paths fail in URL-based marketplaces
-**Symptoms** : Added a marketplace via URL (such as `https://example.com/marketplace.json`), but plugins with relative path sources like `"./plugins/my-plugin"` fail to install with “path not found” errors. **Cause** : adding a URL-based marketplace downloads only the `marketplace.json` file itself, and Claude Code doesn’t fetch plugin files by relative path from that server. Relative paths in the marketplace entry reference files on the remote server that were not downloaded. **Solutions** :
+**Symptoms** : Added a marketplace via a URL such as `https://example.com/marketplace.json`, but plugins with relative path sources like `"./plugins/my-plugin"` fail to install with `its marketplace entry path does not stay inside the marketplace directory`. Already-installed plugins fail to load with `Plugin source path refused`. Both messages have an [error reference entry](</docs/en/errors#marketplace-entry-path-does-not-stay-inside-the-marketplace-directory>). **Cause** : adding a URL-based marketplace downloads only the `marketplace.json` file itself, and Claude Code doesn’t fetch plugin files by relative path from that server. Relative paths in the marketplace entry reference files on the remote server that were not downloaded. **Solutions** :
* **Use external sources** : change plugin entries to any plugin source other than a relative path:
--- a/plugins-reference.md
+++ b/plugins-reference.md
@@ -457,7 +457,7 @@
Field| Type| Description| Example
---|---|---|---
`$schema`| string| JSON Schema URL for editor autocomplete and validation. Claude Code ignores this field at load time.| `"https://json.schemastore.org/claude-code-plugin-manifest.json"`
-`displayName`| string| Human-readable name shown in the `/plugin` picker and other UI surfaces. Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing. Not used for namespacing or lookup.| `"Deployment Tools"`
+`displayName`| string| Human-readable name shown in the `/plugin` picker and other UI surfaces. For a marketplace-installed plugin, a `displayName` on the [marketplace entry](</docs/en/plugin-marketplaces#optional-plugin-fields>) takes precedence over this value. When no display name is set in either place, users see `name`. Unlike `name`, may contain spaces and any casing. Not used for namespacing or lookup.| `"Deployment Tools"`
`version`| string| Optional. Semantic version. Setting this pins the plugin to that version string, so users only receive updates when you bump it, except for a [`command` source](</docs/en/plugin-marketplaces#command-sources>); see Version management. If also set in the marketplace entry, `plugin.json` wins. If omitted, the version comes from the next source in Version management.| `"2.1.0"`
`description`| string| Brief explanation of plugin purpose| `"Deployment automation tools"`
`author`| object| Author information| `{"name": "Dev Team", "email": "dev@company.com"}`
@@ -672,7 +672,7 @@
}
}
-`${CLAUDE_PLUGIN_ROOT}` changes when the plugin updates. The previous version’s directory remains on disk for a grace period after an update, but treat it as ephemeral and don’t write state there. See plugin caching for cleanup semantics. When a plugin updates mid-session, hook commands, monitors, MCP servers, and LSP servers keep using the previous version’s path. Run `/reload-plugins` to switch hooks, MCP servers, and LSP servers to the new path; monitors require a session restart. For a plugin with a `command` source, Claude Code [can reload the plugin itself](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>). MCP servers can also call the `roots/list` request to read the session’s working directories at runtime. See [what `roots/list` returns and when Claude Code notifies the server of changes](</docs/en/mcp#option-3-add-a-local-stdio-server>).
+`${CLAUDE_PLUGIN_ROOT}` changes when the plugin updates. The previous version’s directory remains on disk for a grace period after an update, but treat it as ephemeral and don’t write state there. See plugin caching for cleanup semantics. When a plugin updates mid-session, hook commands, monitors, MCP servers, and LSP servers keep using the previous version’s path. Run `/reload-plugins` to switch hooks, MCP servers, and LSP servers to the new path; monitors require a session restart. In a session without an interactive terminal, the reload leaves plugin MCP servers on the old path until the next session. For a plugin with a `command` source, Claude Code [can reload the plugin itself](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>). MCP servers can also call the `roots/list` request to read the session’s working directories at runtime. See [what `roots/list` returns and when Claude Code notifies the server of changes](</docs/en/mcp#option-3-add-a-local-stdio-server>).
####
@@ -755,7 +755,7 @@
Path traversal limitations
-Claude Code doesn’t let a plugin reference files outside its own directory. It rejects a component path that resolves outside the plugin root, whether the path is declared in `plugin.json` or in a [marketplace entry](</docs/en/plugin-marketplaces#plugin-entries>). That covers a path that points outside the plugin as written, such as `../shared-utils`, and a symlink that leads outside the plugin, other than links within one marketplace. When Claude Code rejects a path, it reports a [`path escapes plugin directory`](</docs/en/errors#path-escapes-plugin-directory>) error and loads the plugin without that component. Claude Code also doesn’t copy files outside the plugin directory into the cache when it installs the plugin, so when a script inside a copied plugin reads a path above the plugin root, it doesn’t find those files either.
+Claude Code doesn’t let a plugin reference files outside its own directory. It rejects a component path that resolves outside the plugin root, whether the path is declared in `plugin.json` or in a [marketplace entry](</docs/en/plugin-marketplaces#plugin-entries>). That covers a path that points outside the plugin as written, such as `../shared-utils`, and a symlink that leads outside the plugin, other than links within one marketplace. On macOS and Linux, Claude Code also rejects a component path that contains a backslash anywhere in it, even when the path stays inside the plugin. Components declared with backslash paths therefore load on Windows only. Write component paths with forward slashes, such as `./commands/deploy.md`. When Claude Code rejects a path, it reports a [`path escapes plugin directory`](</docs/en/errors#path-escapes-plugin-directory>) error and loads the plugin without that component. Claude Code also doesn’t copy files outside the plugin directory into the cache when it installs the plugin, so when a script inside a copied plugin reads a path above the plugin root, it doesn’t find those files either.
###
--- a/prompt-caching.md
+++ b/prompt-caching.md
@@ -10,7 +10,7 @@
Layer| Content| Changes when
---|---|---
-System prompt| Core instructions, tool definitions, output style| The set of loaded tool definitions changes, you switch output style, or Claude Code is upgraded
+System prompt| Core instructions, tool definitions| The set of loaded tool definitions changes or Claude Code is upgraded
Project context| CLAUDE.md, auto memory, unscoped rules| Session starts, or after `/clear` or `/compact`
Conversation| Your messages, Claude’s responses, tool results| Every turn
@@ -67,7 +67,7 @@
Switching models
-Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. When you run `/model` at the terminal, Claude Code asks you to confirm the switch only while the cache is still warm. The cache stays warm for one cache TTL after Claude Code last sent a request in this conversation or Claude last responded. Once that time passes, the cache has expired, so Claude Code switches without asking. Before v2.1.238, Claude Code didn’t check the cache TTL and asked even after the cache had expired. You can also require this confirmation or skip it with a [PreModelSwitch hook](</docs/en/hooks#premodelswitch-decision-control>). The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable 5.1, Fable 5, and Opus 5 is also a model switch. When a safety classifier flags a request and the flagged category has a fallback model, Claude Code re-runs the request on that model and the session continues there.
+Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. When you run `/model` at the terminal, Claude Code asks you to confirm the switch only while the cache is still warm. The cache stays warm for one cache TTL after Claude Code last sent a request in this conversation or Claude last responded. Once that time passes, the cache has expired, so Claude Code switches without asking. Before v2.1.238, Claude Code didn’t check the cache TTL and asked even after the cache had expired. You can also require this confirmation or skip it with a [PreModelSwitch hook](</docs/en/hooks#premodelswitch-decision-control>). The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable models and Opus 5 is also a model switch. When a safety classifier flags a request in a category that has a fallback model, Claude Code re-runs the request on that model and the session continues there. When a skill or command’s frontmatter names a [`model`](</docs/en/skills#frontmatter-reference>) other than the session’s current model, that turn is also a model switch: the next request reads the entire conversation history with no cache hits. The session model resumes on your next prompt. A `context: fork` skill sets the [forked subagent’s model](</docs/en/skills#run-skills-in-a-subagent>) instead.
###
@@ -139,13 +139,14 @@
When plugin changes apply
-Claude Code applies a plugin change when you run [`/reload-plugins`](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>) or start a new session. You pay the cost, whether appended announcements or a full re-read, on the first turn after the change applies, not when you run `/plugin enable` or `/plugin disable`. Claude Code can also apply a change on its own in three cases:
+A plugin change applies when you run [`/reload-plugins`](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>) or start a new session, not when you run `/plugin enable` or `/plugin disable`. You pay the cost, whether appended announcements or a full re-read, on the first turn after the change applies. Claude Code can also apply a change on its own:
* For a plugin with a `command` source, Claude Code [can reload the plugin itself](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>).
* When you [install a plugin from the `/plugin` interface](</docs/en/discover-plugins#install-plugins>), Claude Code can activate it during the install. Claude Code tells you in the install summary whether it did or whether to run `/reload-plugins`.
* When you [move the session with `/cd`](</docs/en/permissions#move-the-session-to-another-directory>) on v2.1.246 or later, Claude Code applies the plugins the new directory’s settings enable as part of the move, without the full re-read warning that holds a `/reload-plugins`.
-
-When you run `/reload-plugins` and the reload would trigger a full re-read, Claude Code shows a warning and doesn’t apply the reload. Rerun it with `--force` to apply the reload anyway.
+ * In interactive sessions, when you add or remove a plugin in a [folder of plugins](</docs/en/plugins#test-your-plugins-locally>) you passed with `--plugin-dir`, the change applies right away. If applying it would trigger a full re-read, Claude Code holds the change instead and shows a notice to run `/reload-plugins`. Requires Claude Code v2.1.265 or later.
+
+When you run `/reload-plugins` and the reload would trigger a full re-read, Claude Code shows a warning and doesn’t apply the reload. Rerun it with `--force` to apply the reload anyway. `/reload-plugins` also runs in sessions without an interactive terminal, such as the desktop app, the Agent SDK, and [non-interactive mode](</docs/en/headless>) with `-p`, when you type it into the session directly. Requires Claude Code v2.1.260 or later. In those sessions the reload applies everything except plugin MCP server changes, which [take effect in your next session](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>) and so never cost a full re-read mid-session.
####
@@ -169,7 +170,7 @@
Changing output style
-[Output style](</docs/en/output-styles>) is part of the system prompt. When you switch styles mid-session with `/config` or the `outputStyle` setting, Claude uses the new style starting with your next message, and that request reads the entire conversation history with no cache hits. To keep that cost small, switch styles before your first message in a session or right after `/clear` or `/compact`, when there is little or no conversation history to re-read. Before v2.1.251, a mid-session style switch kept the cache but didn’t apply until you ran `/clear` or started a new session.
+When you switch [output styles](</docs/en/output-styles>) mid-session with `/config` or the `outputStyle` setting, Claude uses the new style starting with your next message. In a conversation that [keeps a recorded system prompt](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>), as sessions signed in with a claude.ai or Console account do by default, Claude Code delivers the new style’s instructions as a message in the conversation. That request still reads the system prompt and the earlier conversation from the cache. In sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, the style’s instructions are part of the system prompt, so the request after a switch reads the entire conversation history with no cache hits. There, switch styles before your first message in a session or right after `/clear` or `/compact`, when there is little or no conversation history to re-read. Before v2.1.251, a mid-session style switch kept the cache but didn’t apply until you ran `/clear` or started a new session.
###
@@ -245,7 +246,7 @@
Invoking skills and commands
-[Skills](</docs/en/skills>) and [commands](</docs/en/commands>) inject their instructions as user messages at the point of invocation. Nothing earlier in the conversation changes.
+[Skills](</docs/en/skills>) and [commands](</docs/en/commands>) inject their instructions as user messages at the point of invocation. Nothing earlier in the conversation changes. A skill or command whose frontmatter names a `model` can be a model switch for that turn.
###
@@ -346,6 +347,7 @@
* **Session copies** : a session you [copy with `/fork`](</docs/en/agent-view#copy-the-session-with-%2Ffork>) receives its isolation instruction as a message at the end of the copied conversation, so the cache that the original conversation built stays intact.
* **Compaction** : the summarization call described in Compacting the conversation uses the same prefix-sharing approach.
+ * **Resumed subagents** : when Claude [resumes a subagent](</docs/en/sub-agents#resume-subagents>), the resumed run’s first request can read the cache the original run warmed.
* **Workflow fan-outs** : in a [workflow fan-out](</docs/en/workflows#prompt-caching-in-a-fan-out>) of same-prefix agents, Claude Code holds all but the first for up to 5 seconds by default, so their first requests can read the prefix that the first agent cached.
##
--- a/python.md
+++ b/python.md
@@ -903,7 +903,7 @@
`session_id`| `str | None`| `None`| Use a specific session ID instead of an auto-generated one. Must be a valid UUID. Can’t be combined with `continue_conversation` or `resume` unless `fork_session` is also set
`max_turns`| `int | None`| `None`| Maximum agentic turns (tool-use round trips)
`max_budget_usd`| `float | None`| `None`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats
-`disallowed_tools`| `list[str]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>)
+`disallowed_tools`| `list[str]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`, for the command [as written](</docs/en/permissions#bash-rule-limits>). See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>)
`enable_file_checkpointing`| `bool`| `False`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>)
`model`| `str | None`| `None`| Claude model alias or full model name. See [accepted values and provider-specific IDs](</docs/en/model-config#available-models>)
`fallback_model`| `str | None`| `None`| Fallback model to use if the primary model fails
@@ -924,7 +924,7 @@
`user`| `str | None`| `None`| User identifier
`include_partial_messages`| `bool`| `False`| Include partial message streaming events. When enabled, `StreamEvent` messages are yielded
`include_hook_events`| `bool`| `False`| Include hook lifecycle events in the message stream as `HookEventMessage` objects
-`forward_subagent_text`| `bool`| `False`| Forward subagent text and thinking blocks in the message stream. By default only subagent `tool_use` and `tool_result` blocks are emitted. Requires Python Agent SDK 0.2.140 or later
+`forward_subagent_text`| `bool`| `False`| Forward subagent text and thinking blocks in the message stream. Without this option, Claude Code emits subagent `tool_use` and `tool_result` blocks but not text or thinking. Requires Python Agent SDK 0.2.140 or later
`fork_session`| `bool`| `False`| When resuming with `resume`, fork to a new session ID instead of continuing the original session
`resume_session_at`| `str | None`| `None`| When resuming, load the conversation only up to and including the message with this UUID. Use with `resume`, and usually `fork_session`, to branch from an earlier point. Requires Python Agent SDK 0.2.137 or later
`resume_drops_turn`| `str | None`| `None`| UUID of the user prompt whose turn a `resume_session_at` truncation discards. When set, the CLI refuses the resume if the discarded range holds entries not attributable to that turn. Requires Python Agent SDK 0.2.137 or later and Claude Code v2.1.223 or later; the CLI bundled with those SDK versions satisfies the Claude Code requirement
@@ -1166,7 +1166,7 @@
`maxTurns`| No| Maximum number of agentic turns before the agent stops
`background`| No| Run this agent as a non-blocking background task when invoked
`effort`| No| Reasoning effort level for this agent. Accepts a named level or an integer. See `EffortLevel`
-`permissionMode`| No| Permission mode for tool execution within this agent. See `PermissionMode`
+`permissionMode`| No| Permission mode for tool execution within this agent. The [subagent inheritance rules](</docs/en/agent-sdk/permissions#available-modes>) decide when it applies. See `PermissionMode`
`AgentDefinition` field names use camelCase, such as `disallowedTools`, `permissionMode`, and `maxTurns`. These names map directly to the wire format shared with the TypeScript SDK. This differs from `ClaudeAgentOptions`, which uses Python snake_case for the equivalent top-level fields such as `disallowed_tools` and `permission_mode`. Because `AgentDefinition` is a dataclass, passing a snake_case keyword raises a `TypeError` at construction time.
@@ -2647,7 +2647,7 @@
"run_in_background": bool | None, # Agents run in the background by default; set to False to run synchronously
"name": str | None, # Name for the spawned agent
"team_name": str | None, # Deprecated; ignored
- "mode": "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan" | None, # Deprecated; ignored. Subagents inherit the parent session's permission mode; agent-definition frontmatter may override it
+ "mode": "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan" | None, # Deprecated; ignored. The subagent inheritance rules decide a subagent's permission mode
"isolation": "worktree" | "remote" | None, # Isolation mode for the agent's changes
}
--- a/remote-control.md
+++ b/remote-control.md
@@ -46,7 +46,7 @@
claude remote-control
-The process stays running in your terminal in server mode, waiting for remote connections. It displays a session URL you can use to connect from another device, and you can press spacebar to show a QR code for quick access from your phone. While a remote session is active, the terminal shows connection status and tool activity.Available flags:
+Until you accept Remote Control’s one-time confirmation, `claude remote-control` explains what it does and asks `Enable Remote Control? (y/n)` before starting the server. Answer `y` to accept and start the server. If you decline, Claude Code exits without starting the server and asks again the next time you run the command.The process stays running in your terminal in server mode, waiting for remote connections. It displays a session URL you can use to connect from another device, and you can press spacebar to show a QR code for quick access from your phone. While a remote session is active, the terminal shows connection status and tool activity.Available flags:
Flag| Description
---|---
@@ -86,7 +86,7 @@
/remote-control My Project
-This starts a Remote Control session that carries over your current conversation history.The `--verbose`, `--sandbox`, and `--no-sandbox` flags are not available with this command.
+This starts a Remote Control session that carries over your current conversation history.Until you accept Remote Control’s one-time confirmation, a dialog appears before `/remote-control` connects. Select **Enable Remote Control** to accept and connect. If you select **Never mind** or press Esc, Claude Code doesn’t connect and asks again the next time you run `/remote-control`.The `--verbose`, `--sandbox`, and `--no-sandbox` flags are not available with this command.
In the [Claude Code VS Code extension](</docs/en/vs-code>), type `/remote-control` or `/rc` in the prompt box.
@@ -150,11 +150,14 @@
* **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.
* **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 [Claude Code on the web session](</docs/en/claude-code-on-the-web#from-web-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 and from your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, through Anthropic servers like the rest of Remote Control traffic. [Message sessions on other machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) covers the delivery rules and [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) covers the inbound controls. Requires Claude Code v2.1.224 or later.
* **Prompts you send mid-turn** : when you send a prompt from a connected device before the current turn ends, Claude Code queues it and keeps it in the device’s transcript after that turn finishes.
* **Diff of your changes** : when the session’s directory is in a git repository, a connected device’s diff pane shows the diff of your uncommitted changes. The device requests the diff over the connection, and Claude Code computes it on your machine. When your working tree is clean, Claude Code instead serves your branch’s changes since it diverged from the default branch. Before v2.1.247, Claude Code reported the diff to connected devices only in sessions served by `claude remote-control`.
- * **Model** : when you pick a [model](</docs/en/model-config>) from a connected device, Claude Code runs the session on that model. The terminal’s `/model` picker, `/status`, and `/config` show that model. A pick from the device’s model control lasts for the current session only. `/model <name>` sent from the device also sets your default for new sessions, the same as typing it in the terminal.
- * **Effort level** : when you set the [effort level](</docs/en/model-config#adjust-effort-level>) from a connected device, with `/effort` or the device’s effort control, Claude Code applies it to the session on your machine, and claude.ai/code shows the level the session is using. If you pinned a level with `CLAUDE_CODE_EFFORT_LEVEL`, the session keeps that level, and Claude Code refuses a different pick from the effort control. A level you pick from the effort control applies to the current session only and doesn’t change your saved default. Picking a level from the effort control requires Claude Code v2.1.234 or later on your machine.
+ * **Model** : when you pick a [model](</docs/en/model-config>) from a connected device, Claude Code runs the session on that model. The terminal’s `/model` picker, `/status`, and `/config` show that model. Requires Claude Code v2.1.238 or later.
+ * A model you pick from the device’s model control applies to the current session only. When you send `/model <name>` from the device to an interactive session, Claude Code also sets your default for new sessions.
+ * If you send a name Claude Code doesn’t recognize, such as a display name where a model ID is expected, Claude Code [refuses the pick](</docs/en/errors#model-is-not-a-recognized-model-id>) and the session keeps its current model. Before v2.1.260, Claude Code saved an unrecognized pick from the device’s model control, and your next message failed.
+ * **Effort level** : when you set the [effort level](</docs/en/model-config#adjust-effort-level>) from a connected device, with `/effort` or the device’s effort control, Claude Code applies it to the session on your machine, and claude.ai/code shows the level the session is using. If you pinned a level with `CLAUDE_CODE_EFFORT_LEVEL`, the session keeps that level, and Claude Code refuses a different pick from the effort control. Picking a level from the effort control requires Claude Code v2.1.234 or later on your machine.
* **Reconnecting after a connection failure** : run `/remote-control` to reconnect. If compaction rewrote the conversation or you switched conversations with `/resume` in the meantime, Claude Code archives the server session it was using instead of leaving it in the session list. You can still find it by [filtering for archived sessions](</docs/en/claude-code-on-the-web#archive-sessions>). Switching conversations while a device is still connected doesn’t archive the session.
###
@@ -317,20 +320,22 @@
* **One remote session per interactive process** : outside of server mode, each Claude Code instance supports one remote session at a time. Use server mode to run multiple concurrent sessions from a single process.
* **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session goes offline until you bring it back. Unless Claude is in the middle of a task, claude.ai and the Claude app show the session as offline within seconds after the process exits. To keep a session running on a remote machine after you disconnect from SSH, start it inside `tmux` or `screen`.
- * **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.
+ * **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.
* **Interactive session** : keep working locally. Claude Code retries for as long as the outage lasts and reconnects on its own when the network returns.
* **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. Claude Code shows this message only when the session’s presence heartbeats have been failing while the rest of the connection stayed up; it re-registers the session for about 30 minutes before disconnecting.
- * **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. The mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) follows the same deadline but isn’t forwarded: Claude Code shows it only in the terminal where the session runs, and if nobody has answered there by the deadline, it ends the turn without sending the request. Your model selection is unchanged, and Claude Code asks again on your next message. Set [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) to adjust or disable the deadline. Requires Claude Code v2.1.224 or later. Claude Code applies the same deadline to the approval dialog for a held cross-session message. [The held-message expiry rules](</docs/en/cross-session-messaging#control-inbound-messages>) cover the cases where Claude Code keeps the dialog open past it.
+ * **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. The following work from mobile and web:
- * Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits` (prints the billing URL instead of opening a browser), `/recap`, `/reload-plugins`
+ * 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.
* `/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. Unlike the local CLI, `/mcp reconnect` without a server name reconnects every server that has failed or needs authentication.
* `/config`, from v2.1.181: 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 the Claude Code section of your settings instead, and ignores text after the command.
* On Team and Enterprise, `/usage-credits` from mobile or web doesn’t send a [usage-credits request to your admin](</docs/en/costs#add-usage-credits-to-your-subscription>). Sending requires a confirmation that appears only in the interactive CLI, so the command tells you to run it there instead. Before v2.1.211, the text form sent the request without confirmation.
* `/autocompact`, from v2.1.221: pass the window size as an argument, for example `/autocompact 500k`. With no argument, it prints the current window size as text instead of opening the dialog the command shows in a terminal session.
+ * `/advisor`, from v2.1.260: pass the model as an argument, for example `/advisor opus`, or pass `off` to turn the advisor off. Both forms apply to the current session only and leave your saved default unchanged. With no argument, it prints the current advisor as text instead of opening the picker.
##
@@ -344,7 +349,13 @@
”Remote Control requires a claude.ai subscription”
-You’re not authenticated with a claude.ai account. Run `claude auth login` and choose the claude.ai option. If `ANTHROPIC_API_KEY` is set in your environment, unset it first. Before v2.1.206, running `/remote-control` while signed out reported `Unknown command: /remote-control` instead of this message.
+You’re not signed in with a claude.ai account, or another credential is taking precedence over your login. The message takes one of these forms:
+
+ * Signed out, from `/remote-control` or `--remote-control`: `Remote Control requires a claude.ai subscription.`
+ * Signed out, from `claude remote-control`: `You must be logged in to use Remote Control. Remote Control is only available with claude.ai subscriptions.`
+ * Signed in, but an API key or token is in use: `Remote Control requires claude.ai subscription auth.` followed by the credential in use, such as `ANTHROPIC_API_KEY is set, so this session is using API-key auth`. An `apiKeyHelper` setting and `ANTHROPIC_AUTH_TOKEN` are named the same way.
+
+Run `claude auth login` and choose the claude.ai option. If the message names `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN`, remove it wherever it’s set: your shell environment or the `env` block of a [settings file](</docs/en/settings-reference#env>). If it names `apiKeyHelper`, remove that setting. Before v2.1.206, running `/remote-control` while signed out reported `Unknown command: /remote-control` instead of this message.
###
@@ -405,15 +416,8 @@
* **The error mentions`disableRemoteControl`**: your IT administrator has disabled Remote Control on this device through [managed settings](</docs/en/managed-settings>), independent of the organization-wide toggle and of how you’re signed in.
* **Your claude.ai plan is Pro or Max** : Claude Code is still signed in under a Team or Enterprise organization from an earlier login, so it checks that organization’s Remote Control policy. Run `/status` to see which plan and organization your sign-in uses. Run `claude auth logout` then `claude auth login` to sign in again under your current plan.
* **The organization policy didn’t load on this machine** : run `claude doctor` and read the `Organization policy` line. If the line shows the policy isn’t loaded, that is what’s keeping Remote Control off. Before v2.1.261, `claude doctor` didn’t print this line.
+ * **The message doesn’t say to contact your organization admin** : your organization has a HIPAA configuration that is incompatible with Remote Control, and `/status` lists `HIPAA` in its `Compliance` row. In this state the admin panel’s Remote Control toggle is grayed out, so an Owner can’t change it there. Contact Anthropic support to discuss options. Before v2.1.267, this case showed “Remote Control isn’t available for your organization due to its compliance policy” instead.
* **Otherwise, an Owner hasn’t enabled it for your organization** : Remote Control is off by default on Team and Enterprise plans. An Owner can enable it at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) by turning on the **Remote Control** toggle. This toggle is a server-side organization setting.
-
-###
-
-
-
-”Remote Control isn’t available for your organization due to its compliance policy”
-
-Your organization has a data retention or compliance configuration that is incompatible with Remote Control; the parenthetical at the end of the message names it. In this state the admin panel’s Remote Control toggle is grayed out, so an Owner can’t change it there. Contact Anthropic support to discuss options.
###
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -625,6 +625,7 @@
* **`pbcopy`, `xclip`, or `wl-copy` doesn’t update the clipboard**: these clipboard utilities can fail to reach the system clipboard from inside the sandbox, in which case the text piped to them doesn’t arrive. To put Claude’s output on your clipboard, ask Claude to print it in its response, then run [`/copy`](</docs/en/commands>), which writes to the clipboard from the Claude Code process rather than from a sandboxed command. Alternatively, add `pbcopy *`, `wl-copy *`, or `xclip *` to `excludedCommands` to run the command outside the sandbox.
* **A git command fails with`unable to unlink old`**: `git merge`, `git checkout`, and similar commands fail this way when they need to replace a file the sandbox denies writes to, whether that file is under a protected path such as `.claude/skills`, under one of your `denyWrite` entries, or outside the directories the sandbox lets commands write to at all. On Linux and WSL2 the error ends with `Read-only file system`. After the failure, Claude may offer to rerun the command outside the sandbox; approve that retry, or run the git command yourself in another terminal. If you’ve set `allowUnsandboxedCommands` to `false`, Claude can’t offer the retry, so run the command yourself. If the same git command fails often, add it to [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>).
* **Bubblewrap fails to start inside a container** : in an unprivileged container, bubblewrap can’t mount a fresh `/proc` filesystem, so sandboxed commands fail with a `bwrap` error such as `Can't mount proc on /newroot/proc: Operation not permitted`. Set [`enableWeakerNestedSandbox`](</docs/en/settings-reference#sandbox-enableweakernestedsandbox>) to `true` so the inner sandbox bind-mounts the container’s existing `/proc` instead. Only use this setting when the outer container already provides the isolation boundary you need, since it exposes process information to sandboxed commands that a fresh `/proc` mount would hide.
+ * **0-byte read-only files appear at`.claude` settings paths, and “Yes, and don’t ask again” doesn’t save**: on Linux and WSL2, the sandbox holds a write denial on a file that doesn’t exist yet by creating a 0-byte read-only placeholder there while a sandboxed command runs. The sandbox removes the placeholder afterward. If a session is killed before that cleanup runs, for example by SIGKILL, the placeholders stay behind. Later sessions bind them read-only again on every start, so a settings write such as saving a permission choice fails where one sits. Run `claude doctor` to list the leftover placeholder files. The [`Stale sandbox mask files left by a killed session`](</docs/en/errors#stale-sandbox-mask-files-left-by-a-killed-session>) warning names up to three of them and counts the rest. Delete each file with `rm` while no other Claude Code session is running in that project. Before v2.1.257, Claude Code left the same placeholders behind without flagging them.
* **`--dangerously-skip-permissions` fails as root**: this flag is blocked when running as root or via sudo on Linux and macOS, because root access combined with no permission prompts can modify any file or service on the system. The check is skipped automatically inside a recognized sandbox. To run autonomously in a container, use the [dev container](</docs/en/devcontainer>) configuration, which runs Claude Code as a non-root user.
##
--- a/security.md
+++ b/security.md
@@ -58,7 +58,7 @@
* **Permission system** : In Manual mode, sensitive operations require explicit approval
* **Context-aware analysis** : Detects potentially harmful instructions by analyzing the full request
* **Input sanitization** : Prevents command injection by processing user inputs
- * **Network command approval** : Commands that fetch content from the web such as `curl` and `wget` are not auto-approved by default. In Manual mode they prompt like any other non-read-only Bash command, so you can still approve once or add an explicit allow rule like `Bash(curl *)`. To block them entirely, add them to [`permissions.deny`](</docs/en/permissions#tool-specific-permission-rules>)
+ * **Network command approval** : Commands that fetch content from the web such as `curl` and `wget` are not auto-approved by default. In Manual mode they prompt like any other non-read-only Bash command, so you can still approve once or add an explicit allow rule like `Bash(curl *)`. To stop Claude from running them, add them to [`permissions.deny`](</docs/en/permissions#tool-specific-permission-rules>). A deny rule matches the command [as written](</docs/en/permissions#bash-rule-limits>); for network enforcement that doesn’t depend on the command text, see [sandbox network isolation](</docs/en/sandboxing#network-isolation>)
###
--- a/self-hosted-environments-configuration.md
+++ b/self-hosted-environments-configuration.md
@@ -117,17 +117,17 @@
`CLAUDE_RUNNER_WORKSPACE_PATHS`| Colon-separated absolute paths of the session’s working trees. Empty for zero-repo sessions.
`CLAUDE_RUNNER_DEBUG_LOG_PATH`| Path to the session’s debug log, still on disk while the hook runs
`CLAUDE_RUNNER_API_BASE_URL`| Anthropic API base URL for session-scoped calls
-`CLAUDE_RUNNER_CLIENT_PLATFORM`| The client surface that created the session, such as `web_claude_ai`, `desktop_app`, or `ios`. Unset when the session has no recorded or recognized surface.
+`CLAUDE_RUNNER_CLIENT_PLATFORM`| The client surface that created the session, such as `web_claude_ai`, `desktop_app`, or `ios`. Unset when the session has no recorded or recognized surface. Requires Claude Code v2.1.229 or later.
`CLAUDE_CODE_SESSION_ACCESS_TOKEN`| The session access token, for session-scoped API calls
`CLAUDE_RUNNER_EXIT_REASON` takes one of four values:
- * `completed`: a clean exit, including a session archived or deleted while the child was still connected.
- * `failed`: a child crash or a setup failure after spawn.
- * `interrupted`: an idle release, startup timeout, server deassign, drain, or watchdog kill.
- * `abandoned`: reserved for sessions another runner claimed; the hook doesn’t currently fire in that case.
-
-The [session lifecycle counter semantics](</docs/en/self-hosted-environments-reference#session-lifecycle-counter-semantics>) classify an idle release, a startup timeout, and a server deassign as `completed` instead: those are clean handoffs from the session’s perspective even though this hook reports them as `interrupted`. The hook’s exit status never affects the session outcome; a failure is logged and ignored. The runner waits up to `--post-session-hook-timeout-sec`, 60 seconds by default, on every session end including runner shutdown. This example saves uncommitted work to a rescue branch:
+ * `completed`: the session ended cleanly. The Claude Code process exited normally, or the session was archived or deleted while it was still running.
+ * `failed`: the Claude Code process crashed, or setup failed after it started.
+ * `interrupted`: the runner stopped the session. It released the session to free the slot, the session timed out at startup, the server moved the session off this runner, the runner was draining, or the session outlasted its [`--kill-session-after-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) limit.
+ * `abandoned`: reserved for a session another runner claimed. The hook doesn’t currently fire in that case.
+
+The [session lifecycle counters](</docs/en/self-hosted-environments-reference#session-lifecycle-counter-semantics>) count a release, a startup timeout, and a server move as `completed` rather than `interrupted`, because the runner handed the slot back cleanly. Expect that difference if you compare hook receipts with the counters. The hook’s exit status never affects the session outcome; a failure is logged and ignored. The runner waits up to `--post-session-hook-timeout-sec`, 60 seconds by default, on every session end including runner shutdown. This example saves uncommitted work to a rescue branch:
#!/usr/bin/env bash
set -u
@@ -161,7 +161,7 @@
* **Idle after a turn, or timed out at startup** : the runner stops the child and runs this hook to completion. Only then does it release the session. A user message sent while the hook runs can’t resume the session on another runner before the hook finishes.
* **Waiting for the user to answer a prompt, such as a permission prompt** : the runner releases the session first, then runs this hook. A user message sent while the hook runs can resume the session on another runner before the hook finishes.
-A release at the [`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) time follows the same two paths. During a `SIGTERM` drain, the runner holds the session lease until the hook finishes; see [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>). Before v2.1.236, the runner released the session first and then ran this hook on both paths.
+This applies whenever the runner releases a session: at the idle timeout, at the [`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) time, and, on a runner on v2.1.260 or later, at a session’s [`--kill-session-after-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) limit. A session whose turn has ended and that holds only background tasks counts as idle here. Before v2.1.236, the runner released the session first and then ran this hook in both cases. During a `SIGTERM` drain, the runner holds the session lease until the hook finishes; see [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>).
###
@@ -237,12 +237,13 @@
RUN claude mcp add --scope user sidecar -- /usr/local/bin/mcp-sidecar
RUN claude mcp add --scope user --transport http internal http://mcp-gateway.svc.cluster.local:8080
-The runner snapshots the host’s config once at startup. The snapshot captures the `mcpServers` key from the host’s `.claude.json`, which lives next to rather than inside `~/.claude/`, and the runner seeds only that key into each session’s isolated config; account state and project history are dropped. To confirm the servers reached sessions, start a session on the environment and ask Claude to list its MCP tools; the runner also logs a startup warning for any captured entry whose `type` it doesn’t recognize and drops the entry, so you can see why that server is missing from sessions. When `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` is set, the runner reads `.claude.json` from that directory instead, so pointing the variable at an empty directory disables MCP seeding too. Two other sources work as well:
+The runner snapshots the host’s config once at startup. The snapshot captures the `mcpServers` key from the host’s `.claude.json`, which lives next to rather than inside `~/.claude/`, and the runner seeds only that key into each session’s isolated config; account state and project history are dropped. To confirm the servers reached sessions, start a session on the environment and ask Claude to list its MCP tools; the runner also logs a startup warning for any captured entry whose `type` it doesn’t recognize and drops the entry, so you can see why that server is missing from sessions. When `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` is set, the runner reads `.claude.json` from that directory instead, so pointing the variable at an empty directory disables MCP seeding too. Claude Code also loads MCP servers from other sources:
* The enterprise-scope [managed MCP file](</docs/en/managed-mcp>) at its standard system path: `/etc/claude-code/managed-mcp.json` on Linux runner hosts, `/Library/Application Support/ClaudeCode/managed-mcp.json` on macOS hosts. Use it for locked-down fleets where only administrator-listed servers may load. See [exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for the precedence rules. When this file is on the runner host, Claude Code skips the MCP servers Anthropic’s control plane delivers to a session, including claude.ai connectors, and names them in a warning on the session child’s stderr, which the runner records at the `debug` log level. Before v2.1.229, those sessions exited at startup with `You cannot dynamically configure MCP servers when an enterprise MCP config is present`.
+ * The [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key in [managed settings](</docs/en/managed-settings>) on the runner host: provides HTTP and SSE servers without taking exclusive control, so servers from the other sources still load. Requires Claude Code v2.1.259 or later.
* `<repo>/.mcp.json`: project scope. Commit the file to the repository; its servers are auto-approved in cloud sessions.
-When connector delivery is enabled for your organization, Anthropic’s control plane delivers the connectors you’ve configured on claude.ai to interactively-created sessions through server-provided MCP configuration, routed through `api.anthropic.com`. Sessions created programmatically, such as [CLI dispatches](</docs/en/self-hosted-environments-testing#run-the-test-loop>), don’t receive connector delivery; give them MCP servers through the host snapshot, the [managed MCP file](</docs/en/managed-mcp>), or `<repo>/.mcp.json` instead. The child’s OAuth token doesn’t carry a scope for fetching connectors directly, so the child doesn’t attempt that fetch itself; delivery is server-driven. `settings.json` and `managed-settings.json` don’t carry MCP server definitions; there is no top-level `mcpServers` field in the settings schema. Sessions inherit the runner’s environment, so set [`ENABLE_TOOL_SEARCH`](</docs/en/mcp#scale-with-mcp-tool-search>) there to control MCP tool search for every session a runner spawns; the MCP page covers the values.
+When connector delivery is enabled for your organization, Anthropic’s control plane delivers the connectors you’ve configured on claude.ai to interactively-created sessions through server-provided MCP configuration, routed through `api.anthropic.com`. Sessions created programmatically, such as [CLI dispatches](</docs/en/self-hosted-environments-testing#run-the-test-loop>), don’t receive connector delivery; give them MCP servers through any of the other sources this section lists instead. The child’s OAuth token doesn’t carry a scope for fetching connectors directly, so the child doesn’t attempt that fetch itself; delivery is server-driven. `settings.json` doesn’t carry MCP server definitions, and there is no top-level `mcpServers` field in the settings schema. In managed settings, provide servers with the [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) key instead. Sessions inherit the runner’s environment, so set [`ENABLE_TOOL_SEARCH`](</docs/en/mcp#scale-with-mcp-tool-search>) there to control MCP tool search for every session a runner spawns; the MCP page covers the values.
##
--- a/self-hosted-environments-deploy.md
+++ b/self-hosted-environments-deploy.md
@@ -133,6 +133,8 @@
* `user.name = Claude` and `user.email = noreply@anthropic.com`, matching Anthropic-hosted sessions
* SSH-format commit and tag signing, routed through a runner-managed shim that signs each commit via Anthropic’s signing service using the session’s own credentials. Signatures are verifiable on GitHub against Anthropic’s published SSH signing key.
+ * `push.negotiate = true`, so git asks your git host which commits it already has before packing a push. Requires Claude Code v2.1.257 or later.
+ * `core.hooksPath` pointing at a runner-managed hooks directory. Its `commit-msg` and `prepare-commit-msg` hooks add a `Co-authored-by:` trailer for the session’s creator to each commit, built from the email in [`CCR_SESSION_ACCOUNT_EMAIL`](</docs/en/self-hosted-environments-configuration#wrapper-scripts>) and omitted when that variable is unset. If your image already sets `core.hooksPath`, the runner leaves your setting in place, skips installing these hooks, and prints a `[runner:git]` warning.
Commit signing requires git 2.34 or newer; the runner checks at startup and exits with an error if your git is older. This flag doesn’t configure push credentials, which you still provide in the image.
@@ -170,7 +172,7 @@
Use the Anthropic git proxy
-Start the runner with `--use-anthropic-git-proxy`, or set `CLAUDE_RUNNER_USE_GIT_PROXY=1`, to have it clone through Anthropic’s git proxy, authenticated with the session’s own short-lived token. For ordinary user sessions, the proxy uses the GitHub or GitHub Enterprise OAuth token stored for the session creator; for bot and agent sessions, it uses your organization’s GitHub App installation token. Either way, the runner image needs no git credentials at all: no SSH keys, no credential helper, no `.netrc`. This is the same auth path Anthropic-hosted environments use. The proxy requires `--capacity 1` because the proxy URL is per-session, and git 2.32 or newer because older git ignores the configuration mechanism the proxy uses to isolate sessions from each other. The runner refuses to start if either requirement is unmet. Because the proxy fetches from Anthropic’s side, your git host must be reachable from Anthropic infrastructure, the same requirement Anthropic-hosted sessions have; for a git host that’s only routable inside your network, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) instead. Each runner process handles one session at a time, so run more replicas for parallelism. When the proxy is enabled, `--git-host-rewrite` and `--git-ssh-rewrite` have no effect: the proxy URL points at `api.anthropic.com`, not your git host.
+Start the runner with `--use-anthropic-git-proxy`, or set `CLAUDE_RUNNER_USE_GIT_PROXY=1`, to have it clone through Anthropic’s git proxy, authenticated with the session’s own short-lived token. For ordinary user sessions, the proxy uses the GitHub or GitHub Enterprise OAuth token stored for the session creator; for bot and agent sessions, it uses your organization’s GitHub App installation token. Either way, the runner image needs no git credentials at all: no SSH keys, no credential helper, no `.netrc`. This is the same auth path Anthropic-hosted environments use. The proxy requires `--capacity 1` because the proxy URL is per-session, and git 2.32 or newer because older git ignores the configuration mechanism the proxy uses to isolate sessions from each other. The runner refuses to start if either requirement is unmet. Because the proxy fetches from Anthropic’s side, your git host must be reachable from Anthropic infrastructure, the same requirement Anthropic-hosted sessions have; for a git host that’s only routable inside your network, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) instead. Each runner process handles one session at a time, so run more replicas for parallelism. When the proxy is enabled, `--git-host-rewrite` and `--git-ssh-rewrite` have no effect: the proxy URL points at `api.anthropic.com`, not your git host. The runner also reports the opt-in to Anthropic when it registers, printing `Registering as opted in to Anthropic-managed git (--use-anthropic-git-proxy)` at startup. Each session on an opted-in runner then uses either Anthropic-managed git or the per-session proxy URL. When a session uses the per-session proxy URL, the runner logs one `[runner:warn]` line saying so.
###
@@ -354,7 +356,7 @@
In the first two stages that follow the signal, the runner releases sessions, and a released session resumes on a fresh runner when its user sends their next message. Counting from the first signal, the runner moves through three stages:
- * **For the first`n` minutes**: the runner serves its sessions normally and keeps enforcing `--startup-timeout-min` and `--kill-session-after-min`. If you also set [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), the runner releases any session whose user has been idle that long; without it, the runner releases no session early, apart from a startup timeout.
+ * **For the first`n` minutes**: the runner serves its sessions normally and keeps enforcing `--startup-timeout-min` and `--kill-session-after-min`. If you also set [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), the runner releases any session whose user has been idle that long; without it, idle sessions stay on the runner.
* **When the`n` minutes run out**: the runner releases every session it still holds, idle or not. The runner waits for a mid-turn session’s turn to end, and up to 60 seconds more for a turn’s background tasks, before releasing that session.
* **When the post-release grace runs out** : the runner drains whatever sessions it still holds, and the control plane requeues each drained session to another runner right away. The post-release grace starts when the `n` minutes run out and is 75 seconds at defaults. If you set `--drain-wait-sec` above 60 seconds, the post-release grace is `--drain-wait-sec` plus 15 seconds instead.
@@ -446,7 +448,7 @@
Connector traffic leaves your network
-Anthropic calls connector tools, such as GitHub, Slack, Linear, and the other claude.ai connectors, from its own infrastructure rather than from your runner, so when Claude uses a connector in a self-hosted session, that traffic goes through `api.anthropic.com` rather than originating inside your network boundary. To keep a connector out of self-hosted sessions, filter it like any other MCP server with the [`allowedMcpServers` and `deniedMcpServers` policy settings](</docs/en/managed-mcp#policy-based-control-with-allowlists-and-denylists>). Claude Code applies these settings to the connectors Anthropic delivers as well as to the servers you configure, so if you deploy an allowlist for other servers, Claude Code blocks delivered connectors too. To keep connectors available alongside a URL-based allowlist, add entries that match the Anthropic proxy paths for delivered connectors:
+Anthropic calls connector tools from its own infrastructure rather than from your runner. Connector tools are the claude.ai connectors, such as GitHub, Slack, and Linear. When Claude uses a connector in a self-hosted session, that traffic goes through `api.anthropic.com` rather than originating inside your network boundary. To keep a connector out of self-hosted sessions, filter it with the [`allowedMcpServers` and `deniedMcpServers` policy settings](</docs/en/managed-mcp#policy-based-control-with-allowlists-and-denylists>). Claude Code applies these settings to the connectors Anthropic delivers as well as to the servers you seed from the runner host and the servers users add, so if you deploy an allowlist for other servers, Claude Code blocks delivered connectors too. To keep connectors available alongside a URL-based allowlist, add entries that match the Anthropic proxy paths for delivered connectors:
* `https://api.anthropic.com/v2/ccr-sessions/*`
* `https://api.anthropic.com/v1/code/sessions/*`
@@ -460,7 +462,13 @@
Some sessions don’t count as idle
-A session holding a background task that never finishes 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. Always set `--kill-session-after-min` alongside it as a hard backstop so no session can hold a slot indefinitely. `--kill-session-after-min` is a backstop for runaway sessions. The runner terminates any session that reaches the limit, even one someone is still using, so set the flag well 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 session holding a background task that never finishes 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. Always set `--kill-session-after-min` alongside it as a hard backstop so no session can hold a slot indefinitely. `--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, or its turn has ended and it holds only background tasks, the runner releases it right away. 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.
+
+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.
###
@@ -468,7 +476,7 @@
Additional limitations
- * **Resumed sessions lose unpushed work** : when a session is released, on idle timeout or on a runner restart, and the user sends another message, the session resumes on a fresh runner that clones the repository again from its starting branch, so work the session hadn’t pushed is gone. Set [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) to have the runner make a best-effort push of the session’s outcome branches before it releases, so the resumed session starts from those commits instead; this preserves committed work, not a dirty working tree. Before enabling it, restrict who can push to `claude/*` refs on the source remote, for example with a branch ruleset: on resume, the runner fetches the previously pushed branch without verifying who pushed it, so anyone with push access to those refs can place content into the resumed workspace. The runner also discards per-session configuration on resume, meaning the session’s Claude config directory and any shell state the session wrote; `--push-outcome-on-release` doesn’t cover those.
+ * **Resumed sessions lose unpushed work** : when a session is released or its runner is restarted, and the user sends another message, the session resumes on a fresh runner that clones the repository again from its starting branch, so work the session hadn’t pushed is gone. Set [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) to have the runner make a best-effort push of the session’s outcome branches before it releases, so the resumed session starts from those commits instead; this preserves committed work, not a dirty working tree. Before enabling it, restrict who can push to `claude/*` refs on the source remote, for example with a branch ruleset: on resume, the runner fetches the previously pushed branch without verifying who pushed it, so anyone with push access to those refs can place content into the resumed workspace. The runner also discards per-session configuration on resume, meaning the session’s Claude config directory and any shell state the session wrote; `--push-outcome-on-release` doesn’t cover those.
* **Private repositories can’t be added mid-session** : a repository added to a session after it has started isn’t cloned with credentials on a self-hosted runner, so the add fails. Select every repository the session needs when you create it.
* **Some connectors don’t appear in self-hosted sessions** : a connector you haven’t yet connected in claude.ai Settings isn’t listed in a self-hosted session, and the session won’t prompt you to connect it. Connect it in Settings first, then start a fresh session. Adding a connector to an already-running session also doesn’t make its tools available to Claude; start a fresh session to pick up a newly added connector.
--- a/self-hosted-environments-reference.md
+++ b/self-hosted-environments-reference.md
@@ -16,7 +16,7 @@
`--base-dir <path>`| `SELF_HOSTED_RUNNER_BASE_DIR`| `/workspace`; none on Windows| Directory for repository checkouts and per-session working directories. The runner needs write access to this path or its parent. The runner creates the directory at startup and exits with `cannot create or write to base directory` when it can’t create or write to it. Before v2.1.225, the runner created the directory when the first session started, so an unusable path failed sessions rather than startup. On Windows, which isn’t a supported runner host, there is no default: the runner exits at startup unless you pass the flag or set the variable. Use the same value on every runner in an environment. See [Keep the base directory and capacity identical across runners](</docs/en/self-hosted-environments-deploy#keep-the-base-directory-and-capacity-identical-across-runners>).
`--capacity <n>`| none| `1`| Maximum concurrent sessions this runner handles. All sessions belong to the same locked [owner](</docs/en/self-hosted-environments#key-concepts>). Use the same value on every runner in an environment; see [Keep the base directory and capacity identical across runners](</docs/en/self-hosted-environments-deploy#keep-the-base-directory-and-capacity-identical-across-runners>).
`--client-label <label>`| `SELF_HOSTED_RUNNER_CLIENT_LABEL`| the host’s hostname| Label the runner sends when it registers. The runner also reports it as the `client_label` label of `claude_code_self_hosted_runner_info`. Requires Claude Code v2.1.248 or later.
-`--configure-git`| `SELF_HOSTED_RUNNER_CONFIGURE_GIT=1`| off| Write global git identity and enable Anthropic commit signing at startup. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>).
+`--configure-git`| `SELF_HOSTED_RUNNER_CONFIGURE_GIT=1`| off| At startup, write global git identity, enable Anthropic commit signing, turn on git push negotiation, and install commit hooks that append a `Co-authored-by:` trailer. Push negotiation requires Claude Code v2.1.257 or later. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>).
`--confine-repo-settings <mode>`| `SELF_HOSTED_RUNNER_CONFINE_REPO_SETTINGS`| `warn`| Sets the mode of the guard that flags a session when a repository’s committed settings try to grant write or read access outside that session’s own workspace, set environment variables, or override the operator’s sandbox or hooks posture, such as `sandbox.enabled: false` or `disableAllHooks`. The default `warn` logs the violation and still starts the session, `enforce` refuses the session, and `off` disables the scan. See [Harden your deployment](</docs/en/self-hosted-environments-deploy#harden-your-deployment>).
`--debug-token-dir <path>`| `SELF_HOSTED_RUNNER_DEBUG_TOKEN_DIR`| unset| Write live tokens to disk for inspection. Debug only; don’t use in production.
`--defer-shutdown-max-min <n>`| `SELF_HOSTED_RUNNER_DEFER_SHUTDOWN_MAX_MS`| `0`| On the first `SIGTERM` or `SIGINT`, keep serving the sessions already attached instead of draining them, then release whatever is still attached N minutes later and exit. Raise your host’s stop timeout before you set this. See [Defer the drain past the first signal](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>). `0` disables. Requires Claude Code v2.1.238 or later.
@@ -29,7 +29,7 @@
`--git-ssh-rewrite <host>`| none| unset| Rewrite `https://<host>/...` source URLs to `git@<host>:...` before cloning, for SSH-only git hosts. Repeatable; flag only.
`--health-port <port>`| `SELF_HOSTED_RUNNER_HEALTH_PORT`| `8080`| Port for the `/healthz` and `/metrics` listener. Set `0` to disable.
`--hooks-dir <path>`| `SELF_HOSTED_RUNNER_HOOKS_DIR`| unset| Directory of lifecycle hook scripts. See [Lifecycle hooks](</docs/en/self-hosted-environments-configuration#lifecycle-hooks>).
-`--kill-session-after-min <n>`| `SELF_HOSTED_RUNNER_MAX_LIFETIME_MS`| `0`| Terminate a session child once it has lived N minutes wall-clock, as a safety limit for stuck sessions. The runner terminates the session’s process tree, including any commands the session left running. The runner defers a kill that falls mid-turn until the turn finishes, for at most the `SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS` window. To choose a value, see [Some sessions don’t count as idle](</docs/en/self-hosted-environments-deploy#some-sessions-don%E2%80%99t-count-as-idle>). `0` disables.
+`--kill-session-after-min <n>`| `SELF_HOSTED_RUNNER_MAX_LIFETIME_MS`| `0`| Limit a session to N minutes wall-clock, as a safety limit for stuck sessions. On v2.1.260 or later, the runner releases a session that reaches the limit so it can resume on its user’s next message, and terminates it only if it’s still on the runner when the `SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS` grace window ends. Before v2.1.260, the runner terminated the session at the limit. See [Some sessions don’t count as idle](</docs/en/self-hosted-environments-deploy#some-sessions-don%E2%80%99t-count-as-idle>) for the details and how to choose a value. `0` disables.
`--lock-to-account <id>`| `SELF_HOSTED_RUNNER_LOCK_TO_ACCOUNT`| unset| Pre-lock the runner to a specific account at startup instead of locking on first session. Accepts an email address or `user_...` ID in the environment’s organization. A pre-locked runner never picks up Claude Tag channel sessions, which have no account.
`--log-file <path>`| `SELF_HOSTED_RUNNER_LOG_FILE`| unset| Mirror runner logs to a file in addition to stdout and stderr, created with `0600` permissions. Required for `self-hosted-runner doctor` to tail logs locally.
`--log-level <level>`| none| `info`| `info` or `debug`
@@ -42,7 +42,7 @@
`--session-stop-grace-sec <n>`| `SELF_HOSTED_RUNNER_SESSION_STOP_GRACE_MS`| `5`| How long to wait for the Claude process to exit cleanly after a session ends, before force-killing it. Raise the value if the child’s own `SessionEnd` hooks need more time.
`--startup-timeout-min <n>`| `SELF_HOSTED_RUNNER_STARTUP_TIMEOUT_MS`| `15`| Release a session slot if the child hasn’t signaled that it initialized within N minutes of spawn. Cleared by the child’s init signal on the [activity channel](</docs/en/self-hosted-environments-configuration#keep-stdin-and-file-descriptor-3-attached>), not by ordinary output, after which `--release-idle-session-min` takes over. `0` disables.
`--trust-workspace [bool]`| `SELF_HOSTED_RUNNER_TRUST_WORKSPACE`| on| Seed persisted trust for each session’s repository paths so repo-committed `permissions.allow` and `additionalDirectories` are honored. Set `false` to drop repo-committed permission grants and configure allow rules in the host config’s `settings.json` instead; repository-committed `sandbox.*` settings still apply either way, which is why the [repo-settings guard](</docs/en/self-hosted-environments-deploy#harden-your-deployment>) scans them regardless of this flag.
-`--use-anthropic-git-proxy`| `CLAUDE_RUNNER_USE_GIT_PROXY=1`| off| Clone via Anthropic’s git proxy instead of customer-managed git auth. Requires `--capacity 1` and git 2.32 or newer; the runner refuses to start otherwise. Supersedes the rewrite flags.
+`--use-anthropic-git-proxy`| `CLAUDE_RUNNER_USE_GIT_PROXY=1`| off| Clone via the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>) instead of customer-managed git auth. Requires `--capacity 1` and git 2.32 or newer; the runner refuses to start otherwise. Supersedes the rewrite flags.
Most duration flags have a maximum, chosen to keep each timeout inside the runtime’s 32-bit timer ceiling of roughly 24.85 days. The `--*-min` flags cap at 10080 minutes, 7 days; `--drain-grace-sec` at 604800 seconds, also 7 days; and `--drain-wait-sec` at 86400 seconds, 24 hours. `--session-stop-grace-sec` and `--post-session-hook-timeout-sec` are uncapped. Overrunning a cap behaves differently per surface:
@@ -95,7 +95,7 @@
---|---|---
`SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS`| `30000`| How long the runner considers a session busy after a background task finishes while the follow-up turn that reads the result hasn’t started. The `--drain-wait-sec` and `--release-idle-session-min` rows describe where the hold applies on drain and idle release, and [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>) describes where it applies on `--retire-at` retirement. `0` or an unusable value falls back to the default, so the hold can’t be turned off. Requires Claude Code v2.1.228 or later.
`SELF_HOSTED_RUNNER_HOST_CONFIG_DIR`| `~/.claude`| Directory captured into the runner’s startup snapshot and seeded into each session’s `CLAUDE_CONFIG_DIR`; changes on disk apply after a runner restart. Setting the variable also moves where the runner reads `.claude.json` for [MCP seeding](</docs/en/self-hosted-environments-configuration#mcp-servers>), so setting it, including to its own default, relocates that lookup; point at an empty directory to disable seeding entirely.
-`SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS`| `900000`| Bounds how long a `--kill-session-after-min` kill is deferred while waiting for an in-flight turn to finish
+`SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS`| `900000`| How long the runner waits after a session reaches its `--kill-session-after-min` limit, for a running turn to finish or the release to complete, before it terminates the session
`SELF_HOSTED_RUNNER_SIGKILL_GRACE_MS`| `30000`| How long the runner waits for the OS to deliver `SIGKILL` to a child stuck in uninterruptible I/O before exiting itself. Floored at `--post-session-hook-timeout-sec` plus 15 seconds, and 30 more when `--push-outcome-on-release` is set, so the effective minimum is 75 seconds at defaults.
`CLAUDE_RUNNER_FETCH_DEPTH`| `50`| Git fetch depth for fresh clones. Set a positive integer, or `full` or `0` for a complete fetch. Repositories already present in the workspace keep their existing depth.
`CLAUDE_RUNNER_SKIP_GIT_VERIFY`| unset| When `1`, skip the `.git` presence check after a `checkout` hook runs. Set this when your hook materializes a non-git source.
@@ -296,11 +296,11 @@
The `sessions_started_total`, `sessions_completed_total`, `sessions_failed_total`, and `sessions_interrupted_total` counters classify each session by how it ended. Every spawned session child increments `sessions_started_total` at spawn time, and exactly one of the other three increments at exit, so `sessions_started_total` minus the sum of the other three equals the number of session children currently running.
- * `completed`: the session ended cleanly. This covers the child exiting on its own with code `0`, the session being archived or deleted while the child was still connected, and the runner releasing the slot as a clean handoff: an idle release, a startup timeout, or a server-side deassign the poll loop noticed before the child exited. Increments `sessions_completed_total`.
+ * `completed`: the session ended cleanly. This covers the child exiting on its own with code `0`, the session being archived or deleted while the child was still connected, and the runner handing the slot back cleanly: releasing the session at the idle timeout, the retire time, or the `--kill-session-after-min` limit; a startup timeout; or a server-side deassign the poll loop noticed before the child exited. Increments `sessions_completed_total`.
* `failed`: the child exited on its own with a non-zero code, either a crash or a setup failure after spawn. Increments `sessions_failed_total`.
- * `interrupted`: the runner terminated the child for an operational reason that’s neither a session success nor a runner fault, such as a drain or the max-lifetime watchdog `--kill-session-after-min`. A Kubernetes rolling restart sending `SIGTERM` is one example of a drain. Increments `sessions_interrupted_total`.
-
-The [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>)’s `CLAUDE_RUNNER_EXIT_REASON` doesn’t use this classification for clean handoffs. The hook reports an idle release, a startup timeout, and a server deassign as `interrupted`, since from the hook’s perspective the runner killed the child, while the counters above record those same events as `completed`, since nothing went wrong and the slot was handed back cleanly. If you reconcile hook receipts against `sessions_completed_total` directly, you undercount completions. Use the hook for per-session guarantees and the counters for aggregate rates. On a one-shot environment, `--capacity 1` with the default `--drain-grace-sec 0`, each runner process exits moments after its one session ends. `sessions_completed_total`, `sessions_failed_total`, and `sessions_interrupted_total` increment only at session end, right before that exit, so a Prometheus scrape every 15 to 60 seconds rarely catches the increment before the runner’s series disappears; these three end-of-session counters are the terminal counters the rest of this section refers to. `sessions_started_total` increments at spawn and stays visible for the life of the session, so it reliably shows up, but on a one-shot environment it reads closer to “sessions currently running” than a cumulative count. Use the series in this table for the corresponding goal instead of the terminal counters:
+ * `interrupted`: the runner terminated the child for an operational reason that’s neither a session success nor a runner fault, such as a drain, or terminating a session that was still on the runner when the `SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS` grace window after its `--kill-session-after-min` limit ended. A Kubernetes rolling restart sending `SIGTERM` is one example of a drain. Increments `sessions_interrupted_total`.
+
+Before v2.1.260, the runner terminated every session that reached its `--kill-session-after-min` limit and counted it in `sessions_interrupted_total`. The [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>)’s `CLAUDE_RUNNER_EXIT_REASON` classifies clean handoffs differently. The hook reports a release, a startup timeout, and a server deassign as `interrupted`, because the runner stopped the child. These counters record the same events as `completed`, because the slot was handed back cleanly. If you reconcile hook receipts against `sessions_completed_total` directly, you undercount completions. Use the hook for per-session guarantees and the counters for aggregate rates. On a one-shot environment, `--capacity 1` with the default `--drain-grace-sec 0`, each runner process exits moments after its one session ends. `sessions_completed_total`, `sessions_failed_total`, and `sessions_interrupted_total` increment only at session end, right before that exit, so a Prometheus scrape every 15 to 60 seconds rarely catches the increment before the runner’s series disappears; these three end-of-session counters are the terminal counters the rest of this section refers to. `sessions_started_total` increments at spawn and stays visible for the life of the session, so it reliably shows up, but on a one-shot environment it reads closer to “sessions currently running” than a cumulative count. Use the series in this table for the corresponding goal instead of the terminal counters:
Goal| Use
---|---
Show diff (137 lines)
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -1,4 +1,4 @@
-Server-managed settings let organization Owners centrally configure Claude Code from [**Admin Settings > Claude Code > Managed settings**](<https://claude.ai/admin-settings/claude-code>) in the claude.ai console. Claude Code clients fetch these settings automatically when users authenticate with a Team or Enterprise OAuth login, an OAuth token supplied through `CLAUDE_CODE_OAUTH_TOKEN`, or a directly configured API key, on platforms where server-managed delivery is supported. See Platform availability.
+Server-managed settings let organization Owners centrally configure Claude Code from [**Admin Settings > Claude Code > Managed settings**](<https://claude.ai/admin-settings/claude-code>) in the claude.ai console. Claude Code clients fetch these settings automatically when users authenticate with an eligible credential on a platform where server-managed delivery is supported. See Platform availability for the credentials and platforms that qualify.
Server-managed settings are available for [Claude for Teams](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=server_settings_teams#team-&-enterprise>) and [Claude for Enterprise](<https://anthropic.com/contact-sales?utm_source=claude_code&utm_medium=docs&utm_content=server_settings_enterprise>) customers.
@@ -45,7 +45,7 @@
Define your settings
-Add your configuration as JSON. All [settings available in `settings.json`](</docs/en/settings-reference#all-settings>) are supported except those restricted to OS-level policy delivery; see Current limitations for that short list. This includes [hooks](</docs/en/hooks>), [environment variables](</docs/en/env-vars>), and [managed-only settings](</docs/en/managed-settings#managed-only-settings>) like `allowManagedPermissionRulesOnly`.This example enforces a permission deny list, prevents users from bypassing permissions, and restricts permission rules to those defined in managed settings:
+Add your configuration as JSON. All [settings available in `settings.json`](</docs/en/settings-reference#all-settings>) are supported except those restricted to OS-level policy delivery; see Current limitations for that short list. This includes [hooks](</docs/en/hooks>), [environment variables](</docs/en/env-vars>), and [managed-only settings](</docs/en/managed-settings#managed-only-settings>) like `allowManagedPermissionRulesOnly`.This example enforces a permission deny list, prevents users from bypassing permissions, and restricts permission rules to those defined in managed settings. The `Bash(curl *)` rule matches `curl` [as Claude writes it](</docs/en/permissions#bash-rule-limits>), not `/usr/bin/curl` or `sh -c 'curl …'`; for network enforcement that doesn’t depend on the command text, add a [`sandbox` block with `allowManagedDomainsOnly`](</docs/en/sandboxing#configure-the-sandbox-for-your-organization>).
{
"permissions": {
@@ -128,7 +128,7 @@
Server-managed settings have the following limitations:
* Settings apply uniformly to all users in the organization. Per-group configurations are not yet supported.
- * A [`managed-mcp.json`](</docs/en/managed-mcp>) file can’t be distributed through server-managed settings. Deliver the `allowedMcpServers` and `deniedMcpServers` policy keys there instead. Claude Code reads a `managed-mcp.json` deployed at its [system path](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) separately from the managed settings tier, so the file still applies when server-managed settings are in effect.
+ * You can’t distribute a [`managed-mcp.json`](</docs/en/managed-mcp>) file through server-managed settings. Deliver the `allowedMcpServers` and `deniedMcpServers` policy keys there instead. On Claude Code v2.1.259 or later, you can also provide remote servers with [`managedMcpServers`](</docs/en/managed-mcp#provide-servers-through-managed-settings>), which accepts `http` and `sse` servers only and doesn’t take exclusive control the way the file does. Claude Code reads a `managed-mcp.json` deployed at its [system path](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) separately from the managed settings tier, so the file still applies when server-managed settings are in effect.
* Settings restricted to OS-level policy sources, such as `policyHelper` and `wslInheritsWindowsSettings`, aren’t honored. Deploy them through MDM or a system `managed-settings.json` file instead. A `policyHelper` deployed that way runs only when its source is the one selected under [precedence within the managed tier](</docs/en/managed-settings#precedence-within-the-managed-tier>).
##
@@ -143,7 +143,7 @@
Settings precedence
-Server-managed settings and [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments, apart from the [exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>). Within the managed tier, Claude Code by default uses the first source that delivers at least one policy key, checking server-managed settings first and then endpoint-managed settings, apart from the exception keys covered next. [How Claude Code combines managed sources](</docs/en/managed-settings#precedence-within-the-managed-tier>) has the full ranking, the carve-out for the control keys, and the opt-in that applies every source. If the selected source is an MDM policy or managed settings file whose [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, the helper’s output replaces that source as the only managed configuration for the run. Claude Code doesn’t consult a `policyHelper` configured in MDM or file-based settings while server-managed settings deliver a policy key. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch, and the keys that apply only at the next launch, such as `model`, stay in effect until each client relaunches. Run `/status` to see which managed source is active.
+Server-managed settings and [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments, apart from the [exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>). Within the managed tier, Claude Code by default uses the first source that delivers at least one policy key, checking server-managed settings first and then endpoint-managed settings, apart from the exception keys covered next. [How Claude Code combines managed sources](</docs/en/managed-settings#precedence-within-the-managed-tier>) has the full ranking, the carve-out for the control keys, and the opt-in that applies every source. If the selected source is an MDM policy or managed settings file whose [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, the helper’s output replaces that source as the only managed configuration for the run. Claude Code doesn’t consult a `policyHelper` configured in MDM or file-based settings while server-managed settings deliver a policy key. If a later fetch finds the server-managed settings removed, Claude Code runs that helper right away instead of at the next launch. The [`policyHelper`](</docs/en/settings-reference#policyhelper>) entry covers what happens when that run fails. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch, and the keys that apply only at the next launch, such as `model`, stay in effect until each client relaunches. Run `/status` to see which managed source is active.
###
@@ -153,7 +153,7 @@
Two kinds of keys are exceptions to the no-merge rule:
- * **Cross-source lock keys** : a small set of keys, such as the sandbox allowlist locks, [listed on the managed settings page](</docs/en/managed-settings#precedence-within-the-managed-tier>). They are honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when a [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, its output is the only source these checks read. The startup `forceRemoteSettingsRefresh` check runs before the helper and reads any admin source.
+ * **Cross-source lock keys** : a small set of keys, such as the sandbox allowlist locks, [listed on the managed settings page](</docs/en/managed-settings#precedence-within-the-managed-tier>). Claude Code honors them when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded. When a [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, its output is the only source these checks read, apart from [`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>), which Claude Code reads from the admin sources directly at startup.
* **The`env` block**: apart from the telemetry unit and routing variables paired with a credential key, both covered below, it merges per key across the admin-controlled sources. For each environment variable, the highest-priority source defining it wins, and lower admin sources fill in variables the higher sources leave unset. An endpoint-managed `env` entry therefore applies whenever the server-managed configuration leaves that variable unset, or while a cached server value for it is withheld pending server confirmation. Requires Claude Code v2.1.223 or later. Before v2.1.223, Claude Code applies the selected source’s whole `env` block only.
* **Telemetry unit** : the `OTEL_EXPORTER_OTLP_*` exporter keys, the `OTEL_LOG_*` content-capture toggles, `OTEL_LOGS_EXPORTER`, and the beta tracing variables `ENABLE_BETA_TRACING_DETAILED` and `BETA_TRACING_ENDPOINT` follow the highest source that sets any of them as a unit. A source that delivers the `otelHeadersHelper` credential key claims the unit too, but lands these variables only when it is the selected source: a source that isn’t selected but delivers the key contributes none of them and still blocks lower sources from filling them in. Either way, an exporter endpoint from one source can never pair with credentials from another.
* **Credential-paired routing** : a source that pairs routing variables with a selected-source-only credential key, such as `apiKeyHelper` or `otelHeadersHelper`, contributes those routing variables only when it wins the slot.
@@ -172,11 +172,12 @@
**Subsequent launches with cached settings:**
- * Cached settings apply immediately at startup, except for the withheld environment variables described below
+ * Cached settings apply immediately at startup, except for the cached `modelPricing` and `managedMcpServers` values and the environment variables that Claude Code withholds until the server confirms the payload
* A cached [`modelPricing`](</docs/en/settings-reference#modelpricing>) doesn’t apply until the session’s fetch confirms the payload. Until then, the cost figures developers see in `/usage` and the status line are at list price
+ * A cached [`managedMcpServers`](</docs/en/settings-reference#managedmcpservers>) block doesn’t apply until the session’s fetch confirms the payload. Claude Code waits up to 30 seconds for that fetch before connecting MCP servers. If the fetch fails or times out, the session starts without the organization’s servers, `/status` says so, and they connect once a later fetch confirms them. See [When provided servers connect](</docs/en/managed-mcp#when-provided-servers-connect>) for the full behavior, including first launch. Requires Claude Code v2.1.259 or later
* Claude Code fetches fresh settings in the background
* Cached settings persist through network failures. If the startup fetch fails, Claude Code warns in interactive sessions that the cached policy is in effect
- * Until a fetch succeeds, the withheld environment variables remain withheld and cost figures stay at list price
+ * 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 withholding requires Claude Code v2.1.198 or later; before v2.1.198, the whole cached `env` block applies at startup. The withheld categories include:
@@ -186,7 +187,7 @@
* 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, such as telemetry and OpenTelemetry configuration, applies at startup as before. 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; the startup-only selectors covered above reach the environment but don’t switch the running session’s credential source. 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 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.
###
@@ -208,13 +209,18 @@
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, except for the withheld environment variables, or without server-managed settings on a machine that has never fetched them. With no cache, Claude Code still applies any [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) on the device. For environments where either window is unacceptable, set `forceRemoteSettingsRefresh: true` in your managed settings. Clients signed in through a Claude apps gateway exit when the startup fetch fails, without this setting. When this setting is active in a session that fetches server-managed settings, the CLI blocks at startup until remote settings are freshly fetched. If the fetch fails, the CLI exits rather than proceeding without the policy. This setting self-perpetuates: once delivered from the server, it is also cached locally so that subsequent startups enforce the same behavior even before the first successful fetch of a new session. A session that doesn’t fetch server-managed settings starts without waiting. To enable this, add the key to your managed settings configuration:
+By default, if the remote settings fetch fails at startup, the CLI continues with the settings cached from the last successful fetch, except for the values Claude Code withholds 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. 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.
+
+When this setting is active in a session that fetches server-managed settings, the CLI blocks at startup until remote settings are freshly fetched. If the fetch fails, the CLI exits rather than proceeding without the policy. This setting self-perpetuates: once delivered from the server, it is also cached locally so that subsequent startups enforce the same behavior even before the first successful fetch of a new session. A session that doesn’t fetch server-managed settings starts without waiting. To enable this, add the key to your managed settings configuration:
{
"forceRemoteSettingsRefresh": true
}
-You can also set this key in an [endpoint-managed](</docs/en/managed-settings#delivery-mechanisms>) MDM profile or system `managed-settings.json` file to enforce fail-closed behavior on first launch, before any server payload has been delivered. In Claude Code v2.1.191 or later, this flag is an exception to the precedence rule above: it is honored when set in any admin-controlled managed source even if a cached server-managed payload is also present, so an MDM-delivered value is not ignored when server-managed settings exist. When a [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, its output replaces every other managed source for the keys Claude Code reads after startup; the startup fail-closed check itself reads this key from any admin-controlled source before the helper runs. The entry says which sources Claude Code reads the helper from and when it runs. The settings fetch also sends a `Cache-Control: no-cache` header so intermediate HTTP proxies don’t serve a stale response. Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code. The `claude auth` subcommands such as `claude auth login` are exempt from this check and from the gateway startup exit, so users can re-authenticate when expired credentials are the reason the settings fetch fails.
+You can also set this key in an [endpoint-managed](</docs/en/managed-settings#delivery-mechanisms>) MDM profile or system `managed-settings.json` file to enforce fail-closed behavior on first launch, before any server payload has arrived. In Claude Code v2.1.191 or later, this flag is an exception to the precedence rule above: Claude Code honors it when any admin-controlled managed source sets it, even if a cached server-managed payload is also present, so it doesn’t ignore an MDM-delivered value when server-managed settings exist. When a [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings, its output replaces every other managed source for the keys Claude Code reads after startup. For the sources Claude Code reads this key from, see [its settings entry](</docs/en/settings-reference#forceremotesettingsrefresh>). The `policyHelper` entry says which sources Claude Code reads the helper from and when it runs. The settings fetch also sends a `Cache-Control: no-cache` header so intermediate HTTP proxies don’t serve a stale response. Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code. The `claude auth` subcommands such as `claude auth login` are exempt from this check and from the gateway startup exit, so users can re-authenticate when expired credentials are the reason the settings fetch fails.
###
@@ -240,7 +246,7 @@
Claude Code records your approval in your configuration directory, `~/.claude` unless you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). What it records depends on the credential the settings fetch uses:
- * **A claude.ai login saved by`/login` or `claude auth login`**: one approval per organization, held by the account that approved most recently.
+ * **A claude.ai login saved by`/login` or `claude auth login`, or the [keyless Console sign-in](</docs/en/authentication#sign-in-without-an-api-key>)**: one approval per organization, held by the account that approved most recently.
* **A[Claude apps gateway](</docs/en/claude-apps-gateway>) sign-in**: one approval per gateway. If you sign out and back in to the same gateway, Claude Code doesn’t show the dialog again while the settings that require approval are unchanged. Claude Code shows it again when those settings change, when you sign in to a different gateway, and when you accept a new certificate for the same gateway. Claude Code saves no approval for a loopback development gateway reached over plain HTTP, so the dialog appears again after each sign-in.
* **Any other credential** , such as an API key or `CLAUDE_CODE_OAUTH_TOKEN`: one approval for the delivered settings, kept with the cached copy of the settings in that configuration directory. Claude Code shows the dialog again when the settings that require approval change, and after you run `/logout` or `claude auth logout`, either of which deletes the cached copy.
@@ -270,7 +276,7 @@
* Terminal UI and accessibility options
* Numeric limits, budgets, and timeouts
-Other delivered variables can require the user’s approval before they take effect; a non-empty proxy, base-URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` value always does. When a delivered variable needs approval, the dialog names it, so the user sees exactly what the policy is asking to set. Before v2.1.218, Claude Code applied fewer variables without asking the user, so settings such as `DISABLE_AUTO_COMPACT` triggered the dialog at any non-empty value. Claude Code decides whether four privacy toggles need approval by the delivered value rather than by the variable name: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_ERROR_REPORTING`, `DISABLE_TELEMETRY`, and `DO_NOT_TRACK`. A truthy value such as `1` or `true` only turns tracking, reporting, or other nonessential traffic off, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.218, all of them except `DO_NOT_TRACK` applied without approval at any value, and `DO_NOT_TRACK` triggered the dialog at any non-empty value. Claude Code also decides whether [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) needs approval by the delivered value: a truthy value only turns the [body idle timeout](</docs/en/network-config#streaming-idle-watchdogs>) on, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.248, any non-empty value triggered the dialog. Whether [`ANTHROPIC_CUSTOM_HEADERS`](</docs/en/env-vars#variables>) needs approval also depends on the delivered value. Headers that only tag requests, such as `Accept-Language`, apply without the dialog. A line that names a credential, an org or tenant selector, a routing or host override, or an API-behavior header, such as `Authorization`, `X-Api-Key`, `Host`, `anthropic-beta`, or the `X-Amzn-Bedrock-*` headers, requires approval. So does a line whose name isn’t a valid HTTP header token, or whose value contains a character an HTTP header can’t carry. The check matches words inside the header name, so `X-Client-Version`, which contains `client` and `version`, requires approval too. Before v2.1.251, any `ANTHROPIC_CUSTOM_HEADERS` value applied without it.
+Other delivered variables can require the user’s approval before they take effect; a non-empty proxy, base-URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` value always does. When a delivered variable needs approval, the dialog names it, so the user sees exactly what the policy is asking to set. Before v2.1.218, Claude Code applied fewer variables without asking the user, so settings such as `DISABLE_AUTO_COMPACT` triggered the dialog at any non-empty value. Claude Code decides whether four privacy toggles need approval by the delivered value rather than by the variable name: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_ERROR_REPORTING`, `DISABLE_TELEMETRY`, and `DO_NOT_TRACK`. A truthy value such as `1` or `true` only turns tracking, reporting, or other nonessential traffic off, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.218, all of them except `DO_NOT_TRACK` applied without approval at any value, and `DO_NOT_TRACK` triggered the dialog at any non-empty value. Claude Code also decides whether [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) needs approval by the delivered value: a truthy value only turns the [body idle timeout](</docs/en/network-config#streaming-idle-watchdogs>) on, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.248, any non-empty value triggered the dialog. Whether [`ANTHROPIC_CUSTOM_HEADERS`](</docs/en/env-vars#variables>) needs approval also depends on the delivered value. Headers that only tag requests, such as `Accept-Language`, apply without the dialog. A line that names a credential, an org or tenant selector, a routing or host override, or an API-behavior header, such as `Authorization`, `X-Api-Key`, `Host`, `anthropic-beta`, or the `X-Amzn-Bedrock-*` headers, requires approval. So does a line whose name isn’t a valid HTTP header token, or whose value contains a character an HTTP header can’t carry. The check matches words inside the header name, so `X-Client-Version`, which contains `client` and `version`, requires approval too. Before v2.1.251, any `ANTHROPIC_CUSTOM_HEADERS` value applied without it. A falsy value such as `0` or `false` for [`ENABLE_BETA_TRACING_DETAILED`](</docs/en/env-vars#variables>) or [`OTEL_LOG_RAW_API_BODIES`](</docs/en/env-vars#variables>) applies without the dialog, because it only turns detailed tracing or raw API body capture off. Any other non-empty value for either variable requires approval.
##
@@ -278,7 +284,14 @@
Platform availability
-Server-managed settings require a direct connection to `api.anthropic.com`, and delivery requires the session to authenticate with a Team or Enterprise OAuth login, an OAuth token supplied through `CLAUDE_CODE_OAUTH_TOKEN`, or a directly configured API key. Keys returned by an [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) script don’t trigger the settings fetch. In a [Cowork](<https://claude.com/docs/cowork/overview>) session in the Claude Desktop app, Claude Code doesn’t fetch server-managed settings from the claude.ai admin console, even when the user signs in with a Team or Enterprise account. [Where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>) covers which policy reaches Cowork sessions on the user’s machine and remote Cowork sessions. If you export a `CLAUDE_CODE_USE_*` provider variable or a non-default `ANTHROPIC_BASE_URL` in your shell, Claude Code skips the settings fetch for your sessions. `claude doctor` and `/status` report the skipped fetch and its cause. You can’t clear the export with a server-managed `env` block, because the block arrives through the fetch that the export prevents. An [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) `env` block doesn’t restore the fetch either: Claude Code checks eligibility before it applies managed `env` blocks, so the endpoint-managed value changes the session’s provider selection but the fetch stays skipped. To restore server-managed delivery, remove the export from your shell, or set the variable to `""` in your user settings `env` block, which applies before the eligibility check. To enforce policy without relying on users to change their shells, deliver the settings through the endpoint-managed channel instead. For Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) deployments, a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>) provides the equivalent remote managed-settings delivery: gateway-signed-in clients fetch managed settings from the gateway instead of `api.anthropic.com`. The failure semantics differ at startup: a gateway client that can’t reach the gateway exits with an error instead of falling back to cached settings, while the hourly background refresh is fail-open on both channels.
+Server-managed settings require a direct connection to `api.anthropic.com`. Delivery also requires the session to authenticate with one of these credentials:
+
+ * A Team or Enterprise OAuth login
+ * An OAuth token supplied through `CLAUDE_CODE_OAUTH_TOKEN`
+ * A directly configured API key
+ * A `user_oauth` [Anthropic profile](</docs/en/authentication#anthropic-profiles-and-federation-credentials>), unless the profile sets a `base_url` other than the Anthropic API. Requires Claude Code v2.1.257 or later.
+
+Neither keys returned by an [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) script nor [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>) credentials trigger the settings fetch. In a [Cowork](<https://claude.com/docs/cowork/overview>) session in the Claude Desktop app, Claude Code doesn’t fetch server-managed settings from the claude.ai admin console, even when the user signs in with a Team or Enterprise account. [Where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>) covers which policy reaches Cowork sessions on the user’s machine and remote Cowork sessions. If you export a `CLAUDE_CODE_USE_*` provider variable or a non-default `ANTHROPIC_BASE_URL` in your shell, Claude Code skips the settings fetch for your sessions. `claude doctor` and `/status` report the skipped fetch and its cause. You can’t clear the export with a server-managed `env` block, because the block arrives through the fetch that the export prevents. An [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) `env` block doesn’t restore the fetch either: Claude Code checks eligibility before it applies managed `env` blocks, so the endpoint-managed value changes the session’s provider selection but the fetch stays skipped. To restore server-managed delivery, remove the export from your shell, or set the variable to `""` in your user settings `env` block, which applies before the eligibility check. To enforce policy without relying on users to change their shells, deliver the settings through the endpoint-managed channel instead. For Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) deployments, a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>) provides the equivalent remote managed-settings delivery: gateway-signed-in clients fetch managed settings from the gateway instead of `api.anthropic.com`. The failure semantics differ at startup: a gateway client that can’t reach the gateway exits with an error instead of falling back to cached settings, while the hourly background refresh is fail-open on both channels.
##
@@ -298,11 +311,11 @@
Scenario| Behavior
---|---
-User edits the cached settings file| Tampered file applies at startup, and 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. In Claude Code v2.1.198 or later, the withheld environment variables in the `env` block don’t apply until the server confirms the payload. In Claude Code v2.1.242 or later, a cached [`modelPricing`](</docs/en/settings-reference#modelpricing>) doesn’t apply until the server confirms the payload either, so cost figures are at list price until then
+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 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 and still applies any [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) on the device. In Claude Code v2.1.198 or later, the withheld environment variables in the cached `env` block don’t apply on fetch failure. In Claude Code v2.1.242 or later, a cached [`modelPricing`](</docs/en/settings-reference#modelpricing>) doesn’t apply on fetch failure either, so cost figures stay at list price until a fetch succeeds. The rest of the cache still applies. 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, except for the values Claude Code withholds until a fetch succeeds. Without a cache, Claude Code enforces no server-managed settings until the next successful fetch and still applies any [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) on the device. 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
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.md
+++ b/settings.md
@@ -161,7 +161,7 @@
* **A flag for that key** : some keys have their own flag, such as `--model` for `model` and `--effort` for `effortLevel` and `modelSettings`.
* **An environment variable** : export the key’s paired variable before you run `claude`, such as `ANTHROPIC_MODEL` for `model`.
-Each key’s entry on the [settings reference](</docs/en/settings-reference>) lists its per-session overrides and which one takes precedence, so check the entry for the key you want to change. Commands you run inside a session mostly save your choice: `/config` writes to your settings files, `/model` saves the value as your default for new sessions, and `/effort` on your machine saves the level as your default for the model you’re using. If you press `s` in the `/model` picker, Claude Code switches the model without saving it as your user default. Claude Code applies some `/effort` levels, such as `max` and `ultracode`, to the current session only; see [Adjust effort level](</docs/en/model-config#adjust-effort-level>). For example, to start one session on Opus without changing your default:
+Each key’s entry on the [settings reference](</docs/en/settings-reference>) lists its per-session overrides and which one takes precedence, so check the entry for the key you want to change. Commands you run inside a session mostly save your choice: when you change a setting in `/config`, Claude Code writes it to your settings files, and `/model` saves the value as your default for new sessions. If you press `s` in the `/model` picker, Claude Code switches the model without saving it as your user default. [Adjust effort level](</docs/en/model-config#adjust-effort-level>) says which `/effort` picks Claude Code saves as your default for the model you’re using and which apply to the current session only. For example, to start one session on Opus without changing your default:
claude --settings '{"model": "claude-opus-4-8"}'
@@ -171,7 +171,7 @@
When edits take effect
-Claude Code watches your settings files and reloads them when they change, so it applies most edits to the running session without a restart, including edits to `permissions`, `hooks`, and credential helpers such as `apiKeyHelper`. The reload covers user, project, local, and managed settings, and Claude Code runs the [`ConfigChange` hook](</docs/en/hooks#configchange>) for each settings-file change it detects, not for managed settings that arrive from MDM or the claude.ai console. Managed settings that arrive through MDM or from the claude.ai console reach a running session on a schedule rather than on save; the [delivery table](</docs/en/managed-settings#choose-a-delivery-mechanism>) gives it per source. Claude Code reads some keys only once, at session start, so an edit to one of them doesn’t reach the running session. Admin-side keys that also wait for a restart, such as `requiredMinimumVersion`, are listed under [where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>). The ones you’re most likely to edit mid-session:
+Claude Code watches your settings files and reloads them when they change, so it applies most edits to the running session without a restart, including edits to `permissions`, `hooks`, and credential helpers such as `apiKeyHelper`. Claude Code also loads a settings file you create mid-session if its folder existed when the session started. For the project’s `.claude/` folder, it loads the file even when you create the folder in the same session. The reload covers user, project, local, and managed settings, and Claude Code runs the [`ConfigChange` hook](</docs/en/hooks#configchange>) for each settings-file change it detects, not for managed settings that arrive from MDM or the claude.ai console. Managed settings that arrive through MDM or from the claude.ai console reach a running session on a schedule rather than on save; the [delivery table](</docs/en/managed-settings#choose-a-delivery-mechanism>) gives it per source. Claude Code reads some keys only once, at session start, so an edit to one of them doesn’t reach the running session. Admin-side keys that also wait for a restart, such as `requiredMinimumVersion`, are listed under [where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>). The ones you’re most likely to edit mid-session:
* [`model`](</docs/en/settings-reference#model>): use [`/model`](</docs/en/model-config#setting-your-model>) to switch mid-session. Each model has its own prompt cache, so the first request after a switch re-reads the whole conversation uncached; see [Switching models](</docs/en/prompt-caching#switching-models>)
* [`effortLevel`](</docs/en/settings-reference#effortlevel>) and [`modelSettings`](</docs/en/settings-reference#modelsettings>): use [`/effort`](</docs/en/model-config#adjust-effort-level>) to change effort mid-session
@@ -331,7 +331,7 @@
Exceptions to managed settings precedence
-For a few security-sensitive keys, Claude Code honors a restrictive value from a scope that otherwise couldn’t override managed settings. Find the key in this table to see which value it honors and from where.
+For a few keys whose values restrict a session, Claude Code honors a restrictive value from a scope that otherwise couldn’t override managed settings. Find the key in this table to see which value it honors and from where.
Key| Value Claude Code honors| Notes
---|---|---
@@ -342,6 +342,7 @@
[`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>)| A stricter value from `.claude/settings.json` or `.claude/settings.local.json`, on the `accept` < `hold` < `refuse` ladder| Honored over managed, `--settings`, and user values; a project or local value that isn’t stricter is ignored
[`useAutoModeDuringPlan`](</docs/en/settings-reference#useautomodeduringplan>)| `false` from any managed source, `--settings`, `~/.claude/settings.json`, or `.claude/settings.local.json`| Honored even when the winning managed source sets `true`; a `false` in `.claude/settings.json` is ignored
[`syncClaudeAiSkills`](</docs/en/settings-reference#syncclaudeaiskills>)| `false` from any managed source, `--settings`, `~/.claude/settings.json`, or `.claude/settings.local.json`| Honored even when the winning managed source sets `true`; a `false` in `.claude/settings.json` is ignored
+[`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>)| A lower cap from any scope, including `--settings`| Honored even when the managed settings Claude Code applies set a higher cap; the lowest cap applies. Requires Claude Code v2.1.267 or later
An app that runs Claude Code inside itself and sets [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) is also an exception. Claude Code takes that app’s model configuration over the `model`, `fallbackModel`, and `modelOverrides` keys from every managed source, and over the model-selection variables in a managed `env` block, such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family. Claude Code keeps a managed [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist in force unless the app supplies its own.
--- a/settings-example.md
+++ b/settings-example.md
@@ -86,11 +86,12 @@
A team’s shared settings
-One team’s shared settings, committed to the repository so everyone who clones it gets the same permissions, hooks, telemetry, and plugin marketplace. Save a file like this at `.claude/settings.json` at the top of the repository. Three things to know before you commit one:
+One team’s shared settings, committed to the repository so everyone who clones it gets the same permissions, hooks, telemetry, and plugin marketplace. Save a file like this at `.claude/settings.json` at the top of the repository. What to know before you commit one:
* **Cloud sessions read it too.** A [cloud session](</docs/en/settings#settings-in-cloud-sessions>) on Claude Code on the web starts from a clone of the repository, so the committed file applies there as well.
* **Allow rules wait for trust.** Allow rules and `extraKnownMarketplaces` entries take effect after each person [trusts this folder itself](</docs/en/permissions#project-allow-rules-and-workspace-trust>), not only a parent folder; deny and ask rules apply in every session, trusted or not.
* **The hook is a script in the repo.** This file’s hook runs `.claude/hooks/block-rm.sh`; [How a hook resolves](</docs/en/hooks#how-a-hook-resolves>) walks through writing it.
+ * **Rules match the command and path as written.** `Bash(git push *)` doesn’t match [`git -C . push`](</docs/en/permissions#bash-rule-limits>). `Read(./.env)` on its own stops the file tools and commands that name the file, such as `cat .env`, but not [`grep -r` run over the directory](</docs/en/permissions#read-and-edit>); the `sandbox` block in this file closes that gap, because the sandbox [adds your `Read` deny paths](</docs/en/settings-reference#sandbox-filesystem-denyread>) to what every sandboxed command can’t read.
* Copyable settings file
@@ -171,11 +172,11 @@
"allow": [
"Bash(npm run *)"
],
- // Always confirm before pushing
+ // Confirm before git push commands
"ask": [
"Bash(git push *)"
],
- // Never read env files or the secrets folder
+ // Deny reads of env files and the secrets folder by the file tools and file-reading commands
"deny": [
"Read(./.env)",
"Read(./.env.*)",
@@ -245,7 +246,7 @@
* `forceLoginMethod` and `forceLoginOrgUUID` pin the login method and organization
* `availableModels` and `enforceAvailableModels` restrict which models sessions can use
- * `permissions.deny` blocks two file reads and `curl`, and `disableBypassPermissionsMode` removes the bypass permission mode
+ * `permissions.deny` denies two file reads and `curl` commands [as Claude writes them](</docs/en/permissions#bash-rule-limits>), and `disableBypassPermissionsMode` removes the bypass permission mode
* [`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
@@ -331,7 +332,7 @@
],
"enforceAvailableModels": true,
"permissions": {
- // Block curl, the project's .env file, and its secrets folder on every machine
+ // Deny curl commands and reads of the project's .env file and secrets folder on every machine
"deny": [
"Bash(curl *)",
"Read(./.env)",
@@ -343,9 +344,9 @@
// Ignore permission rules from user, project, and local settings
"allowManagedPermissionRulesOnly": true,
// Only the GitHub MCP server, matched by URL rather than by name, since a user can
- // name any server "github". Servers that don't match don't load, which includes every
- // stdio server when the list has only URL entries; the lock below makes this managed
- // list the only allowlist that counts
+ // name any server "github". User-added servers that don't match don't load, including
+ // every stdio server when the list has only URL entries. The allowManagedMcpServersOnly
+ // key below makes this managed list the only allowlist that applies
"allowedMcpServers": [
{
"serverUrl": "https://api.githubcopilot.com/*"
Show diff (385 lines)
--- a/settings-reference.md
+++ b/settings-reference.md
@@ -16,7 +16,7 @@
`allowAllClaudeAiMcps`| Load the [claude.ai connectors](</docs/en/mcp>) Claude Code fetches itself alongside a deployed [`managed-mcp.json`](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>)| MCP| Managed
`allowedChannelPlugins`| Replace the default allowlist of [channel plugins](</docs/en/channels#restrict-which-channel-plugins-can-run>) that can push messages| Plugins and skills| Managed
`allowedHttpHookUrls`| Limit which URLs [HTTP hooks](</docs/en/hooks>) can target| Hooks and automation| Any file
-`allowedMcpServers`| Allowlist which [MCP servers](</docs/en/mcp>) people can use| MCP| Any file
+`allowedMcpServers`| Allowlist which [MCP servers](</docs/en/mcp>) users can add| MCP| Any file
`allowManagedHooksOnly`| Run only the [hooks](</docs/en/hooks>) your organization deploys| Hooks and automation| Managed
`allowManagedMcpServersOnly`| Make the managed [MCP](</docs/en/mcp>) allowlist the only one that applies| MCP| Managed
`allowManagedPermissionRulesOnly`| Make [managed settings](</docs/en/managed-settings>) the only settings source of [permission rules](</docs/en/permissions#managed-settings>)| Permission settings| Managed
@@ -106,13 +106,15 @@
`isolatePeerMachines`| Ask you before Claude [messages one of your sessions on another machine](</docs/en/cross-session-messaging#require-approval-for-cross-machine-messages>)| Agents, sessions, and worktrees| Any file
`keybindingFlavor`| Deprecated and has no effect; the word-editing shortcuts always [follow readline conventions](</docs/en/interactive-mode#make-ctrl-w-delete-back-to-whitespace>)| Interface and terminal| Any file
`language`| Have Claude respond in a language other than English| Model and responses| Any file
+`managedMcpServers`| Provide remote [MCP servers](</docs/en/managed-mcp#provide-servers-through-managed-settings>) to every user alongside the ones they add| MCP| Managed
`managedSourcesBehavior`| Compose every [managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) you deploy instead of using the highest-priority one alone| Enterprise and managed settings| Managed
+`maxEffortLevel`| Cap the [effort level](</docs/en/model-config#adjust-effort-level>) for every model or per model, on every provider| Model and responses| Any file
`minimumVersion`| Keep [auto-updates](</docs/en/setup#pin-a-minimum-version>) from installing anything below a version| Updates and versioning| Any file
`model`| Change the [model](</docs/en/model-config#set-a-default-model-for-new-sessions>) Claude Code starts with| Model and responses| Any file
`modelOverrides`| [Map model IDs](</docs/en/model-config#override-model-ids-per-version>) to your provider’s IDs, such as Bedrock ARNs| Model and responses| Any file
`modelPicker`| Choose which models the [`/model` picker](</docs/en/model-config#available-models>) lists, in your own order and with your own labels| Model and responses| User or managed
`modelPricing`| Report spend at your organization’s contracted rates instead of list price| Model and responses| Managed
-`modelSettings`| Keep a saved [effort level](</docs/en/model-config#adjust-effort-level>) per model, which Claude Code writes when you run `/effort`| Model and responses| Any file
+`modelSettings`| Keep a saved [effort level](</docs/en/model-config#adjust-effort-level>) per model, or cap one model’s effort| Model and responses| Any file
`otelHeadersHelper`| Generate rotating [OpenTelemetry](</docs/en/monitoring-usage#dynamic-headers>) headers with your own command| Authentication and providers| Any file
`outputStyle`| Change Claude’s role, tone, and output format with an [output style](</docs/en/output-styles>)| Model and responses| Any file
`parentSettingsBehavior`| Apply or drop restrictions an [SDK or IDE host](</docs/en/managed-settings#let-an-embedding-host-add-policy>) passes when you deploy [managed settings](</docs/en/managed-settings>)| Enterprise and managed settings| Managed
@@ -250,7 +252,7 @@
`advisorModel`
-Pick which model answers when Claude calls the server-side [advisor tool](</docs/en/advisor>). Unset it to turn the advisor off. The advisor must be at least as capable as your main model; when it isn’t, Claude Code sends requests without the advisor. See [Choose an advisor model](</docs/en/advisor#choose-an-advisor-model>). You don’t usually edit this key by hand. Run `/advisor` to open a picker that shows the current choice, the models that can advise, and **No advisor**. Claude Code saves your pick to this key in `~/.claude/settings.json`. In a session attached to a remote worker, the pick applies to that session only. If your account requires the [usage-credits consent](</docs/en/advisor#fable-advisor-and-usage-credits>), accept it first by running `/model fable`. Until you do, picking Fable in `/advisor` saves nothing and Claude Code tells you to run `/model fable` first.
+Pick which model answers when Claude calls the server-side [advisor tool](</docs/en/advisor>). Unset it to turn the advisor off. The advisor must be at least as capable as your main model; when it isn’t, Claude Code sends requests without the advisor. See [Choose an advisor model](</docs/en/advisor#choose-an-advisor-model>). You don’t usually edit this key by hand. Run `/advisor` to open a picker that shows the current choice, the models that can advise, and **No advisor**. Claude Code saves your pick to this key in `~/.claude/settings.json`. If you pick from a [Remote Control](</docs/en/remote-control>) client or in a session attached to a remote worker, the pick applies to that session only and doesn’t change this key. If your account requires the [usage-credits consent](</docs/en/advisor#fable-advisor-and-usage-credits>), accept it first by running `/model fable`. Until you do, picking Fable in `/advisor` saves nothing and Claude Code tells you to run `/model fable` first.
* **Scope** : `Any file`
* **Type** : string, one of the aliases `"fable"`, `"opus"`, or `"sonnet"`, which resolve to Claude Code’s current default version of that model family, or a full model ID such as `"claude-opus-5"`
@@ -263,7 +265,7 @@
"advisorModel": "opus"
}
-The key has no effect on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. `"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 and Claude Platform on AWS. `"fable"` requires [Fable access](</docs/en/advisor#choose-an-advisor-model>).
###
@@ -314,7 +316,7 @@
`effortLevel`
-Set a default [effort level](</docs/en/model-config#adjust-effort-level>) for models you haven’t saved a level for. Lower levels are faster and cheaper on straightforward tasks, and higher levels reason more deeply on complex problems. When you run `/effort low`, `medium`, `high`, or `xhigh` in an interactive session on your machine, Claude Code saves the level for the active model under `modelSettings` rather than writing this key. Within the same settings file, Claude Code uses a model’s saved level rather than this key; `modelSettings` states the cross-file precedence. In a `-p` run, the Agent SDK, or a session attached to a remote worker, `/effort` applies to that session only. The message that `/effort` prints says which happened. Before v2.1.251, `/effort` wrote this key.
+Set a default [effort level](</docs/en/model-config#adjust-effort-level>) for models you haven’t saved a level for. Lower levels are faster and cheaper on straightforward tasks, and higher levels reason more deeply on complex problems. When you run `/effort low`, `medium`, `high`, or `xhigh` in an interactive session on your machine, Claude Code saves the level for the active model under `modelSettings` rather than writing this key. Before v2.1.251, `/effort` wrote this key. Within the same settings file, Claude Code uses a model’s saved level rather than this key. `modelSettings` states the cross-file precedence. In a session attached to a remote worker, `/effort` applies to that session only. In a `-p` run or the Agent SDK it also applies to that session only, [unless a hold on the model’s default effort is in effect](</docs/en/model-config#non-interactive-effort>). [Adjust effort level](</docs/en/model-config#adjust-effort-level>) lists the interactive picks that also apply to that session only. The message that `/effort` prints says which happened.
* **Scope** : `Any file`
* **Type** : string, one of:
@@ -331,7 +333,7 @@
"effortLevel": "xhigh"
}
-On Opus 4.7, Opus 4.8, and Fable 5, Claude Code holds that model’s default effort, organization-set or built-in, until you change effort once, for example with an interactive `/effort`, the `/model` picker’s effort slider, or `--effort` at launch. After that, Claude Code resolves effort by the precedence stated at `modelSettings`. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>).
+On Opus 4.7, Opus 4.8, and Fable 5, Claude Code holds that model’s default effort, organization-set or built-in; [Adjust effort level](</docs/en/model-config#adjust-effort-level>) states which ways of setting a level end the hold and which leave it in place. Once the hold ends, Claude Code resolves effort by the precedence stated at `modelSettings`.
###
@@ -441,6 +443,34 @@
{
"language": "japanese"
}
+
+###
+
+
+
+`maxEffortLevel`
+
+Cap the [effort level](</docs/en/model-config#adjust-effort-level>) a session can use, leaving lower levels available. Any higher level runs at the cap instead, including one from `/effort`, the `/model` picker, `--effort`, [`CLAUDE_CODE_EFFORT_LEVEL`](</docs/en/env-vars>), or the model’s own default. Claude Code applies the cap itself before each request, so it holds on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry. Requires Claude Code v2.1.267 or later.
+
+ * **Scope** : `Any file`. Deploy it in managed settings to enforce it for an organization. When several scopes set a cap, the lowest applies, so a cap set in one scope can’t be raised from another
+ * **Type** : string, one of `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. A `"max"` value sets no cap
+ * **Default** : unset, so no cap applies
+ * **Per-model caps** : add `maxEffortLevel` to a model’s `modelSettings` entry. That entry replaces this key for the model only within the settings source that sets both, such as your user settings or one [managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). Set `"max"` there to exempt the model from that source’s cap; Claude Code still applies caps from other sources
+
+This example caps every model at `medium` and exempts Sonnet 4.6:
+
+settings.json
+
+ {
+ "maxEffortLevel": "medium",
+ "modelSettings": {
+ "claude-sonnet-4-6": {
+ "maxEffortLevel": "max"
+ }
+ }
+ }
+
+When your organization also sets an [effort limit](</docs/en/model-config#organization-effort-limits>) for a model, the lower of the two caps applies.
###
@@ -600,10 +630,10 @@
`modelSettings`
-Requires Claude Code v2.1.251 or later. Save an [effort level](</docs/en/model-config#adjust-effort-level>) for each model you use. In an interactive session on your machine, when you run `/effort low`, `medium`, `high`, or `xhigh` or move the `/model` picker’s effort slider, Claude Code saves that level here under the model you’re using, so you rarely edit this key yourself. The `effortLevel` entry lists the sessions in which `/effort` applies to that session only. Edit the key by hand to change or remove a level you saved. A model’s entry here takes precedence over `effortLevel` in the same settings file. Across files, Claude Code resolves each model separately: the highest-precedence [settings file](</docs/en/settings#settings-precedence>) that sets either that model’s entry or `effortLevel` decides, so an `effortLevel` in managed settings outranks a level you saved in user settings. [Adjust effort level](</docs/en/model-config#adjust-effort-level>) lists what else can override a saved level, such as `--effort` at launch.
-
- * **Scope** : `Any file`
- * **Type** : object mapping a model name to an object with an `effortLevel` field, one of `"low"`, `"medium"`, `"high"`, or `"xhigh"`
+Save an [effort level](</docs/en/model-config#adjust-effort-level>) for each model you use. In an interactive session on your machine, when you save `low`, `medium`, `high`, or `xhigh` as your default with `/effort` or the `/model` picker’s effort slider, Claude Code writes that level here under the model you’re using, so you rarely edit this key yourself. The `effortLevel` entry lists the sessions where `/effort` applies to that session only. Requires Claude Code v2.1.251 or later. Edit the key by hand to change or remove a level you saved. A model’s `effortLevel` here takes precedence over the top-level `effortLevel` in the same settings file. Across files, Claude Code resolves each model separately: the highest-precedence [settings file](</docs/en/settings#settings-precedence>) that sets either an `effortLevel` for that model or the top-level `effortLevel` decides, so an `effortLevel` in managed settings outranks a level you saved in user settings. [Adjust effort level](</docs/en/model-config#adjust-effort-level>) lists what else can override a saved level, such as `--effort` at launch. To cap one model’s effort rather than set its level, add a `maxEffortLevel` field to that model’s entry. The field requires Claude Code v2.1.267 or later.
+
+ * **Scope** : `Any file`
+ * **Type** : object mapping a model name to an object with an `effortLevel` field, one of `"low"`, `"medium"`, `"high"`, or `"xhigh"`, a `maxEffortLevel` field, or both
* **Default** : unset
Claude Code writes each entry under the model’s canonical name, such as `claude-opus-5`, and matches that model’s alias, date-suffixed, `[1m]`, and recognized provider-specific IDs to the same entry. This example keeps Opus 5 at `medium` while other models use their own saved or default levels:
@@ -626,7 +656,7 @@
`outputStyle`
-Select an [output style](</docs/en/output-styles>) by name. An output style is a saved set of instructions that Claude Code adds to the system prompt to change Claude’s role, tone, and output format, such as the built-in Explanatory and Learning styles or one you wrote yourself. If you change this key during a session, Claude uses the new style starting with your next message. That message rebuilds the [prompt cache](</docs/en/prompt-caching#changing-output-style>) once, because the style is part of the system prompt. Before v2.1.251, the edit applied only after you ran `/clear` or started a new session.
+Select an [output style](</docs/en/output-styles>) by name. An output style is a saved set of instructions that changes Claude’s role, tone, and output format, such as the built-in Explanatory and Learning styles or one you wrote yourself. If you change this key during a session, Claude uses the new style starting with your next message. For what that message costs in prompt caching, see [Changing output style](</docs/en/prompt-caching#changing-output-style>). Before v2.1.251, the edit applied only after you ran `/clear` or started a new session.
* **Scope** : `Any file`
* **Type** : string, the name of a [built-in](</docs/en/output-styles#built-in-output-styles>) or [custom](</docs/en/output-styles#create-a-custom-output-style>) output style
@@ -733,7 +763,7 @@
"switchModelsOnFlag": false
}
-See [Ask before switching](</docs/en/model-config#ask-before-switching>). Requires Claude Code v2.1.170 or later.
+See [Ask before switching](</docs/en/model-config#ask-before-switching>).
###
@@ -741,11 +771,11 @@
`ultracode`
-Start sessions with [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>) on. With it on, Claude plans a workflow for each substantive task instead of waiting for you to ask. Claude plans workflows only when [dynamic workflows](</docs/en/workflows>) are enabled for you and your model supports `xhigh` effort. Either way, `ultracode: true` runs the session at `xhigh` effort. Claude Code reads this key but never writes it: `/effort ultracode` turns ultracode on for the current session only.
-
- * **Scope** : `Any file`
- * **Type** : Boolean
- * `true`: sessions start at `xhigh` effort, with ultracode on when dynamic workflows are enabled for you and your model supports `xhigh`
+Start sessions with [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>) on. With it on, Claude plans a workflow for each substantive task instead of waiting for you to ask. Claude plans workflows only when [dynamic workflows](</docs/en/workflows>) are enabled for you, your model supports `xhigh` effort, and no [effort cap](</docs/en/model-config#organization-effort-limits>) below `xhigh` applies. Either way, `ultracode: true` runs the session at `xhigh` effort, or at the cap when an effort cap is lower. Claude Code reads this key but never writes it: `/effort ultracode` turns ultracode on for the current session only.
+
+ * **Scope** : `Any file`
+ * **Type** : Boolean
+ * `true`: sessions start at `xhigh` effort, with ultracode on when dynamic workflows are enabled for you, your model supports `xhigh`, and no effort cap is below `xhigh`
* `false`: sessions start with ultracode off
* **Default** : unset, so ultracode is off
* **Per-session overrides** : `/effort ultracode` turns ultracode on for one session without this key. So does `--effort ultracode`, which requires Claude Code v2.1.203 or later
@@ -756,7 +786,7 @@
"ultracode": true
}
-Ultracode runs the session at `xhigh` effort and takes precedence over `effortLevel` and `modelSettings` entries. An Agent SDK `apply_flag_settings` control request also accepts the key.
+Ultracode runs the session at `xhigh` effort and takes precedence over `effortLevel` and `modelSettings` entries. If an [effort cap](</docs/en/model-config#organization-effort-limits>) below `xhigh` applies to the model, such as a `maxEffortLevel` setting, the session runs at the cap instead and ultracode stays off. Claude then doesn’t plan workflows on its own, and `/effort` doesn’t offer `ultracode`. An Agent SDK `apply_flag_settings` control request also accepts the key.
##
@@ -969,7 +999,7 @@
`permissions.deny`
-List the tool uses Claude Code blocks. Use it for files that hold API keys, secrets, or environment values: Claude Code excludes matching files from file discovery and search results, denies reads of them, and blocks the [Edit and Write tools](</docs/en/permissions#read-and-edit>) on the matching paths. Read and Edit deny rules apply to Claude’s built-in file tools, to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, and `sed`, and to the targets of Bash [redirections](</docs/en/permissions#redirections>) such as `> file` and `< file`; they don’t apply to arbitrary subprocesses, so for OS-level enforcement [enable the sandbox](</docs/en/sandboxing>).
+List the tool uses Claude Code blocks. Use it for files that hold API keys, secrets, or environment values: Claude Code excludes matching files from file discovery and search results, denies reads of them, and blocks the [Edit and Write tools](</docs/en/permissions#read-and-edit>) on the matching paths. Read and Edit deny rules apply to Claude’s built-in file tools, to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, and `sed`, and to the targets of Bash [redirections](</docs/en/permissions#redirections>) such as `> file` and `< file`; they don’t apply to a command that reads files without naming them, such as `grep -r pattern .`, or to arbitrary subprocesses, so for OS-level enforcement [enable the sandbox](</docs/en/sandboxing>).
* **Scope** : `Any file`
* **Type** : array of permission rule strings
@@ -992,7 +1022,7 @@
}
}
-Tool names accept glob patterns, so `"*"` denies every tool and `"mcp__*"` denies every MCP tool. Claude Code ignores a deny rule for the [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) tool as long as any other tool is still available to Claude. For what a `Bash` deny rule can and can’t catch, see [Bash permission limitations](</docs/en/permissions#tool-specific-permission-rules>). This key replaces the deprecated `ignorePatterns` configuration.
+Tool names accept glob patterns, so `"*"` denies every tool and `"mcp__*"` denies every MCP tool. Claude Code ignores a deny rule for the [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) tool as long as any other tool is still available to Claude. A `Bash` deny rule matches the command as Claude writes it, so `Bash(curl *)` doesn’t stop `/usr/bin/curl` or `sh -c 'curl …'`; see [what a Bash rule doesn’t match](</docs/en/permissions#bash-rule-limits>). This key replaces the deprecated `ignorePatterns` configuration.
###
@@ -2118,7 +2148,7 @@
}
}
-Claude Code merges this list from every settings source the session loads even when `allowManagedDomainsOnly` is set, so a developer can always tighten the deny list. For IPv6 literals, see [IPv6 addresses in domain lists](</docs/en/sandboxing#ipv6-addresses-in-domain-lists>).
+Claude Code merges this list from every settings source the session loads even when `allowManagedDomainsOnly` is set, so a developer can always tighten the deny list. For IPv6 literals, see [IPv6 addresses in domain lists](</docs/en/sandboxing#ipv6-addresses-in-domain-lists>). An entry written with the trailing dot that marks a fully qualified domain name, such as `example.com.`, blocks the same connections as `example.com`.
###
@@ -2708,7 +2738,7 @@
`dialogExpiry`
-Set the deadline for dialogs Claude Code [forwards to a remote client](</docs/en/remote-control#limitations>), such as a Remote Control or SDK host, for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), and for the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may have nobody at the terminal. When no answer arrives before the deadline, Claude Code cancels the dialog and continues with its no-action default. Requires Claude Code v2.1.224 or later.
+Set the deadline for dialogs Claude Code [forwards to a remote client](</docs/en/remote-control#limitations>), such as a Remote Control or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>). On Claude Code v2.1.236 or later, the same deadline bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may have nobody at the terminal. When no answer arrives before the deadline, Claude Code cancels the dialog and continues with its no-action default. Requires Claude Code v2.1.224 or later.
* **Scope** : `User or managed`
* **Type** : string, one of `"60s"`, `"5m"`, `"10m"`, or `"never"`, which disables the deadline
@@ -2985,7 +3015,7 @@
`showTurnDuration`
-Show or hide the turn duration message after each response, such as “Cooked for 1m 6s”. Appears in `/config` as **Show turn duration**.
+Show or hide the turn duration message after each response, such as “Cooked for 1m 6s · done 6:05 PM”. The clock after “done” shows when the turn finished; `timeFormat` and `timeZone` control its format and zone. Appears in `/config` as **Show turn duration**.
* **Scope** : `Any file`. A value in `~/.claude.json` from an older version applies when no settings file sets it.
* **Type** : Boolean
@@ -3195,7 +3225,7 @@
`terminalProgressBarEnabled`
-Some terminals can show a progress indicator on the tab or in the taskbar for the program running in them. While Claude is working, Claude Code reports an in-progress state to the terminal and clears it when the turn ends, so you can see from another tab or window whether Claude is still busy. It does so only in terminals that support the indicator: ConEmu, Ghostty 1.2.0 or later, and iTerm2 3.6.6 or later. Set this key to `false` to stop reporting it. Appears in `/config` as **Terminal progress bar**.
+Some terminals can show a progress indicator on the tab or in the taskbar for the program running in them. While Claude is working, Claude Code reports an in-progress state to the terminal, so you can see from another tab or window whether the session is still busy. The indicator stays visible after the turn ends while [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) or [dynamic workflows](</docs/en/workflows>) are still running, and clears once the session is idle. Claude Code reports it only in terminals that support the indicator: ConEmu, Ghostty 1.2.0 or later, and iTerm2 3.6.6 or later. Set this key to `false` to stop Claude Code from reporting it. Appears in `/config` as **Terminal progress bar**.
* **Scope** : `Any file`. A value in `~/.claude.json` from an older version applies when no settings file sets it.
* **Type** : Boolean
@@ -3564,7 +3594,7 @@
`prUrlTemplate`
-Point the PR links Claude Code renders, in the footer badge and in tool-result summaries, at an internal code-review tool instead of `github.com`. Claude Code substitutes `{host}`, `{owner}`, `{repo}`, `{number}`, and `{url}` from the PR URL. The [GitLab merge request badge](</docs/en/interactive-mode#gitlab-merge-requests>) keeps its GitLab URL.
+Point the PR links Claude Code renders, in the footer badge and in tool-result summaries, at an internal code-review tool instead of `github.com`. Claude Code substitutes `{host}`, `{owner}`, `{repo}`, `{number}`, and `{url}` from the PR URL. [GitLab merge request](</docs/en/interactive-mode#gitlab-merge-requests>) links on both surfaces keep their GitLab URL.
* **Scope** : `Any file`
* **Type** : string, a URL template using any of the five placeholders
@@ -3974,7 +4004,7 @@
}
}
-`"name-only"` lists the skill to the model without its description, `"user-invocable-only"` hides it from the model but keeps `/name` typable, and `"off"` hides it from both. Overrides don’t apply to plugin skills, which you manage through `/plugin`.
+Overrides don’t apply to plugin skills, which you manage through `/plugin`. In managed settings and files passed with `--settings`, a key on a bundled skill’s alias, such as `checkup` for `/doctor`, also applies to the skill; see [how alias keys combine with keys on the skill’s own name](</docs/en/skills#override-skill-visibility-from-settings>).
###
@@ -4368,7 +4398,7 @@
`strictPluginOnlyCustomization.mcp`
-Lock the `mcp` surface. Claude Code stops loading MCP servers from `~/.claude.json` and `.mcp.json`, and keeps loading plugin MCP servers and [`managed-mcp.json`](</docs/en/managed-mcp>) servers.
+Lock the `mcp` surface. Claude Code stops loading MCP servers from `~/.claude.json` and `.mcp.json`, and keeps loading plugin MCP servers, [`managed-mcp.json`](</docs/en/managed-mcp>) servers, and servers from `managedMcpServers`.
* **Scope** : `Managed`
* **Type** : the string `"mcp"` in the `strictPluginOnlyCustomization` array
@@ -4575,11 +4605,11 @@
`allowedMcpServers`
-Allowlist the MCP servers people can use. Claude Code blocks any server that doesn’t match an entry wherever it’s defined, including plugin servers, servers passed with `--mcp-config`, and servers from `managed-mcp.json`. Built-in servers such as Claude in Chrome, the `ide` server Claude Code connects to in a running [VS Code](</docs/en/vs-code#the-built-in-ide-mcp-server>) or [JetBrains](</docs/en/jetbrains#the-built-in-ide-mcp-server>) IDE, and servers the CLI itself configures are exempt from the allowlist, and the denylist still applies to them. In-process `type: "sdk"` servers, which the [app that started the session registers](</docs/en/mcp#how-connectors-reach-claude-code>), are exempt from both lists.
+Allowlist the MCP servers people can add. Claude Code blocks any server that doesn’t match an entry wherever it’s defined, including plugin servers, servers passed with `--mcp-config`, and servers from claude.ai. Built-in servers such as Claude in Chrome, the `ide` server Claude Code connects to in a running [VS Code](</docs/en/vs-code#the-built-in-ide-mcp-server>) or [JetBrains](</docs/en/jetbrains#the-built-in-ide-mcp-server>) IDE, and servers the CLI itself configures are exempt from the allowlist, and the denylist still applies to them. In-process `type: "sdk"` servers are exempt from both lists; the [app that started the session](</docs/en/mcp#how-connectors-reach-claude-code>) registers them. Servers your organization delivers are also exempt from the allowlist, and the denylist still applies to them. The exemption covers every `managedMcpServers` entry, and any [`managed-mcp.json`](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) entry whose values use no `${VAR}` expansion. See [How a server is evaluated](</docs/en/managed-mcp#how-a-server-is-evaluated>) for the full check order. Before v2.1.259, servers from `managed-mcp.json` had to match too.
* **Scope** : `Any file`. Entries from every file merge into one allowlist unless `allowManagedMcpServersOnly` is set. Deploy it in managed settings to enforce it.
* **Type** : array of objects, each with exactly one key: `serverName`, a string limited to letters, numbers, hyphens, and underscores; `serverCommand`, an array of the command and its arguments matched exactly; or `serverUrl`, a URL pattern with `*` wildcards
- * **Default** : unset, so every server is allowed; an empty array blocks every server
+ * **Default** : unset, so every server is allowed; an empty array blocks every server users add
This example allows only the stdio server that the listed `npx` command starts:
@@ -4626,7 +4656,7 @@
`deniedMcpServers`
-Block specific MCP servers. Claude Code refuses to load a matching server wherever it’s defined, including plugin servers, servers passed with `--mcp-config`, servers from `managed-mcp.json`, and the claude.ai connectors [it fetches itself](</docs/en/mcp#how-connectors-reach-claude-code>). In-process `type: "sdk"` servers, which the app that started the session registers, are exempt.
+Block specific MCP servers. Claude Code refuses to load a matching server wherever it’s defined, including plugin servers, servers passed with `--mcp-config`, servers from `managed-mcp.json`, servers from `managedMcpServers`, and the claude.ai connectors [it fetches itself](</docs/en/mcp#how-connectors-reach-claude-code>). In-process `type: "sdk"` servers are exempt; the app that started the session registers them.
* **Scope** : `Any file`. Entries from every file merge into one denylist, and `allowManagedMcpServersOnly` doesn’t change that. Deploy it in managed settings to enforce it.
* **Type** : array of objects, each with exactly one key: `serverName`, any non-empty string, so a claude.ai connector’s display name such as `"claude.ai Slack"` works; `serverCommand`, an array of the command and its arguments matched exactly; or `serverUrl`, a URL pattern with `*` wildcards
@@ -4728,6 +4758,33 @@
}
A `disabledMcpjsonServers` entry still rejects a server.
+
+###
+
+
+
+`managedMcpServers`
+
+Provide remote MCP servers to every user from managed settings. Users keep the servers they add themselves and can’t edit or remove the ones you provide. Requires Claude Code v2.1.259 or later.
+
+ * **Scope** : `Managed`. Claude Code drops the key with a warning in user, project, and local settings, and doesn’t read it in the Claude Desktop app’s Code tab on a third-party deployment or in the app’s Cowork sessions, where Claude Desktop supplies and locks those sessions’ MCP servers itself.
+ * **Type** : object keyed by server name. Each entry has the `.mcp.json` shape for an `http` or `sse` server: a required `https://` `url`, and optionally `headers`, `oauth`, and the other HTTP and SSE options. Claude Code drops entries that fail validation, and [What an entry can contain](</docs/en/managed-mcp#what-an-entry-can-contain>) lists the conditions
+ * **Default** : unset, so managed settings provide no servers
+
+This example provides one HTTP server named `search`:
+
+managed-settings.json
+
+ {
+ "managedMcpServers": {
+ "search": {
+ "type": "http",
+ "url": "https://search.example.com/mcp"
+ }
+ }
+ }
+
+For precedence, how provided servers combine with `managed-mcp.json` and the allow and deny lists, and what users see, see [Provide servers through managed settings](</docs/en/managed-mcp#provide-servers-through-managed-settings>).
##
@@ -5385,7 +5442,7 @@
"forceLoginMethod": "claudeai"
}
-Every first-party login path applies the restriction, including the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, and `/install-github-app`, except the terminal’s interactive login screen, reached by `/login` or first-run onboarding, which pre-selects the method without enforcing it. Before v2.1.212, only terminal logins applied it. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for how each login path, environment credentials, and third-party providers are handled.
+Every first-party login path applies the restriction, including the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, and `/install-github-app`, except the terminal’s interactive login screen, reached by `/login` or first-run onboarding, which pre-selects the method without enforcing it. Before v2.1.212, only terminal logins applied it. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for how each login path, environment credentials, and third-party providers are handled. When a managed source on the machine sets `"gateway"`, Claude Code doesn’t use a leftover login, API key, or `apiKeyHelper` credential. See [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>) for the message each one produces. If you select a cloud provider through `CLAUDE_CODE_USE_BEDROCK` or a similar environment variable, the session doesn’t need the gateway sign-in. Before v2.1.261, Claude Code used a leftover login on these machines.
###
@@ -5393,7 +5450,7 @@
`forceLoginGatewayUrl`
-Set the gateway URL the `/login` Cloud gateway screen connects to, so people reach your [cloud gateway](</docs/en/claude-apps-gateway>) without typing its address. The screen has no URL field: with this key set, it shows your gateway URL and connects when the person presses Enter; without it, it tells them to contact their IT administrator. When `forceLoginMethod` is unset, this key alone opens the Cloud gateway screen. `forceLoginMethod: "gateway"` also opens it and removes the login-method picker, and a `claudeai` or `console` value there takes precedence over this key. Set both keys so the screen connects instead of showing an error.
+Set the gateway URL the `/login` Cloud gateway screen connects to, so people reach your [cloud gateway](</docs/en/claude-apps-gateway>) without typing its address. The screen has no URL field: with this key set, it shows your gateway URL and connects when the person presses Enter; without it, it tells them to contact their IT administrator. Either this key or `forceLoginMethod: "gateway"` makes the machine gateway-only, so `/login` opens on the Cloud gateway screen with no login-method picker. See [Administrator policy requires a Cloud gateway sign-in](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>) for what happens to a leftover first-party login or API key. Set both keys so the screen connects instead of showing an error.
* **Scope** : `Managed`. Read only from a source on the machine: `managed-settings.json`, the macOS plist or Windows HKLM registry, or a policy helper. Claude Code ignores it in HKCU and server-managed settings.
* **Type** : string, a full URL including the scheme
@@ -5405,7 +5462,7 @@
"forceLoginGatewayUrl": "https://claude-gateway.example.com"
}
-A value that isn’t a valid URL is dropped on its own; the rest of the managed settings file still applies. See [Set the gateway URL](</docs/en/claude-apps-gateway#set-the-gateway-url>).
+If the value isn’t a valid URL, the sign-in screen reports it, and the rest of the managed settings file still applies. See [Set the gateway URL](</docs/en/claude-apps-gateway#set-the-gateway-url>).
###
@@ -5819,21 +5876,24 @@
"managedSourcesBehavior": "merge"
}
-Under `"merge"`, Claude Code combines each key by its kind. This table gives the rule for each kind; the restriction allowlist and highest-source-only rows name every key they cover, and the other rows give examples:
+Under `"merge"`, Claude Code combines each key by its kind. This table gives the rule for each kind. The restriction allowlist, values-taken-whole, and highest-source-only rows name every key they cover, and the other rows give examples:
Kind of key| How Claude Code combines it| Keys
---|---|---
Lists| Combines entries from every source| `permissions.allow`, `sandbox.network.allowedDomains`, and other list keys
Locks| Applies the strictest value any source sets. When no source sets a strict value, applies a looser value only from the highest source| `allowManagedPermissionRulesOnly`, `permissions.disableBypassPermissionsMode`, and other boolean or enum locks
Restriction allowlists| Takes the list whole from the highest source that sets it, without adding entries from lower sources. When the highest source doesn’t set one, takes it whole from the next source down| `availableModels`, `allowedMcpServers`, `strictKnownMarketplaces`, `allowedChannelPlugins`, and the `fallbackModel` chain
-Read from the highest-priority source only| Reads the key only from the highest-priority source that carries a policy key, so a lower source’s value is ignored even when the highest source sets none| `apiKeyHelper`, `awsAuthRefresh`, `awsCredentialExport`, `gcpAuthRefresh`, `otelHeadersHelper`, `proxyAuthHelper`, `forceLoginOrgUUID`, `forceLoginMethod`, `forceLoginGatewayUrl`, `parentSettingsBehavior`, `modelPicker`, `permissions.defaultMode`
+Values taken whole| Takes the value whole from the highest source that sets it, without combining entries or fields from lower sources. When the highest source doesn’t set it, takes it whole from the next source down| `sandbox.credentials.awsPairs`, `sandbox.ripgrep`
+Provided MCP servers| Combines the server names from every source. When two sources set the same name, applies the higher source’s whole entry| `managedMcpServers`
+Read from the highest-priority source only| Reads the key only from the highest-priority source that carries a policy key, so a lower source’s value is ignored even when the highest source sets none| `apiKeyHelper`, `awsAuthRefresh`, `awsCredentialExport`, `gcpAuthRefresh`, `otelHeadersHelper`, `proxyAuthHelper`, `forceLoginOrgUUID`, `forceLoginMethod`, `forceLoginGatewayUrl`, `parentSettingsBehavior`, `modelPicker`, `policyHelper`, `permissions.defaultMode`
`env`| [Merges per variable across admin sources](</docs/en/managed-settings#keys-read-from-every-admin-source>), under both `"first-wins"` and `"merge"`| `env`
Every other key| Takes the value from the highest source that sets it| `cleanupPeriodDays`, `model`
-Two of those keys add a condition of their own:
-
+Taking `sandbox.credentials.awsPairs` and `sandbox.ripgrep` whole requires Claude Code v2.1.257 or later. Three of those keys add a condition of their own:
+
+ * **`policyHelper`** : Claude Code honors it only when the highest source that carries a policy key is an MDM policy or a managed settings file, so under server-managed settings it doesn’t apply.
* **`modelOverrides`** : pairs with `availableModels`. Claude Code takes `modelOverrides` from the highest source that sets it, unless a higher source sets `availableModels` without `modelOverrides`. In that case it ignores `modelOverrides` from every source.
- * **`forceLoginGatewayUrl` and the `"gateway"` value of `forceLoginMethod`**: Claude Code honors them only when the highest source is an MDM policy or a managed settings file, so under server-managed settings neither applies.
+ * **`forceLoginGatewayUrl` and the `"gateway"` value of `forceLoginMethod`**: Claude Code reads them only from the managed sources on the machine itself and ignores them in server-managed settings. The machine’s values apply even when server-managed settings are also present.
To confirm which sources combined on a machine, run `/status` and [read the `Setting sources` line](</docs/en/managed-settings#read-the-source-in-/status>).
@@ -5867,11 +5927,11 @@
Run an executable you deploy that computes managed settings at startup, so you can derive policy from device posture, identity, or a remote service instead of a static file. Claude Code runs the helper before it accepts the first prompt and treats the settings it emits as the managed settings for the session.
- * **Scope** : `Managed`. Read from the macOS plist, the Windows HKLM registry, or the managed settings file. Claude Code reads the key from the highest-priority managed source that delivers settings and runs the helper only when that source is one of those three; it ignores the key in server-managed settings, the HKCU registry, and host-supplied parent settings.
+ * **Scope** : `Managed`. Read from the macOS plist, the Windows HKLM registry, or the managed settings file. Claude Code reads the key from the highest-priority managed source that carries a [policy key](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) and runs the helper only when that source is one of those three; it ignores the key in server-managed settings, the HKCU registry, and host-supplied parent settings.
* **Type** : object with `path`, `timeoutMs`, and `refreshIntervalMs`
* **Default** : unset, so no helper runs
-This example runs the helper with a 5-second timeout and re-runs it every five minutes:
+When server-managed settings deliver the policy at launch, they take precedence over the helper’s source and the helper doesn’t run. If a later settings fetch reports the server-managed settings removed, Claude Code runs the helper at that point rather than waiting for the next launch. Its output governs the rest of the session, and a run that fails ends the session with the same message as a failed startup run. This example runs the helper with a 5-second timeout and re-runs it every five minutes:
managed-settings.json
@@ -5897,7 +5957,7 @@
}
}
-When the helper emits `managedSettings`, that object becomes the only managed settings source for the run: Claude Code ignores the MDM, file, and HKCU sources, reads the [cross-source keys](</docs/en/managed-settings#keys-read-from-every-admin-source>) from the helper’s output alone, and never merges [parent settings](</docs/en/managed-settings#parent-settings-from-embedding-hosts>). The startup `forceRemoteSettingsRefresh` check runs before the helper and reads any admin source. A helper that exits 0 with an envelope that omits `managedSettings` contributes no managed settings, and the other sources apply as usual.
+When the helper emits `managedSettings`, that object becomes the only managed settings source for the run: Claude Code ignores the MDM, file, and HKCU sources, reads the [cross-source keys](</docs/en/managed-settings#keys-read-from-every-admin-source>) from the helper’s output alone, and never merges [parent settings](</docs/en/managed-settings#parent-settings-from-embedding-hosts>). The startup `forceRemoteSettingsRefresh` check runs before the helper and reads any admin source. A helper that exits `0` with an envelope that omits `managedSettings` contributes no managed settings, and the other sources apply as usual.
####
@@ -5913,7 +5973,7 @@
* The helper writes more than 1 MiB to stdout or to stderr.
* stdout isn’t a single JSON object, or its `managedSettings` has a [schema violation Claude Code can’t repair](</docs/en/managed-settings#find-entries-claude-code-dropped>).
-When the startup run fails, Claude Code prints the reason and refuses to start. After a non-zero exit or a timeout, the message includes the helper’s stderr. The refusal covers interactive sessions, `claude -p`, Agent SDK sessions, [background sessions](</docs/en/agent-view>), and most subcommands. The refusal is deliberate, so a helper that needs outage resilience should serve from its own cache and exit `0`. When a background refresh fails, Claude Code keeps the last successful policy in effect. Claude Code runs each refresh under the same `timeoutMs` and failure rules as the startup run. With `--debug`, Claude Code writes the helper’s stderr from every run to the [debug log](</docs/en/debug-your-config>). Claude Code reports an invalid `policyHelper` value as a [dropped entry](</docs/en/managed-settings#find-entries-claude-code-dropped>) and starts the session on the remaining managed settings without running a helper. Invalid values include a bare path string and a `timeoutMs` below its minimum. To turn a helper off, remove the key from the source that sets it.
+When the startup run fails, Claude Code prints the reason and refuses to start. After a non-zero exit or a timeout, the message includes the helper’s stderr. The refusal covers interactive sessions, `claude -p`, Agent SDK sessions, [background sessions](</docs/en/agent-view>), and most subcommands. The refusal is deliberate, so a helper that needs outage resilience should serve from its own cache and exit `0`. When a background refresh fails, Claude Code keeps the last successful policy in effect, and `/status` shows the failing refresh with its reason until a refresh succeeds. Each refresh runs under the same `timeoutMs` and failure rules as the startup run. With `--debug`, Claude Code writes the helper’s stderr from every run to the [debug log](</docs/en/debug-your-config>). Claude Code reports an invalid `policyHelper` value as a [dropped entry](</docs/en/managed-settings#find-entries-claude-code-dropped>) and starts the session on the remaining managed settings without running a helper. Invalid values include a bare path string and a `timeoutMs` below its minimum. To turn a helper off, remove the key from the source that sets it.
###
--- a/statusline.md
+++ b/statusline.md
@@ -160,7 +160,7 @@
`workspace.project_dir`| Directory where Claude Code was launched, which may differ from `cwd` if the working directory changes during a session
`workspace.added_dirs`| Additional directories added via `/add-dir` or `--add-dir`. Empty array if none have been added
`workspace.git_worktree`| Git worktree name when the current directory is inside a linked worktree created with `git worktree add`. Absent in the main working tree. Populated for any git worktree, unlike `worktree.*`, which is present only while the session is in a [worktree session](</docs/en/worktrees>)
-`workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured
+`workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example, `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured. For a gitlab.com project nested in subgroups, `owner` is the full namespace path with slashes, such as `"group/subgroup"`. Before v2.1.260, `workspace.repo` was absent for these projects
`cost.total_cost_usd`| Estimated session cost in USD, computed client-side at list price unless a [`modelPricing`](</docs/en/settings-reference#modelpricing>) table is in effect. May differ from your actual bill. Resets to $0 when `/clear` starts a new session. Before v2.1.211, the total carried over after `/clear`
`cost.total_duration_ms`| Total wall-clock time since the session started, in milliseconds
`cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds
--- a/streaming-output.md
+++ b/streaming-output.md
@@ -1,4 +1,4 @@
-By default, the Agent SDK yields complete `AssistantMessage` objects after Claude finishes generating each response. To receive incremental updates as text and tool calls are generated, enable partial message streaming.
+By default, the Agent SDK yields a complete `AssistantMessage` for each non-empty content block, such as a text block or a tool call, after Claude finishes generating that block. To receive incremental updates as text and tool calls are generated, enable partial message streaming.
This page covers output streaming (receiving tokens in real-time). For input modes (how you send messages), see [Send messages to agents](</docs/en/agent-sdk/streaming-vs-single-mode>). You can also [stream responses using the Agent SDK via the CLI](</docs/en/headless>).
@@ -90,9 +90,10 @@
uuid: UUID;
session_id: string;
ttft_ms?: number; // Time to first token in ms, present only on message_start events
+ user_message_uuid?: string;
};
-The `parent_tool_use_id` field is always `None` in Python and `null` in TypeScript. Stream events are emitted for the main session only; token-level deltas from subagents aren’t forwarded. To attribute output to a subagent, use complete messages, which carry `parent_tool_use_id`. See [Detect subagent invocation](</docs/en/agent-sdk/subagents#detect-subagent-invocation>). The `event` field contains the raw streaming event from the [Claude API](<https://platform.claude.com/docs/en/build-with-claude/streaming#event-types>). Common event types include:
+The `parent_tool_use_id` field is always `None` in Python and `null` in TypeScript. Stream events are emitted for the main session only; token-level deltas from subagents aren’t forwarded. To attribute output to a subagent, use complete messages, which carry `parent_tool_use_id`. See [Detect subagent invocation](</docs/en/agent-sdk/subagents#detect-subagent-invocation>). Claude Code sets `user_message_uuid` on the turn’s first non-ping stream event, and again when the message the turn is answering changes, under the conditions in [`user_message_uuid`](</docs/en/agent-sdk/typescript#user_message_uuid>). The Python `StreamEvent` doesn’t expose this field. The `event` field contains the raw streaming event from the [Claude API](<https://platform.claude.com/docs/en/build-with-claude/streaming#event-types>). Common event types include:
Event Type| Description
---|---
@@ -109,23 +110,24 @@
Message flow
-With partial messages enabled, you receive messages in this order:
+Claude Code emits an `AssistantMessage` as each non-empty content block completes, so a response with a text block and a tool call yields two `AssistantMessage` objects. Each one carries only its own content block, and both share the same message ID, which you read as `message.message.id` in TypeScript and `message.message_id` in Python. With partial messages enabled, each `AssistantMessage` arrives before that block’s `content_block_stop` event, and you receive messages in this order:
StreamEvent (message_start)
StreamEvent (content_block_start) - text block
StreamEvent (content_block_delta) - text chunks...
+ AssistantMessage - complete text block
StreamEvent (content_block_stop)
StreamEvent (content_block_start) - tool_use block
StreamEvent (content_block_delta) - tool input chunks...
+ AssistantMessage - complete tool_use block
StreamEvent (content_block_stop)
StreamEvent (message_delta)
StreamEvent (message_stop)
- AssistantMessage - complete message with all content
... tool executes ...
... more streaming events for next turn ...
ResultMessage - final result
-Without partial messages enabled, you receive all message types except `StreamEvent`. Common types include `SystemMessage` (session initialization), `AssistantMessage` (complete responses), `ResultMessage` (final result), and a compact boundary message indicating when conversation history was compacted (`SDKCompactBoundaryMessage` in TypeScript; `SystemMessage` with subtype `"compact_boundary"` in Python).
+Without partial messages enabled, you receive all message types except `StreamEvent`. Common types include `SystemMessage` (session initialization), `AssistantMessage` (complete content blocks), `ResultMessage` (final result), and a compact boundary message indicating when conversation history was compacted (`SDKCompactBoundaryMessage` in TypeScript; `SystemMessage` with subtype `"compact_boundary"` in Python).
##
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -458,7 +458,12 @@
Permission modes
-Set `permissionMode` to choose the permission mode a subagent runs in. Use the modes’ config values, so Manual mode is `default`. If you leave it unset, the subagent inherits the main conversation’s mode, which starts as [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) on Pro, Max, and Team plans unless your settings or your organization change it. Setting it overrides that mode, except in the cases described below.
+Set `permissionMode` to choose the permission mode a subagent runs in. Use the modes’ config values, so Manual mode is `default`. If you leave it unset, the subagent inherits the main conversation’s mode, which starts as [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) on Pro, Max, and Team plans unless your settings or your organization change it. The main conversation’s permission mode decides whether Claude Code uses the value you set:
+
+ * When the main conversation is in `bypassPermissions`, `acceptEdits`, or [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the subagent runs in that same mode and Claude Code ignores the `permissionMode` you set. Under auto mode, the classifier evaluates the subagent’s tool calls with the main conversation’s block and allow rules.
+ * When the main conversation is in `default`, `dontAsk`, or `plan` mode, the subagent runs in the permission mode you set, except `bypassPermissions`. A subagent that declares `bypassPermissions` keeps the main conversation’s mode instead. The `bypassPermissions` exception requires Claude Code v2.1.267 or later.
+
+`permissionMode` accepts these values, and `manual` as an alias for `default`:
Mode| Behavior
---|---
@@ -466,12 +471,8 @@
`acceptEdits`| Auto-accept file edits and common filesystem commands for paths in the working directory or `additionalDirectories`
`auto`| [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>): a background classifier reviews commands and protected-directory writes
`dontAsk`| Auto-deny permission prompts. Explicitly allowed tools still work; `AskUserQuestion`, MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code are denied even if you’ve allowed them
-`bypassPermissions`| Skip permission prompts
+`bypassPermissions`| [Skip permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>). A subagent runs in this mode only when the main conversation does
`plan`| Plan mode (read-only exploration)
-
-Use `bypassPermissions` with caution. It skips permission prompts, allowing the subagent to execute operations without approval, including writes to `.git`, `.config/git`, `.claude`, `.vscode`, `.idea`, `.husky`, `.cargo`, `.devcontainer`, `.yarn`, and `.mvn`.Even in this mode, the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) still apply. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) for details.
-
-If the parent uses `bypassPermissions` or `acceptEdits`, this takes precedence and can’t be overridden. If the parent uses [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the subagent inherits auto mode and any `permissionMode` in its frontmatter is ignored: the classifier evaluates the subagent’s tool calls with the same block and allow rules as the parent session. If bypass mode is disabled by [`permissions.disableBypassPermissionsMode`](</docs/en/permissions#managed-settings>), Claude Code ignores `permissionMode: bypassPermissions` in the frontmatter and the subagent runs with the parent session’s mode. Before v2.1.223, Claude Code applied the frontmatter mode even with bypass disabled.
####
@@ -727,7 +728,7 @@
claude --agent code-reviewer
-The subagent’s system prompt replaces the default Claude Code system prompt entirely, the same way [`--system-prompt`](</docs/en/cli-reference>) does. `CLAUDE.md` files and project memory still load through the normal message flow. The agent name appears as `@<name>` in the startup header so you can confirm it’s active. This works with built-in and custom subagents, and the choice persists when you resume the session: Claude Code restores the agent’s system prompt, tool restrictions, and model along with the conversation. If the agent no longer exists when you resume, the session continues with the default tools and system prompt and shows a [warning naming the agent](</docs/en/errors#session-agent-no-longer-available>). For a plugin-provided subagent, you can pass only the agent name and Claude Code finds it:
+The subagent’s system prompt replaces the default Claude Code system prompt entirely, the same way [`--system-prompt`](</docs/en/cli-reference>) does. `CLAUDE.md` files and project memory still load through the normal message flow. The agent name appears as `@<name>` in the startup header so you can confirm it’s active. This works with built-in and custom subagents, and the choice persists when you resume the session: Claude Code restores the agent’s tool restrictions and model along with the conversation. If the agent no longer exists when you resume, the session continues with the default tools and shows a [warning naming the agent](</docs/en/errors#session-agent-no-longer-available>). For the system prompt in either case, see [System prompt flags in resumed conversations](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>). For a plugin-provided subagent, you can pass only the agent name and Claude Code finds it:
claude --agent security-reviewer
@@ -761,7 +762,7 @@
* Where fork mode is on, as it is by default in an interactive session, Claude Code runs the subagent in the background, forks and non-fork subagents alike, and Claude can’t ask for the foreground.
* Where fork mode is off, Claude runs the subagent in the background by default and in the foreground when it needs the result before continuing. Fork mode is off in [non-interactive mode](</docs/en/headless>) with `-p` and in the Agent SDK unless you turn it on. To keep a particular subagent in the background even when Claude wants the result, set its frontmatter `background` field to `true`.
-For a skill with `context: fork`, Claude Code follows the rules in [Run skills in a subagent](</docs/en/skills#run-skills-in-a-subagent>) instead, whether or not fork mode is on. Background subagents run with a smaller built-in tool set than foreground subagents, except for conversation forks, and they surface every permission prompt in your main session. When you answer one of those prompts with a choice that lasts beyond that one tool call, such as a grant that lasts for the rest of the session, Claude Code applies your answer to the whole session, including your main conversation. A background subagent can leave a background [Bash or PowerShell command](</docs/en/tools-reference#background-commands>) [running past the end of its turn](</docs/en/interactive-mode#how-backgrounding-works>). When that command ends, Claude Code sends the subagent a notification. A background subagent’s results reach Claude as a completion notification in a later turn. Claude waits for that notification before reporting the subagent’s results, and if you ask about progress first, it reports that the subagent is still running. Before v2.1.211, Claude sometimes reported results for a background subagent that hadn’t finished. You can also steer this yourself:
+For a skill with `context: fork`, Claude Code follows the rules in [Run skills in a subagent](</docs/en/skills#run-skills-in-a-subagent>) instead, whether or not fork mode is on. Background subagents run with a smaller built-in tool set than foreground subagents, except for conversation forks and resumed foreground subagents. Background subagents surface every permission prompt in your main session. When you answer one of those prompts with a choice that lasts beyond that one tool call, such as a grant that lasts for the rest of the session, Claude Code applies your answer to the whole session, including your main conversation. A background subagent can leave a background [Bash or PowerShell command](</docs/en/tools-reference#background-commands>) [running past the end of its turn](</docs/en/interactive-mode#how-backgrounding-works>). When that command ends, Claude Code sends the subagent a notification. A background subagent’s results reach Claude as a completion notification in a later turn. Claude waits for that notification before reporting the subagent’s results, and if you ask about progress first, it reports that the subagent is still running. Before v2.1.211, Claude sometimes reported results for a background subagent that hadn’t finished. You can also steer this yourself:
* Where fork mode is off, ask Claude to run a task in the background or in the foreground
* Press **Ctrl+B** to background a running task
@@ -771,7 +772,7 @@
* When a subagent finishes successfully, Claude Code removes its row immediately and, except in [screen reader mode](</docs/en/accessibility>), shows `/tasks to see subagents` in the footer for 30 seconds. During those 30 seconds, run [`/tasks`](</docs/en/commands>) and press `Enter` on the subagent to open its transcript. Before v2.1.232, Claude Code kept the row for 30 seconds after the subagent finished, the same as a failed one, and showed no footer hint.
* When a subagent fails or you stop it, Claude Code keeps its row for 30 seconds. To clear the row sooner, select it and press `x`.
-A background subagent that completes stays listed in [`/tasks`](</docs/en/commands>), marked done and sorted below running work, for the same window as the footer hint above. Its detail view stays open when the subagent finishes. Subagents that fail or that you stop leave the list. Before v2.1.208, a completed subagent left the list the moment it finished and its detail view closed.
+A background subagent that completes stays listed in [`/tasks`](</docs/en/commands>), marked done and sorted below running work, for the same 30 seconds as the footer hint. Its detail view stays open when the subagent finishes. Subagents that fail or that you stop leave the list. Before v2.1.208, a completed subagent left the list the moment it finished and its detail view closed.
###
@@ -939,7 +940,7 @@
Resume subagents
-Each subagent invocation creates a new instance rather than continuing an earlier one. To continue an existing subagent’s work instead of starting over, ask Claude to resume it. Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. The subagent picks up exactly where it stopped rather than starting fresh.
+Each subagent invocation creates a new instance rather than continuing an earlier one. To continue an existing subagent’s work instead of starting over, ask Claude to resume it. Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. If the subagent spawned background subagents of its own, that history includes the results they delivered while it ran. The subagent picks up exactly where it stopped rather than starting fresh.
* When a subagent completes, Claude receives its agent ID.
* The built-in Explore and Plan agents are one-shot and return no agent ID, so Claude can’t resume them. Use `general-purpose` or a custom subagent when you need to continue the work.
@@ -953,7 +954,7 @@
Continue that code review and now analyze the authorization logic
[Claude resumes the subagent with full context from previous conversation]
-A completed subagent that receives a `SendMessage` auto-resumes in the background without a new `Agent` invocation. The same applies to a subagent that Claude stopped with the `TaskStop` tool. A subagent you stopped yourself, with `x` in `/tasks` or an SDK `stop_task` request, doesn’t auto-resume. If Claude sends it a message, the message is refused and Claude is told the agent was cancelled. While that subagent’s row is still in the subagent panel, type into its transcript to resume it yourself. After that, a message from Claude can auto-resume it again. Requires Claude Code v2.1.191 or later. Resuming starts a new run of the agent under the same ID, so a subagent that had already failed or completed shows as running again in the task list and in the Agent SDK’s task events. Before v2.1.205, it kept showing its earlier failed or completed status while the resumed run was working. As of v2.1.199, `SendMessage` checks that a name still refers to the same agent it reached earlier in the conversation. If a newer agent has taken the name, such as a re-spawned background agent that reused it, Claude Code refuses the send rather than delivering it to the wrong agent, and the error reports which agent the name now reaches so Claude can retarget. To reach the earlier agent while it’s still running, Claude addresses it by the agent ID it received when it spawned that agent. The check is scoped to the current conversation and resets on `/clear`. As of v2.1.198, a subagent treats messages from the agent that launched it as normal task direction, including mid-task course corrections, and acts on them within its own permission settings. Two limits still hold regardless of who sent the message: no message from any agent counts as your approval for a pending permission prompt, and no agent message can change a subagent’s permission settings, `CLAUDE.md`, or configuration. Only the permission system or your own messages can grant approval. You can also ask Claude for the agent ID if you want to reference it explicitly, or find IDs in the transcript files at `~/.claude/projects/{project}/{sessionId}/subagents/`. Each transcript is stored as `agent-{agentId}.jsonl`. Subagent transcripts persist independently of the main conversation:
+When Claude sends a completed subagent a message with the `SendMessage` tool, the subagent resumes in the background without a new `Agent` invocation. The same applies to a subagent that Claude stopped with the `TaskStop` tool, once its stopped run has exited. The resumed run keeps the tool set from where the subagent first ran and can keep reading the [prompt cache the original run warmed](</docs/en/prompt-caching#subagents-and-the-cache>). A subagent that has the `SendMessage` tool can send that message too. In an interactive session, the resumed agent then reports back to the subagent that resumed it, not to your main conversation. That subagent waits for the result before finishing its own work. When a subagent messages an agent it reports to, such as its own launcher, Claude Code resumes that agent without redirecting its results. A subagent you stopped yourself, with `x` in `/tasks` or an SDK `stop_task` request, doesn’t auto-resume. If Claude sends it a message, the message is refused and Claude is told the agent was cancelled. While that subagent’s row is still in the subagent panel, type into its transcript to resume it yourself. After that, a message from Claude can auto-resume it again. Requires Claude Code v2.1.191 or later. Resuming starts a new run of the agent under the same ID, so a subagent that had already failed or completed shows as running again in the task list and in the Agent SDK’s task events. Before v2.1.205, it kept showing its earlier failed or completed status while the resumed run was working. As of v2.1.199, `SendMessage` checks that a name still refers to the same agent it reached earlier in the conversation. If a newer agent has taken the name, such as a re-spawned background agent that reused it, Claude Code refuses the send rather than delivering it to the wrong agent, and the error reports which agent the name now reaches so Claude can retarget. To reach the earlier agent while it’s still running, Claude addresses it by the agent ID it received when it spawned that agent. The check is scoped to the current conversation and resets on `/clear`. As of v2.1.198, a subagent treats messages from the agent that launched it as normal task direction, including mid-task course corrections, and acts on them within its own permission settings. Two limits still hold regardless of who sent the message: no message from any agent counts as your approval for a pending permission prompt, and no agent message can change a subagent’s permission settings, `CLAUDE.md`, or configuration. Only the permission system or your own messages can grant approval. You can also ask Claude for the agent ID if you want to reference it explicitly, or find IDs in the transcript files at `~/.claude/projects/{project}/{sessionId}/subagents/`. Each transcript is stored as `agent-{agentId}.jsonl`. Subagent transcripts persist independently of the main conversation:
* **Main conversation compaction** : when the main conversation compacts, subagent transcripts are unaffected. They’re stored in separate files.
* **Session persistence** : subagent transcripts persist within their session. You can resume a subagent after restarting Claude Code by resuming the same session.
--- a/subagents.md
+++ b/subagents.md
@@ -159,7 +159,7 @@
`maxTurns`| `number`| No| Maximum number of agentic turns before the agent stops. When the agent reaches the limit, Claude Code returns its output marked as partial, and you can resume the agent to continue. The partial marking requires Claude Code v2.1.246 or later
`background`| `boolean`| No| Run this agent as a non-blocking background task when invoked
`effort`| `'low' | 'medium' | 'high' | 'xhigh' | 'max' | number`| No| Reasoning effort level for this agent
-`permissionMode`| `PermissionMode`| No| Permission mode for tool execution within this agent
+`permissionMode`| `PermissionMode`| No| Permission mode for tool execution within this agent. The [subagent inheritance rules](</docs/en/agent-sdk/permissions#available-modes>) decide when it applies
In the Python SDK, multi-word field names such as `disallowedTools` and `mcpServers` keep their camelCase spelling to match the wire format rather than following Python’s snake_case convention. See the [`AgentDefinition` reference](</docs/en/agent-sdk/python#agentdefinition>) for details. Subagents run in the background by default. An Agent tool call that omits the [`run_in_background`](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) input launches a background subagent, and Claude sets `run_in_background: false` when it needs the result before continuing. Set the `background` field to `true` to force background execution for a specific agent regardless of what Claude requests. Before Claude Code v2.1.198, the background default was rolling out gradually, and an Agent tool call that omitted `run_in_background` could run the subagent synchronously. Subagents can also spawn subagents of their own. To limit how deep that nesting goes, how many subagents run at once, and how much a query spends, see Cap subagent depth, concurrency, and spend.
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -130,7 +130,8 @@
What persists between commands
- * When Claude runs `cd` in the main session, the new working directory carries over to later Bash commands as long as it stays inside the project directory or an [additional working directory](</docs/en/permissions#working-directories>) you added with `--add-dir`, `/add-dir`, or `additionalDirectories` in settings. Subagent sessions never carry over working directory changes.
+ * When Claude runs `cd` in the main session, the new working directory carries over to later Bash commands as long as it stays inside the project directory or an [additional working directory](</docs/en/permissions#working-directories>) you added with `--add-dir`, `/add-dir`, or `additionalDirectories` in settings. This includes commands Claude runs in response to your later messages.
+ * Subagent sessions never carry over working directory changes.
* If `cd` lands outside those directories, Claude Code resets to the project directory and appends `Shell cwd was reset to <dir>` to the tool result.
* To disable this carry-over so every Bash command starts in the project directory, set `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1`.
* Environment variables don’t persist. An `export` in one command won’t be available in the next.
@@ -261,7 +262,7 @@
* `src/**/*.ts` matches all `.ts` files under `src/`
* `*.{json,yaml}` matches `.json` and `.yaml` files in the current directory
-Results are sorted by modification time and capped at 100 files. If the cap is hit, Claude sees a truncation flag in the result and can narrow the pattern. Glob doesn’t respect `.gitignore` by default, so it finds gitignored files alongside tracked ones. This differs from Grep, which skips gitignored files. To make Glob respect `.gitignore`, set `CLAUDE_CODE_GLOB_NO_IGNORE=false` before launching Claude Code. A `pattern` or `path` value that contains a null byte returns an error asking Claude to remove it.
+Results are sorted by modification time and capped at 100 files. If the cap is hit, Claude sees a truncation flag in the result and can narrow the pattern. Glob doesn’t respect `.gitignore` by default, so it finds gitignored files alongside tracked ones. This differs from Grep, which skips gitignored files. To make Glob respect `.gitignore`, set `CLAUDE_CODE_GLOB_NO_IGNORE=false` before launching Claude Code. Claude Code decides permission for a Glob call before it checks whether the search directory exists. It still runs the read-permission check for a missing `path` outside the [working directories](</docs/en/permissions#working-directories>), so a permission prompt for a path doesn’t mean the path exists. A `pattern` or `path` value that contains a null byte returns an error asking Claude to remove it.
##
@@ -275,7 +276,7 @@
* `content`: matching lines with file and line number. When the tool’s `offset` parameter points past the last match for a pattern that has matches, Grep returns `No entries at this offset`, so Claude widens or resets the offset instead of concluding the pattern doesn’t match.
* `count`: match count per file, followed by a total across all matching files. The total covers every match even when the tool’s `head_limit` or `offset` parameters truncate the listed per-file entries. Before v2.1.208, the total only summed the listed entries.
-Claude can scope results by file with the `glob` parameter, such as `**/*.tsx`, or by language with the `type` parameter, such as `py` or `rust`. By default, patterns match within a single line. Claude can set `multiline: true` to match across line boundaries. Grep respects `.gitignore`, so gitignored files are skipped. To search a gitignored file, Claude passes its path directly.
+Claude can scope results by file with the `glob` parameter, such as `**/*.tsx`, or by language with the `type` parameter, such as `py` or `rust`. By default, patterns match within a single line. Claude can set `multiline: true` to match across line boundaries. Grep respects `.gitignore`, so gitignored files are skipped. To search a gitignored file, Claude passes its path directly. Claude Code decides permission for a Grep call before it checks whether the search `path` exists. It still runs the read-permission check for a missing `path` outside the [working directories](</docs/en/permissions#working-directories>), so a permission prompt for a path doesn’t mean the path exists.
##
Show diff (164 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -509,7 +509,7 @@
`cwd`| `string`| `process.cwd()`| Current working directory
`debug`| `boolean`| `false`| Enable debug mode for the Claude Code process
`debugFile`| `string`| `undefined`| Write debug logs to a specific file path. Implicitly enables debug mode
-`disallowedTools`| `string[]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`. See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>)
+`disallowedTools`| `string[]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`, for the command [as written](</docs/en/permissions#bash-rule-limits>). See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>)
`effort`| `'low' | 'medium' | 'high' | 'xhigh' | 'max'`| Model default| Controls how much effort Claude puts into its response. Works with adaptive thinking to guide thinking depth. See [adjust the effort level](</docs/en/model-config#adjust-effort-level>)
`enableFileCheckpointing`| `boolean`| `false`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>)
`env`| `Record<string, string | undefined>`| `process.env`| Environment variables. When set, this replaces the subprocess environment instead of merging with `process.env`, so pass `{ ...process.env, YOUR_VAR: 'value' }` to keep inherited variables like `PATH`. See Handle slow or stalled API responses for an example of this pattern, and [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads. Set `CLAUDE_AGENT_SDK_CLIENT_APP` to identify your app in the User-Agent header
@@ -518,7 +518,7 @@
`extraArgs`| `Record<string, string | null>`| `{}`| Additional arguments
`fallbackModel`| `string`| `undefined`| Model to use if primary fails
`forkSession`| `boolean`| `false`| When resuming with `resume`, fork to a new session ID instead of continuing the original session
-`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. By default only `tool_use` and `tool_result` blocks from subagents are emitted. Messages from subagents at every nesting depth are forwarded on Claude Code v2.1.219 and later; before v2.1.219, only messages from depth-1 subagents appeared
+`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. Without this option, Claude Code emits subagent `tool_use` and `tool_result` blocks but not text or thinking. Messages from subagents at every nesting depth are forwarded on Claude Code v2.1.219 and later; before v2.1.219, only messages from depth-1 subagents appeared
`hooks`| `Partial<Record<``HookEvent``, ``HookCallbackMatcher``[]>>`| `{}`| Hook callbacks for events
`includeHookEvents`| `boolean`| `false`| Include hook lifecycle events in the message stream as `SDKHookStartedMessage`, `SDKHookProgressMessage`, and `SDKHookResponseMessage`. Lifecycle events for `SessionStart` and `Setup` hooks are always included and don’t need this option. Some hook events, such as `Notification`, `SessionEnd`, `PreCompact`, and `PostCompact`, never produce an `SDKHookStartedMessage`, even with this option. For those events, Claude Code still emits an `SDKHookProgressMessage` while a command hook that runs for more than a second produces output, and emits an `SDKHookResponseMessage` only when a hook [that runs in the background](</docs/en/hooks#run-hooks-in-the-background>) finishes
`includePartialMessages`| `boolean`| `false`| Include partial message events
@@ -553,7 +553,7 @@
`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>)
-`systemPrompt`| `string | string[] | { type: 'preset'; preset: 'claude_code'; append?: string; excludeDynamicSections?: 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>)
+`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
`title`| `string`| `undefined`| Display title for the session. When resuming via `resume` or `continue`, the resumed session’s persisted title takes precedence; use `renameSession()` to retitle an existing session
@@ -677,7 +677,7 @@
Changes [settings](</docs/en/settings>) on a running session without restarting the query. Use it when a setting that has no dedicated setter needs to change mid-session, such as tightening `permissions` after the agent reads untrusted input. `setModel()` and `setPermissionMode()` are dedicated setters for those two keys; `applyFlagSettings()` is the general form that accepts any subset of the settings keys, and passing `model` here behaves the same as `setModel()`. Only some keys take effect mid-session:
- * **Applied on the next turn** : `effortLevel`, `ultracode`, `permissions`, `hooks`, `skillOverrides`, `fastMode`, `agent`. Switching `agent` also applies that agent’s model override, hooks, and system prompt on the next turn.
+ * **Applied on the next turn** : `effortLevel`, `ultracode`, `permissions`, `hooks`, `skillOverrides`, `fastMode`, `agent`. Switching `agent` also applies that agent’s model override and hooks on the next turn. Its system prompt applies on the next turn, or, in a session that [reuses a recorded system prompt](</docs/en/agent-sdk/modifying-system-prompts#change-the-prompt-of-an-existing-session>), once the session is compacted.
* **Applied during the current turn** : `model`. If you switch `model` while Claude is working on a turn, the response Claude is already generating finishes on the old model, and the rest of the turn, starting with the next call Claude Code makes to the model, uses the new one. Subagents keep their own model. Before v2.1.212, a mid-turn switch waited for the next turn.
* **No effect mid-session** : the system prompt options. These are resolved once at startup, so the running session keeps the original value even though the call succeeds. To change them, start a new session.
@@ -948,7 +948,7 @@
`background`| No| Run this agent as a non-blocking background task when invoked
`memory`| No| Memory source for this agent: `'user'`, `'project'`, or `'local'`
`effort`| No| Reasoning effort level for this agent. Accepts a named level or an integer
-`permissionMode`| No| Permission mode for tool execution within this agent. See `PermissionMode`
+`permissionMode`| No| Permission mode for tool execution within this agent. The [subagent inheritance rules](</docs/en/agent-sdk/permissions#available-modes>) decide when it applies. See `PermissionMode`
`criticalSystemReminder_EXPERIMENTAL`| No| Experimental: Critical reminder added to the system prompt
###
@@ -1298,7 +1298,14 @@
user_message_uuids?: string[];
};
-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'`, or `'unknown'`. `'model_not_found'` means the selected model doesn’t exist or isn’t available to your account or deployment. `'overloaded'` means the API returned a 529 because the server is at capacity, as opposed to `'rate_limit'`, which is a 429 against your quota. `'account_on_hold'` means [your account is on hold](</docs/en/errors#your-account-is-on-hold>). `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. Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn’s first assistant message, under the conditions in `user_message_uuid`. `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.
+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:
+
+ * `'model_not_found'`: the selected model doesn’t exist or isn’t available to your account or deployment
+ * `'overloaded'`: the API returned a 529 because the server is at capacity, as opposed to `'rate_limit'`, which is a 429 against your quota
+ * `'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. Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn’s first assistant message, under the conditions in `user_message_uuid`. `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.
###
@@ -1419,9 +1426,9 @@
* `api_error_status`: the HTTP status code of the API error that terminated the conversation. Absent or `null` when the turn ended without an API error.
* `ttft_ms`: time to first token in milliseconds, measured when the first complete assistant message arrives. Present on the success arm only.
* `ttft_stream_ms`: time in milliseconds until the first `message_start` stream event, when the response stream opens. Lower than `ttft_ms`; the gap between the two is time spent streaming the first message. Present on the success arm only.
- * `user_message_uuid`: the `uuid` of the message you sent that started this turn. See `user_message_uuid` for which results carry it.
+ * `user_message_uuid`: the `uuid` of the message you sent that this turn answered. See `user_message_uuid` for which results carry it.
* `user_message_uuids`: the `uuid`s of every message you sent that Claude Code answered in this turn. See `user_message_uuids`.
- * `request_sent_wall_ms`: epoch milliseconds at which Claude Code dispatched the API request, for joins against server-side timestamps. Present on the success arm only, together with `user_message_uuid`, when `is_error` is false.
+ * `request_sent_wall_ms`: epoch milliseconds at which Claude Code dispatched the API request, for joins against server-side timestamps. Present only together with `user_message_uuid`, on a success result with `is_error` false whose turn sent an API request.
* `first_content_frame_ms`: time in milliseconds until the first `content_block_start` or `content_block_delta` stream event, counting thinking blocks as content. Present on the success arm only, when `is_error` is false. Requires Agent SDK v0.3.260 or later.
* `first_stream_post_ms`, `first_stream_post_ack_ms`, `first_stream_post_wall_ms`: timings for uploading the turn’s first stream event. Claude Code records them only in sessions it streams to claude.ai, such as [cloud sessions](</docs/en/claude-code-on-the-web>), and the results `query()` yields don’t carry them. Requires Agent SDK v0.3.260 or later.
* `usage`: main agent loop only. Excludes subagent and auxiliary model calls, and is per-turn in streaming-input sessions. Prefer `modelUsage` for token/cost accounting.
@@ -1455,17 +1462,23 @@
`user_message_uuid`
-The `uuid` of the `SDKUserMessage` that started the turn, echoed so you can match Claude Code’s reply to the message you sent. Claude Code echoes it only if you set `uuid` on that message. The field is optional on `SDKUserMessage`, and a string prompt passed to `query()` carries none. When you send several messages close together, Claude Code can merge them into one turn. The field then carries only the last message’s `uuid`. To match the reply to any of the merged messages, use `user_message_uuids`. When you set `uuid`, Claude Code echoes it on three kinds of frame:
-
- * **The result** : on the success arm with `is_error` false, together with `request_sent_wall_ms`, which requires Agent SDK v0.3.216 or later. Claude Code also echoes it on an error result that answers a message you sent, which requires Agent SDK v0.3.246 or later.
- * **The turn’s first reply** : the first assistant message, or with `includePartialMessages` the first stream event whose `event.type` isn’t `ping`, so you can bind the reply before the result arrives. When a turn streams nothing, Claude Code sets it on the first assistant message instead. One reply frame per turn carries it. Requires Agent SDK v0.3.246 or later.
+The `uuid` of the `SDKUserMessage` the turn is answering, echoed so you can match Claude Code’s reply to the message you sent. Claude Code echoes a `uuid` only if you set one on the message. The field is optional on `SDKUserMessage`, and a string prompt passed to `query()` carries none. Which of your messages a turn answers depends on how the turn started:
+
+ * **A regular message you sent** , meaning one without `isSynthetic: true`: the turn answers that message for its whole run. When you send several messages close together, Claude Code can merge them into one turn, and the field then carries only the last message’s `uuid`. To match the reply to any of the merged messages, use `user_message_uuids`.
+ * **A message you sent with`isSynthetic: true`**: the turn answers that message at first. If Claude Code picks up a regular message of yours between tool calls, the turn answers the picked-up message from then on. Echoing a synthetic message’s `uuid` requires Agent SDK v0.3.265 or later; earlier versions echo nothing on synthetic turns.
+ * **A prompt Claude Code generated itself** , such as the turn that continues interrupted work after a session restarts: the turn answers no message of yours at first and its frames carry no echo. If Claude Code picks up a regular message of yours between tool calls, the turn answers that message from then on. The pickup echo requires Agent SDK v0.3.265 or later; earlier versions echo nothing on these turns.
+
+Claude Code echoes the answered message’s `uuid` on three kinds of frame:
+
+ * **The result** : every result of a turn that answered a message you sent. Every such result carries it on Agent SDK v0.3.265 or later. Before v0.3.265, the success result of a turn that a regular message started lacked it when the turn sent no API request or ended with a deferred tool call. Before v0.3.246, error results lacked it too, and before v0.3.216 every result did.
+ * **The turn’s first reply** : the first assistant message, or with `includePartialMessages` the first stream event whose `event.type` isn’t `ping`, so you can bind the reply before the result arrives. When a turn streams nothing, Claude Code sets it on the first assistant message instead. The first-reply echo requires Agent SDK v0.3.246 or later. When the message the turn is answering changes mid-turn, the first reply after the change carries the field too, on Agent SDK v0.3.265 or later; earlier versions set it on one reply frame per turn.
* **Every`thinking_tokens` frame of the turn**: so you can attribute thinking progress to the message you sent without waiting for the turn’s first reply. Requires Agent SDK v0.3.260 or later.
Claude Code omits the field in these cases:
- * Later assistant messages and stream events of the same turn
+ * Reply frames other than those first replies
* Subagent frames
- * Synthetic turns, such as scheduled ones
+ * Turns that answer no message with a `uuid`: the turn answered a message you sent without one, or Claude Code started the turn itself and picked up no regular message that has one
* Results that answer no message you sent, such as the zeroed result after a crashed worker process
####
@@ -1474,7 +1487,7 @@
`user_message_uuids`
-The `uuid`s of every message you sent that Claude Code answered in this turn. When you send several messages close together, Claude Code can merge them into one turn, and `user_message_uuid` then names only the last of them. To match the reply to any of the merged messages, look for that message’s `uuid` anywhere in this list. Requires Agent SDK v0.3.259 or later. Claude Code sets the list together with `user_message_uuid` on the turn’s first reply and on the result. For the full set of frames that carry `user_message_uuid`, and the version each requires, see `user_message_uuid`. The list always contains `user_message_uuid` and holds at most 64 entries. A message you send while the turn is running that Claude Code picks up between tool calls appears only in the result’s list. When a first reply or result carries `user_message_uuid` without the list, it came from an earlier Claude Code version, so fall back to the single field.
+The `uuid`s of every message you sent that Claude Code answered in this turn. When you send several messages close together, Claude Code can merge them into one turn, and `user_message_uuid` then names only the last of them. To match the reply to any of the merged messages, look for that message’s `uuid` anywhere in this list. Requires Agent SDK v0.3.259 or later. Claude Code sets the list together with `user_message_uuid` on each reply frame that carries that field and on the result. For the full set of frames that carry `user_message_uuid`, and the version each requires, see `user_message_uuid`. The list always contains `user_message_uuid` and holds at most 64 entries. When Claude Code picks up a regular message you sent while a turn was running, it adds that message’s `uuid` to the result’s list. When a first reply or result carries `user_message_uuid` without the list, it came from an earlier Claude Code version, so fall back to the single field.
####
@@ -1549,11 +1562,11 @@
uuid: UUID;
session_id: string;
ttft_ms?: number; // Time to first token in ms, present only on message_start events
- user_message_uuid?: string; // Present on at most one stream event per turn
+ user_message_uuid?: string;
user_message_uuids?: string[];
};
-Claude Code sets `user_message_uuid` and `user_message_uuids` on one stream event per turn, under the conditions in `user_message_uuid`.
+Claude Code sets `user_message_uuid` and `user_message_uuids` on the turn’s first non-ping stream event, and again when the message the turn is answering changes, under the conditions in `user_message_uuid`.
###
@@ -2723,7 +2736,7 @@
**Tool name:** `Agent`. The previous name `Task` is still accepted as an alias, and the `tools` array in the `SDKSystemMessage` init message currently lists this tool as `Task` for backward compatibility.
-The `mode` field is deprecated and ignored on Claude Code v2.1.212 or later: subagents [inherit the parent session’s permission mode](</docs/en/agent-sdk/permissions#available-modes>), and a subagent definition’s `permissionMode` can override it, except when the parent uses `bypassPermissions`, `acceptEdits`, or `auto`. On v2.1.223 or later, Claude Code ignores a definition’s `permissionMode: "bypassPermissions"` when bypass mode is disabled by [`permissions.disableBypassPermissionsMode`](</docs/en/permissions#managed-settings>).
+The `mode` field is deprecated and ignored on Claude Code v2.1.212 or later. A subagent runs in either the parent session’s permission mode or its definition’s `permissionMode`, and the [subagent inheritance rules](</docs/en/agent-sdk/permissions#available-modes>) decide which.
type AgentInput = {
description: string;
@@ -2733,7 +2746,7 @@
run_in_background?: boolean;
name?: string;
team_name?: string; // Deprecated; ignored
- mode?: "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan"; // Deprecated; ignored. Subagents inherit the parent session's permission mode; agent-definition frontmatter may override it
+ mode?: "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan"; // Deprecated; ignored. The subagent inheritance rules decide a subagent's permission mode
isolation?: "worktree" | "remote";
};
@@ -2777,7 +2790,7 @@
dangerouslyDisableSandbox?: boolean;
};
-Executes Bash commands with optional timeout and background execution. The working directory persists between commands; shell state such as exported environment variables doesn’t.
+Executes Bash commands with optional timeout and background execution. The working directory persists between commands, including commands run in later turns of a multi-turn session; shell state such as exported environment variables doesn’t. For the limits on which directory changes carry over, see [What persists between commands](</docs/en/tools-reference#what-persists-between-commands>).
###
@@ -5191,7 +5204,7 @@
* 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.
- * Treat `error_category` as a closed set of tokens for choosing your own message text, not as display text: `rate_limit`, `overloaded`, `authentication_failed`, `server_error`, or `unknown`.
+ * Treat `error_category` as a token for choosing your own message text, not as display text. The values are `rate_limit`, `overloaded`, `authentication_failed`, `server_error`, `cloud_credential_error`, and `unknown`. Handle a value you don’t recognize the way you handle `unknown`, because later releases can add values.
###
--- a/ultrareview.md
+++ b/ultrareview.md
@@ -133,7 +133,7 @@
Flag| Description
---|---
`--json`| Print the raw `bugs.json` payload instead of the formatted findings
-`--timeout <minutes>`| Maximum minutes to wait for the review to finish. Defaults to 30
+`--timeout <minutes>`| Maximum minutes to wait for the review to finish. Defaults to 45
`--post`| Post the finished findings to the pull request as one plain comment from your GitHub account. Works on `github.com` pull request targets; on other targets, Claude Code ignores the flag and says so. Requires Claude Code v2.1.227 or later
`--no-post`| Don’t post the findings. This is the default, and if you pass both flags, Claude Code doesn’t post. Requires Claude Code v2.1.227 or later
--- a/vs-code.md
+++ b/vs-code.md
@@ -90,11 +90,11 @@
* **Manual** : Claude asks permission before file edits and most shell commands.
* **Plan** : Claude describes what it will do and waits for approval before making changes. VS Code automatically opens the plan as a full Markdown document where you can add inline comments to give feedback before Claude begins.
* **Edit automatically** : Claude makes edits without asking.
- * **Model** : select **Switch model…** from the command menu to change the model mid-session. You can also click the model name at the bottom of the prompt box to open the same picker. The picker includes a **More models** page with the models not on the main list. When the current model supports [effort levels](</docs/en/model-config#adjust-effort-level>), the picker also shows an **Effort** row. The model name button, the **More models** page, and the **Effort** row require Claude Code v2.1.257 or later.
+ * **Model** : select **Switch model…** from the command menu to change the model mid-session. You can also click the model name at the bottom of the prompt box to open the same picker. When the current model supports [effort levels](</docs/en/model-config#adjust-effort-level>), the picker also shows an **Effort** row. The model name button and the **Effort** row require Claude Code v2.1.257 or later.
* **Command menu** : click `/` or type `/` to open the command menu. Options include attaching files, switching models, and toggling extended thinking. The Customize section provides access to MCP servers, slash commands, output styles, hooks, memory, permissions, and plugins. Items with a terminal icon open in the integrated terminal.
* To browse commands such as `/usage` or [`/remote-control`](</docs/en/remote-control>), select **Slash commands** in the Customize section. A dialog lists them with a filter box. Pick one to run it. Typing `/` in the prompt box still suggests commands inline. Requires Claude Code v2.1.257 or later.
- * Select **Output styles** in the Customize section to pick an [output style](</docs/en/output-styles>), including your custom styles. Requires Claude Code v2.1.257 or later.
- * The Settings section includes **Enable Remote Control for all sessions** , which sets [`remoteControlAtStartup`](</docs/en/settings-reference#remotecontrolatstartup>) to control whether [new interactive sessions connect to Remote Control automatically](</docs/en/remote-control#enable-remote-control-for-all-sessions>). Requires Claude Code v2.1.203 or later. When you flip the toggle, the change applies to the sessions already open in VS Code, not only to sessions you start afterwards. If you turn it off, the open sessions disconnect. Before v2.1.257, the toggle applied only to sessions started after the change.
+ * Select **Output styles** in the Customize section to pick an [output style](</docs/en/output-styles>), including your custom styles. Requires Claude Code v2.1.257 or later. To create a custom style instead, select **Build a custom style** from the **Output styles** menu. Claude Code writes the [style file](</docs/en/output-styles#create-a-custom-output-style>) for you at the project or user level. Requires Claude Code v2.1.261 or later.
+ * The Settings section includes **Enable Remote Control for all sessions** , which sets [`remoteControlAtStartup`](</docs/en/settings-reference#remotecontrolatstartup>) to control whether [new interactive sessions connect to Remote Control automatically](</docs/en/remote-control#enable-remote-control-for-all-sessions>). Requires Claude Code v2.1.203 or later. When you turn the toggle on or off in a VS Code window, the change applies to the sessions already open in that VS Code window, not only to sessions you start afterwards. If you turn it off, the open sessions disconnect. With Claude Code v2.1.261 or later, the change also reaches sessions open in your other VS Code windows.
* The Settings section also includes **Focus view** , which hides tool calls, tool results, and thinking behind expandable rows, leaving your prompts and Claude’s responses. Claude’s latest to-do list stays visible, and so does the text a pending question from Claude is asking about; this requires Claude Code v2.1.225 or later. Toggle it there, with `Ctrl+Option+F` (Mac) / `Ctrl+Alt+F` (Windows/Linux), or from the Command Palette with **Claude Code: Toggle Focus view**. The change applies to every open session and persists across sessions. Requires Claude Code v2.1.221 or later.
* To report a bug, click **Report a problem** at the bottom of the menu, or type `/bug` or `/feedback` with an optional description that prefills the report. When you submit the report and you’re signed in to Anthropic on a first-party connection, Claude Code sends it to Anthropic. On a third-party provider, or without Anthropic credentials, the dialog still opens, but submitting shows an error and sends nothing: unlike the CLI’s `/bug`, the extension doesn’t write a local archive. Requires Claude Code v2.1.229 or later.
* **Side questions** : type `/btw` followed by a question to ask about your session [without adding to the conversation](</docs/en/interactive-mode#side-questions-with-%2Fbtw>). The answer opens in a panel beside the chat, where you can ask follow-up questions. The thread survives window reloads. Claude Code keeps the newest 20 exchanges and expires stored threads on the [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) schedule, as long as Claude Code can [safely determine the retention period](</docs/en/claude-directory#cleaned-up-automatically>). To clear a thread, click the trash icon in the panel. Requires Claude Code v2.1.227 or later.
@@ -121,7 +121,12 @@
Resume past conversations
-Click the **Session history** button at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time. Click any conversation to resume it with the full message history. For more on resuming sessions, see [Manage sessions](</docs/en/sessions>). New sessions receive AI-generated titles based on your first message. Hover over a session to reveal rename and archive actions: rename to give it a descriptive title, or archive to move it to the **Archived sessions** group at the bottom of the list. To restore an archived session, expand **Archived sessions** and click **Unarchive session**. Before v2.1.257, the action was **Delete session** , which hid a session with no way to restore it. Sessions you deleted then appear under **Archived sessions** after you upgrade. When the conversation you resume ended in plan mode, Claude Code restores plan mode. Requires Claude Code v2.1.246 or later. Claude Code doesn’t restore it in two cases:
+Click the **Session history** button at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time. Click any conversation to resume it with the full message history. For more on resuming sessions, see [Manage sessions](</docs/en/sessions>).
+
+ * **Session titles** : new sessions receive AI-generated titles based on your first message.
+ * **Rename and archive** : hover over a session to reveal these actions. Rename to give it a descriptive title, or archive to move it to the **Archived sessions** group at the bottom of the list.
+
+By default, a session with no activity for 14 days moves to **Archived sessions** automatically, unless it is open, unread, or in a group. Automatic archiving requires Claude Code v2.1.265 or later. To change the period or turn it off, open the [Archive Inactive Sessions setting](<vscode://settings/claudeCode.archiveInactiveSessions>) and select a number of days or **Never**. To restore an archived session, expand **Archived sessions** and click **Unarchive session**. Before v2.1.257, the action was **Delete session** , which hid a session with no way to restore it. Sessions you deleted then appear under **Archived sessions** after you upgrade. When the conversation you resume ended in plan mode, Claude Code restores plan mode. Requires Claude Code v2.1.246 or later. Claude Code doesn’t restore it in two cases:
* The extension [chooses the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) from `claudeCode.initialPermissionMode` or a pick that carries over from an earlier conversation
* You have `claudeCode.claudeProcessWrapper` configured
@@ -160,7 +165,7 @@
Check account and usage
-Run `/usage` to open the Account & usage dialog. The dialog requires a claude.ai sign-in, so it isn’t offered on a third-party provider. It shows your signed-in account, your plan, and usage bars for the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits. It flags behaviors that account for 10% or more of recent usage, such as cache misses, long context, and subagent-heavy or highly parallel sessions, each with a tip to reduce it. Attribution tables show how much usage came from each skill, subagent, plugin, and MCP server. Requires Claude Code v2.1.174 or later. Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. For more on tracking and reducing usage, see [Track your costs](</docs/en/costs#track-your-costs>).
+Run `/usage` to open the Account & usage dialog. The dialog requires a claude.ai sign-in, so it isn’t offered on a third-party provider. It shows your signed-in account, your plan, and usage bars for your plan’s limits, such as the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits. It flags behaviors that account for 10% or more of recent usage, such as cache misses, long context, and subagent-heavy or highly parallel sessions, each with a tip to reduce it. Attribution tables show how much usage came from each skill, subagent, plugin, and MCP server. Requires Claude Code v2.1.174 or later. Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. For more on tracking and reducing usage, see [Track your costs](</docs/en/costs#track-your-costs>).
##
@@ -183,6 +188,11 @@
* **Editor area** : opens Claude as a tab alongside your files. Useful for side tasks.
Use the sidebar for your main Claude session and open additional tabs for side tasks. Claude remembers your preferred location. The Activity Bar sessions list icon is separate from the Claude panel: the sessions list is always visible in the Activity Bar, while the Claude panel icon only appears there when the panel is docked to the left sidebar.
+
+After you run **Developer: Reload Window** or restart VS Code, whether a chat comes back with its conversation depends on where it was open:
+
+ * **Editor tab** : the conversation comes back with its tab.
+ * **Sidebar** : the conversation comes back if you sent a message or Claude responded in it within the last 10 minutes. If it doesn’t come back, resume the conversation from Session history.
###
@@ -370,6 +380,7 @@
`useCtrlEnterToSend`| `false`| Use Ctrl/Cmd+Enter instead of Enter to send prompts
`enableNewConversationShortcut`| `false`| Enable Cmd/Ctrl+N to start a new conversation
`enableReopenClosedSessionShortcut`| `true`| Use Cmd/Ctrl+Shift+T to reopen the most recently closed Claude session tab. When the last closed tab wasn’t a Claude session, the shortcut runs VS Code’s normal reopen-closed-editor command instead.
+`archiveInactiveSessions`| `14`| Archive a session automatically after this many days without activity: `1`, `2`, `7`, or `14`. Set `0` to turn it off. Requires Claude Code v2.1.265 or later
`hideOnboarding`| `false`| Hide the onboarding checklist (graduation cap icon)
`focusView`| `false`| Hide tool calls, tool results, and thinking behind expandable rows, leaving your prompts and Claude’s responses. Claude’s latest to-do list stays visible; this requires Claude Code v2.1.225 or later. You can also toggle Focus view from the command menu. Requires Claude Code v2.1.221 or later
`respectGitIgnore`| `true`| Exclude .gitignore patterns from file searches
@@ -405,7 +416,7 @@
Feature| CLI| VS Code Extension
---|---|---
Commands and skills| [All](</docs/en/commands>)| Subset (type `/` to see available)
-MCP server config| Yes| Partial (add servers via CLI; manage existing servers with `/mcp` in the chat panel)
+MCP server config| Yes| Yes (add and manage servers with `/mcp` in the chat panel)
Checkpoints| Yes| Yes
`!` bash shortcut| Yes| No
Tab completion| Yes| No
@@ -462,12 +473,12 @@
Connect to external tools with MCP
-MCP (Model Context Protocol) servers give Claude access to external tools, databases, and APIs. To add an MCP server, open the integrated terminal (`Ctrl+`` or `Cmd+``) and run `claude mcp add`. The example below adds GitHub’s remote MCP server, which authenticates with a [personal access token](<https://github.com/settings/personal-access-tokens>) passed as a header:
+MCP (Model Context Protocol) servers give Claude access to external tools, databases, and APIs. To manage MCP servers without leaving VS Code, type `/mcp` in the chat panel. From the dialog that opens, you can add servers, remove servers saved at the local, user, or project [scope](</docs/en/mcp#mcp-installation-scopes>), enable or disable servers, reconnect to a server, and manage OAuth authentication. Adding and removing servers in the dialog requires Claude Code v2.1.261 or later. You can also run `claude mcp add` in VS Code’s integrated terminal (`Ctrl+`` or `Cmd+``). The dialog and the terminal command save to the same MCP configuration, and changes from either take effect in conversations you start afterwards. The example below adds GitHub’s remote MCP server, which authenticates with a [personal access token](<https://github.com/settings/personal-access-tokens>) passed as a header:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer YOUR_GITHUB_PAT"
-Replace `YOUR_GITHUB_PAT` with your personal access token. The `claude mcp add` command saves the configuration without validating credentials, so a placeholder value is accepted here but the server fails to connect later. To verify the connection, type `/mcp` in the chat panel and check that the server shows `connected`. A server with bad credentials shows `failed`. Once configured, ask Claude to use the tools (e.g., “Review PR #456”). To manage MCP servers without leaving VS Code, type `/mcp` in the chat panel. The MCP management dialog lets you enable or disable servers, reconnect to a server, and manage OAuth authentication. See the [MCP documentation](</docs/en/mcp>) for available servers.
+Replace `YOUR_GITHUB_PAT` with your personal access token. The `claude mcp add` command saves the configuration without validating credentials, so a placeholder value is accepted here but the server fails to connect later. To verify the connection, start a new conversation, type `/mcp`, and check that the server shows **Connected**. A server with bad credentials shows **Failed**. Once configured, ask Claude to use the tools (e.g., “Review PR #456”). To find servers to connect, see [Find and build MCP servers](</docs/en/mcp#find-and-build-mcp-servers>).
##
@@ -643,5 +654,5 @@
Now that you have Claude Code set up in VS Code:
* [Explore common workflows](</docs/en/common-workflows>) to get the most out of Claude Code
- * [Set up MCP servers](</docs/en/mcp>) to extend Claude’s capabilities with external tools. Add servers using the CLI, then manage them with `/mcp` in the chat panel.
+ * [Set up MCP servers](</docs/en/mcp>) to extend Claude’s capabilities with external tools. Add and manage them with `/mcp` in the chat panel.
* [Configure Claude Code settings](</docs/en/settings>) to customize allowed commands, hooks, and more. These settings are shared between the extension and CLI.
--- a/workflows.md
+++ b/workflows.md
@@ -86,7 +86,7 @@
Key| Action
---|---
`↑` / `↓`| Select a phase or agent
-`Enter` or `→`| Drill into the selected phase, then into an agent to read its prompt, recent tool calls, and result
+`Enter` or `→`| Drill into the selected phase, then into an agent’s detail. In the detail, `Enter` expands or collapses it
`Esc` or `←`| Back out one level. In v2.1.203 through v2.1.205, `←` didn’t step back out of a phase or agent; use `Esc` on those versions
`j` / `k`| Scroll within the agent detail when it overflows
`f`| Filter the agent list in the selected phase by status. Press again to cycle
@@ -95,6 +95,8 @@
`r`| Restart the selected running agent
`s`| Save the run’s script as a command
+The agent detail lists the agent’s prompt, its recent tool calls, and its result. Each call shows its state, such as still running or failed. When the agent keeps a task list of its own, the detail shows it too, with each task’s status. Press `Enter` to expand the detail. The prompt and result then show in full, and each listed call shows its input and the start of its result.
+
##
@@ -316,7 +318,7 @@
return audits.filter(Boolean)
-The body is plain JavaScript with top-level `await`. `agent()` spawns one subagent, `pipeline()` runs one per item in a list, and `parallel()` runs a set of agent tasks at the same time and waits for all of them. An `agent()` call resolves to `null` if you stop it mid-run or it hits an unrecoverable API error. `pipeline()` keeps that `null` in the results array, which is why the example ends with `.filter(Boolean)` to drop those entries.
+The body is plain JavaScript with top-level `await`. `agent()` spawns one subagent, `pipeline()` runs one per item in a list, and `parallel()` runs a set of agent tasks at the same time and waits for all of them. An `agent()` call resolves to `null` if you stop it mid-run or it hits an unrecoverable API error. `pipeline()` keeps that `null` in the results array, which is why the example ends with `.filter(Boolean)` to drop those entries. If you pass a `schema` on an `agent()` call, that subagent returns JSON matching the shape instead of prose. Claude Code checks the schema before starting the subagent: when it can prove the schema contradicts itself, the call fails with an error naming the contradiction, and the subagent never starts. One contradiction it can prove is a `required` key that `additionalProperties: false` rules out. If the subagent’s output still fails validation after five attempts, the call fails with an error that includes the last validation failure. To change the attempt count, set [`MAX_STRUCTURED_OUTPUT_RETRIES`](</docs/en/env-vars>).
###
@@ -373,7 +375,7 @@
Manage runs
-Once a run starts, you manage it from the `/workflows` view, or by expanding its progress line in the task panel below the input box.
+Once a run starts, you manage it from the `/workflows` view, or by expanding its progress line in the task panel below the input box. When you stop a run, it stays in the task panel while any of its agents’ processes are still running. If you stop it again, Claude Code re-signals those processes.
###
@@ -381,7 +383,7 @@
Resume after a pause
-Resume a paused run from `/workflows` by selecting it and pressing `p`. For a run you stopped, ask Claude to relaunch the workflow with the same script. Claude Code replays the run in the order agents started, and each agent either returns its saved result or runs again:
+Resume a paused run from `/workflows` by selecting it and pressing `p`. For a run you stopped, ask Claude to relaunch the workflow with the same script. If agents from the stopped run haven’t exited yet, Claude Code refuses the relaunch until they have, so a second copy of those agents can’t run alongside them. Claude Code replays the run in the order agents started, and each agent either returns its saved result or runs again:
* **Completed** : returns its saved result. The first agent whose prompt differs from the previous run, because you edited the script or an earlier agent returned something different, runs again, and so does every agent after it, even ones that completed.
* **Still running when you stopped** : starts over. Stopping the whole run doesn’t count any agent as failed.
@@ -390,7 +392,9 @@
That last case means a failure in the middle of a fan-out reruns work that already finished. If a script starts A, B, C, and D in that order and B fails, relaunching returns A from cache and runs B, C, and D again. You can resume a run within the same Claude Code session. What happens to a running workflow when you leave the session depends on how you leave:
* If you [background the session](</docs/en/agent-view#what-carries-over-when-you-background>), Claude Code replays the run the same way in the background session and continues it.
- * If you exit Claude Code while a workflow is running and [agent view is on](</docs/en/agent-view#from-inside-a-session>), the exit dialog offers `Move to background and exit`, which carries the run over the same way. If you choose `Exit and stop tasks` instead, or the option isn’t offered, the run stops with the session. Claude Code keeps the run’s saved results under that session’s directory in `~/.claude/projects/`, so a session you resume with `claude --resume` can replay them when you ask Claude to relaunch the workflow, while a session you start fresh has nothing to replay and starts the workflow over.
+ * If you exit Claude Code while a workflow is running and [agent view is on](</docs/en/agent-view#from-inside-a-session>), the exit dialog offers `Move to background and exit`, which carries the run over the same way. If you choose `Exit and stop tasks` instead, or the option isn’t offered, the run stops with the session. Claude Code keeps the run’s saved results under that session’s directory in `~/.claude/projects/`, so a session you resume with `claude --resume` can replay them when you ask Claude to relaunch the workflow. In a session you start fresh, Claude has no earlier run to relaunch and starts the workflow over as a new run.
+
+In a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code also saves the run’s results with the session’s conversation history, which survives when the session’s VM is reclaimed. When you [reopen such a session](</docs/en/claude-code-on-the-web#environment-expired>) and ask Claude to relaunch the workflow, completed agents still return their saved results. In local and cloud sessions alike, when Claude relaunches an earlier run and Claude Code can’t find that run’s saved results at all, the relaunch fails with a `nothing to resume` error instead of starting the run over on its own. Ask Claude to start the workflow over as a new run.
###
--- a/worktrees.md
+++ b/worktrees.md
@@ -317,7 +317,7 @@
Claude Code refuses to use a worktree
-An error starting `Refusing to use <path> as an isolation worktree` means Claude Code checked the directory’s git identity before adopting it as a session’s or subagent’s isolated checkout, and declined it. The check runs whether Claude Code is creating the worktree, entering an existing one, or reusing one from an earlier run. In most cases the rest of the message says the directory’s git metadata resolves into the main checkout: for example, its `.git` file points at the main repository’s own `.git` directory, or git resolves its working tree to the main checkout through a `core.worktree` redirect. From such a directory, an ordinary git command such as `git reset --hard` would act on the main checkout instead of the worktree. Claude Code also refuses when the directory has a `.git` entry it can’t read, rather than assuming the worktree is safe. Claude Code leaves the refused directory in place, since it may hold work. Match the message to its recovery, whether it follows `Refusing to use <path>` or appears in a resume message; some endings occur only in resume messages:
+An error starting `Refusing to use <path> as an isolation worktree` means Claude Code checked the directory’s git identity before adopting it as a session’s or subagent’s isolated checkout, and declined it. The check runs whether Claude Code is creating the worktree, entering an existing one, or reusing one from an earlier run. In most cases the rest of the message says the directory’s git metadata resolves into the main checkout: for example, its `.git` file points at the main repository’s own `.git` directory, or git resolves its working tree to the main checkout through a `core.worktree` redirect. From such a directory, an ordinary git command such as `git reset --hard` would act on the main checkout instead of the worktree. Claude Code also refuses when the directory has a `.git` entry it can’t read, rather than assuming the worktree is safe. A directory with no git metadata at all, such as one your `WorktreeCreate` hook creates, passes the check only when no git repository contains it. If the hook creates the directory inside a repository, git resolves it to that repository’s checkout and Claude Code refuses it with the `git resolves its working tree to` message, so have the hook create its directories outside any repository. Claude Code leaves the refused directory in place, since it may hold work. Match the message to its recovery, whether it follows `Refusing to use <path>` or appears in a resume message; some endings occur only in resume messages:
* **Says`launch from the parent checkout` or `Run the resume from the project checkout`**: you launched Claude Code from inside the worktree. Launch from the main checkout instead; the worktree needs no recreation.
* **Says`it cannot be resumed or re-entered`**: nothing in this session vouches for the worktree from where you launched. Recreate it; the directory and its work remain on disk for manual recovery, and when the worktree has a parent checkout, resuming from there also works.
@@ -332,7 +332,7 @@
The session resumes outside its worktree
-When an interactive resume can’t return the session to its worktree, Claude Code says so with one of the messages below.
+When you resume a session interactively and Claude Code can’t return it to its worktree, Claude Code says so with one of the messages below. When Claude Code clears the worktree binding, it records the clear in the session transcript. If you [suppress transcript writes](</docs/en/sessions#where-transcripts-are-stored>), the message says instead that the binding could not be cleared and that Claude Code will re-check the worktree on a later resume.
Message starts with| What happened and what to do
---|---
@@ -341,9 +341,9 @@
`Did not re-enter your worktree <path>`| Claude Code refused the worktree binding as unsafe; it clears the binding and the session continues without isolation. The message includes the specific refusal: match it under Claude Code refuses to use a worktree, since the fix is recreation for some refusals and a path change for others.
`Could not re-enter your worktree <path>`| Claude Code couldn’t vouch for the worktree from where you launched, most commonly because you launched from inside it; the binding is kept. The rest of the message names the fix; match it under Claude Code refuses to use a worktree.
-In [non-interactive mode](</docs/en/headless>) with `-p`, and on resumes the [Agent SDK](</docs/en/agent-sdk/sessions>) runs, Claude Code stops the resume with a stderr error for every refusal except a gone worktree, instead of continuing without isolation, and the messages take different shapes from the ones in the table above:
-
- * `Error: cannot resume into worktree <path>: ...This session was not started.` for a refusal the table shows as `Did not re-enter`
+In [non-interactive mode](</docs/en/headless>) with `-p`, and on resumes that the [Agent SDK](</docs/en/agent-sdk/sessions>) runs, Claude Code stops the resume with a stderr error for every refusal except a gone worktree, instead of continuing without isolation. With `--output-format stream-json`, the refusal also arrives on stdout as a `result` message with subtype `error_during_execution` whose `errors` array carries the same text, so an Agent SDK application receives the reason rather than only a non-zero exit. Before v2.1.260, a worktree-resume refusal produced no `result` message. The messages take different shapes from the interactive messages in the table:
+
+ * `Error: cannot resume into worktree <path>: ...This session was not started.` for a refusal the table shows as `Did not re-enter`. Claude Code clears the worktree binding before exiting, and the error says so; the next time you resume the conversation, the session continues in the current directory without worktree isolation. Before v2.1.260, Claude Code didn’t write the cleared binding, so every retry of the same resume failed with the same error. If you [suppress transcript writes](</docs/en/sessions#where-transcripts-are-stored>), the clear can’t be saved. The error then says the same command will be refused again, and names `--fork-session` and starting a new conversation as ways to continue without the worktree.
* `Error: could not verify worktree <path> for this resume, so the resume was aborted...` for `Could not verify`
* `Error: ...The worktree binding is kept.` for `Could not re-enter`
* `Notice: the worktree <path> for this session no longer exists...` for a gone worktree; Claude Code prints it and continues the session, as an interactive resume does