Changes on
76 changes detected
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -34,7 +34,12 @@
Decide how settings reach devices
-Managed settings define organization policy. Claude Code checks the four sources below in priority order and applies the first one that returns a non-empty configuration. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled source sets them; when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read.
+Managed settings define organization policy. Claude Code checks the four sources in the table below in priority order and applies the first one that returns a non-empty configuration, with two exceptions:
+
+ * Claude Code honors a small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, when any admin-controlled source sets them.
+ * Claude Code [merges the `env` block per key across the admin-controlled sources](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>), apart from the telemetry-unit and credential-paired routing exceptions covered there. Only admin-controlled sources contribute to the merge, developer-writable settings can’t, and [`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION=1`](</docs/en/env-vars>) restores the winner-only composition. Requires Claude Code v2.1.223 or later.
+
+When a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only managed configuration Claude Code reads: the lock-key checks read it alone, and no per-key `env` merge happens.
Mechanism| Delivery| Priority| Platforms
---|---|---|---
--- a/agents.md
+++ b/agents.md
@@ -16,7 +16,7 @@
* A [background bash command](</docs/en/interactive-mode#background-bash-commands>) runs one shell command without blocking the conversation. It doesn’t spawn an agent.
* A [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>), started with `/subtask`, is a subagent that inherits your full conversation context instead of starting fresh. It’s a way to spawn a subagent, not a separate surface. To copy the whole session into a new [background session](</docs/en/agent-view#from-inside-a-session>) that runs alongside it, use `/fork`. With [agent view turned off](</docs/en/agent-view#turn-off-agent-view>), the forked-subagent command is `/fork` instead and `/subtask` isn’t available.
- * A [routine](</docs/en/routines>) runs a session on a schedule in Anthropic’s cloud, not in parallel on your machine.
+ * A [routine](</docs/en/routines>) runs a session on a schedule in the cloud, not in parallel on your machine.
Running several sessions or subagents at once multiplies token usage. See [Costs](</docs/en/costs>) for usage and rate-limit details.
--- a/authentication.md
+++ b/authentication.md
@@ -141,7 +141,12 @@
* **`claude setup-token` and `/install-github-app`**: enforce only `forceLoginMethod`, so they can mint a token in a different organization
* **[Gateway](</docs/en/claude-apps-gateway>) sign-in**: selected by `forceLoginMethod: "gateway"` rather than restricted by it, and doesn’t authenticate against an Anthropic organization, so `forceLoginOrgUUID` doesn’t apply; use your gateway identity provider to restrict access
-Deploy the keys through your device management tooling. [Server-managed settings](</docs/en/server-managed-settings>) reach only accounts that are already authenticated into your organization, so they can’t redirect a developer’s first login. If your organization distributes server-managed settings as well, set the keys in both places: managed-settings sources [don’t merge](</docs/en/server-managed-settings#settings-precedence>), and cached server-managed settings replace the device-managed file entirely. The keys also block sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`, since organization membership can’t be verified for an environment credential. Cloud provider sessions such as Amazon Bedrock authenticate against your cloud provider and aren’t blocked; restrict those through your cloud IAM policies. See [`forceLoginOrgUUID`](</docs/en/settings#available-settings>) in the settings reference for the full behavior. Before v2.1.146, the pin applied only to the login flow and didn’t block API-key credentials.
+Deploy the keys through your device management tooling. [Server-managed settings](</docs/en/server-managed-settings>) reach only accounts that are already authenticated into your organization, so they can’t redirect a developer’s first login. If your organization distributes server-managed settings as well, set the keys in both places: managed-settings sources [don’t merge](</docs/en/server-managed-settings#settings-precedence>), and cached server-managed settings replace the device-managed file, apart from two kinds of keys that still fill in from a losing source:
+
+ * **The`env` block**: [merges per key](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>) in Claude Code v2.1.223 or later
+ * **The[cross-source lock keys](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>)**: honored from any admin source
+
+`forceLoginMethod` and `forceLoginOrgUUID` are neither, so keep them in both places. The keys also block sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`, since organization membership can’t be verified for an environment credential. Cloud provider sessions such as Amazon Bedrock authenticate against your cloud provider and aren’t blocked; restrict those through your cloud IAM policies. See [`forceLoginOrgUUID`](</docs/en/settings#available-settings>) in the settings reference for the full behavior. Before v2.1.146, the pin applied only to the login flow and didn’t block API-key credentials.
##
--- a/best-practices.md
+++ b/best-practices.md
@@ -487,7 +487,7 @@
* [Worktrees](</docs/en/worktrees>): run separate CLI sessions in isolated git checkouts so edits don’t collide
* [Desktop app](</docs/en/desktop#work-in-parallel-with-sessions>): manage multiple local sessions visually, each in its own worktree
- * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions on Anthropic-managed cloud infrastructure in isolated VMs
+ * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions in the cloud, on Anthropic-managed infrastructure by default
* [Agent teams](</docs/en/agent-teams>): automated coordination of multiple sessions with shared tasks, messaging, and a team lead
Beyond parallelizing work, multiple sessions enable quality-focused workflows. A fresh context improves code review since Claude won’t be biased toward code it just wrote. For example, use a Writer/Reviewer pattern:
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,42 @@
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.224
+
+August 7, 2026
+
+ * Added self-hosted environments: `claude self-hosted-runner` turns your own machines or containers into a place Claude Code web, mobile, and desktop sessions can run, on Team and Enterprise plans
+ * Added `archive` plugin source: install plugins from a zip over HTTPS without git or npm, with optional SHA-256 pinning
+ * Added a cancel-and-confirm step when removing an unavailable paste changes a command’s text
+ * Added `ANTHROPIC_BEDROCK_REGION_PREFIX` env var for Bedrock to prefer a specific cross-region inference profile over the `AWS_REGION`-derived one
+ * Added `crossSessionInbound` and `dialogExpiry` settings: cross-session messages sent to a session running with bypassed permissions are held for your approval, and messages to other sessions auto-deliver
+ * Added sandbox credential-masking options: `extract` and `onExtractNoMatch` for structured env values, `decode: "jwt"` with `maskClaims` for JWT-aware masking, and `awsPairs`/`sigv4` for AWS SigV4 re-signing; these need `network.tlsTerminate` and are honored only from user, managed, or `--settings` settings
+ * Added cross-session `SendMessage`: Claude Code sessions can now message each other, on any of your machines, with `ListAgents` to discover them (macOS and Linux)
+ * Fixed long (>200 char) project paths resolving to another project’s session directory under a shared sanitized prefix; session list, rename, fork, delete and `/resume` no longer cross projects
+ * Fixed `SendMessage` reporting “Message sent” when the write to a teammate’s inbox had actually failed; failed deliveries are now reported as errors
+ * Fixed sandbox filesystem deny entries written with a trailing slash (e.g. `denyRead: "~/.aws/"`) being silently bypassable on Linux and macOS
+ * Fixed sandbox violation details never appearing in Bash tool results; Claude now sees which file or network access was denied and why
+ * Fixed MCP tools that connect mid-turn being deferred for tool search without their names announced to the model
+ * Fixed plugin install records being silently corrupted when the same plugin is installed in multiple projects
+ * Fixed recalled or restored paste content occasionally attaching wrong data or silently losing text when the paste had aged out or placeholder numbers collided
+ * Fixed copy-on-select on Wayland sometimes not reaching the clipboard; the two selection writes no longer race
+ * Fixed the feedback survey’s transcript share silently failing on long sessions; a failed share now shows an error instead of a success message
+ * Fixed Remote Control auto-start intermittently failing with “Remote credentials fetch failed” on a cold start with a stale login token
+ * Fixed Remote Control and SDK clients showing a blank “(no content)” message after `/clear` and other output-less commands
+ * Fixed a Remote Control session recreated after its server session expired uploading prior local conversation history into the new session
+ * Improved fullscreen mode to keep the full pre-compaction history in scrollback across repeated compactions, instead of only the most recent interval
+ * Improved Remote Control: attached web and mobile clients now see compaction progress and the post-compaction boundary instead of a silent pause; `/clear` resets now propagate to attached clients
+ * Improved Remote Control: connection failures now show a persistent failure indicator with details and a reconnect shortcut, instead of only an 8-second toast
+ * Removed the 200-subagent-per-session spawn cap; long-running sessions no longer refuse new agents (concurrency and depth limits still apply)
+ * Changed managed settings: the approval prompt no longer re-appears after re-login or org switching when the organization’s settings are unchanged
+ * Changed the feedback-survey transcript share: with your consent it now also uploads the last request’s model settings — the system prompt (which includes your `CLAUDE.md` instructions), tool definitions, and model parameters. Secrets are redacted as before, and these fields are dropped first if the share is too large
+ * Changed the Bash tool description to always note that command output is displayed to the model, not reliably to the user
+ * Changed recalled paste placeholder numbers to renumber when accepted into the input
+ * Changed Remote Control to archive the stale server session instead of leaving a dead one listed when a fresh session is minted after compaction or `/resume`
+ * [VSCode] Fixed the extension showing Remote Control as connected after the connection failed
+ * Fixed a session resume silently reconnecting Remote Control after the user turned it off (`--resume`, SDK hosts, and the VS Code extension)
+ * [VSCode] Fixed sessions not honoring `remoteControlAtStartup` when explicitly enabled
--- a/checkpointing.md
+++ b/checkpointing.md
@@ -6,7 +6,7 @@
How checkpoints work
-As you work with Claude, checkpointing automatically captures the state of your code before each user prompt. This safety net lets you pursue ambitious, wide-scale tasks knowing you can always return to a prior code state.
+As you work with Claude, checkpointing automatically captures the state of your code before each user prompt.
###
@@ -17,7 +17,7 @@
Claude Code tracks all changes made by its file editing tools:
* Every user prompt creates a new checkpoint
- * Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Discarding an older checkpoint deletes the snapshot files that no remaining checkpoint references, except each file’s first snapshot, which the VS Code extension uses as the baseline for its session diffs. Before v2.1.208, those superseded snapshot files stayed on disk until the session was cleaned up.
+ * Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Discarding an older checkpoint deletes the snapshot files that no remaining checkpoint references, except each file’s first snapshot, which the VS Code extension uses as the baseline for its session diffs.
* Claude Code saves checkpoints with the conversation, so you can still run `/rewind` after you resume a session
* Claude Code deletes checkpoints along with sessions after 30 days; change the period with [`cleanupPeriodDays`](</docs/en/settings#available-settings>)
@@ -99,7 +99,10 @@
Subagent edits not restored
-Except for a [skill with `context: fork`](</docs/en/skills#run-skills-in-a-subagent>) that runs in the foreground, edits a [subagent](</docs/en/sub-agents>) applies land outside your session’s checkpoints, so rewinding doesn’t restore them, even though the subagent makes them with Claude’s file editing tools. This includes a background [`/code-review --fix`](</docs/en/code-review>) run and any forked skill that runs in the background. Use git to revert those edits. The foreground fork edits your working tree during your own turn, so rewinding restores its edits as usual. A forked skill runs in the background by default; set `background: false` in its frontmatter to run it in the foreground, where the invoking turn waits for the result. Before v2.1.218, forked skills always ran in the foreground.
+A [subagent](</docs/en/sub-agents>) makes edits with Claude’s file editing tools, but Claude Code usually doesn’t capture those edits in your session’s checkpoints. Whether rewinding restores them depends on how the subagent runs:
+
+ * **Foreground forked skill** : a [skill with `context: fork`](</docs/en/skills#run-skills-in-a-subagent>) that runs in the foreground edits your working tree during your own turn, so rewinding restores its edits as usual. Set `background: false` to run a fork in the foreground; a few situations, [listed on the skills page](</docs/en/skills#run-skills-in-a-subagent>), run it there regardless of the setting.
+ * **Any other subagent** : rewinding doesn’t restore the edits. Use git to revert them. This includes a forked skill that runs in the background, the default, and a background [`/code-review --fix`](</docs/en/code-review>) run.
###
@@ -125,11 +128,7 @@
Not a replacement for version control
-Checkpoints are designed for quick, session-level recovery. For permanent version history and collaboration:
-
- * Continue using version control (ex. Git) for commits, branches, and long-term history
- * Checkpoints complement but don’t replace proper version control
- * Think of checkpoints as “local undo” and Git as “permanent history”
+Checkpoints are designed for quick, session-level recovery. For permanent version history and collaboration, continue using version control, such as Git, for commits, branches, and long-term history.
##
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
@@ -343,8 +343,8 @@
Four parent-supplied settings are honored even with all five locks set:
- * **`forceLoginOrgUUID`** : Claude Code honors a parent-supplied value when no admin source sets an org UUID. Gateway sign-in doesn’t check this key, so it matters only for fleets that also use first-party Anthropic logins. An org UUID in any admin source blocks the parent’s value, but the value Claude Code enforces comes from the highest-priority source, so set `forceLoginOrgUUID` there.
- * **`allowedMcpServers`** : Claude Code honors a parent-supplied allowlist when no admin source sets one, and `allowManagedMcpServersOnly` doesn’t block it, because the lock enforces whichever list wins as the managed value, including a parent-supplied list when no admin source sets one. A list in any admin source blocks the parent’s, but the list Claude Code enforces comes from the highest-priority source, so set `allowedMcpServers` there, next to the lock.
+ * **`forceLoginOrgUUID`** : Claude Code honors a parent-supplied value when the highest-priority admin source doesn’t set an org UUID. Gateway sign-in doesn’t check this key, so it matters only for fleets that also use first-party Anthropic logins. An org UUID in the highest-priority admin source blocks the parent’s value and is the one Claude Code enforces, so set `forceLoginOrgUUID` there.
+ * **`allowedMcpServers`** : Claude Code honors a parent-supplied allowlist when the highest-priority admin source doesn’t set one, and `allowManagedMcpServersOnly` doesn’t block it, because the lock enforces whichever list wins as the managed value, including a parent-supplied list when the highest-priority admin source doesn’t set one. A list in the highest-priority admin source blocks the parent’s and is the list Claude Code enforces, so set `allowedMcpServers` there, next to the lock. Before v2.1.223, a value for either key in any admin source blocked the parent’s.
* **`availableModels`** : Claude Code honors a parent-supplied model list when the winning managed source doesn’t set one. If your fleet restricts models, set `availableModels` in the winning source.
* **`strictPluginOnlyCustomization`** : this key passes the filter regardless of any lock, and it makes Claude Code ignore the developer’s own customization, including protective hooks. No lock blocks it.
--- a/claude-apps-gateway-config.md
+++ b/claude-apps-gateway-config.md
@@ -548,7 +548,12 @@
Precedence with other managed sources
-If a device also has a local `managed-settings.json` or MDM-delivered policy, the managed sources don’t merge. The highest-priority source provides all policy settings, ranked in this order with highest priority first:
+If a device also has a local `managed-settings.json` or MDM-delivered policy, the managed sources don’t merge, with two per-key exceptions while no [policy helper](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is supplying managed settings, since a helper’s output replaces the managed sources entirely:
+
+ * The `env` block, in Claude Code v2.1.223 or later
+ * The [cross-source lock keys](</docs/en/settings#settings-precedence>)
+
+Both are covered in the list later in this section. The highest-priority source provides all policy settings, ranked in this order with highest priority first:
1. The [policy helper](</docs/en/settings#compute-managed-settings-with-a-policy-helper>)
2. Gateway-delivered settings
@@ -568,13 +573,9 @@
* [`allowAllClaudeAiMcps`](</docs/en/settings#available-settings>): allow-only override for the claude.ai MCP server allowlist
* `sandbox.bwrapPath` and `sandbox.socatPath`: filesystem paths to the [sandbox](</docs/en/sandboxing>) helper binaries
* [`forceRemoteSettingsRefresh`](</docs/en/server-managed-settings>): blocks startup until remote managed settings are freshly fetched, so an MDM or file policy that sets it is honored even when a cached remote payload that lacks the key is the highest-priority source
-
-Every other key, including `disableBypassPermissionsMode`, comes from the highest-priority source only. Two [parent-settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) checks read every admin source:
-
- * When any admin source sets `allowManagedPermissionRulesOnly`, Claude Code drops parent-supplied permission allow rules and `additionalDirectories`. The key’s effect on the developer’s own rules still follows the highest-priority source.
- * A `forceLoginOrgUUID` or `allowedMcpServers` value in any admin source blocks a parent-supplied one. The value that applies still comes from the highest-priority source.
-
-See [Settings precedence](</docs/en/settings#settings-precedence>) for the same rules on the settings page. 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.
+ * `env`: each variable comes from the highest-priority admin source that defines it, and lower admin sources fill in variables the higher sources leave unset. The telemetry unit and credential-paired routing variables follow their own rules; see [Per-key exceptions across managed sources](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>). Requires Claude Code v2.1.223 or later
+
+Every other key, including `disableBypassPermissionsMode`, comes from the highest-priority source only. One [parent-settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) check reads every admin source: when any admin source sets `allowManagedPermissionRulesOnly`, Claude Code drops parent-supplied permission allow rules and `additionalDirectories`. The key’s effect on the developer’s own rules still follows the highest-priority source. A `forceLoginOrgUUID` or `allowedMcpServers` value in the highest-priority admin source blocks a parent-supplied one and is the value Claude Code enforces. A value in a non-winning admin source neither applies nor blocks the parent’s. Before v2.1.223, a value in any admin source blocked the parent’s. See [Settings precedence](</docs/en/settings#settings-precedence>) for the same rules on the settings page. 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.
`mcpServers` inside a policy’s `cli` block is rejected at gateway boot. Per-group MCP distribution is not available; deploy MCP servers via the file-based `managed-mcp.json` on each device or let developers add them locally.
Show diff (117 lines)
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -1,6 +1,6 @@
Claude Code on the web is in research preview for Pro, Max, and Team users, and for Enterprise users with premium seats or Chat + Claude Code seats.
-Claude Code on the web runs tasks on Anthropic-managed cloud infrastructure at [claude.ai/code](<https://claude.ai/code>). Sessions persist even if you close your browser, and you can monitor them from the Claude mobile app.
+Claude Code on the web runs tasks on Anthropic-managed cloud infrastructure at [claude.ai/code](<https://claude.ai/code>), or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there. Sessions persist even if you close your browser, and you can monitor them from the Claude mobile app.
New to Claude Code on the web? Start with [Get started](</docs/en/web-quickstart>) to connect your GitHub account and submit your first task.
@@ -47,9 +47,9 @@
Move tasks between web and terminal
-These workflows require the [Claude Code CLI](</docs/en/quickstart>) signed in to the same claude.ai account. You can start new cloud sessions from your terminal, or pull cloud sessions into your terminal to continue locally. Cloud sessions persist even if you close your laptop, and you can monitor them from anywhere including the Claude mobile app. The `--cloud` and `--teleport` flags don’t appear in `claude --help` output, but the CLI accepts them as shown below.
-
-From the CLI, session handoff is one-way: you can pull cloud sessions into your terminal with `--teleport`, but you can’t push an existing terminal session to the web. The `--cloud` flag creates a new cloud session for your current repository. The [Desktop app](</docs/en/desktop#continue-in-another-surface>) provides a Continue in menu that can send a local session to the web.
+These workflows require the [Claude Code CLI](</docs/en/quickstart>) signed in to the same claude.ai account. You can start new cloud sessions from your terminal, or pull cloud sessions into your terminal to continue locally. Cloud sessions persist even if you close your laptop, and you can monitor them from anywhere including the Claude mobile app.
+
+From the CLI, session handoff is one-way: you can pull cloud sessions into your terminal with `--teleport`, but you can’t push an existing terminal session to the web. The `--cloud` flag with a task description creates a new cloud session for your current repository; with a session ID or claude.ai/code URL it instead targets that existing session, [queueing a message or attaching your terminal](</docs/en/claude-code-on-the-web#send-follow-ups-from-the-cli>). The [Desktop app](</docs/en/desktop#continue-in-another-surface>) provides a Continue in menu that can send a local session to the web.
###
@@ -110,6 +110,42 @@
+Send follow-ups from the CLI
+
+Once a cloud session is running, wherever it executes, send it a follow-up message from the `claude` CLI on any machine where you’re logged in with `claude auth login`. The CLI authenticates with your Anthropic account credentials and sends no local session state, so the command doesn’t need to run from the machine that started the session, and it’s the same in every shell, including PowerShell. The primary form posts one message and exits:
+
+ claude -p "your message" --cloud <session-id>
+
+The CLI queues the message into the session and exits without waiting for a reply. Use it to steer a long-running session, queue the next step while the current one is still finishing, or send follow-ups from a [CI script](</docs/en/self-hosted-environments-testing#run-the-test-loop>). You can also pipe the message on stdin instead of passing it as an argument: `echo "your message" | claude -p --cloud <session-id>`. Without `-p`, `claude --cloud <session-id>` attaches your terminal to the session so you can converse with it directly. Interactive attach is rolling out gradually; if you see `Attaching to an existing cloud session is not enabled for your account`, contact your Anthropic account team. The `-p` queue-and-exit form isn’t affected by this rollout. For `<session-id>`, pass the bare ID, such as `session_...` or `cse_...`, or the session’s `claude.ai/code/<id>` URL, with or without the scheme or query string. Find the ID in your session list at claude.ai/code.
+
+`--cloud` requires an Anthropic account. It’s not available when Claude Code is configured for Amazon Bedrock, Google Cloud’s Agent Platform, or another third-party provider. An [LLM gateway](</docs/en/llm-gateway>) configured only through `ANTHROPIC_BASE_URL` doesn’t count as a third-party provider for this check, but you still need to sign in with `claude auth login`. Your organization’s `allow_remote_sessions` policy must also be enabled. An Owner can turn it on in the Claude Code admin settings at claude.ai/admin-settings/claude-code.
+
+####
+
+
+
+Output and errors
+
+On success, the queue-and-exit form prints the session ID and a link to view the session:
+
+ Sent to cloud session.
+ Session ID: session_01DiUkqY2kzbUbDmW1w96rfi
+ View: https://claude.ai/code/session_01DiUkqY2kzbUbDmW1w96rfi?from=cli&m=0
+
+Pass `--output-format json` for a machine-readable result: `{ok, session_id, url}` on success, or `{ok: false, session_id, error}` when the send fails, for example when the session is missing or archived. Configuration errors, such as an unsupported provider or a disabled organization policy, print to stderr without JSON. `--output-format stream-json` isn’t supported with `--cloud <session-id>`. The CLI prefixes errors with `Error: `. A failed delivery is wrapped as `failed to send message to cloud session <id>: <reason>`.
+
+Message| What it means
+---|---
+`Cloud sessions aren't available with <provider>. They run on Anthropic's infrastructure and require an Anthropic account.`| Claude Code is configured for a third-party provider. The message names the provider with the label your configuration uses, such as `Amazon Bedrock` or `Google Vertex AI`. Remove that provider’s configuration, for example by unsetting `CLAUDE_CODE_USE_BEDROCK`, and sign in with an Anthropic account (`claude auth login`).
+`Cloud sessions are disabled by your organization's policy. Contact your organization admin to enable them.`| The `allow_remote_sessions` organization policy is off.
+`Attaching to an existing cloud session is not enabled for your account.`| Interactive attach, without `-p`, is rolling out gradually and isn’t available for your account yet. The queue-and-exit form, `-p "..." --cloud <session-id>`, works regardless.
+`Session not found: <id>`| The ID or URL doesn’t match a session you can access. Check it against the session’s claude.ai/code URL.
+`cloud session <id> is archived and cannot accept new messages`| The session has been archived. Start a new session instead.
+
+###
+
+
+
From web to terminal
Pull a cloud session into your terminal using any of these:
@@ -117,7 +153,7 @@
* **Using`--teleport`**: from the command line, run `claude --teleport` for an interactive session picker, or `claude --teleport <session-id>` to resume a specific session directly. If you have uncommitted changes, you’ll be prompted to stash them first.
* **Using`/teleport`**: inside an existing CLI session, run `/teleport` or `/tp` to open the same session picker without restarting Claude Code.
* **From`/tasks`**: run `/tasks` to see your background sessions, then press `t` to teleport into one.
- * **From the web interface** : select **Open in CLI** to copy a command you can paste into your terminal.
+ * **From the web interface** : select **Open in > Terminal** from the session menu to copy a command you can paste into your terminal.
When you teleport a session, Claude verifies you’re in the correct repository, fetches and checks out the branch from the cloud session, and loads the full conversation history into your terminal. The terminal gets its own copy of the session: new work there stays local and doesn’t appear in the cloud session on claude.ai or the Claude mobile app. To keep steering from your phone after teleporting, start [`/remote-control`](</docs/en/remote-control>) in the local session. `--teleport` is distinct from `--resume`. `--resume` reopens a conversation from this machine’s local history and doesn’t list cloud sessions; `--teleport` pulls a cloud session and its branch.
@@ -142,7 +178,7 @@
`--teleport` is unavailable
-Teleport requires claude.ai subscription authentication. If you’re authenticated via API key, run `/login` to sign in with your claude.ai account instead. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, `--teleport` stops with `Cloud sessions aren't available with <provider>` because cloud sessions run on Anthropic’s infrastructure and aren’t available through those providers. If you’re already signed in via claude.ai and `--teleport` is still unavailable, your organization may have disabled cloud sessions.
+Teleport requires claude.ai subscription authentication. If you’re authenticated via API key, run `/login` to sign in with your claude.ai account instead. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, `--teleport` stops with `Cloud sessions aren't available with <provider>` because cloud sessions use the Anthropic API for inference and aren’t available through those providers. If you’re already signed in via claude.ai and `--teleport` is still unavailable, your organization may have disabled cloud sessions.
##
@@ -269,10 +305,10 @@
Each cloud session is separated from your machine and from other sessions through several layers:
- * **Isolated virtual machines** : each session runs in an isolated, Anthropic-managed VM
- * **Network access controls** : network access is limited by default, and can be disabled. When running with network access disabled, Claude Code can still communicate with the Anthropic API, which may allow data to exit the VM.
- * **Credential protection** : sensitive credentials such as git credentials or signing keys are never inside the sandbox with Claude Code. Authentication is handled through a secure proxy using scoped credentials.
- * **Secure analysis** : code is analyzed and modified within isolated VMs before creating PRs
+ * **Isolated virtual machines** : each session runs in an isolated, Anthropic-managed VM. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on your own infrastructure instead, where isolation is your deployment’s responsibility
+ * **Network access controls** : in Anthropic-hosted environments, network access is limited by default and can be disabled. In a self-hosted environment, you restrict session egress at your own network boundary. When running with network access disabled, Claude Code can still communicate with the Anthropic API, which may allow data to exit the VM.
+ * **Credential protection** : in Anthropic-hosted environments, sensitive credentials such as git credentials or signing keys are never inside the sandbox with Claude Code; authentication is handled through a secure proxy using scoped credentials. Sessions in a self-hosted environment authenticate git with credentials your deployment provides; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options, including per-session minted credentials and the same proxy.
+ * **Secure analysis** : code is analyzed and modified within the session’s isolated environment before creating PRs
##
@@ -300,7 +336,7 @@
Unable to get organization UUID
-`claude --cloud` and `claude --teleport` require sign-in with a claude.ai account. If you authenticate with an API key, or your stored account details are stale, these commands fail with `Unable to get organization UUID` or a message that API key authentication is not sufficient. Run `/login` to sign in with your claude.ai account, then retry the command. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the commands stop earlier with `Cloud sessions aren't available with <provider>`. Cloud sessions run on Anthropic’s infrastructure and aren’t available through those providers.
+`claude --cloud` and `claude --teleport` require sign-in with a claude.ai account. If you authenticate with an API key, or your stored account details are stale, these commands fail with `Unable to get organization UUID` or a message that API key authentication is not sufficient. Run `/login` to sign in with your claude.ai account, then retry the command. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the commands stop earlier with `Cloud sessions aren't available with <provider>`. Cloud sessions use the Anthropic API for inference and aren’t available through those providers.
###
@@ -333,7 +369,7 @@
* **Rate limits** : Claude Code on the web shares rate limits with all other Claude and Claude Code usage within your account. Running multiple tasks in parallel consumes more rate limits proportionately. There is no separate compute charge for the cloud VM.
* **Repository authentication** : you can only move sessions from web to local when you are authenticated to the same account
* **Platform restrictions** : repository cloning and pull request creation require GitHub. Self-hosted [GitHub Enterprise Server](</docs/en/github-enterprise-server>) instances are supported for Team and Enterprise plans. GitLab, Bitbucket, and other non-GitHub repositories can be sent to cloud sessions as a local bundle, but the session can’t push results back to the remote
- * **Organization IP allowlist** : cloud sessions call the Anthropic API from Anthropic-managed infrastructure, not your network. If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled, every cloud session fails with an authentication error. The same applies to [Code Review](</docs/en/code-review>) and [Routines](</docs/en/routines>). Contact [Anthropic support](<https://support.claude.com/>) to exempt Anthropic-hosted services from your organization’s IP allowlist.
+ * **Organization IP allowlist** : cloud sessions call the Anthropic API from Anthropic-managed infrastructure, not your network, while sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) call it from your own network. If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled, every Anthropic-hosted cloud session fails with an authentication error. The same applies to [Code Review](</docs/en/code-review>) and to [routines](</docs/en/routines>) that run on Anthropic-hosted environments; a routine routed to a self-hosted environment calls the API from your own network. Contact [Anthropic support](<https://support.claude.com/>) to exempt Anthropic-hosted services from your organization’s IP allowlist.
##
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -160,7 +160,7 @@
Clear local data
-Run `claude project purge` to delete the state Claude Code holds for one project. The command requires Claude Code v2.1.124 or later. It deletes:
+Run `claude project purge` to delete the state Claude Code holds for one project. It deletes:
* Transcripts and auto memory under `projects/`
* Per-session `tasks/`, `debug/`, and `file-history/` entries
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -69,16 +69,17 @@
`--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"`
`--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`| Create a new [web session](</docs/en/claude-code-on-the-web>) on claude.ai with the provided task description| `claude --cloud "Fix the login bug"`
+`--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, target that existing session instead: `-p` queues the message into it, and no `-p` attaches your terminal. 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. 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 (for example, `"api,hooks"` or `"!statsig,!file"`)| `claude --debug "api,mcp"`
+`--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"`
`--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 [`effortLevel`](</docs/en/settings#available-settings>) setting 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>`| With `-p`, create a new [cloud session](</docs/en/claude-code-on-the-web>) on the named environment and exit without waiting for a reply; self-hosted environment IDs have the form `ccpool_...`. Can’t be combined with `--cloud`. See [dispatch from a script](</docs/en/self-hosted-environments-testing#run-the-test-loop>)| `claude -p "Run the smoke test" --environment ccpool_abc123`
`--exclude-dynamic-system-prompt-sections`| Move per-machine sections from the system prompt (working directory, environment info, memory paths, git-repo flag) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when `--system-prompt` or `--system-prompt-file` is set. Use with `-p` for scripted, multi-user workloads| `claude -p --exclude-dynamic-system-prompt-sections "query"`
`--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#available-settings>), which this flag overrides| `claude --fallback-model sonnet,haiku`
@@ -111,11 +112,12 @@
`--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 after each turn with a predicted next user prompt. 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"`
-`--remote`| Deprecated alias for `--cloud`| `claude --remote "Fix the login bug"`
+`--ref <branch>`| With `--environment`, base the new session’s checkout on a named ref instead of local `HEAD`| `claude -p "Run the smoke test" --environment ccpool_abc123 --ref main`
+`--remote`| Deprecated alias for `--cloud`, including the existing-session form| `claude --remote "Fix the login bug"`
`--remote-control`, `--rc`| Start an interactive session with [Remote Control](</docs/en/remote-control#start-a-remote-control-session>) enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the session| `claude --remote-control "My Project"`
`--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`
-`--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`; passing a session ID searches only the current project directory and its git worktrees. As of v2.1.144, [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. 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`
--- a/cloud-environments.md
+++ b/cloud-environments.md
@@ -1,6 +1,6 @@
Cloud environments require [Claude Code on the web](</docs/en/claude-code-on-the-web>), which is in research preview for Pro, Max, and Team users, and for Enterprise users with [premium seats or Chat + Claude Code seats](<https://support.claude.com/en/articles/11845131-use-claude-code-with-your-team-or-enterprise-plan>).
-Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: [Claude Code on the web](</docs/en/claude-code-on-the-web>), the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>), [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [routines](</docs/en/routines>), the [Claude mobile app](</docs/en/mobile>), and the [Desktop app](</docs/en/desktop>).
+Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: [Claude Code on the web](</docs/en/claude-code-on-the-web>), the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>), [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [routines](</docs/en/routines>), the [Claude mobile app](</docs/en/mobile>), and the [Desktop app](</docs/en/desktop>). Claude Tag sessions can’t run in [self-hosted environments](</docs/en/self-hosted-environments>) yet; the other surfaces can route to any environment.
[Remote Control](</docs/en/remote-control>) sessions connect the web and mobile interfaces to a session on your own machine, which uses your machine’s network and files, not a cloud environment. Claude Tag channel sessions use shared environments only.
@@ -18,7 +18,7 @@
With only **Default** available, every session runs in it. When you have more than one environment, sessions choose one per surface:
* On the web, the Desktop app, and the mobile app, sessions use the environment shown in the selector. An admin-set organization default fills the selection when you haven’t picked one.
- * From the CLI, sessions use your `/remote-env` pick, or fall back to your first available cloud environment.
+ * From the CLI, sessions use your `/remote-env` pick, or fall back to your first available cloud environment. Passing `--environment <environment-id>` on a [scripted dispatch](</docs/en/self-hosted-environments-testing#run-the-test-loop>) overrides both for that invocation; the flag requires Claude Code v2.1.224 or later.
Configure an environment when the default isn’t enough: when Claude needs to reach domains outside the default allowlist, needs environment variables set for its sessions, or needs dependencies installed before it starts working.
@@ -82,7 +82,7 @@
Organization-shared environments
-Owners and admins on Team and Enterprise plans can create cloud environments that are shared with every member of the organization. Shared environments appear in each member’s environment selector alongside their personal ones, so a team can standardize on one configuration instead of each member recreating it. Create, edit, and archive shared environments from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). Each shared environment has a name, a network access level, environment variables in `.env` format, and a setup script. Owners and admins choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Values in a shared environment reach every member’s sessions in that environment. Like personal environments, shared environments have no dedicated secrets store, so don’t include secrets. In [Claude Tag](<https://claude.com/docs/claude-tag/overview>) channels, Claude works as your organization’s shared identity, not as any member, so channel sessions use shared environments only. You can set the environment a channel uses in two ways:
+Owners and admins on Team and Enterprise plans can create cloud environments that are shared with every member of the organization; the same roles manage everything else on the **Cloud environments** admin page, including [self-hosted environments](</docs/en/self-hosted-environments>). Shared environments appear in each member’s environment selector alongside their personal ones, so a team can standardize on one configuration instead of each member recreating it. Create, edit, and archive shared environments from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). Each shared environment has a name, a network access level, environment variables in `.env` format, and a setup script. Owners and admins choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Values in a shared environment reach every member’s sessions in that environment. Like personal environments, shared environments have no dedicated secrets store, so don’t include secrets. In [Claude Tag](<https://claude.com/docs/claude-tag/overview>) channels, Claude works as your organization’s shared identity, not as any member, so channel sessions use shared environments only. You can set the environment a channel uses in two ways:
* Set a shared environment as the organization’s default environment at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>).
* [Pin one to a channel](<https://claude.com/docs/claude-tag/admins/troubleshooting#channel-sessions-use-the-wrong-environment-or-can%E2%80%99t-find-one>) in the Claude Tag admin settings.
@@ -136,7 +136,7 @@
GitHub proxy
-All GitHub operations go through a dedicated proxy that keeps your real GitHub credentials outside the session’s VM, independent of the environment’s access level:
+In Anthropic-hosted environments, all GitHub operations go through a dedicated proxy that keeps your real GitHub credentials outside the session’s VM, independent of the environment’s access level. Sessions in a self-hosted environment authenticate git operations with credentials your deployment provides; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options, including per-session minted credentials and an opt-in to this same proxy. The proxy provides:
* **Git credentials** : the git client inside the VM uses a scoped credential, which the proxy verifies and swaps for your actual GitHub token.
* **API requests** : requests from the built-in GitHub tools, and from `gh` under the `proxy-injected` placeholder, go out with your real credentials substituted.
@@ -151,7 +151,7 @@
Security proxy
-Cloud sessions run behind an HTTP/HTTPS network proxy for security and abuse prevention purposes. All outbound internet traffic passes through this proxy, which provides:
+Cloud sessions in Anthropic-hosted environments run behind an HTTP/HTTPS network proxy for security and abuse prevention purposes; in a [self-hosted environment](</docs/en/self-hosted-environments-deploy#default-deny-egress>), outbound traffic leaves through your own network boundary instead. All outbound internet traffic from an Anthropic-hosted session passes through this proxy, which provides:
* Protection against malicious requests
* Rate limiting and abuse prevention
@@ -182,7 +182,7 @@
Your repo’s `.claude/rules/`| Yes| Part of the clone
Your repo’s `.claude/skills/`, `.claude/agents/`, `.claude/commands/`| Yes| Part of the clone
Plugins declared in `.claude/settings.json`| Yes| Installed at session start from the [marketplace](</docs/en/plugin-marketplaces>) you declared. Requires network access to reach the marketplace source
-Your organization’s [server-managed settings](</docs/en/server-managed-settings>)| Yes| Fetched from Anthropic’s servers when the session starts. See [Surface coverage](</docs/en/model-config#surface-coverage>) for how `availableModels` is enforced in cloud sessions. Settings deployed to your device through MDM or managed settings files don’t apply, because the session runs on an Anthropic-managed VM
+Your organization’s [server-managed settings](</docs/en/server-managed-settings>)| Yes| Fetched from Anthropic’s servers when the session starts. See [Surface coverage](</docs/en/model-config#surface-coverage>) for how `availableModels` is enforced in cloud sessions. Settings deployed to your device through MDM or managed settings files don’t apply, because the session runs on an Anthropic-managed VM; in a [self-hosted environment](</docs/en/self-hosted-environments>), sessions read the managed settings file in the runner image only when server-managed settings deliver no keys, per [settings precedence](</docs/en/server-managed-settings#settings-precedence>)
Your user `~/.claude/CLAUDE.md`| No| Lives on your machine, not in the repo
Your user `~/.claude/skills/`, `~/.claude/agents/`, `~/.claude/commands/`| No| Live on your machine, not in the repo. Commit them to the repo’s `.claude/` directory instead. Cloud sessions automatically load skills you enable on claude.ai
Plugins enabled only in your user settings| No| User-scoped `enabledPlugins` lives in `~/.claude/settings.json`. Declare them in the repo’s `.claude/settings.json` instead
@@ -302,7 +302,7 @@
* 16 GB of RAM
* 30 GB of disk
-The VM may stop tasks that need significantly more memory, such as large build jobs or memory-intensive tests. For workloads beyond these limits, use [Remote Control](</docs/en/remote-control>) to run Claude Code on your own hardware.
+The VM may stop tasks that need significantly more memory, such as large build jobs or memory-intensive tests. For workloads beyond these limits, use [Remote Control](</docs/en/remote-control>) to run Claude Code on your own hardware, or run cloud sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) on compute your organization operates.
##
@@ -352,7 +352,7 @@
**When they run**| Before Claude Code launches, skipped when a cached environment exists| After Claude Code launches, on every session including resumed
**Where they run**| Cloud sessions only| Local and cloud sessions
-If you have SessionStart hooks in your user-level `~/.claude/settings.json`, don’t expect them in the cloud: user-level settings stay on your machine. In a cloud session, Claude Code runs hooks from the repository and from your organization’s [server-managed settings](</docs/en/server-managed-settings>).
+If you have SessionStart hooks in your user-level `~/.claude/settings.json`, don’t expect them in the cloud: user-level settings stay on your machine. In a cloud session, Claude Code runs hooks from the repository and from your organization’s [server-managed settings](</docs/en/server-managed-settings>); sessions in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#permissions-and-tool-approval>) also run hooks the operator seeded from the runner host’s `~/.claude/`.
###
@@ -402,7 +402,7 @@
* **No cloud-only scoping** : hooks run in both local and cloud sessions. To skip local execution, check the `CLAUDE_CODE_REMOTE` environment variable as shown above.
* **Requires network access** : install commands need to reach package registries. If your environment uses **None** network access, these hooks fail. The default allowlist under **Trusted** covers npm, PyPI, RubyGems, and crates.io.
- * **Proxy compatibility** : all outbound traffic passes through a security proxy. Some package managers don’t work correctly with this proxy. Bun is a known example.
+ * **Proxy compatibility** : in Anthropic-hosted environments, all outbound traffic passes through a security proxy, and some package managers don’t work correctly with it; Bun is a known example. In a [self-hosted environment](</docs/en/self-hosted-environments-deploy#default-deny-egress>), outbound traffic goes through your own network boundary instead.
* **Adds startup latency** : hooks run each time a session starts or resumes, unlike setup scripts which benefit from environment caching. Keep install scripts fast by checking whether dependencies are already present before reinstalling.
To persist environment variables for subsequent Bash commands, write to the file at `$CLAUDE_ENV_FILE`. See [SessionStart hooks](</docs/en/hooks#sessionstart>) for details. To customize the base image, use a setup script to install what you need on top of the provided image, or run your own image as a container alongside Claude with `docker compose`. Replacing the base image entirely isn’t supported yet.
@@ -676,8 +676,9 @@
* [Claude Code on the web](</docs/en/claude-code-on-the-web>): start, manage, and share cloud sessions
* [Web quickstart](</docs/en/web-quickstart>): connect GitHub and start your first cloud session
- * [Claude Tag](<https://claude.com/docs/claude-tag/overview>): sessions Claude starts from Slack run in the same environments
+ * [Claude Tag](<https://claude.com/docs/claude-tag/overview>): sessions Claude starts from Slack run in the same Anthropic-hosted environments
* [Routines](</docs/en/routines>): scheduled runs use the same environments and network access levels
* [Remote Control](</docs/en/remote-control>): run sessions on your own machine’s network and files instead
+ * [Self-hosted environments](</docs/en/self-hosted-environments>): run cloud sessions on your organization’s own infrastructure
* [SessionStart hooks](</docs/en/hooks#sessionstart>): repo-committed setup that runs in local and cloud sessions
* [Server-managed settings](</docs/en/server-managed-settings>): organization policy that reaches cloud sessions
--- a/code-review.md
+++ b/code-review.md
@@ -298,7 +298,7 @@
Review a diff locally
-The [`/code-review` command](</docs/en/commands>) reviews a diff in your terminal without installing the GitHub App. It reports correctness bugs and reuse, simplification, and efficiency cleanups.
+The [`/code-review` command](</docs/en/commands>) reviews a diff in your terminal without installing the GitHub App. It reports correctness bugs and reuse, simplification, and efficiency cleanups. `/review` is an alias of `/code-review`; before v2.1.223, it was a separate command that ran a single-pass, read-only review of a GitHub pull request.
1
@@ -346,7 +346,7 @@
Tune effort and arguments
-Pass an [effort level](</docs/en/model-config#adjust-effort-level>) to trade coverage for confidence. At `low` and `medium`, the review reports only the findings it’s most confident in, so you see fewer false positives; `high` through `max` cast a wider net and may include findings the review is less sure about. Without an effort argument, the review uses the session’s current effort. After the effort level and flags, Claude Code reads the rest of the line in one of two ways:
+Pass an [effort level](</docs/en/model-config#adjust-effort-level>) to trade coverage for confidence. At `low` and `medium`, the review reports only the findings it’s most confident in, so you see fewer false positives; `high` through `max` broaden coverage and may include findings the review is less sure about. When you don’t type a level, the review reuses the last one you typed, even in an earlier session, and Claude Code shows a notice such as `Reusing high effort, the level you typed last time`. Type a level, like `/code-review high`, to change what later runs reuse; a level you pass in a non-interactive `-p` run doesn’t update it. If you’ve never typed a level, the review uses the session’s current effort. Before v2.1.223, a `/code-review` without a level always used the session’s current effort. After the effort level and flags, Claude Code reads the rest of the line in one of two ways:
* **Without`ultra`**: everything left is the review target, even when it starts with another command name. `/code-review /fix-issue 123` reviews with `/fix-issue 123` as target text instead of loading `/fix-issue` as a second [stacked skill](</docs/en/skills#pass-arguments-to-skills>). Before v2.1.218, a command stacked after `/code-review` expanded as its own skill.
* **With`ultra`**: Claude Code reads a single word as a base branch or PR number, and turns longer text that doesn’t name a branch or PR into [a note attached to the review](</docs/en/ultrareview#pass-a-request-in-plain-words>). `/code-review ultra check my auth changes` reviews your current branch, and Claude relates the findings to your note.
--- a/commands.md
+++ b/commands.md
@@ -6,7 +6,7 @@
Commands across a typical workflow
-Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` to set up any servers the project needs, ask Claude to create any [subagents](</docs/en/sub-agents>) you want, and run `/permissions` to set your approval rules. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust which model you’re using and how much reasoning it applies. When the conversation gets long, `/context` shows what’s filling the window and `/compact` summarizes it to free space. Use `/btw` for a quick aside that shouldn’t add to the conversation history. **Run work in parallel.** Claude delegates side tasks to [subagents](</docs/en/sub-agents>), and `/tasks` lists the current session’s background work, including subagents that have finished. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed, `/code-review` checks the diff for correctness bugs and cleanups and can apply the findings with `--fix`, `/review` gives a fast single-pass, read-only review of a GitHub pull request, `/code-review <level> <pr#>` runs a multi-agent review of one, and `/security-review` checks the diff for security vulnerabilities. `/code-review ultra` runs a multi-agent review in the cloud. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` returns to an earlier conversation, `/branch` branches the current one to try a different direction, and `/fork` copies it into a new [background session](</docs/en/agent-view>). `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` runs a setup checkup that diagnoses installation and configuration issues and can fix them, `/debug` diagnoses runtime issues, and `/feedback` reports a bug with session context attached.
+Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` to set up any servers the project needs, ask Claude to create any [subagents](</docs/en/sub-agents>) you want, and run `/permissions` to set your approval rules. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust which model you’re using and how much reasoning it applies. When the conversation gets long, `/context` shows what’s filling the window and `/compact` summarizes it to free space. Use `/btw` for a quick aside that shouldn’t add to the conversation history. **Run work in parallel.** Claude delegates side tasks to [subagents](</docs/en/sub-agents>), and `/tasks` lists the current session’s background work, including subagents that have finished. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed. `/code-review` checks the current diff for correctness bugs and cleanups and can apply the findings with `--fix`; pass a PR number, such as `/code-review high 1234`, to review a pull request instead. `/review` is an alias. `/code-review ultra` runs a multi-agent review in the cloud. `/security-review` checks the diff for security vulnerabilities. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` returns to an earlier conversation, `/branch` branches the current one to try a different direction, and `/fork` copies it into a new [background session](</docs/en/agent-view>). `/teleport` pulls a web session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` runs a setup checkup that diagnoses installation and configuration issues and can fix them, `/debug` diagnoses runtime issues, and `/feedback` reports a bug with session context attached.
##
@@ -36,11 +36,11 @@
`/branch [name]`| Create a branch of the current conversation at this point, so you can try a different direction without losing the conversation as it stands. Switches you into the branch and preserves the original, which you can return to with `/resume`. To run a copy as a separate [background session](</docs/en/agent-view>) instead of switching into it, use `/fork`; to hand a side task to a [subagent](</docs/en/sub-agents>) that reports back into this conversation, use `/subtask`
`/btw [question]`| Ask a quick [side question](</docs/en/interactive-mode#side-questions-with-%2Fbtw>) without adding to the conversation. Without a question, reopens the overlay on your most recent side question from this session so you can browse earlier answers; with no side questions yet, it asks for one. Before v2.1.212, `/btw` required a question
`/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. Alias: `/share`. Before v2.1.212, `/bug` and `/share` were aliases of `/feedback`
-`/cd <path>`| Move this session to a new working directory. The conversation’s prompt cache is preserved: the new directory’s [`CLAUDE.md`](</docs/en/memory>) is appended as a message instead of rebuilding the system prompt. The session is relocated to the new directory’s project storage, so `--resume` and `--continue` find it from there. Prompts you to trust the directory if you haven’t worked in it before. Typing a partial path shows matching directory suggestions; press `Tab` to accept one. The suggestions require Claude Code v2.1.206 or later. To grant access to an extra directory without moving the session, use `/add-dir`. Restrict or disable `/cd` targets with [`Cd` permission rules](</docs/en/permissions#cd>). Requires Claude Code v2.1.169 or later; earlier versions report `Unknown command: /cd`
+`/cd <path>`| Move this session to a new working directory. The conversation’s prompt cache is preserved: the new directory’s [`CLAUDE.md`](</docs/en/memory>) is appended as a message instead of rebuilding the system prompt. The session is relocated to the new directory’s project storage, so `--resume` and `--continue` find it from there. `claude --resume <session-id>` also [finds the moved session from any other directory](</docs/en/sessions#resume-a-session>); this requires Claude Code v2.1.223 or later. Prompts you to trust the directory if you haven’t worked in it before. Typing a partial path shows matching directory suggestions; press `Tab` to accept one. The suggestions require Claude Code v2.1.206 or later. To grant access to an extra directory without moving the session, use `/add-dir`. Restrict or disable `/cd` targets with [`Cd` permission rules](</docs/en/permissions#cd>). Requires Claude Code v2.1.169 or later; earlier versions report `Unknown command: /cd`
`/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings
`/claude-api [migrate|managed-agents-onboard|prompt-audit]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and Managed Agents reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `migrate` to upgrade existing Claude API code to a newer model, `managed-agents-onboard` for a walkthrough that creates a new Managed Agent, or `prompt-audit` to flag instructions written for older models in your prompts, skills, and tool descriptions and propose fixes as a diff. The `prompt-audit` subcommand requires Claude Code v2.1.221 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>). Aliases: `/reset`, `/new`
-`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff 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>). See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for effort levels, targeting, and how it relates to `/simplify`
+`/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 no level given, the review reuses the level you typed last, falling back to the session’s [effort level](</docs/en/model-config#adjust-effort-level>) if you’ve never typed one; before v2.1.223, it always used the session’s effort level. A local review runs as a [subagent](</docs/en/sub-agents>), in the background in interactive sessions, so it doesn’t fill your conversation; before v2.1.218, it ran inside your conversation. See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for 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>). Run `/config --help` to list every settable key with its options. Alias: `/settings`
@@ -96,18 +96,18 @@
`/remote-env`| Choose the default environment for [cloud agents](</docs/en/cloud-environments#select-an-environment-from-the-cli>)
`/rename [name]`| Rename the current session and show the name on the prompt bar. Without a name, auto-generates one from conversation history. Also available in non-interactive mode (`-p`); requires Claude Code v2.1.205 or later. From every rename surface, including claude.ai and the desktop app, Claude Code replaces control and invisible characters in the new name with spaces and caps the name at 200 characters. If the name is empty once invisible characters are removed, Claude Code rejects it and shows `That name is empty once invisible characters are removed. Usage: /rename <name>`. The character replacement and length cap require Claude Code v2.1.221 or later
`/resume [session]`| Resume a conversation by ID or name, or open the session picker. As of v2.1.144, [background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`; one that is still running can’t be resumed here, so attach to it from `claude agents` or stop it there first. Alias: `/continue`
-`/review [PR]`| Run a fast single-pass, read-only review of a GitHub pull request by number. With no argument, lists open PRs to pick from; text after the PR number becomes additional review instructions. From v2.1.186 through v2.1.201, `/review` instead ran the same multi-agent engine as `/code-review medium`. For a multi-agent review at a chosen effort level, use [`/code-review <level> <pr#>`](</docs/en/code-review#review-a-diff-locally>); for a cloud-based review, see [`/code-review ultra`](</docs/en/ultrareview>)
+`/review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [pr#|branch|path]`| Alias of [`/code-review`](</docs/en/code-review#review-a-diff-locally>): reviews the current diff, or a PR number, branch, or path you pass, such as `/review 1234`, and takes the same effort levels and flags. For a deep cloud review, use [`/code-review ultra`](</docs/en/ultrareview>). Before v2.1.223, `/review` was a separate command that ran a single-pass, read-only review of a GitHub pull request by number, listing open PRs to pick from when run with no argument; from v2.1.186 through v2.1.201, it ran the same multi-agent engine as `/code-review medium`
`/rewind`| Rewind the conversation and/or code to a previous point, or summarize from a selected message. See [checkpointing](</docs/en/checkpointing>). Aliases: `/checkpoint`, `/undo`
`/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working, not only passing tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later
`/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later
`/sandbox`| Toggle [sandbox mode](</docs/en/sandboxing>). Available on supported platforms only
-`/schedule [description]`| Create, update, list, or run [routines](</docs/en/routines>), which execute on Anthropic-managed cloud infrastructure. Claude walks you through the setup conversationally. Alias: `/routines`
+`/schedule [description]`| Create, update, list, or run [routines](</docs/en/routines>), which execute in the cloud. Claude walks you through the setup conversationally. Alias: `/routines`
`/scroll-speed`| Adjust mouse wheel [scroll speed](</docs/en/fullscreen#mouse-wheel-scrolling>) interactively, with a ruler you can scroll while the dialog is open to preview the change. Available in [fullscreen rendering](</docs/en/fullscreen>) only and not in the JetBrains IDE terminal
`/security-review`| Analyze the changes on your current branch for security vulnerabilities. Reviews the diff between your branch and origin’s default branch, identifying risks like injection, auth issues, and data exposure. Needs an `origin` remote; if the review fails with an `ambiguous argument` error, see the [error reference](</docs/en/errors#security-review-fails-without-origin-head>)
`/setup-bedrock`| Configure [Amazon Bedrock](</docs/en/amazon-bedrock>) authentication, region, and model pins through an interactive wizard. Only visible when `CLAUDE_CODE_USE_BEDROCK=1` is set. First-time Amazon Bedrock users can also access this wizard from the login screen
`/setup-vertex`| Configure [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) authentication, project, region, and model pins through an interactive wizard. Only visible when `CLAUDE_CODE_USE_VERTEX=1` is set. First-time Google Cloud’s Agent Platform users can also access this wizard from the login screen
`/simplify [target]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the changed code for cleanup opportunities and apply the fixes. Four review [agents](</docs/en/sub-agents>) run in parallel, covering reuse of existing helpers, simplification, efficiency, and whether the change is at the right level of abstraction. From v2.1.154, the review doesn’t look for correctness bugs. Use `/code-review` to find bugs. On earlier versions, `/simplify` is equivalent to `/code-review --fix`. Pass a path or PR reference to review a specific target
-`/skills`| List available [skills](</docs/en/skills>). As of v2.1.121, type to filter the list by name. Press `t` to sort by token count. Press `Space` to [cycle a skill’s visibility to Claude and the `/` menu](</docs/en/skills#override-skill-visibility-from-settings>), then `Enter` to save
+`/skills`| List available [skills](</docs/en/skills>). Type to filter the list by name. Press `t` to sort by token count. Press `Space` to [cycle a skill’s visibility to Claude and the `/` menu](</docs/en/skills#override-skill-visibility-from-settings>), then `Enter` to save
`/stats`| Alias for `/usage`. Opens on the Stats tab
`/status`| Open the Settings interface on the Status tab, showing version, model, account, and connectivity. A `Session kind` row reads `background job · attached` or `background job · unattended` in a [background session](</docs/en/agent-view>), depending on whether a terminal is attached, and `interactive` in any other session. Before v2.1.221, `/status` didn’t show this row. Works while Claude is responding
`/statusline`| Configure Claude Code’s [status line](</docs/en/statusline>). Describe what you want, or run without arguments to auto-configure from your shell prompt
--- a/common-workflows.md
+++ b/common-workflows.md
@@ -397,7 +397,7 @@
Option| Where it runs| Best for
---|---|---
-[Routines](</docs/en/routines>)| Anthropic-managed infrastructure| Tasks that should run even when your computer is off. Can also trigger on API calls or GitHub events in addition to a schedule. Configure at [claude.ai/code/routines](<https://claude.ai/code/routines>).
+[Routines](</docs/en/routines>)| Cloud, Anthropic-managed by default| Tasks that should run even when your computer is off. Can also trigger on API calls or GitHub events in addition to a schedule. Configure at [claude.ai/code/routines](<https://claude.ai/code/routines>).
[Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>)| Your machine, via the desktop app| Tasks that need direct access to local files, tools, or uncommitted changes.
[GitHub Actions](</docs/en/github-actions>)| Your CI pipeline| Tasks tied to repo events like opened PRs, or cron schedules that should live alongside your workflow config.
[`/loop`](</docs/en/scheduled-tasks>)| The current CLI session| Quick polling while a session is open. Tasks stop when you start a new conversation; `--resume` and `--continue` restore unexpired ones.
--- a/data-usage.md
+++ b/data-usage.md
@@ -158,7 +158,7 @@
`skipWebFetchPreflight: true` in [settings](</docs/en/settings>) to disable.| Default on.
`skipWebFetchPreflight: true` in [settings](</docs/en/settings>) to disable.
-All environment variables can be checked into `settings.json` (see [settings reference](</docs/en/settings>)). As of v2.1.126, when a host platform sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`, metrics default to on for Google Cloud’s Agent Platform, Amazon Bedrock, and Microsoft Foundry, and follow the standard `DISABLE_TELEMETRY` opt-out. Error reporting and `/feedback` reports remain off by default on those providers.
+All environment variables can be checked into `settings.json` (see [settings reference](</docs/en/settings>)). When a host platform sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`, metrics default to on for Google Cloud’s Agent Platform, Amazon Bedrock, and Microsoft Foundry, and follow the standard `DISABLE_TELEMETRY` opt-out. Error reporting and `/feedback` reports remain off by default on those providers.
###
--- a/debug-your-config.md
+++ b/debug-your-config.md
@@ -41,7 +41,7 @@
* Project-scoped servers in `.mcp.json` require a one-time approval. If the prompt was dismissed, the server stays disabled until you approve it from `/mcp`.
* A server that fails to start shows as failed in `/mcp`. Relative file paths in `command` or `args` are a frequent cause, since they resolve against the directory you launched Claude Code from rather than the location of `.mcp.json`.
- * A server that shows as connected but lists zero tools has started successfully but isn’t returning a tool list. Select **Reconnect** from `/mcp`. If the count stays at zero, run `claude --debug mcp` to see the server’s stderr output.
+ * A server that shows as connected but lists zero tools has started successfully but isn’t returning a tool list. Select **Reconnect** from `/mcp`. If the count stays at zero, run `claude --debug=mcp` and read the server’s stderr in the debug log at `~/.claude/debug/<session-id>.txt`.
For configuration locations and scope rules, see [MCP](</docs/en/mcp>).
@@ -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/settings#settings-files>), only the invalid entry is stripped and the file’s other hooks still apply.
-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 hooks` 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.
+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.
##
@@ -115,7 +115,7 @@
* **[`.claude` directory reference](</docs/en/claude-directory>)**: every config file location and what reads it
* **[Settings](</docs/en/settings>)** : precedence order and the full key list
- * **[Hooks reference](</docs/en/hooks>)** : event names, payloads, and `--debug hooks` output format
+ * **[Hooks reference](</docs/en/hooks>)** : event names, payloads, and `--debug` output format
* **[MCP](</docs/en/mcp>)** : server configuration, approval, and `/mcp` output
* **[Troubleshoot installation and login](</docs/en/troubleshoot-install>)** : `command not found`, PATH, and authentication problems
* **[Troubleshooting](</docs/en/troubleshooting>)** : performance, hangs, and search issues
--- a/desktop.md
+++ b/desktop.md
@@ -34,7 +34,7 @@
Before you send your first message, configure four things in the prompt area:
- * **Environment** : choose where Claude runs. Select **Local** for your machine, **Cloud** for Anthropic-hosted cloud sessions, an **SSH connection** for a remote machine you manage, or on Windows a [**WSL distribution**](</docs/en/desktop-wsl>). See environment configuration.
+ * **Environment** : choose where Claude runs. Select **Local** for your machine, **Cloud** for cloud sessions, an **SSH connection** for a remote machine you manage, or on Windows a [**WSL distribution**](</docs/en/desktop-wsl>). See environment configuration.
* **Project folder** : select the folder or repository Claude works in. For cloud sessions, you can add multiple repositories.
* **Model** : pick a [model](</docs/en/model-config#available-models>) from the dropdown next to the send button. You can change this during the session.
* **Permission mode** : choose how much autonomy Claude has from the mode selector. You can change this during the session.
@@ -88,7 +88,7 @@
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.
-Cloud sessions support Accept edits, Plan, and Auto. Accept edits corresponds to `default` mode: cloud sessions pre-approve file edits, so the selector shows Accept edits instead of Manual. Bypass permissions is not available because cloud sessions already run in a sandboxed VM. Enterprise admins can restrict which permission modes are available. See enterprise configuration for details.
+Cloud sessions support Accept edits, Plan, and Auto. Accept edits corresponds to `default` mode: cloud sessions pre-approve file edits, so the selector shows Accept edits instead of Manual. Bypass permissions is not available in cloud sessions. Enterprise admins can restrict which permission modes are available. See enterprise configuration for details.
###
@@ -368,7 +368,7 @@
Session isolation requires [Git](<https://git-scm.com/downloads>). Most Macs include Git by default. Run `git --version` in Terminal to check; if it prints a version number, Git is installed. On Windows, Git is required for the Code tab to work: [download Git for Windows](<https://git-scm.com/downloads/win>), install it, and restart the app. If you run into Git errors, ask Claude in the [Cowork tab](<https://claude.com/product/cowork>) to help troubleshoot your setup.
-Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. For a session on a local environment, Claude Code applies the rename to the session’s underlying CLI name too, so the new name appears in the `claude agents` listing on that machine; the shared rename requires Claude Code v2.1.221 or later. To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session.
+Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session.
###
@@ -406,7 +406,7 @@
Run long-running tasks remotely
-For large refactors, test suites, migrations, or other long-running tasks, select **Cloud** instead of **Local** when starting a session. Cloud sessions run on Anthropic’s cloud infrastructure and continue even if you close the app or shut down your computer. Check back anytime to see progress or steer Claude in a different direction. You can also monitor cloud sessions from [claude.ai/code](<https://claude.ai/code>) or the [Claude mobile app](</docs/en/mobile>). Cloud sessions also support multiple repositories. After selecting a cloud environment, click the **+** button next to the repo pill to add additional repositories to the session. Each repo gets its own branch selector. This is useful for tasks that span multiple codebases, such as updating a shared library and its consumers. See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for more on how cloud sessions work.
+For large refactors, test suites, migrations, or other long-running tasks, select **Cloud** instead of **Local** when starting a session. Cloud sessions run on Anthropic-managed infrastructure by default and continue even if you close the app or shut down your computer. Check back anytime to see progress or steer Claude in a different direction. You can also monitor cloud sessions from [claude.ai/code](<https://claude.ai/code>) or the [Claude mobile app](</docs/en/mobile>). Cloud sessions also support multiple repositories. After selecting a cloud environment, click the **+** button next to the repo pill to add additional repositories to the session. Each repo gets its own branch selector. This is useful for tasks that span multiple codebases, such as updating a shared library and its consumers. See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for more on how cloud sessions work.
###
@@ -650,7 +650,7 @@
The environment you pick when starting a session determines where Claude executes and how you connect:
* **Local** : runs on your machine with direct access to your files
- * **Cloud** : runs on Anthropic’s cloud infrastructure. Sessions continue even if you close the app.
+ * **Cloud** : runs on Anthropic-managed infrastructure by default. Sessions continue even if you close the app.
* **SSH** : runs on a remote machine you connect to over SSH, such as your own servers, cloud VMs, or dev containers
* **WSL** (Windows): runs inside a [WSL 2 distribution](</docs/en/desktop-wsl>) on your machine, using its Linux toolchain and native paths
@@ -766,7 +766,7 @@
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>).
* **Local sessions on this machine** : a managed settings file deployed to disk applies. Managed settings pushed remotely through the admin console also reach these sessions on Anthropic’s API when the session authenticates with an organization login or a directly configured API key, following the same [settings precedence](</docs/en/settings#settings-precedence>) as the terminal CLI.
- * **Cloud sessions** : run on Anthropic-managed VMs and receive [server-managed settings](</docs/en/server-managed-settings>) only.
+ * **Cloud sessions** : receive [server-managed settings](</docs/en/server-managed-settings>); device-deployed files don’t reach them, because they run on Anthropic-managed VMs. Sessions routed to a [self-hosted environment](</docs/en/self-hosted-environments>) fall back to the managed settings file in the runner image when server-managed settings deliver no keys, per [settings precedence](</docs/en/server-managed-settings#settings-precedence>).
* **SSH sessions** : the session reads the managed settings file from the remote host. Desktop itself reads `sshConfigs` and `sshHostAllowlist` from the local machine’s managed settings when creating the connection.
`permissions.disableBypassPermissionsMode` and `disableAutoMode` also work in user and project settings, but placing them in managed settings prevents users from overriding them. Claude Code reads `autoMode` from user settings, the `--settings` flag, and managed settings, but not from `.claude/settings.json` or `.claude/settings.local.json`: both files live in the repo directory, so a cloned repo or build step can’t inject its own classifier rules. Before v2.1.207, Claude Code also read `.claude/settings.local.json`. For the complete list of managed-only settings including `allowManagedPermissionRulesOnly` and `allowManagedHooksOnly`, see [managed-only settings](</docs/en/permissions#managed-only-settings>).
@@ -835,7 +835,7 @@
Data handling
-Claude Code processes your code locally in local sessions or on Anthropic’s cloud infrastructure in cloud sessions. Conversations and code context are sent to Anthropic’s API for processing. See [data handling](</docs/en/data-usage>) for details on data retention, privacy, and compliance.
+Claude Code processes your code locally in local sessions, or in cloud sessions on Anthropic-managed infrastructure, unless your organization routes them to a [self-hosted environment](</docs/en/self-hosted-environments>). Conversations and code context are sent to Anthropic’s API for processing. See [data handling](</docs/en/data-usage>) for details on data retention, privacy, and compliance.
###
--- a/desktop-linux.md
+++ b/desktop-linux.md
@@ -63,11 +63,11 @@
curl -fLO "https://downloads.claude.ai/claude-desktop/apt/stable/$(curl -s "https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-$(dpkg --print-architecture)/Packages" | grep '^Filename: pool/main/c/claude-desktop/claude-desktop_' | sort -V | tail -n 1 | cut -d' ' -f2)"
-If the command fails with `Remote file name has no length`, the lookup returned no package path. This can mean the repository index couldn’t be fetched, for example when your network blocks `downloads.claude.ai`, or that no package exists for your architecture. Confirm that your network can reach `downloads.claude.ai` and that `dpkg --print-architecture` prints `amd64` or `arm64`; the repository doesn’t publish packages for other architectures. Then open the downloaded file with your software installer, such as GNOME Software, or install it with apt from the directory that contains the downloaded file:
+If the command fails with `Remote file name has no length`, the lookup returned no package path. This can mean the repository index couldn’t be fetched, for example when your network blocks `downloads.claude.ai`, or that no package exists for your architecture. Confirm that your network can reach `downloads.claude.ai` and that `dpkg --print-architecture` prints `amd64` or `arm64`; the repository doesn’t publish packages for other architectures. To install without registering Anthropic’s apt repository, first create `/etc/default/claude-desktop` with the line `CLAUDE_DESKTOP_ADD_REPO="false"`. Without the repository, apt doesn’t deliver new versions; to update, re-run the download command and reinstall, or register the repository later. Then open the downloaded file with your software installer, such as GNOME Software, or install it with apt from the directory that contains the downloaded file:
sudo apt install ./claude-desktop_*.deb
-If apt reports `E: Unsupported file ./claude-desktop_*.deb given on commandline`, the pattern didn’t match a `.deb` file in the current directory. Confirm the download completed, then run the command again from the directory that contains the file. A `.deb` installed this way doesn’t receive updates. To get updates through apt, register the repository from the Add Anthropic’s apt repository step. The package also writes a commented-out repository entry to `/etc/apt/sources.list.d/claude-desktop.list`; uncommenting its `deb` line is equivalent.
+If apt reports `E: Unsupported file ./claude-desktop_*.deb given on commandline`, the pattern didn’t match a `.deb` file in the current directory. Confirm the download completed, then run the command again from the directory that contains the file. Installing the `.deb` also registers Anthropic’s apt repository at `/etc/apt/sources.list.d/claude-desktop.list`, so future updates arrive with your system’s regular package updates.
##
@@ -89,7 +89,7 @@
sudo apt remove claude-desktop
-This removes the signing key along with the app, so if you added the repository entry during install, remove it too:
+Uninstalling the package also removes the repository entry and signing key it registered. If you added the repository entry yourself with the Add Anthropic’s apt repository step, remove it too:
sudo rm /etc/apt/sources.list.d/claude-desktop.list
--- a/desktop-quickstart.md
+++ b/desktop-quickstart.md
@@ -62,7 +62,7 @@
You can also select:
- * **Cloud** : Run sessions on Anthropic’s cloud infrastructure that continue even if you close the app. Cloud sessions use the same infrastructure as [Claude Code on the web](</docs/en/claude-code-on-the-web>).
+ * **Cloud** : Run sessions in the cloud that continue even if you close the app. Cloud sessions use the same infrastructure as [Claude Code on the web](</docs/en/claude-code-on-the-web>).
* **SSH** : Connect to a remote machine over SSH, such as your own servers, cloud VMs, or dev containers. Desktop installs Claude Code on the remote machine automatically the first time you connect.
* **WSL** (Windows): Run the session inside a [WSL 2 distribution](</docs/en/desktop-wsl>); Claude Code, tools, and git execute on the Linux side with native paths.
--- a/desktop-scheduled-tasks.md
+++ b/desktop-scheduled-tasks.md
@@ -1,4 +1,4 @@
-Scheduled tasks start a new session automatically at a time and frequency you choose. Use them for recurring work like daily code reviews, dependency update checks, or morning briefings that pull from your calendar and inbox. The Desktop app’s **Routines** page lets you create both local scheduled tasks and remote [routines](</docs/en/routines>). A local task runs on your machine with direct access to your files and tools, but only fires while the app is open and your computer is awake. A remote routine runs on Anthropic-managed cloud infrastructure even when your computer is off, and can also fire on API calls or GitHub events. This page covers local scheduled tasks; for remote routines and their trigger options, see [Routines](</docs/en/routines>).
+Scheduled tasks start a new session automatically at a time and frequency you choose. Use them for recurring work like daily code reviews, dependency update checks, or morning briefings that pull from your calendar and inbox. The Desktop app’s **Routines** page lets you create both local scheduled tasks and remote [routines](</docs/en/routines>). A local task runs on your machine with direct access to your files and tools, but only fires while the app is open and your computer is awake. A remote routine runs in the cloud even when your computer is off, and can also fire on API calls or GitHub events. This page covers local scheduled tasks; for remote routines and their trigger options, see [Routines](</docs/en/routines>).
##
@@ -10,7 +10,7 @@
| [Cloud](</docs/en/routines>)| [Desktop](</docs/en/desktop-scheduled-tasks>)| [`/loop`](</docs/en/scheduled-tasks>)
---|---|---|---
-Runs on| Anthropic cloud| Your machine| Your machine
+Runs on| Cloud, Anthropic-managed by default| Your machine| Your machine
Requires machine on| No| Yes| Yes
Requires open session| No| No| Yes
Persistent across restarts| Yes| Yes| Restored on `--resume` if unexpired
@@ -104,7 +104,7 @@
Related resources
- * [Routines](</docs/en/routines>): run tasks on Anthropic-managed infrastructure on a schedule, via API call, or in response to GitHub events, even when your computer is off
+ * [Routines](</docs/en/routines>): run tasks in the cloud on a schedule, via API call, or in response to GitHub events, even when your computer is off
* [Run prompts on a schedule](</docs/en/scheduled-tasks>): session-scoped scheduling with `/loop` in the CLI
* [Claude Code GitHub Actions](</docs/en/github-actions>): run Claude on a schedule in CI instead of on your machine
* [Use Claude Code Desktop](</docs/en/desktop>): the full Desktop app guide
--- a/discover-plugins.md
+++ b/discover-plugins.md
@@ -19,8 +19,6 @@
Install individual plugins
Browse the catalog and install the plugins you want.
-
-Think of it like adding an app store: adding the store gives you access to browse its collection, but you still choose which apps to download individually.
##
@@ -180,9 +178,9 @@
Select a plugin to view its details. The details pane shows what the plugin contains and what it costs:
- * A **Context cost** estimate so you can see how many tokens the plugin will add to your [context window](</docs/en/features-overview#understand-context-costs>) every turn (Claude Code v2.1.143 and later)
- * The plugin’s **Last updated** date (v2.1.144 and later)
- * A **Will install** section listing the plugin’s commands, agents, skills, hooks, and MCP and LSP servers, so you can review exactly what it adds before installing (v2.1.145 and later)
+ * A **Context cost** estimate so you can see how many tokens the plugin will add to your [context window](</docs/en/features-overview#understand-context-costs>) every turn
+ * The plugin’s **Last updated** date
+ * A **Will install** section listing the plugin’s commands, agents, skills, hooks, and MCP and LSP servers, so you can review exactly what it adds before installing
Not every plugin provides the data behind these fields. For plugins from local or custom marketplaces, you may not see the **Context cost** and **Last updated** rows, and the **Will install** section may show **Components will be discovered at installation** instead.Choose an installation scope:
@@ -205,8 +203,6 @@
/commit-commands:commit
This stages your changes, generates a commit message, and creates the commit.Each plugin works differently. Check the plugin’s details in the **Discover** tab to see the commands and skills it provides, or visit its homepage for usage guidance.
-
-The rest of this guide covers all the ways you can add marketplaces, install plugins, and manage your configuration.
##
@@ -320,12 +316,12 @@
* type to filter by plugin name or description
* press Enter to open a plugin’s detail view and enable, disable, or uninstall it
-Uninstalling a plugin that a project’s `.claude/settings.json` enables asks which scope you mean: disable it for you alone, which writes an override to your `.claude/settings.local.json` and leaves the plugin installed for the project, or uninstall it for everyone, which removes it from the shared `.claude/settings.json`. Requires Claude Code v2.1.203 or later. Before v2.1.203, the dialog offered only the local disable. The detail view shows the components the plugin contributes: commands, skills, agents, hooks, MCP servers, and LSP servers. The same inventory is available from the command line with `claude plugin details`. The **Installed** tab also collects marketplace plugins you installed yourself but haven’t used in at least two weeks, over a span of at least 10 sessions, under a **Not used recently** header. The detail view shows a **Last used** line for each plugin. Use these to find plugins that still add startup and context cost even though you no longer use them, then disable or uninstall them. Requires Claude Code v2.1.187 or later. Two kinds of plugins are never listed as unused:
+When you uninstall a plugin that a project’s `.claude/settings.json` enables, Claude Code asks which scope you mean: disable it for you alone, which writes an override to your `.claude/settings.local.json` and leaves the plugin installed for the project, or uninstall it for everyone, which removes it from the shared `.claude/settings.json`. The detail view shows the components the plugin contributes: commands, skills, agents, hooks, MCP servers, and LSP servers. The same inventory is available from the command line with `claude plugin details`. Claude Code also lists marketplace plugins you installed yourself but haven’t used in at least two weeks, over a span of at least 10 sessions, under a **Not used recently** header in the **Installed** tab. The detail view shows a **Last used** line for each plugin. Use these to find plugins that still add startup and context cost even though you no longer use them, then disable or uninstall them. Two kinds of plugins are never listed as unused:
* plugins that your organization manages or that you load with `--plugin-dir`
* plugins that contribute a theme, output style, monitor, or workflow, since those deliver value without an invocation to track
-The **Not used recently** header and the **Last used** line are both hidden when your organization restricts marketplaces with [`strictKnownMarketplaces`](</docs/en/settings#strictknownmarketplaces>). A plugin’s [language server](</docs/en/plugins#add-lsp-servers-to-your-plugin>) counts as used when it delivers diagnostics or answers a code navigation request, so an LSP plugin whose server is active in your sessions isn’t listed as unused. Before v2.1.203, language server activity couldn’t be counted as use, so plugins that contribute an LSP server were exempt from the group entirely, the same way theme and output style plugins still are. The first session on a version that counts language server activity also resets the usage record of each LSP plugin that hadn’t recorded any use yet, so Claude Code doesn’t judge a plugin you installed earlier as unused based on data recorded before its server activity was tracked. Before v2.1.206, that first session could list an actively used LSP plugin under **Not used recently** and suggest reviewing it. When you install a plugin that declares dependencies, the install output lists which dependencies were auto-installed alongside it. You can also manage plugins with direct commands:
+The **Not used recently** header and the **Last used** line are both hidden when your organization restricts marketplaces with [`strictKnownMarketplaces`](</docs/en/settings#strictknownmarketplaces>). A plugin’s [language server](</docs/en/plugins#add-lsp-servers-to-your-plugin>) counts as used when it delivers diagnostics or answers a code navigation request, so an LSP plugin whose server is active in your sessions isn’t listed as unused. Before v2.1.203, language server activity couldn’t be counted as use, so plugins that contribute an LSP server were exempt from the group entirely, the same way theme and output style plugins still are. The first session on a version that counts language server activity also resets the usage record of each LSP plugin that hadn’t recorded any use yet, so Claude Code doesn’t judge a plugin you installed earlier as unused based on data recorded before its server activity was tracked. When you install a plugin that declares dependencies, the install output lists which dependencies were auto-installed alongside it. You can also manage plugins with direct commands:
* When you run `/plugin disable`, `/plugin enable`, or `/plugin uninstall`, Claude Code opens the plugin panel to apply the change and leaves it open. Press **Esc** to close the panel before typing another command.
* For scripting, use the `claude plugin` shell commands instead, which don’t open the panel.
@@ -480,12 +476,7 @@
Common issues
- * **Marketplace not loading** : verify the URL is accessible and that `.claude-plugin/marketplace.json` exists at the path
- * **Plugin installation failures** : check that plugin source URLs are accessible and that repositories are public, or that you have access to them
- * **Files not found after installation** : plugins are copied to a cache, so paths referencing files outside the plugin directory won’t work
- * **Plugin skills not appearing** : clear the cache with `rm -rf ~/.claude/plugins/cache`, restart Claude Code, and reinstall the plugin.
-
-For detailed troubleshooting with solutions, see [Troubleshooting](</docs/en/plugin-marketplaces#troubleshooting>) in the marketplace guide. For debugging tools, see [Debugging and development tools](</docs/en/plugins-reference#debugging-and-development-tools>).
+If plugin skills don’t appear, clear the cache with `rm -rf ~/.claude/plugins/cache`, restart Claude Code, and reinstall the plugin. For detailed troubleshooting with solutions, see [Troubleshooting](</docs/en/plugin-marketplaces#troubleshooting>) in the marketplace guide. For debugging tools, see [Debugging and development tools](</docs/en/plugins-reference#debugging-and-development-tools>).
###
--- a/env-vars.md
+++ b/env-vars.md
@@ -192,7 +192,8 @@
`CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt`
`CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise
`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements
-`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning
+`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning
+`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#settings-precedence>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later
`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors
`CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting
`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering
@@ -257,7 +258,7 @@
`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name
`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers
`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead
-`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later
+`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply
`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later
`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources
`CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap
@@ -416,7 +417,7 @@
`VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Google Cloud’s Agent Platform
`VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Google Cloud’s Agent Platform
`VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform
-`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform. Added in v2.1.111
+`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform
`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform. Added in v2.1.154
`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
Show diff (146 lines)
--- a/errors.md
+++ b/errors.md
@@ -17,6 +17,7 @@
`Request timed out`| Server errors, or Network if the message mentions your internet connection
`Server error mid-response. The response above may be incomplete.`| Server errors
`Connection closed mid-response` / `Response stalled mid-stream`| Server errors
+`Connection closed while thinking` / `Response stalled while thinking`| Automatic retries
`<model> is temporarily unavailable, so auto mode cannot determine the safety of...`| Server errors
`Auto mode could not evaluate this action and is blocking it for safety`| Server errors
`Auto mode classifier transcript exceeded context window`| Server errors
@@ -92,6 +93,7 @@
`references ${user_config.*} in a shell-form command`| Plugin errors
`Monitor "<name>" from plugin <plugin> references ${user_config.*} in its command`| Plugin errors
`headersHelper for MCP server '<name>' references ${user_config.*}`| Plugin errors
+`Plugin archive integrity check failed`| Plugin errors
`would be spawned with zero tools — refusing`| Tool errors
`File is covered by a Read deny rule in your permission settings`| Tool errors
`Error: this write left the memory index at MEMORY.md at ..., over its ... read limit`| Tool errors
@@ -114,17 +116,17 @@
Automatic retries
-Claude Code retries transient failures up to 10 times with exponential backoff before showing you an error. It doesn’t always retry a failure that arrives partway through Claude’s response. When you see one of the errors on this page, Claude Code has already exhausted those retries, unless the failure is one it doesn’t retry. Claude Code retries these failures:
-
- * Server errors, overloaded responses, and request timeouts.
- * Dropped connections. This covers a connection that drops in the middle of a request, before Claude has started a block of text or a tool call in its response: Claude Code re-issues the request with the same backoff, and the turn continues. Before v2.1.198, Claude Code stopped the turn with a connection error when the connection dropped mid-response, before any visible output had streamed.
- * A stalled response stream while the response is still in progress, before Claude has started a block of text or a tool call: Claude Code aborts the stalled connection and re-issues the request at most once, outside the 10-attempt budget above.
+Claude Code retries transient failures up to 10 times with exponential backoff before showing you an error. It doesn’t always retry a failure that arrives partway through Claude’s response. When you see one of the errors on this page, Claude Code has already made whatever retries apply to that failure; the lists below say which failures get the full budget, which get a smaller one, and which get none. Claude Code retries these failures:
+
+ * Server errors, overloaded responses, and request timeouts that arrive before any of Claude’s response has streamed.
+ * Dropped connections. When a connection drops partway through a request before Claude has completed any part of its response, including its thinking, Claude Code re-issues the request with the same backoff and the turn continues, even if some text had already started streaming. When it drops after Claude has finished thinking but before it has started any text or tool call, Claude Code instead re-issues the request up to two times in quick succession, and ends the turn with `Connection closed while thinking, before producing a response` if the connection keeps dropping at that point.
+ * A stalled response stream, when none of the response has arrived yet or when Claude has finished thinking but hasn’t started any text or tool call: Claude Code aborts the stalled connection and re-issues the request at most once, outside the 10-attempt budget above. If the response stalls a second time after Claude has finished thinking but before any text or tool call, Claude Code ends the turn with `Response stalled while thinking, before producing a response`.
* Temporary 429 throttles. When you’re signed in with a claude.ai subscription, this includes 429 throttles that don’t carry your plan’s quota headers. Before v2.1.199, Claude Code retried those throttles only for API key and Enterprise sign-ins.
Claude Code doesn’t retry these failures:
* A TLS certificate validation failure, such as a TLS-inspecting proxy, a missing `NODE_EXTRA_CA_CERTS` bundle, or an expired certificate. Claude Code reports the error on the first attempt, so you can fix the certificate setup right away; see SSL certificate errors. Claude Code still retries transient TLS conditions such as a handshake timeout. Before v2.1.199, Claude Code retried certificate failures through the full retry budget before showing the error.
- * A server error, dropped connection, or stalled stream that arrives after Claude has started a block of text or a tool call in its response, but before it finishes the response. Claude Code could execute the same tool calls twice if it re-ran the request, so it keeps what Claude completed and shows an incomplete-response notice. Claude Code still runs any tool calls Claude completed and continues the turn from their results. Before v2.1.199, Claude Code discarded the partial output and reported the whole turn as an error when a server error arrived mid-stream.
+ * A server error, dropped connection, or stalled stream that arrives after Claude has completed a block of text or a tool call, or has started one after finishing its thinking, but before it finishes the response. Claude Code could execute the same tool calls twice if it re-ran the request, so it keeps what Claude completed and shows an incomplete-response notice. Claude Code still runs any tool calls Claude completed and continues the turn from their results. Before v2.1.199, Claude Code discarded the partial output and reported the whole turn as an error when a server error arrived mid-stream.
* A failure that arrives after Claude has finished the response: nothing needs retrying, so Claude Code keeps the complete response and ends the turn normally.
* An Amazon Bedrock streaming response with an unexpected content-type, because the gateway or proxy rewriting the response would rewrite the retry the same way. Requires Claude Code v2.1.208 or later.
@@ -213,7 +215,7 @@
The response above may be incomplete
-A streaming request failed after Claude had started a block of text or a tool call, while the response was still in progress. Re-sending the request could run the same tool calls twice, so Claude Code keeps the output Claude completed and appends this notice instead of discarding the turn. Which variant you see names the cause:
+A streaming request failed while the response was still in progress, after Claude had completed a block of text or a tool call, or had started one after finishing its thinking. Re-sending the request could run the same tool calls twice, so Claude Code keeps the output Claude completed and appends this notice instead of discarding the turn. Which variant you see names the cause:
API Error: Server error mid-response. The response above may be incomplete.
API Error: Connection closed mid-response. The response above may be incomplete.
@@ -223,9 +225,9 @@
* `Connection closed mid-response`: the connection dropped.
* `Response stalled mid-stream`: the stream stopped sending data. Before v2.1.222, this variant could also appear on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL` while the server’s keep-alive pings were still arriving, because Claude Code counted only parsed response events there; upgrading stops those spurious timeouts on those routes. Gateways reached through a provider base URL such as `ANTHROPIC_BEDROCK_BASE_URL` aren’t wrapped by the byte watchdog; see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>).
-Claude Code shows this notice only when the failure lands after Claude has started a block of text or a tool call and before the response finishes:
-
- * While the response is in progress, before Claude has started a block of text or a tool call, Claude Code either retries the failure or ends the turn with a different error. See Automatic retries.
+When one of these failures lands at another point in the turn, Claude Code handles it without this notice:
+
+ * Earlier in the response, Claude Code either retries the failure or ends the turn with a different error. See Automatic retries.
* When one of these failures arrives after Claude has finished the response, Claude Code keeps the complete response and ends the turn normally, without this notice. Before v2.1.222, Claude Code showed the `Connection closed mid-response` or `Response stalled mid-stream` notice when the connection dropped or stalled after the response finished, and reported the turn as an error even though the response was complete.
**What to do:**
@@ -465,7 +467,7 @@
**What to do:**
* Check for typos and confirm the key has not been revoked in the [Console](<https://platform.claude.com/settings/keys>)
- * Run `env | grep ANTHROPIC` in the same shell. Tools like direnv, dotenv shell plugins, and IDE terminals can load a stale key from a `.env` file in your project without you setting it explicitly.
+ * In the same shell, run `env | grep ANTHROPIC`, or in PowerShell `Get-ChildItem Env:ANTHROPIC*`. Tools like direnv, dotenv shell plugins, and IDE terminals can load a stale key from a `.env` file in your project without you setting it explicitly.
* Unset `ANTHROPIC_API_KEY` and run `/login` to use subscription auth instead
* If the key comes from an [`apiKeyHelper`](</docs/en/settings#available-settings>) script, run the script directly to confirm it prints a valid key on stdout
* Run `/status` to confirm which credential source Claude Code is actually using
@@ -604,7 +606,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 run `unset ANTHROPIC_API_KEY` to fall back to your subscription.
+ * 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 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.
@@ -770,10 +772,11 @@
Socket is closed
-`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Claude Code either retries the request or keeps the response Claude produced:
-
- * If the response is still in progress and Claude hasn’t started any block of text or a tool call, Claude Code treats the failure as a dropped connection and retries the request automatically, so the turn continues.
- * If Claude has started a block of text or a tool call but hasn’t finished the response, Claude Code keeps what Claude completed and shows an incomplete-response notice. It still runs any tool calls Claude completed and continues the turn from their results.
+`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Depending on how far the response had progressed, Claude Code retries the request, keeps what Claude produced, or ends the turn:
+
+ * If Claude hasn’t completed any part of the response yet, including its thinking, Claude Code treats the failure as a dropped connection and retries the request automatically, so the turn continues, even if some text had started streaming.
+ * If Claude has finished thinking but hasn’t started any text or tool call, Claude Code re-issues the request up to two times in quick succession, then ends the turn with `Connection closed while thinking, before producing a response` if the connection keeps dropping at that point.
+ * If Claude has completed a block of text or a tool call, or has started one after finishing its thinking, but hasn’t finished the response, Claude Code keeps what Claude completed and shows an incomplete-response notice. It still runs any tool calls Claude completed and continues the turn from their results.
* If the socket closes after Claude has finished the response, Claude Code ends the turn normally with the complete response.
Before v2.1.214, Claude Code didn’t retry this failure, and the turn stopped with an error containing `Socket is closed`. **What to do:**
@@ -1319,8 +1322,8 @@
The quoted command varies between runs: the review starts several `git` commands against `origin/HEAD` at once and reports whichever fails first, so you may see `git log` or a different `git diff` in its place. Git creates the ref only when the remote’s default branch is both advertised by the remote and covered by your fetch refspec. A full `git clone` of a remote with commits meets both conditions. Single-branch and CI checkouts fetch too narrow a refspec, a server-side HEAD left pointing at a branch nobody pushed advertises no default, and a repository with no `origin` remote, or one you never fetched, provides neither. **What to do:**
- * Create the ref by naming your remote’s default branch: `git remote set-head origin <default-branch>`. This works whenever the local tracking ref `origin/<default-branch>` exists. If it doesn’t, as in single-branch clones, fetch the branch first: `git remote set-branches --add origin <branch> && git fetch origin`, then rerun the set-head command. Rerun `/security-review`.
- * If you’d rather not name the branch, run `git fetch origin && git remote set-head origin --auto`, which asks the remote which branch is its default. It fails with `error: Cannot determine remote HEAD` when the remote advertises no default branch, because it is empty or its HEAD points at a branch nobody pushed; name the branch explicitly instead. It fails with `error: Not a valid ref` when your clone doesn’t fetch that branch; widen the refspec as above first.
+ * Create the ref by naming your remote’s default branch: `git remote set-head origin <default-branch>`. This works whenever the local tracking ref `origin/<default-branch>` exists. If it doesn’t, as in single-branch clones, fetch the branch first: run `git remote set-branches --add origin <branch>`, then `git fetch origin`, then rerun the set-head command. Rerun `/security-review`.
+ * If you’d rather not name the branch, run `git fetch origin` and then `git remote set-head origin --auto`, which asks the remote which branch is its default. It fails with `error: Cannot determine remote HEAD` when the remote advertises no default branch, because it is empty or its HEAD points at a branch nobody pushed; name the branch explicitly instead. It fails with `error: Not a valid ref` when your clone doesn’t fetch that branch; widen the refspec as above first.
* If the repository has no remote, add one with `git remote add origin <url>` and fetch before creating the ref. If the remote is empty, push your branch first with `git push -u origin HEAD` and name that branch in the set-head command; `origin/HEAD` then points at the branch you just pushed, so `/security-review` sees an empty diff until the branch diverges from it.
###
@@ -1451,6 +1454,26 @@
* For a hook, add an `args` array so it runs in [exec form](</docs/en/hooks#exec-form-and-shell-form>), where each `${user_config.KEY}` becomes one argument with no shell in between. Or drop the reference and read the `$CLAUDE_PLUGIN_OPTION_<KEY>` environment variable inside the script
* For a monitor, drop the reference and have the monitor script read the value from a config file
* For a `headersHelper`, move `${user_config.KEY}` into the server’s `headers` field, which isn’t shell-parsed, or read the value inside the helper script
+
+###
+
+
+
+Plugin archive integrity check failed
+
+The plugin’s marketplace entry uses an [`archive` source](</docs/en/plugin-marketplaces#zip-archives>) with a `sha256` pin, and the digest of the downloaded file doesn’t match the pin. Claude Code refuses the install, so nothing changes in the plugin cache. The mismatch has three possible causes:
+
+ * The file at the URL changed after the author computed the pin
+ * The author entered the wrong digest in the marketplace entry
+ * The URL serves a different file than the author pinned
+
+ Plugin archive integrity check failed for https://artifacts.example.com/claude-plugins/my-plugin.zip: expected sha256 6bfa50e3d2e00c052b46abe51fff89346ac803e45771f76dcf6df1ab74cca5e1, got ac52220c0914ef8ca6a602e4a7362f88d30fb021110f72a6d15b68c3fe7df2b7. The archive was not installed. Verify the sha256 in the marketplace entry, or that the URL serves the intended file.
+
+**What to do:**
+
+ * If you publish the plugin, recompute the digest of the exact file the URL serves, for example with `shasum -a 256 my-plugin.zip`, or `Get-FileHash -Algorithm SHA256 my-plugin.zip` in PowerShell, and update the `sha256` in the marketplace entry
+ * If you install the plugin, run `/plugin marketplace update <name>` to refresh the catalog in case the entry was corrected, then retry the install
+ * If the digests still disagree after a refresh, ask the marketplace owner which file they pinned before installing
##
@@ -1666,8 +1689,7 @@
**What to do:**
- * Identify which files were skipped so you can handle each one with the steps below. The message gives only a count, so list your project’s links to find them: `find . -type l` for symlinks and `find . -type f -links +1` for hard-linked files.
- * If debug logging is on, the log at `~/.claude/debug/<session-id>.txt` names each skipped path as the restore runs. Turn it on with `/debug` before your next restore to skip the search.
+ * Identify which files were skipped so you can handle each one with the steps below. The message gives only a count; the debug log at `~/.claude/debug/<session-id>.txt` names each skipped path as the restore runs, so turn on debug logging with `/debug` before your next restore. On macOS or Linux, you can instead find the links directly: `find . -type l` for symlinks and `find . -type f -links +1` for hard-linked files.
* If a skipped file is a link you created on purpose, such as a config file managed by a dotfile manager or a file hard-linked by tools like pnpm, the rewind left its contents alone. To undo the session’s changes to it, ask Claude to reverse the edit or edit the file yourself
* If you didn’t create the link, inspect the path before trusting its contents: something replaced the file after the checkpoint
--- a/github-enterprise-server.md
+++ b/github-enterprise-server.md
@@ -39,7 +39,7 @@
Start the guided setup
-Click **Connect**. Enter a display name for the connection and your GHES hostname, for example `github.example.com`. If your GHES instance uses a self-signed or private certificate authority, paste the CA certificate in the optional field.
+Click **Connect**. Enter a display name of up to 20 characters for the connection and your GHES hostname, for example `github.example.com`. If your GHES instance uses a self-signed or private certificate authority, paste the CA certificate in the optional field.
3
@@ -65,7 +65,7 @@
GitHub App permissions
-The manifest configures the GitHub App with the permissions and webhook events Claude needs across web sessions, Code Review, Claude Security, and contribution metrics:
+The manifest configures the GitHub App with the permissions and webhook events below, which together cover web sessions, Code Review, Claude Security, plugin marketplaces, and contribution metrics:
Permission| Access| Used for
---|---|---
@@ -74,10 +74,12 @@
Issues| Read and write| Responding to issue mentions
Checks| Read and write| Posting Code Review check runs
Actions| Read| Reading CI status for auto-fix
-Repository hooks| Read and write| Receiving webhooks for contribution metrics
+Commit statuses| Read| Reading CI status from providers that report commit statuses instead of check runs
+Repository hooks| Read and write| Creating a webhook on a plugin marketplace repository when **Sync automatically** is turned on for a marketplace in [Organization settings > Plugins](<https://claude.ai/admin-settings/plugins>)
Metadata| Read| Required by GitHub for all apps
-
-The app subscribes to `pull_request`, `issue_comment`, `pull_request_review_comment`, `pull_request_review`, and `check_run` events.
+Organization members| Read| Matching the Claude GitHub App on github.com, which uses it to check a connecting user’s organization role when linking an installation
+
+The app subscribes to `pull_request`, `issue_comment`, `pull_request_review_comment`, `pull_request_review`, `check_run`, and `status` events. GitHub applies a manifest only when the app is created, so an app created from an earlier version of the manifest keeps the permissions and events it was created with. If your app is missing any of the permissions or events above, add them in the app’s settings on your GHES instance. GitHub then asks an owner of each installation to approve the new permissions, and the installation keeps its old permissions until they do.
###
@@ -85,7 +87,7 @@
Manual setup
-If the guided redirect flow is blocked by your network configuration, click **Add manually** instead of Connect. Create a GitHub App on your GHES instance with the permissions and events above, then enter the app credentials in the form: hostname, OAuth client ID and secret, GitHub App ID, client ID, client secret, webhook secret, and private key.
+If the guided redirect flow is blocked by your network configuration, click **Add manually** instead of Connect. Create a GitHub App on your GHES instance with the permissions and events above, then enter the connection details in the form: a display name, your GHES hostname and optional port, and the app’s ID, client ID, client secret, webhook secret, and private key. The form also accepts an optional custom CA certificate and read replica hostnames. Claude generates the app’s webhook URL when you save the connection. After you click **Add configuration** , open the connection’s **More options** menu, select **Copy webhook URL** , and paste the URL into the app’s webhook settings on your GHES instance. Use the same webhook secret you entered in the form.
###
@@ -93,7 +95,7 @@
Network requirements
-Your GHES instance must be reachable from Anthropic infrastructure so Claude can clone repositories and post review comments. If your GHES instance is behind a firewall, allowlist the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>).
+For Anthropic-hosted sessions, your GHES instance must be reachable from Anthropic infrastructure so Claude can clone repositories and post review comments. If your GHES instance is behind a firewall, allowlist the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>). Sessions in a [self-hosted environment](</docs/en/self-hosted-environments-deploy#configure-git>) clone from inside your network instead, unless the runner opts into the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), which fetches from Anthropic’s side and needs the same reachability; the [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) covers the hosted pre-session flows, such as the repository picker, for a GHES host that’s only routable internally.
##
@@ -110,7 +112,7 @@
claude --cloud "Add retry logic to the payment webhook handler"
-The session runs on Anthropic infrastructure, clones your repository from GHES, and pushes changes back to a branch. Monitor progress with `/tasks` or at [claude.ai/code](<https://claude.ai/code>). See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for the full cloud session workflow including diff review, auto-fix, and routines.
+The session clones your repository from GHES and pushes changes back to a branch. Monitor progress with `/tasks` or at [claude.ai/code](<https://claude.ai/code>). See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for the full cloud session workflow including diff review, auto-fix, and routines.
###
@@ -246,7 +248,7 @@
GHES instance not reachable
-If reviews or web sessions time out, your GHES instance may not be reachable from Anthropic infrastructure. Confirm your firewall allows inbound connections from the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>).
+If reviews or Anthropic-hosted web sessions time out, your GHES instance may not be reachable from Anthropic infrastructure. Confirm your firewall allows inbound connections from the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>). Sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) reach GHES from inside your network, so for them check the runner’s own network path and the [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) instead.
###
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -93,7 +93,7 @@
3\. Configure GCP credentials
-Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code v2.1.121 or later 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 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.
--- a/headless.md
+++ b/headless.md
@@ -10,7 +10,7 @@
Basic usage
-Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively. Not every [CLI option](</docs/en/cli-reference>) combines with `-p`. Claude Code rejects `--bg` and `--cloud` with an error naming the conflict. Options you’ll combine with `-p` often include:
+Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively. Not every [CLI option](</docs/en/cli-reference>) combines with `-p`. Claude Code rejects `--bg`, and rejects `--cloud` with a task description, with an error naming the conflict; `--cloud` with a session ID and `-p` instead [queues a message into that cloud session](</docs/en/claude-code-on-the-web#send-follow-ups-from-the-cli>) and exits. Options you’ll combine with `-p` often include:
* `--continue` for continuing conversations
* `--allowedTools` for auto-approving tools
@@ -72,7 +72,7 @@
With `--output-format json`, the response payload includes `total_cost_usd` and a per-model cost breakdown, so scripted callers can track spend per invocation without consulting the [usage dashboard](</docs/en/costs>).
-As of Claude Code v2.1.128, piped stdin is capped at 10MB. If you exceed the cap, Claude Code exits with a clear error and a non-zero status. To work with larger inputs, write the content to a file and reference the file path in your prompt instead of piping it.
+Piped stdin is capped at 10MB. If you exceed the cap, Claude Code exits with a clear error and a non-zero status. To work with larger inputs, write the content to a file and reference the file path in your prompt instead of piping it.
If Claude Code can’t read stdin, for example because the process that started it disconnected its end, Claude Code prints a warning to stderr and continues with the prompt from the command line. Before v2.1.211, an unreadable stdin on Windows crashed the session or made it exit silently with no output.
@@ -289,7 +289,7 @@
session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')
claude -p "Continue that review" --resume "$session_id"
-Run both commands from the same directory: session ID lookup is scoped to the current project directory and its git worktrees. See [Resume a session](</docs/en/sessions#resume-a-session>) for the full scope rules.
+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.
##
Show diff (191 lines)
--- a/hooks.md
+++ b/hooks.md
@@ -1,6 +1,6 @@
For a quickstart guide with examples, see [Automate actions with hooks](</docs/en/hooks-guide>).
-Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code’s lifecycle. Hooks run wherever Claude Code runs: sessions in the terminal, IDE extensions, the [Desktop app](</docs/en/desktop-quickstart>), and [Claude Code on the web](</docs/en/claude-code-on-the-web>) all fire the same hook events. Use this reference to look up event schemas, configuration options, JSON input/output formats, and advanced features like async hooks, HTTP hooks, and MCP tool hooks. If you’re setting up hooks for the first time, start with the [guide](</docs/en/hooks-guide>) instead.
+Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code’s lifecycle. Hooks run wherever Claude Code runs: sessions in the terminal, IDE extensions, the [Desktop app](</docs/en/desktop-quickstart>), and [Claude Code on the web](</docs/en/claude-code-on-the-web>) all fire the same hook events. Use this reference to look up event schemas, configuration options, JSON input/output formats, and advanced features like async hooks, HTTP hooks, and MCP tool hooks.
##
@@ -237,7 +237,7 @@
[Plugin](</docs/en/plugins>) `hooks/hooks.json`| When plugin is enabled| Yes, bundled with the plugin
[Skill](</docs/en/skills>) or [agent](</docs/en/sub-agents>) frontmatter| While the component is active| Yes, defined in the component file
-Cloud sessions on [Claude Code on the web](</docs/en/claude-code-on-the-web>) don’t read your local `~/.claude/settings.json`; hooks there come from the repo and from your organization’s server-managed settings. See [what carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) for which files reach a cloud session. For details on settings file resolution, see [settings](</docs/en/settings>). Hooks from settings files, managed policy settings, and plugins also run inside [subagents](</docs/en/sub-agents>). When a subagent calls a tool, tool events such as `PreToolUse` and `PostToolUse` fire the same configured hooks as in the main conversation, and the input carries the `agent_id` and `agent_type` common input fields that identify the subagent. Enterprise administrators can use `allowManagedHooksOnly` to block user, project, and plugin hooks. Hooks from plugins force-enabled in managed settings `enabledPlugins` are exempt, so administrators can distribute vetted hooks through an organization marketplace. See [Hook configuration](</docs/en/settings#hook-configuration>). Hook entries merge across settings levels rather than replacing each other: user, project, and local settings add their own hooks without removing managed ones, and the `disableAllHooks` setting can’t disable managed hooks from outside managed settings. The [HTTP hook allowlists](</docs/en/settings#hook-configuration>) apply to hooks from every source, including managed policy settings:
+Cloud sessions on [Claude Code on the web](</docs/en/claude-code-on-the-web>) don’t read your local `~/.claude/settings.json`; hooks there come from the repo and from your organization’s server-managed settings. See [what carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) for which files reach a cloud session. For details on settings file resolution, see [settings](</docs/en/settings>). Hooks from settings files, managed policy settings, and plugins also run inside [subagents](</docs/en/sub-agents>). When a subagent calls a tool, tool events such as `PreToolUse` and `PostToolUse` fire the same configured hooks as in the main conversation, and the input carries the `agent_id` and `agent_type` common input fields that identify the subagent. Enterprise administrators can use `allowManagedHooksOnly` to block user, project, and plugin hooks. Hooks from plugins force-enabled in managed settings `enabledPlugins` are exempt. See [Hook configuration](</docs/en/settings#hook-configuration>). Hook entries merge across settings levels rather than replacing each other: user, project, and local settings add their own hooks without removing managed ones, and the `disableAllHooks` setting can’t disable managed hooks from outside managed settings. The [HTTP hook allowlists](</docs/en/settings#hook-configuration>) apply to hooks from every source, including managed policy settings:
* `allowedHttpHookUrls`: when defined at any settings level, Claude Code runs an HTTP hook handler only if its URL matches the merged allowlist
* `httpHookAllowedEnvVars`: when defined, Claude Code interpolates only the environment variables on that list into hook headers
@@ -297,7 +297,7 @@
}
}
-`UserPromptSubmit`, `PostToolBatch`, `Stop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`, `WorktreeCreate`, `WorktreeRemove`, `MessageDisplay`, and `CwdChanged` don’t support matchers and always fire on every occurrence. If you add a `matcher` field to these events, it is silently ignored. For tool events, you can filter more narrowly by setting the `if` field on individual hook handlers. `if` uses [permission rule syntax](</docs/en/permissions>) to match against the tool name and arguments together, so `"Bash(git *)"` runs when any subcommand of the Bash input matches `git *` and `"Edit(*.ts)"` runs only for TypeScript files.
+If you add a `matcher` field to an event without matcher support, it is silently ignored. For tool events, you can filter more narrowly by setting the `if` field on individual hook handlers. `if` uses [permission rule syntax](</docs/en/permissions>) to match against the tool name and arguments together, so `"Bash(git *)"` runs when any subcommand of the Bash input matches `git *` and `"Edit(*.ts)"` runs only for TypeScript files.
####
@@ -443,7 +443,7 @@
`headers`| no| Additional HTTP headers as key-value pairs. Values support environment variable interpolation using `$VAR_NAME` or `${VAR_NAME}` syntax. Only variables listed in `allowedEnvVars` are resolved
`allowedEnvVars`| no| List of environment variable names that may be interpolated into header values. References to unlisted variables are replaced with empty strings. Required for any env var interpolation to work
-Claude Code sends the hook’s JSON input as the POST request body with `Content-Type: application/json`. The response body uses the same JSON output format as command hooks. Error handling differs from command hooks: non-2xx responses, connection failures, and timeouts all produce non-blocking errors that allow execution to continue. To block a tool call or deny a permission, return a 2xx response with a JSON body containing `decision: "block"` or a `hookSpecificOutput` with `permissionDecision: "deny"`. This example sends `PreToolUse` events to a local validation service, authenticating with a token from the `MY_TOKEN` environment variable:
+Claude Code sends the hook’s JSON input as the POST request body with `Content-Type: application/json`. The response body uses the same JSON output format as command hooks. Error handling differs from command hooks; see HTTP response handling. This example sends `PreToolUse` events to a local validation service, authenticating with a token from the `MY_TOKEN` environment variable:
{
"hooks": {
@@ -525,7 +525,7 @@
* `${CLAUDE_PLUGIN_ROOT}`: the plugin’s installation directory, for scripts bundled with a [plugin](</docs/en/plugins>). Changes on each plugin update.
* `${CLAUDE_PLUGIN_DATA}`: the plugin’s [persistent data directory](</docs/en/plugins-reference#persistent-data-directory>), for dependencies and state that should survive plugin updates.
-Prefer exec form for any hook that references a path placeholder. Exec form passes each `args` element as one argument with no shell tokenization, so paths with spaces or special characters need no quoting. In shell form, wrap each placeholder in double quotes.
+Prefer exec form for any hook that references a path placeholder. In shell form, wrap each placeholder in double quotes.
* Project scripts
@@ -650,7 +650,7 @@
Field| Description
---|---
`agent_id`| Unique identifier for the subagent. Present only when the hook fires inside a subagent call. Use this to distinguish subagent hook calls from main-thread calls.
-`agent_type`| Agent name (for example, `"Explore"` or `"security-reviewer"`). Present when the session uses `--agent` or the hook fires inside a subagent. For subagents, the subagent’s type takes precedence over the session’s `--agent` value. For [custom subagents](</docs/en/sub-agents>), this is the `name` field from the agent’s frontmatter, not the filename. For subagents shipped by a [plugin](</docs/en/plugins>), this is the plugin-scoped identifier such as `my-plugin:reviewer`, not the bare frontmatter name. See SubagentStart for how to write a matcher against a plugin-scoped name.
+`agent_type`| Agent name (for example, `"Explore"` or `"security-reviewer"`). Present when the session uses `--agent` or the hook fires inside a subagent. For subagents, the subagent’s type takes precedence over the session’s `--agent` value. See SubagentStart for the values custom and plugin subagents report and how to write a matcher against a plugin-scoped name.
Only `SessionStart` hooks can receive a `model` field, and it is not guaranteed to be present. There is no `$CLAUDE_MODEL` environment variable. A hook process inherits the parent environment, so it can read `$ANTHROPIC_MODEL` if you set it in your shell, but that value doesn’t change when you switch models with `/model` during a session. One set of variables is not inherited: Claude Code [removes `OTEL_*` exporter variables from every subprocess it spawns](</docs/en/monitoring-usage#administrator-configuration>), including hooks. For example, a `PreToolUse` hook for a Bash command receives this on stdin:
@@ -737,7 +737,7 @@
`InstructionsLoaded`| No| Exit code is ignored
`MessageDisplay`| No| The original text is displayed
-For `SessionStart`, `Setup`, and `SubagentStart`, the exit code 2 stderr renders in the transcript as a `<hook name> hook error` notice, the same way a non-blocking error does. Claude doesn’t see it, and the session or subagent proceeds. For `SubagentStart`, the notice appears in the subagent’s own transcript, not in the parent conversation. As of Claude Code v2.1.199, `SessionStart`, `Setup`, and `SubagentStart` show exit code 2 stderr in the transcript. Earlier versions wrote it to the debug log only.
+For `SessionStart`, `Setup`, and `SubagentStart`, the exit code 2 stderr renders in the transcript as a `<hook name> hook error` notice, the same way a non-blocking error does. Claude doesn’t see it, and the session or subagent proceeds. For `SubagentStart`, the notice appears in the subagent’s own transcript, not in the parent conversation.
###
@@ -880,7 +880,7 @@
* PermissionRequest
-Used by `UserPromptSubmit`, `UserPromptExpansion`, `PostToolUse`, `PostToolUseFailure`, `PostToolBatch`, `Stop`, `SubagentStop`, `ConfigChange`, and `PreCompact`. The only value is `"block"`. To allow the action to proceed, omit `decision` from your JSON, or exit 0 without any JSON at all:
+The only value for `decision` is `"block"`. To allow the action to proceed, omit `decision` from your JSON, or exit 0 without any JSON at all:
{
"decision": "block",
@@ -1033,8 +1033,6 @@
exit 0
-Any variables written to this file will be available in all subsequent Bash commands that Claude Code executes during the session.
-
`CLAUDE_ENV_FILE` is available for SessionStart, Setup, CwdChanged, and FileChanged hooks. Other hook types don’t have access to this variable.
###
@@ -1138,7 +1136,7 @@
UserPromptSubmit
-Runs when the user submits a prompt, before Claude processes it. This allows you to add additional context based on the prompt/conversation, validate prompts, or block certain types of prompts. `UserPromptSubmit` hooks have a default timeout of 30 seconds for `command`, `http`, and `mcp_tool` types, shorter than the 600-second default for those types on most other events. Because this hook runs before every prompt and blocks model processing until it completes, a stuck hook stalls the session. If your hook needs more time, set the `timeout` field in the hook entry. A `UserPromptSubmit` command, HTTP, or MCP tool hook that reaches its timeout is canceled and its output, including any `additionalContext`, is discarded. The prompt still reaches Claude without that context. As of v2.1.196, the transcript shows a notice naming the hook, the timeout that fired, and that the output was discarded. Earlier versions cancel the hook with no notice. An [Agent SDK callback hook](</docs/en/agent-sdk/hooks>) on `UserPromptSubmit` that reaches its timeout blocks the prompt with a message naming the hook and the timeout, because a callback there can be acting as a policy gate that must not fail open. The session continues. Before v2.1.208, a callback timeout on that event ended the turn with an execution error.
+Runs when the user submits a prompt, before Claude processes it. This allows you to add additional context based on the prompt/conversation, validate prompts, or block certain types of prompts. `UserPromptSubmit` hooks have a default timeout of 30 seconds for `command`, `http`, and `mcp_tool` types, shorter than the 600-second default for those types on most other events. Because this hook runs before every prompt and blocks model processing until it completes, a stuck hook stalls the session. If your hook needs more time, set the `timeout` field in the hook entry. A `UserPromptSubmit` command, HTTP, or MCP tool hook that reaches its timeout is canceled and its output, including any `additionalContext`, is discarded. The prompt still reaches Claude without that context. The transcript shows a notice naming the hook, the timeout that fired, and that the output was discarded. An [Agent SDK callback hook](</docs/en/agent-sdk/hooks>) on `UserPromptSubmit` that reaches its timeout blocks the prompt with a message naming the hook and the timeout, because a callback there can be acting as a policy gate that must not fail open. The session continues. Before v2.1.208, a callback timeout on that event ended the turn with an execution error.
####
@@ -1322,8 +1320,6 @@
#!/bin/bash
jq '{hookSpecificOutput: {hookEventName: "MessageDisplay", displayContent: (.delta | gsub("\\*\\*"; "") | gsub("`"; ""))}}'
-
-The script needs `jq` on your `PATH`.
Register a command hook that runs the script through PowerShell:
@@ -1577,7 +1573,7 @@
}
}
-`AskUserQuestion` and `ExitPlanMode` require user interaction and normally block in [non-interactive mode](</docs/en/headless>) with the `-p` flag. Returning `permissionDecision: "allow"` together with `updatedInput` satisfies that requirement: the hook reads the tool’s input from stdin, collects the answer through your own UI, and returns it in `updatedInput` so the tool runs without prompting. Returning `"allow"` alone is not sufficient for these tools. For `AskUserQuestion`, echo back the original `questions` array and add an `answers` object mapping each question’s text to the chosen answer. Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) prompt even when a hook returns `"allow"`. As of v2.1.199, an MCP tool whose server marks it with [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) is stricter: a hook can’t skip its approval prompt with `"allow"`, with or without `updatedInput`, because Claude Code can’t confirm the hook collected the interaction the tool needs.
+`AskUserQuestion` and `ExitPlanMode` require user interaction and normally block in [non-interactive mode](</docs/en/headless>) with the `-p` flag. Returning `permissionDecision: "allow"` together with `updatedInput` satisfies that requirement: the hook reads the tool’s input from stdin, collects the answer through your own UI, and returns it in `updatedInput` so the tool runs without prompting. Returning `"allow"` alone is not sufficient for these tools. For `AskUserQuestion`, echo back the original `questions` array and add an `answers` object mapping each question’s text to the chosen answer. As of v2.1.199, an MCP tool whose server marks it with [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) is stricter: a hook can’t skip its approval prompt with `"allow"`, with or without `updatedInput`, because Claude Code can’t confirm the hook collected the interaction the tool needs.
PreToolUse previously used top-level `decision` and `reason` fields, but these are deprecated for this event. Use `hookSpecificOutput.permissionDecision` and `hookSpecificOutput.permissionDecisionReason` instead. The deprecated values `"approve"` and `"block"` map to `"allow"` and `"deny"` respectively. Other events like PostToolUse and Stop continue to use top-level `decision` and `reason` as their current format.
@@ -1818,13 +1814,12 @@
Field| Description
---|---
`error`| String describing what went wrong. The format depends on the tool that failed
-`is_interrupt`| Optional boolean. True when the failure reached Claude Code as an abort rather than as an error the tool reported; the shell tools convert mid-run cancellations into ordinary exit-code errors, so an exit-code payload carries `is_interrupt: false` even when the command was cancelled
+`is_interrupt`| Optional boolean. True when the failure reached Claude Code as an abort rather than as an error the tool reported. Cancelling a running tool does not fire this hook; the tool result carries the interruption message instead
`duration_ms`| Optional. Tool execution time in milliseconds. Excludes time spent in permission prompts and PreToolUse hooks
The `error` string is generally the same text Claude receives as the failed tool’s result. Its format varies by tool and failure. Key your hook on `tool_name`, `is_interrupt`, and the `Exit code N` first line; treat the rest of the string as display text, not a stable format.
* For Bash and PowerShell, a command that ran and exited produces a first line `Exit code N`, then any output the command produced as one block with stdout and stderr interleaved
- * The line `[Request interrupted by user for tool use]` appears when the command was cancelled while running
* A payload may also carry a bare failure message with no exit-code line, when Claude Code could not start the shell process itself
* Claude Code middle-truncates strings longer than 10,000 characters around a `... [N characters truncated] ...` marker, and can insert lines of its own, such as `Command timed out after 2m 0s`
@@ -2105,7 +2100,7 @@
TaskCreated
-Runs when a task is being created via the `TaskCreate` tool. Use this to enforce naming conventions, require task descriptions, or prevent certain tasks from being created. When a `TaskCreated` hook exits with code 2, the task is not created and the stderr message is fed back to the model as feedback. To stop the teammate entirely instead of re-running it, return JSON with `{"continue": false, "stopReason": "..."}`. TaskCreated hooks don’t support matchers and fire on every occurrence.
+Runs when a task is being created via the `TaskCreate` tool. Use this to enforce naming conventions, require task descriptions, or prevent certain tasks from being created. TaskCreated hooks don’t support matchers and fire on every occurrence.
####
@@ -2166,7 +2161,7 @@
TaskCompleted
-Runs when a task is being marked as completed. This fires in two situations: when any agent explicitly marks a task as completed through the TaskUpdate tool, or when an [agent team](</docs/en/agent-teams>) teammate finishes its turn with in-progress tasks. Use this to enforce completion criteria like passing tests or lint checks before a task can close. When a `TaskCompleted` hook exits with code 2, the task is not marked as completed and the stderr message is fed back to the model as feedback. To stop the teammate entirely instead of re-running it, return JSON with `{"continue": false, "stopReason": "..."}`. TaskCompleted hooks don’t support matchers and fire on every occurrence.
+Runs when a task is being marked as completed. This fires in two situations: when any agent explicitly marks a task as completed through the TaskUpdate tool, or when an [agent team](</docs/en/agent-teams>) teammate finishes its turn with in-progress tasks. Use this to enforce completion criteria like passing tests or lint checks before a task can close. TaskCompleted hooks don’t support matchers and fire on every occurrence.
####
@@ -2358,7 +2353,7 @@
TeammateIdle
-Runs when an [agent team](</docs/en/agent-teams>) teammate is about to go idle after finishing its turn. Use this to enforce quality gates before a teammate stops working, such as requiring passing lint checks or verifying that output files exist. When a `TeammateIdle` hook exits with code 2, the teammate receives the stderr message as feedback and continues working instead of going idle. To stop the teammate entirely instead of re-running it, return JSON with `{"continue": false, "stopReason": "..."}`. TeammateIdle hooks don’t support matchers and fire on every occurrence.
+Runs when an [agent team](</docs/en/agent-teams>) teammate is about to go idle after finishing its turn. Use this to enforce quality gates before a teammate stops working, such as requiring passing lint checks or verifying that output files exist. TeammateIdle hooks don’t support matchers and fire on every occurrence.
####
@@ -2990,7 +2985,7 @@
Prompt hook configuration
-Set `type` to `"prompt"` and provide a `prompt` string instead of a `command`. Use the `$ARGUMENTS` placeholder to inject the hook’s JSON input data into your prompt text. Claude Code sends the combined prompt and input to a fast Claude model, which returns a JSON decision. This `Stop` hook asks the LLM to evaluate whether all tasks are complete before allowing Claude to finish:
+Set `type` to `"prompt"` and provide a `prompt` string instead of a `command`. Use the `$ARGUMENTS` placeholder to inject the hook’s JSON input data into your prompt text. This `Stop` hook asks the LLM to evaluate whether all tasks are complete before allowing Claude to finish:
{
"hooks": {
@@ -3234,10 +3229,8 @@
Limitations
-Async hooks have several constraints compared to synchronous hooks:
-
- * Only `type: "command"` hooks support `async`. Prompt-based hooks can’t run asynchronously.
- * Async hooks can’t block tool calls or return decisions. By the time the hook completes, the triggering action has already proceeded.
+Async hooks have additional constraints compared to synchronous hooks:
+
* Hook output is delivered on the next conversation turn. If the session is idle, the response waits until the next user interaction. Exception: an `asyncRewake` hook that exits with code 2 wakes Claude immediately even when the session is idle.
* Each execution creates a separate background process. There is no deduplication across multiple firings of the same async hook.
@@ -3252,8 +3245,6 @@
Disclaimer
-
-Command hooks run with your system user’s full permissions.
Command hooks execute shell commands with your full user permissions. They can modify, delete, or access any files your user account can access. Review and test all hook commands before adding them to your configuration.
@@ -3277,7 +3268,7 @@
Windows PowerShell tool
-On Windows, you can run individual hooks in PowerShell by setting `"shell": "powershell"` on a command hook. Hooks spawn PowerShell directly, so this works regardless of whether `CLAUDE_CODE_USE_POWERSHELL_TOOL` is set. Claude Code auto-detects `pwsh.exe`, the PowerShell 7 and later executable, and falls back to `powershell.exe` for Windows PowerShell 5.1.
+On Windows, you can run individual hooks in PowerShell by setting `"shell": "powershell"` on a command hook. Claude Code auto-detects `pwsh.exe`, the PowerShell 7 and later executable, and falls back to `powershell.exe` for Windows PowerShell 5.1.
{
"hooks": {
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -196,7 +196,7 @@
}
}
-To test the hook, ask Claude to add a line with single-quoted strings to a JavaScript file, then open the file: with Prettier’s default settings, the hook rewrites them to double quotes. On Claude Code v2.1.191 or later you can also write the matcher as `Edit,Write`, since `|` and `,` are interchangeable list separators for tool-name matchers on those versions. When the hook succeeds, Claude Code shows nothing in the conversation. To confirm the hook ran, check that the edited file is reformatted, or see Debug techniques.
+To test the hook, ask Claude to add a line with single-quoted strings to a JavaScript file, then open the file: with Prettier’s default settings, the hook rewrites them to double quotes. When the hook succeeds, Claude Code shows nothing in the conversation. To confirm the hook ran, check that the edited file is reformatted, or see Debug techniques.
The Bash examples on this page use `jq` for JSON parsing. Install it with `brew install jq` on macOS, `apt-get install jq` on Debian and Ubuntu, or see [`jq` downloads](<https://jqlang.org/download/>).
@@ -585,7 +585,7 @@
* `"deny"`: cancel the tool call and send the reason to Claude
* `"ask"`: show the permission prompt to the user as normal
-A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. Returning `"allow"` skips the interactive prompt but doesn’t override [permission rules](</docs/en/permissions#manage-permissions>). If a deny rule matches the tool call, the call is blocked even when your hook returns `"allow"`. If an ask rule matches, the user is still prompted, and so are connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>). This means deny rules from any settings scope, including [managed settings](</docs/en/settings#settings-files>), always take precedence over hook approvals. Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt:
+A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt:
{
"hookSpecificOutput": {
--- a/how-claude-code-works.md
+++ b/how-claude-code-works.md
@@ -79,7 +79,7 @@
Environment| Where code runs| Use case
---|---|---
**Local**| Your machine| Default. Full access to your files, tools, and environment
-**Cloud**| Anthropic-managed VMs| Offload tasks, work on repos you don’t have locally
+**Cloud**| Anthropic-managed VMs, or [self-hosted environments](</docs/en/self-hosted-environments>) your organization operates| Offload tasks, work on repos you don’t have locally
**Remote Control**| Your machine, controlled from a browser| Use the web UI while execution and your files stay local
###
--- a/llm-gateway-protocol.md
+++ b/llm-gateway-protocol.md
@@ -179,7 +179,7 @@
* `ANTHROPIC_AUTH_TOKEN` as a bearer token, when set
* Otherwise the resolved API key, including an [`apiKeyHelper`](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) value, in the `x-api-key` header
-This differs from inference requests, which send a helper value in both headers. A gateway that authenticates `/v1/models` must accept `x-api-key` for helper deployments. Any headers from `ANTHROPIC_CUSTOM_HEADERS` are included as well. Claude Code reads `id` and the optional `display_name` from each entry in the response’s `data` array, and ignores entries whose `id` doesn’t begin with `claude` or `anthropic`:
+This differs from inference requests, which send a helper value in both headers. A gateway that authenticates `/v1/models` must accept `x-api-key` for helper deployments. Any headers from `ANTHROPIC_CUSTOM_HEADERS` are included as well. Claude Code reads `id` and the optional `display_name` from each entry in the response’s `data` array:
{
"data": [
@@ -188,6 +188,8 @@
]
}
+Claude Code keeps an entry when its `id` contains `claude` or `anthropic` anywhere in the string, matched case-insensitively, and ignores the rest. Provider-prefixed IDs such as `vertex_ai/claude-sonnet-4-6` or `bedrock/anthropic.claude-sonnet-4-5` pass the filter; an ID that contains neither substring doesn’t. Before v2.1.223, Claude Code kept an entry only when its `id` began with `claude` or `anthropic`, which hid provider-prefixed IDs.
+
###
--- a/mcp.md
+++ b/mcp.md
@@ -188,7 +188,7 @@
Automatic reconnection
-If an HTTP or SSE server disconnects mid-session, Claude Code automatically reconnects with exponential backoff: up to five attempts, starting at a one-second delay and doubling each time. The server appears as pending in `/mcp` while reconnection is in progress. After five failed attempts the server is marked as failed and you can retry manually from `/mcp`. Stdio servers are local processes and are not reconnected automatically. The same backoff applies when an HTTP or SSE server fails its initial connection at startup. As of v2.1.121, Claude Code retries the initial connection up to three times on transient errors such as a 5xx response, a connection refused, or a timeout, then marks the server as failed if it still can’t connect. Authentication and not-found errors are not retried because they require a configuration change to resolve. When a configured server fails to connect, Claude Code tells Claude which server failed and its connection error, including in `ToolSearch` results that find no matching tool, so Claude reports the connection failure in its response. Requires tool search, which is enabled by default. In configurations without tool search, such as a custom `ANTHROPIC_BASE_URL`, `ENABLE_TOOL_SEARCH=false`, or a model that doesn’t support tool search, and on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, Claude Code doesn’t report failed server connections to Claude. Before v2.1.205, Claude Code didn’t pass connection errors to Claude, and Claude could respond as if the failed server’s tools were never configured. As of v2.1.191, the capability discovery requests that run after a successful connection, such as `tools/list`, `prompts/list`, and `resources/list`, also retry transient network and server errors up to three times with short backoff. Authentication errors, 4xx responses, and request timeouts are not retried.
+If an HTTP or SSE server disconnects mid-session, Claude Code automatically reconnects with exponential backoff: up to five attempts, starting at a one-second delay and doubling each time. The server appears as pending in `/mcp` while reconnection is in progress. After five failed attempts the server is marked as failed and you can retry manually from `/mcp`. Stdio servers are local processes and are not reconnected automatically. The same backoff applies when an HTTP or SSE server fails its initial connection at startup. Claude Code retries the initial connection up to three times on transient errors such as a 5xx response, a connection refused, or a timeout, then marks the server as failed if it still can’t connect. Authentication and not-found errors are not retried because they require a configuration change to resolve. When a configured server fails to connect, Claude Code tells Claude which server failed and its connection error, including in `ToolSearch` results that find no matching tool, so Claude reports the connection failure in its response. Requires tool search, which is enabled by default. In configurations without tool search, such as a custom `ANTHROPIC_BASE_URL`, `ENABLE_TOOL_SEARCH=false`, or a model that doesn’t support tool search, and on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, Claude Code doesn’t report failed server connections to Claude. Before v2.1.205, Claude Code didn’t pass connection errors to Claude, and Claude could respond as if the failed server’s tools were never configured. As of v2.1.191, the capability discovery requests that run after a successful connection, such as `tools/list`, `prompts/list`, and `resources/list`, also retry transient network and server errors up to three times with short backoff. Authentication errors, 4xx responses, and request timeouts are not retried.
###
@@ -362,7 +362,7 @@
}
}
-For security reasons, Claude Code prompts for approval before using project-scoped servers from `.mcp.json` files. If you need to reset these approval choices, use the `claude mcp reset-project-choices` command.
+For security reasons, Claude Code prompts for approval in interactive sessions before using project-scoped servers from `.mcp.json` files. To reset those approval choices, run `claude mcp reset-project-choices`. `claude -p` runs, [Agent SDK](</docs/en/headless>) sessions, and [cloud sessions](</docs/en/claude-code-on-the-web>) can’t show that prompt: Claude Code loads project-scoped servers there without asking. To keep a server out anyway, add it to [`disabledMcpjsonServers`](</docs/en/settings#available-settings>), which blocks it in every mode, or exclude project settings entirely with [`--setting-sources`](</docs/en/cli-reference>) or the SDK’s `settingSources` option.
###
@@ -1126,7 +1126,7 @@
}
}
-The `alwaysLoad` field is available on all server types and requires Claude Code v2.1.121 or later. An MCP server can also mark individual tools as always-loaded by including `"anthropic/alwaysLoad": true` in the tool’s `_meta` object, which has the same effect for that tool only. Setting `alwaysLoad: true` also makes startup wait for the server’s tools, capped at the standard 5-second connect timeout, since they must be present when the first prompt is built. A remote server with a valid `cached` entry supplies its tools from the cache without connecting, so it doesn’t hold startup. Other servers connect in the background by default; set [`MCP_CONNECTION_NONBLOCKING=0`](</docs/en/env-vars>) to make startup wait for them too.
+The `alwaysLoad` field is available on all server types. An MCP server can also mark individual tools as always-loaded by including `"anthropic/alwaysLoad": true` in the tool’s `_meta` object, which has the same effect for that tool only. Setting `alwaysLoad: true` also makes startup wait for the server’s tools, capped at the standard 5-second connect timeout, since they must be present when the first prompt is built. A remote server with a valid `cached` entry supplies its tools from the cache without connecting, so it doesn’t hold startup. Other servers connect in the background by default; set [`MCP_CONNECTION_NONBLOCKING=0`](</docs/en/env-vars>) to make startup wait for them too.
##
--- a/mcp-quickstart.md
+++ b/mcp-quickstart.md
@@ -299,7 +299,7 @@
Status shows Failed to connect or Connection error
-Both statuses mean the server didn’t start or the URL didn’t respond. They can also appear for HTTP servers that reject the token you configured in `headers.Authorization`; a server that wants a token you haven’t configured shows `! Needs authentication` instead, covered in Connect a server that requires sign-in.An HTTP server that returns `404 Not Found` shows `MCP endpoint not found at <url>. Check the URL in your MCP config.` when you select the server in `/mcp`. The message shows the URL’s origin, such as `https://mcp.example.com`, without its path, so run `claude mcp get <name>` to see the full URL you configured. Compare its path to the server’s documented MCP endpoint path, then run `claude mcp remove <name>` and re-add with the correct URL. Before v2.1.191, Claude Code showed a generic `Error POSTing to endpoint` message without the URL.For HTTP servers, confirm the URL is reachable from your machine:
+Both statuses mean the server didn’t start or the URL didn’t respond. They can also appear for HTTP servers that reject the token you configured in `headers.Authorization`; a server that wants a token you haven’t configured shows `! Needs authentication` instead, covered in Connect a server that requires sign-in.If an HTTP server returns `404 Not Found`, Claude Code shows `MCP endpoint not found at <origin>. Check the URL in your MCP config.` when you select the server in `/mcp`. The message names the URL’s origin, such as `https://mcp.example.com`, without its path, so run `claude mcp get <name>` to see the full URL you configured. Compare its path to the server’s documented MCP endpoint path, then run `claude mcp remove <name>` and re-add with the correct URL. Before v2.1.219, the message included the URL’s path as well, and before v2.1.191, a `404` showed a generic `Error POSTing to endpoint` message without the URL.For HTTP servers, confirm the URL is reachable from your machine:
curl -I https://mcp.sentry.dev/mcp
--- a/mobile.md
+++ b/mobile.md
@@ -1,4 +1,4 @@
-The Claude app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) and [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>) is a client for Claude Code sessions rather than a place where code runs. From your phone you reach cloud sessions on Anthropic-managed infrastructure, a session running on your own machine through Remote Control, or the Desktop app through [Dispatch](</docs/en/desktop#sessions-from-dispatch>).
+The Claude app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) and [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>) is a client for Claude Code sessions rather than a place where code runs. From your phone you reach cloud sessions in the cloud, a session running on your own machine through Remote Control, or the Desktop app through [Dispatch](</docs/en/desktop#sessions-from-dispatch>).
Claude Code doesn’t have a separate mobile app: cloud sessions and Remote Control both live in the **Code** tab in the Claude app, and Dispatch is a task you message in the app.
@@ -38,11 +38,11 @@
Feature| What you connect to| When to use
---|---|---
-[Claude Code on the web](</docs/en/claude-code-on-the-web>)| A cloud session on Anthropic-managed infrastructure| Your repository is on GitHub and the task should keep running after you put your phone away. See the [web quickstart](</docs/en/web-quickstart>) to set up.
+[Claude Code on the web](</docs/en/claude-code-on-the-web>)| A cloud session on cloud infrastructure, Anthropic-managed by default| Your repository is on GitHub and the task should keep running after you put your phone away. See the [web quickstart](</docs/en/web-quickstart>) to set up.
[Remote Control](</docs/en/remote-control>)| A Claude Code session running on your computer| The work needs your local filesystem, tools, or MCP servers.
[Dispatch](</docs/en/desktop#sessions-from-dispatch>)| The Desktop app on your computer| You want to message a task and let Dispatch decide how to run it. Requires a Pro or Max plan.
-If your computer will be off, use cloud sessions: they run on Anthropic’s infrastructure and continue with your laptop closed. Remote Control and Dispatch drive your own machine, so it needs to stay on with Claude Code or the Desktop app running. If your machine sleeps during a Remote Control session, the session reconnects when it comes back online. For a fuller comparison that also covers Channels, Slack, and scheduled tasks, see [work when you are away from your terminal](</docs/en/platforms#work-when-you-are-away-from-your-terminal>). Cloud sessions and Remote Control run from the **Code** tab and are covered below. For Dispatch, which you message as a task in the app, see [sessions from Dispatch](</docs/en/desktop#sessions-from-dispatch>).
+If your computer will be off, use cloud sessions: they run in the cloud and continue with your laptop closed. Remote Control and Dispatch drive your own machine, so it needs to stay on with Claude Code or the Desktop app running. If your machine sleeps during a Remote Control session, the session reconnects when it comes back online. For a fuller comparison that also covers Channels, Slack, and scheduled tasks, see [work when you are away from your terminal](</docs/en/platforms#work-when-you-are-away-from-your-terminal>). Cloud sessions and Remote Control run from the **Code** tab and are covered below. For Dispatch, which you message as a task in the app, see [sessions from Dispatch](</docs/en/desktop#sessions-from-dispatch>).
###
@@ -50,7 +50,7 @@
Start and monitor cloud sessions
-Claude Code on the web runs tasks on Anthropic-managed cloud infrastructure, so a session continues after you put your phone away. From the Code tab, select a repository and branch, describe the task, and submit it. Sessions persist across devices: a task you start on your laptop is ready to review from your phone, and one you start from your phone is waiting when you’re back at your desk. Open a session in the app to check progress, answer Claude’s questions, or steer it in a new direction. You can also tell Claude to [watch a pull request](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) and fix CI failures or review comments as they arrive. To connect GitHub and set up your environment, follow the [web quickstart](</docs/en/web-quickstart>), and see [Claude Code on the web](</docs/en/claude-code-on-the-web>) for everything cloud sessions can do.
+Claude Code on the web runs tasks on cloud infrastructure, Anthropic-managed by default, so a session continues after you put your phone away. From the Code tab, select a repository and branch, describe the task, and submit it. Sessions persist across devices: a task you start on your laptop is ready to review from your phone, and one you start from your phone is waiting when you’re back at your desk. Open a session in the app to check progress, answer Claude’s questions, or steer it in a new direction. You can also tell Claude to [watch a pull request](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) and fix CI failures or review comments as they arrive. To connect GitHub and set up your environment, follow the [web quickstart](</docs/en/web-quickstart>), and see [Claude Code on the web](</docs/en/claude-code-on-the-web>) for everything cloud sessions can do.
###
--- a/model-config.md
+++ b/model-config.md
@@ -157,9 +157,9 @@
Delivery mechanism| CLI and IDE| Desktop local sessions| Web, mobile, and cloud sessions| Agent SDK and non-interactive| Cowork
---|---|---|---|---|---
[Server-managed settings](</docs/en/server-managed-settings>) from the admin console| Enforced| Enforced| Enforced| Enforced| Not delivered
-[MDM or managed settings files](</docs/en/settings#settings-files>)| Enforced| Enforced| Not delivered| Enforced| Enforced where deployed
-
- * Cloud sessions, on [Claude Code on the web](</docs/en/claude-code-on-the-web>) or in the Desktop app, run on Anthropic-managed VMs: settings deployed to your device do not reach them, so deliver the allowlist through server-managed settings. A mid-session model switch in a cloud session is rejected when the requested model is excluded by the allowlist. Server-side rejection at session creation applies to organization model restrictions, not the `availableModels` settings key.
+[MDM or managed settings files](</docs/en/settings#settings-files>)| Enforced| Enforced| Not delivered in Anthropic-hosted environments; in [self-hosted environments](</docs/en/self-hosted-environments>), enforced from the runner image when server-managed settings deliver no keys| Enforced| Enforced where deployed
+
+ * Cloud sessions, on [Claude Code on the web](</docs/en/claude-code-on-the-web>) or in the Desktop app, run on Anthropic-managed VMs by default: settings deployed to your device do not reach them, so deliver the allowlist through server-managed settings. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on your own compute and fall back to the managed settings file in the runner image when your organization delivers no server-managed settings; when both exist, the server-managed payload takes precedence, with the per-key `env` merge exception described in [settings precedence](</docs/en/server-managed-settings#settings-precedence>). A mid-session model switch in a cloud session is rejected when the requested model is excluded by the allowlist. Server-side rejection at session creation applies to organization model restrictions, not the `availableModels` settings key.
* Cowork, the agentic-work tab in the Claude Desktop app, is not a Claude Code surface and does not receive server-managed settings by design. A managed settings file applies to Cowork sessions when it is present where the session runs; remote Cowork sessions run on Anthropic-managed VMs, where a device-deployed file is not present.
* Sessions on [third-party providers](</docs/en/server-managed-settings#platform-availability>) such as Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) do not receive server-managed settings, so deliver the allowlist through MDM or managed settings files there.
* Server-managed delivery also requires the session to authenticate with an organization login or a directly configured API key. Fleets that generate keys only through an [`apiKeyHelper`](</docs/en/settings#available-settings>) script should deliver the allowlist through MDM or managed settings files.
@@ -187,7 +187,7 @@
"enforceAvailableModels": true
}
-The Default option resolves to the account-type default, or to the organization default model when an admin has set one. When that model is not in the allowlist, the Default option instead resolves to the first `availableModels` entry that names an allowed, available model, and the `/model` picker’s Default row shows that model. This applies everywhere the default is reached: session startup, selecting Default in `/model`, the `"default"` keyword in fallback model chains, and the fallback used when an excluded selection is dropped. `enforceAvailableModels` has no effect when `availableModels` is unset or empty: with `availableModels: []`, the Default model for the account type remains usable, so the setting cannot lock users out of every model. When `availableModels` is non-empty but no entry resolves to an allowed and available model, enforcement is skipped and Default resolves to the account-type default, with a warning visible only under `--debug`. Keep at least one guaranteed-available entry in the list to avoid this. Deploy both keys in the [highest-precedence managed source](</docs/en/settings#settings-precedence>): admin-deployed managed sources do not merge, so a pair placed in a managed settings file is ignored when the admin console delivers any settings.
+The Default option resolves to the account-type default, or to the organization default model when an admin has set one. When that model is not in the allowlist, the Default option instead resolves to the first `availableModels` entry that names an allowed, available model, and the `/model` picker’s Default row shows that model. This applies everywhere the default is reached: session startup, selecting Default in `/model`, the `"default"` keyword in fallback model chains, and the fallback used when an excluded selection is dropped. `enforceAvailableModels` has no effect when `availableModels` is unset or empty: with `availableModels: []`, the Default model for the account type remains usable, so the setting cannot lock users out of every model. When `availableModels` is non-empty but no entry resolves to an allowed and available model, enforcement is skipped and Default resolves to the account-type default, with a warning visible only under `--debug`. Keep at least one guaranteed-available entry in the list to avoid this. Deploy both keys in the [highest-precedence managed source](</docs/en/settings#settings-precedence>): these keys don’t merge across managed sources, so a pair placed in a managed settings file is ignored when the admin console delivers any settings.
###
@@ -221,7 +221,7 @@
Merge behavior
-When the [highest-precedence managed settings source](</docs/en/server-managed-settings#settings-precedence>) defines `availableModels`, that list alone applies, apart from a [host platform that supplies its own](</docs/en/settings#settings-precedence>): entries in user, project, or local settings cannot extend it, and admin-deployed managed sources do not merge with each other, so a list deployed in a managed settings file is ignored when server-managed settings deliver any keys. Otherwise, lists from user, project, and local settings are [concatenated and deduplicated](</docs/en/settings#settings-precedence>) like other array settings. As of Claude Code v2.1.175, the managed list replaces lower-precedence entries; earlier versions merge them. Within the effective list, an entry naming a specific model in a family, whether a version prefix or a full model ID, disables that family’s wildcard entry: `["sonnet", "claude-sonnet-4-5"]` allows only Sonnet 4.5 versions, not every Sonnet model.
+When the [highest-precedence managed settings source](</docs/en/server-managed-settings#settings-precedence>) defines `availableModels`, that list alone applies, apart from a [host platform that supplies its own](</docs/en/settings#settings-precedence>): entries in user, project, or local settings cannot extend it, and `availableModels` doesn’t merge across admin-deployed managed sources, so a list deployed in a managed settings file is ignored when server-managed settings deliver any keys. Otherwise, lists from user, project, and local settings are [concatenated and deduplicated](</docs/en/settings#settings-precedence>) like other array settings. As of Claude Code v2.1.175, the managed list replaces lower-precedence entries; earlier versions merge them. Within the effective list, an entry naming a specific model in a family, whether a version prefix or a full model ID, disables that family’s wildcard entry: `["sonnet", "claude-sonnet-4-5"]` allows only Sonnet 4.5 versions, not every Sonnet model.
###
--- a/monitoring-usage.md
+++ b/monitoring-usage.md
@@ -67,7 +67,7 @@
* **Endpoints** : when you set `OTEL_EXPORTER_OTLP_ENDPOINT`, Claude Code removes every developer-set per-signal endpoint. Developers can’t point one signal at a different collector, so you don’t need to also set the per-signal endpoint variables in managed settings.
* **Protocols** : when you set `OTEL_EXPORTER_OTLP_PROTOCOL`, Claude Code removes every developer-set per-signal protocol.
* **Credentials** : when you set `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_EXPORTER_OTLP_CLIENT_KEY`, or `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`, Claude Code removes the developer-set per-signal versions of that variable, plus every developer-set endpoint variable, generic or per-signal, since those credentials would otherwise reach a collector the managed settings didn’t choose.
- * **Exporter selectors** : `OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, and the beta `OTEL_TRACES_EXPORTER` follow normal per-key precedence. A developer’s setting can still disable a signal or switch it to the console exporter, so set the selectors in managed settings too if you need them locked.
+ * **Exporter selectors** : `OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, and the beta `OTEL_TRACES_EXPORTER` follow normal per-key precedence. A developer’s setting can still disable a signal or switch it to the console exporter, so set the selectors in managed settings too if you need them locked. Across [admin sources](</docs/en/settings#settings-precedence>), `OTEL_LOGS_EXPORTER` follows the [telemetry unit](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>) while the other two selectors merge per key. Requires Claude Code v2.1.223 or later.
Claude Code doesn’t remove per-signal variables that you set in managed settings itself, so you can route one signal to a different collector by setting its variable there, as the SIEM example does. If you set a per-signal credential there, Claude Code removes the developer-set endpoint for that signal. This removal behavior changes where telemetry is delivered, not what Claude Code collects. Before v2.1.217, every variable followed per-key settings precedence independently, so a signal-specific endpoint set in user settings or the shell redirected that signal away from the managed collector.
--- a/network-config.md
+++ b/network-config.md
@@ -197,7 +197,7 @@
`formulae.brew.sh`| Update version checks on Homebrew installs. Other install methods don’t contact this host
`code.claude.com`| Claude Code documentation lookups by the built-in claude-code-guide agent and pre-approved WebFetch requests. Blocking this host only affects documentation lookups
-If you install Claude Code through npm or manage your own binary distribution, end users don’t need the native installer and auto-updater uses of `downloads.claude.ai`, but npm and bun installs need their package registry, `registry.npmjs.org`, unless your organization mirrors it. The other uses in the table apply regardless of install method. The two Datadog intake hosts carry only optional operational telemetry, and setting [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`](</docs/en/env-vars>) disables both. Sessions on third-party providers never send to these hosts, even when a platform sets [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) and telemetry metrics default on. See [Telemetry services](</docs/en/data-usage#telemetry-services>) for everything Claude Code sends and how to disable it before finalizing your allowlist. When using [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), or a signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) session, model traffic and authentication go to your provider or gateway instead of `api.anthropic.com`, `claude.ai`, or `platform.claude.com`. The WebFetch tool still calls `api.anthropic.com` for its [domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) unless you set `skipWebFetchPreflight: true` in [settings](</docs/en/settings>). When routing through an [LLM gateway](</docs/en/llm-gateway>) with [`ANTHROPIC_BASE_URL`](</docs/en/llm-gateway-connect#set-the-base-url-and-credential>), the [fast mode](</docs/en/fast-mode>) availability check still calls `api.anthropic.com` rather than the gateway base URL. The check does honor a configured HTTP proxy, so where a network block is the cause, an allowlist entry for `api.anthropic.com` in the proxy is the fix. A network block fails the check only where the host is unreachable even through the proxy, and fast mode then reports a connectivity error. The same connectivity error appears when the check presents a gateway-issued credential that Anthropic rejects; allowlisting doesn’t help there, since nothing is blocked. See [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) for the variables that restore it. [Claude Code on the web](</docs/en/claude-code-on-the-web>) and [Code Review](</docs/en/code-review>) connect to your repositories from Anthropic-managed infrastructure. If your GitHub Enterprise Cloud organization restricts access by IP address, enable [IP allow list inheritance for installed GitHub Apps](<https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization#allowing-access-by-github-apps>). The Claude GitHub App registers its IP ranges, so enabling this setting allows access without manual configuration. To [add the ranges to your allow list manually](<https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization#adding-an-allowed-ip-address>) instead, or to configure other firewalls, see the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>). For self-hosted [GitHub Enterprise Server](</docs/en/github-enterprise-server>) instances behind a firewall, allowlist the same [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>) so Anthropic infrastructure can reach your GHES host to clone repositories and post review comments.
+If you install Claude Code through npm or manage your own binary distribution, end users don’t need the native installer and auto-updater uses of `downloads.claude.ai`, but npm and bun installs need their package registry, `registry.npmjs.org`, unless your organization mirrors it. The other uses in the table apply regardless of install method. The two Datadog intake hosts carry only optional operational telemetry, and setting [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`](</docs/en/env-vars>) disables both. Sessions on third-party providers never send to these hosts, even when a platform sets [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) and telemetry metrics default on. See [Telemetry services](</docs/en/data-usage#telemetry-services>) for everything Claude Code sends and how to disable it before finalizing your allowlist. When using [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), or a signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) session, model traffic and authentication go to your provider or gateway instead of `api.anthropic.com`, `claude.ai`, or `platform.claude.com`. The WebFetch tool still calls `api.anthropic.com` for its [domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) unless you set `skipWebFetchPreflight: true` in [settings](</docs/en/settings>). When routing through an [LLM gateway](</docs/en/llm-gateway>) with [`ANTHROPIC_BASE_URL`](</docs/en/llm-gateway-connect#set-the-base-url-and-credential>), the [fast mode](</docs/en/fast-mode>) availability check still calls `api.anthropic.com` rather than the gateway base URL. The check does honor a configured HTTP proxy, so where a network block is the cause, an allowlist entry for `api.anthropic.com` in the proxy is the fix. A network block fails the check only where the host is unreachable even through the proxy, and fast mode then reports a connectivity error. The same connectivity error appears when the check presents a gateway-issued credential that Anthropic rejects; allowlisting doesn’t help there, since nothing is blocked. See [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) for the variables that restore it. [Claude Code on the web](</docs/en/claude-code-on-the-web>) in Anthropic-hosted environments and [Code Review](</docs/en/code-review>) connect to your repositories from Anthropic-managed infrastructure; sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) connect from inside your network, unless the runner opts into the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), which fetches from Anthropic’s side. If your GitHub Enterprise Cloud organization restricts access by IP address, enable [IP allow list inheritance for installed GitHub Apps](<https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization#allowing-access-by-github-apps>). The Claude GitHub App registers its IP ranges, so enabling this setting allows access without manual configuration. To [add the ranges to your allow list manually](<https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization#adding-an-allowed-ip-address>) instead, or to configure other firewalls, see the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>). For self-hosted [GitHub Enterprise Server](</docs/en/github-enterprise-server>) instances behind a firewall, allowlist the same [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>) so Anthropic infrastructure can reach your GHES host to clone repositories and post review comments. Sessions in a [self-hosted environment](</docs/en/self-hosted-environments-deploy#configure-git>) reach your GHES host from inside your network instead, so that exposure applies only to Anthropic-hosted sessions, to hosted pre-session flows such as the repository picker, and to self-hosted runners that opt into the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), which fetches from Anthropic’s side. For a GHES host that’s only routable inside your network, the [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) carries the hosted pre-session flows over an outbound connection instead, so the allowlist isn’t needed for them.
###
--- a/overview.md
+++ b/overview.md
@@ -137,7 +137,7 @@
Run Claude on a schedule to automate work that repeats: morning PR reviews, overnight CI failure analysis, weekly dependency audits, or syncing docs after PRs merge.
- * [Routines](</docs/en/routines>) run on Anthropic-managed infrastructure, so they keep running even when your computer is off. They can also trigger on API calls or GitHub events. Create them from the web, the Desktop app, or by running `/schedule` in the CLI.
+ * [Routines](</docs/en/routines>) run in the cloud, so they keep running even when your computer is off. They can also trigger on API calls or GitHub events. Create them from the web, the Desktop app, or by running `/schedule` in the CLI.
* [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) run on your machine, with direct access to your local files and tools
* [`/loop`](</docs/en/scheduled-tasks>) repeats a prompt within a CLI session for quick polling
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -17,7 +17,7 @@
`dontAsk`| Only pre-approved tools| Locked-down CI and scripts
`bypassPermissions`| Everything| Isolated containers and VMs only
-The mode that reviews every action is named **Manual** in the CLI, in `claude --help`, in the VS Code and JetBrains extensions, and in the desktop app. Its config value is `default`, which is what hooks and SDK integrations use. The CLI accepts `manual` as an alias wherever you type the value, for example `claude --permission-mode manual` or `"defaultMode": "manual"`. The Manual label and the `manual` alias require Claude Code v2.1.200 or later. The desktop app’s label doesn’t depend on your CLI version. Writes to protected paths are never auto-approved except in `bypassPermissions` mode and in planning sessions with bypass permissions available, guarding repository state and Claude’s own configuration against accidental corruption. Modes set the baseline. Layer [permission rules](</docs/en/permissions#manage-permissions>) on top to pre-approve or block specific tools. These controls apply in every mode, including `bypassPermissions`:
+The mode that reviews every action is named **Manual** in the CLI, in `claude --help`, in the VS Code and JetBrains extensions, and in the desktop app. Its config value is `default`, which is what hooks and SDK integrations use. The CLI accepts `manual` as an alias wherever you type the value, for example `claude --permission-mode manual` or `"defaultMode": "manual"`. The Manual label and the `manual` alias require Claude Code v2.1.200 or later. The desktop app’s label doesn’t depend on your CLI version. Writes to protected paths are never auto-approved except in `bypassPermissions` mode and in planning sessions with bypass permissions available. Modes set the baseline. Layer [permission rules](</docs/en/permissions#manage-permissions>) on top to pre-approve or block specific tools. These controls apply in every mode, including `bypassPermissions`:
* deny rules and explicit ask rules, which apply to every tool but can’t block [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains
* the [org `ask` setting on connector tools](</docs/en/mcp#organization-controls-on-connector-tools>)
@@ -43,7 +43,7 @@
* Web and mobile
-**During a session** : press `Shift+Tab` to cycle `default` → `acceptEdits` → `plan`. The status bar shows the active mode as `⏸ plan mode on`, `⏵⏵ accept edits on`, `⏵⏵ auto mode on`, `⏵⏵ don't ask on`, or `⏵⏵ bypass permissions on`. Manual mode, `default` in that cycle, shows a gray `⏸ manual mode on` badge. Before v2.1.203, the status bar showed no badge in Manual mode.Not every mode is in the default cycle:
+**During a session** : press `Shift+Tab` to cycle `default` → `acceptEdits` → `plan`. The status bar shows the active mode as `⏸ plan mode on`, `⏵⏵ accept edits on`, `⏵⏵ auto mode on`, `⏵⏵ don't ask on`, or `⏵⏵ bypass permissions on`. Manual mode, `default` in that cycle, shows a gray `⏸ manual mode on` badge.Not every mode is in the default cycle:
* `auto`: appears when your account meets the auto mode requirements; cycling to it switches modes without a confirmation prompt
* `bypassPermissions`: appears after you start with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, `--allow-dangerously-skip-permissions`, or `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>); the `--allow-` variant adds the mode to the cycle without activating it
@@ -73,7 +73,7 @@
Auto| `auto`
Bypass permissions| `bypassPermissions`
-Before v2.1.205, the extension labeled `plan` as Plan mode and `auto` as Auto mode.Auto mode appears in the mode indicator when your account meets every requirement listed in the auto mode section. The `claudeCode.initialPermissionMode` setting does not accept `auto`. To start in auto mode by default, set `defaultMode` in your [user settings](</docs/en/settings#settings-files>) instead. Claude Code ignores `defaultMode: "auto"` in project and local settings.Bypass permissions requires the **Allow dangerously skip permissions** toggle in the extension settings before it appears in the mode indicator.See the [VS Code guide](</docs/en/vs-code>) for extension-specific details.
+Auto mode appears in the mode indicator when your account meets every requirement listed in the auto mode section. The `claudeCode.initialPermissionMode` setting does not accept `auto`. To start in auto mode by default, set `defaultMode` in your [user settings](</docs/en/settings#settings-files>) instead. Claude Code ignores `defaultMode: "auto"` in project and local settings.Bypass permissions requires the **Allow dangerously skip permissions** toggle in the extension settings before it appears in the mode indicator.See the [VS Code guide](</docs/en/vs-code>) for extension-specific details.
The JetBrains plugin runs Claude Code in the IDE terminal, so switching modes works the same as in the CLI: press `Shift+Tab` to cycle, or pass `--permission-mode` when launching.
@@ -164,7 +164,7 @@
* **Plan** : All plans.
* **Organization** : on Team and Enterprise, auto mode is available by default. Administrators can turn it off for the organization by setting `permissions.disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>).
* **Model** : on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Claude Opus 4.6 or later, Sonnet 4.6 or later, or [Fable 5](</docs/en/model-config#work-with-fable-5>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, only Claude Sonnet 5, Opus 4.7 or later, and Fable 5. Older models, including Sonnet 4.5, Opus 4.5, Haiku, and claude-3 models, are not supported on any provider.
- * **Provider** : available by default on the Anthropic API, Claude Platform on AWS, Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in Claude apps gateway sessions. In v2.1.158 through v2.1.206, auto mode was off on all of these providers except the Anthropic API and Claude Platform on AWS until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
+ * **Provider** : available by default on the Anthropic API, Claude Platform on AWS, Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in Claude apps gateway sessions.
If Claude Code reports auto mode as unavailable, one of these requirements is unmet; this is not a transient outage. A separate message that names a model and says auto mode “cannot determine the safety” of an action means a classifier request failed; that failure is usually transient, but on Amazon Bedrock it can repeat until your account can invoke the named model. See the [error reference](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) for the causes and what to do. If you set `defaultMode: "auto"` in [settings](</docs/en/settings#available-settings>) and the session starts in `default` mode with no error, the setting is likely in `.claude/settings.json` or `.claude/settings.local.json`. Claude Code v2.1.142 and later ignore `auto` from those files so a repository cannot grant itself auto mode. Move it to `~/.claude/settings.json`.
@@ -263,7 +263,7 @@
* In [non-interactive mode](</docs/en/headless>) and Agent SDK sessions there is no turn boundary, so a deny is reused for the rest of the run
* 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, with the two exceptions the lists above cover: the classifier judges a push to a deploy-named branch such as `production` or `gh-pages` on its own terms, and still blocks a push whose content carries risk. 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, with the two exceptions the lists above cover. 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>).
###
@@ -329,7 +329,7 @@
Skip all checks with bypassPermissions mode
-`bypassPermissions` mode disables permission prompts and safety checks so tool calls execute immediately, including writes to protected paths. Before v2.1.126, protected-path writes still prompted in this mode. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) still force a prompt in this mode. MCP tools marked with [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) also still prompt; this requires Claude Code v2.1.199 or later. Removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, still prompt as a circuit breaker against model error. The circuit breaker also fires when the command contains command substitution with `$(...)` or backticks, or process substitution with `<(...)`, whether the removal sits inside the substitution, as in `echo "$(rm -rf ~)"`, or elsewhere in the same command. The plain form, typed as its own command, has prompted in this mode since the circuit breaker was introduced; before v2.1.208, commands containing those forms didn’t prompt. In sessions with bypass permissions available, Claude Code also doesn’t enforce plan mode’s blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and the removal circuit breaker above still prompt.
+`bypassPermissions` mode disables permission prompts and safety checks so tool calls execute immediately, including writes to protected paths. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) still force a prompt in this mode. MCP tools marked with [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) also still prompt; this requires Claude Code v2.1.199 or later. Removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, still prompt as a circuit breaker against model error. The circuit breaker also fires when the command contains command substitution with `$(...)` or backticks, or process substitution with `<(...)`, whether the removal sits inside the substitution, as in `echo "$(rm -rf ~)"`, or elsewhere in the same command. The plain form, typed as its own command, has prompted in this mode since the circuit breaker was introduced; before v2.1.208, commands containing those forms didn’t prompt. In sessions with bypass permissions available, Claude Code also doesn’t enforce plan mode’s blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and the removal circuit breaker above still prompt.
Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.
--- a/permissions.md
+++ b/permissions.md
@@ -49,7 +49,7 @@
`dontAsk`| Auto-denies tools unless pre-approved via `/permissions` or `permissions.allow` rules. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) are denied even if you’ve allowed them
`bypassPermissions`| Skips permission prompts, except those forced by explicit `ask` rules, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>). Root and home directory removals such as `rm -rf /` also still prompt as a circuit breaker
-`bypassPermissions` mode skips permission prompts, including for writes to `.git`, `.config/git`, `.claude`, `.vscode`, `.idea`, `.husky`, `.cargo`, `.devcontainer`, `.yarn`, and `.mvn`. Only use this mode in isolated environments like containers or VMs where Claude Code can’t cause damage.A few prompts still fire in this mode. Explicit `ask` rules, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) still prompt. Removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, also prompt as a circuit breaker against model error, including when the command contains command substitution with `$(...)` or backticks, or process substitution with `<(...)`. Before v2.1.208, only the plain form, such as `rm -rf ~` typed as its own command, prompted; commands that reached the removal through a substitution didn’t.
+`bypassPermissions` mode skips permission prompts, including for writes to [protected paths](</docs/en/permission-modes#protected-paths>) such as `.git` and `.claude`. Only use this mode in isolated environments like containers or VMs where Claude Code can’t cause damage.A few prompts still fire in this mode. Explicit `ask` rules, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) still prompt. Removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, also prompt as a circuit breaker against model error, including when the command contains command substitution with `$(...)` or backticks, or process substitution with `<(...)`.
To prevent `bypassPermissions` or `auto` mode from being used, set `permissions.disableBypassPermissionsMode` or `permissions.disableAutoMode` to `"disable"` in any [settings file](</docs/en/settings#settings-files>). These are most useful in managed settings where they can’t be overridden.
@@ -122,7 +122,7 @@
Wildcard patterns
-Bash rules support glob patterns with `*`. Wildcards can appear at any position in the command. This configuration allows npm and git commit commands while blocking git push:
+Bash rules support glob patterns with `*`. This configuration allows npm and git commit commands while blocking git push:
{
"permissions": {
@@ -139,7 +139,7 @@
}
}
-The space before `*` matters: `Bash(ls *)` matches `ls -la` but not `lsof`, while `Bash(ls*)` matches both. The `:*` suffix is an equivalent way to write a trailing wildcard, so `Bash(ls:*)` matches the same commands as `Bash(ls *)`. The permission dialog writes the space-separated form when you select “Yes, don’t ask again” for a command prefix. The `:*` form is only recognized at the end of a pattern. In a pattern like `Bash(git:* push)`, the colon is treated as a literal character and won’t match git commands.
+The `:*` suffix is an equivalent way to write a trailing wildcard, so `Bash(ls:*)` matches the same commands as `Bash(ls *)`. The permission dialog writes the space-separated form when you select “Yes, don’t ask again” for a command prefix. The `:*` form is only recognized at the end of a pattern. In a pattern like `Bash(git:* push)`, the colon is treated as a literal character and won’t match git commands.
###
@@ -509,15 +509,7 @@
Settings precedence
-Permission rules follow the same [settings precedence](</docs/en/settings#settings-precedence>) as all other Claude Code settings:
-
- 1. **Managed settings** : no other level, including command line arguments, can override a managed permission rule
- 2. **Command line arguments** : temporary session overrides
- 3. **Local project settings** (`.claude/settings.local.json`)
- 4. **Shared project settings** (`.claude/settings.json`)
- 5. **User settings** (`~/.claude/settings.json`)
-
-If a tool is denied at any level, no other level can allow it. For example, a managed settings deny can’t be overridden by `--allowedTools`, and `--disallowedTools` can add restrictions beyond what managed settings define. The same holds across settings scopes: if user settings allow a permission and project settings deny it, the deny rule blocks it. The reverse is also true: a user-level deny blocks a project-level allow, because deny rules from any scope are evaluated before allow rules. Embedding hosts can supply additional managed policy via the SDK `managedSettings` option, including permission allow rules unless the admin sets the `allowManaged*Only` locks; [Deliver policy to Claude Desktop sessions](</docs/en/claude-apps-gateway#deliver-policy-to-claude-desktop-sessions>) covers when embedder policy applies at all.
+Permission rules follow the same [settings precedence](</docs/en/settings#settings-precedence>) as all other Claude Code settings, with managed settings highest: no other level, including command line arguments, can override a managed permission rule. If a tool is denied at any level, no other level can allow it. For example, a managed settings deny can’t be overridden by `--allowedTools`, and `--disallowedTools` can add restrictions beyond what managed settings define. The same holds across settings scopes: if user settings allow a permission and project settings deny it, the deny rule blocks it. The reverse is also true: a user-level deny blocks a project-level allow, because deny rules from any scope are evaluated before allow rules. Embedding hosts can supply additional managed policy via the SDK `managedSettings` option, including permission allow rules unless the admin sets the `allowManaged*Only` locks; [Deliver policy to Claude Desktop sessions](</docs/en/claude-apps-gateway#deliver-policy-to-claude-desktop-sessions>) covers when embedder policy applies at all.
##
--- a/platforms.md
+++ b/platforms.md
@@ -14,10 +14,10 @@
[Desktop](</docs/en/desktop>)| Visual review, parallel sessions, managed setup| Diff viewer, app preview, [computer use](</docs/en/desktop#let-claude-use-your-computer>) and [Dispatch](</docs/en/desktop#sessions-from-dispatch>) on Pro and Max
[VS Code](</docs/en/vs-code>)| Working inside VS Code without switching to a terminal| Inline diffs, integrated terminal, file context
[JetBrains](</docs/en/jetbrains>)| Working inside IntelliJ, PyCharm, WebStorm, or other JetBrains IDEs| Diff viewer, selection sharing, terminal session
-[Web](</docs/en/claude-code-on-the-web>)| Long-running tasks that don’t need much steering, or work that should continue when you’re offline| Anthropic-managed cloud, continues after you disconnect
+[Web](</docs/en/claude-code-on-the-web>)| Long-running tasks that don’t need much steering, or work that should continue when you’re offline| Cloud, Anthropic-managed by default; continues after you disconnect
[Mobile](</docs/en/mobile>)| Starting and monitoring tasks while away from your computer| Cloud sessions from the Claude app for iOS and Android, [Remote Control](</docs/en/remote-control>) for local sessions, [Dispatch](</docs/en/desktop#sessions-from-dispatch>) to Desktop on Pro and Max
-The CLI is the most complete surface for terminal-native work: scripting and the Agent SDK are CLI-only. Third-party providers also work in [VS Code](</docs/en/vs-code#use-third-party-providers>). Enterprise [Desktop](</docs/en/desktop>) deployments support Google Cloud’s Agent Platform, and Desktop supports [gateway providers](</docs/en/llm-gateway-connect#desktop-app>); for Amazon Bedrock or Microsoft Foundry, use the CLI or VS Code, or [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>), which runs the Code tab on those providers. Desktop and the IDE extensions trade some CLI-only features for visual review and tighter editor integration. The web runs in Anthropic’s cloud, so tasks keep going after you disconnect. Mobile is a thin client into those same cloud sessions or into a local session via Remote Control, and can send tasks to Desktop with Dispatch. You can mix surfaces on the same project. Configuration, project memory, and MCP servers are shared across the local surfaces.
+The CLI is the most complete surface for terminal-native work: scripting and the Agent SDK are CLI-only. Third-party providers also work in [VS Code](</docs/en/vs-code#use-third-party-providers>). Enterprise [Desktop](</docs/en/desktop>) deployments support Google Cloud’s Agent Platform, and Desktop supports [gateway providers](</docs/en/llm-gateway-connect#desktop-app>); for Amazon Bedrock or Microsoft Foundry, use the CLI or VS Code, or [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>), which runs the Code tab on those providers. Desktop and the IDE extensions trade some CLI-only features for visual review and tighter editor integration. The web runs in the cloud, so tasks keep going after you disconnect. Mobile is a thin client into those same cloud sessions or into a local session via Remote Control, and can send tasks to Desktop with Dispatch. You can mix surfaces on the same project. Configuration, project memory, and MCP servers are shared across the local surfaces.
##
@@ -52,6 +52,7 @@
[Remote Control](</docs/en/remote-control>)| Drive a running session from [claude.ai/code](<https://claude.ai/code>) or the Claude mobile app| Your machine (CLI or VS Code)| Run `claude remote-control`| Steering in-progress work from another device
[Channels](</docs/en/channels>)| Push events from a chat app like Telegram or Discord, or your own server| Your machine (CLI)| [Install a channel plugin](</docs/en/channels#quickstart>) or [build your own](</docs/en/channels-reference>)| Reacting to external events like CI failures or chat messages
[Slack](</docs/en/slack>)| Mention `@Claude` in a team channel| Anthropic cloud| [Install the Slack app](</docs/en/slack#setting-up-claude-code-in-slack>) with [Claude Code on the web](</docs/en/claude-code-on-the-web>) enabled| PRs and reviews from team chat
+[Self-hosted environments](</docs/en/self-hosted-environments>)| Start a [cloud session](</docs/en/claude-code-on-the-web>) and pick your organization’s environment| Your organization’s infrastructure| [Deploy runners](</docs/en/self-hosted-environments-quickstart>), on Team and Enterprise plans| Cloud sessions that must run inside your network
[Scheduled tasks](</docs/en/scheduled-tasks>)| Set a schedule| [CLI](</docs/en/scheduled-tasks>), [Desktop](</docs/en/desktop-scheduled-tasks>), or [cloud](</docs/en/routines>)| Pick a frequency| Recurring automation like daily reviews
If you’re not sure where to start, [install the CLI](</docs/en/quickstart>) and run it in a project directory. If you’d rather not use a terminal, [Desktop](</docs/en/desktop-quickstart>) gives you the same engine with a graphical interface.
--- a/plugin-dependencies.md
+++ b/plugin-dependencies.md
@@ -1,4 +1,4 @@
-A plugin can depend on other plugins by listing them in `plugin.json` or in its marketplace entry. By default, a dependency tracks the latest available version, so an upstream release can change the dependency under your plugin without warning. Version constraints let you hold a dependency at a tested version range until you choose to move. When you install a plugin that declares dependencies, Claude Code resolves and installs them automatically and lists which dependencies were added at the end of the install output. If a dependency later goes missing, `/reload-plugins` and the background plugin auto-update reinstall it, provided its marketplace is already in your configured marketplaces. Re-running `claude plugin install` on the dependent plugin, or adding a marketplace with `claude plugin marketplace add`, also resolves any outstanding missing dependencies. Dependencies from a marketplace you have not added are left unresolved. This guide is for plugin authors who declare dependencies in `plugin.json` and for marketplace maintainers who tag releases. To install plugins that have dependencies, see [Discover and install plugins](</docs/en/discover-plugins>). For the full manifest schema, see the [Plugins reference](</docs/en/plugins-reference>).
+A plugin can depend on other plugins by listing them in `plugin.json` or in its marketplace entry. By default, a dependency tracks the latest available version, so an upstream release can change the dependency under your plugin without warning. Version constraints let you hold a dependency at a tested version range until you choose to move. When you install a plugin that declares dependencies, Claude Code resolves and installs them automatically. If a dependency later goes missing, `/reload-plugins` and the background plugin auto-update reinstall it, provided its marketplace is already in your configured marketplaces. Re-running `claude plugin install` on the dependent plugin, or adding a marketplace with `claude plugin marketplace add`, also resolves any outstanding missing dependencies. Dependencies from a marketplace you have not added are left unresolved. This guide is for plugin authors who declare dependencies in `plugin.json` and for marketplace maintainers who tag releases. To install plugins that have dependencies, see [Discover and install plugins](</docs/en/discover-plugins>). For the full manifest schema, see the [Plugins reference](</docs/en/plugins-reference>).
##
@@ -35,7 +35,7 @@
`version`| string| A [semver range](<https://github.com/npm/node-semver#ranges>) such as `~2.1.0`, `^2.0`, `>=1.4`, or `=2.1.0`. The dependency is fetched at the highest tagged version that satisfies this range.
`marketplace`| string| A different marketplace to resolve `name` in. Cross-marketplace dependencies are blocked unless the target marketplace is listed in `allowCrossMarketplaceDependenciesOn` in the root marketplace’s `marketplace.json`.
-The `version` field accepts any expression supported by Node’s `semver` package, including caret, tilde, hyphen, and comparator ranges. Pre-release versions such as `2.0.0-beta.1` are excluded unless your range opts in with a pre-release suffix like `^2.0.0-0`.
+Pre-release versions such as `2.0.0-beta.1` are excluded unless your range opts in with a pre-release suffix like `^2.0.0-0`.
##
@@ -163,7 +163,7 @@
Remove orphaned auto-installed dependencies
-Auto-installed dependencies stay on disk after the plugins that installed them are uninstalled, in case you reinstall a dependent plugin or want to keep using the dependency directly. To clean them up, run `claude plugin prune` to list the auto-installed dependencies that no longer have any installed plugin requiring them and remove them after a confirmation prompt. This requires Claude Code v2.1.121 or later.
+Auto-installed dependencies stay on disk after the plugins that installed them are uninstalled, in case you reinstall a dependent plugin or want to keep using the dependency directly. To clean them up, run `claude plugin prune` to list the auto-installed dependencies that no longer have any installed plugin requiring them and remove them after a confirmation prompt.
claude plugin prune
@@ -173,7 +173,7 @@
* `--dry-run` lists what would be removed without changing anything.
* `-y` skips the confirmation prompt. When stdin or stdout isn’t a terminal, prune lists the orphans and exits without removing them unless you pass `-y`.
-To prune as part of an uninstall, pass `--prune` to `claude plugin uninstall`. After removing the named plugin, Claude Code scans for and removes any auto-installed dependencies that are now orphaned. Plugins you installed yourself are never pruned, only those installed automatically through another plugin’s `dependencies` array. The same confirmation behavior applies: pass `-y` to skip the prompt. When stdin or stdout isn’t a terminal, the uninstall still completes, but the prune step lists the orphans and removes nothing unless you pass `-y`. For example, to uninstall `deploy-kit` and clean up the dependencies it leaves behind:
+To prune as part of an uninstall, pass `--prune` to `claude plugin uninstall`. After removing the named plugin, Claude Code scans for and removes any auto-installed dependencies that are now orphaned. Plugins you installed yourself are never pruned, only those installed automatically through another plugin’s `dependencies` array. The same confirmation behavior applies. When stdin or stdout isn’t a terminal, the uninstall still completes, but the prune step lists the orphans and removes nothing unless you pass `-y`. For example, to uninstall `deploy-kit` and clean up the dependencies it leaves behind:
claude plugin uninstall deploy-kit --prune
--- a/plugin-hints.md
+++ b/plugin-hints.md
@@ -1,4 +1,4 @@
-If you maintain a CLI or SDK and have a plugin in the official Anthropic marketplace, your tool can prompt Claude Code users to install that plugin. Your CLI writes a one-line marker to stderr when it detects it is running inside Claude Code. Claude Code reads the marker, strips it from the output, and shows the user a one-time install prompt. Claude Code strips the hint line from the command output before sending it to the model, so the marker never appears in the conversation and is not counted toward token usage. The protocol requires no extra commands and does not change what your CLI prints for users outside Claude Code. This page is for CLI and SDK maintainers. If you are looking to install plugins, see [Discover and install plugins](</docs/en/discover-plugins>).
+If you maintain a CLI or SDK and have a plugin in the official Anthropic marketplace, your tool can prompt Claude Code users to install that plugin. Your CLI writes a one-line marker to stderr when it detects it is running inside Claude Code. Claude Code reads the marker, strips it from the output, and shows the user a one-time install prompt. The protocol requires no extra commands and does not change what your CLI prints for users outside Claude Code. This page is for CLI and SDK maintainers. If you are looking to install plugins, see [Discover and install plugins](</docs/en/discover-plugins>).
##
Show diff (149 lines)
--- a/plugin-marketplaces.md
+++ b/plugin-marketplaces.md
@@ -228,7 +228,7 @@
---|---|---
`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. Requires Claude Code v2.1.143 or later.
`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. Omit to fall back to the git commit SHA. See Version resolution.
+`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. If set in neither place, the version comes from the next source in Version resolution.
`author`| object| Plugin author information (`name` required; `email` and `url` optional)
`homepage`| string| Plugin homepage or documentation URL
`repository`| string| Source code repository URL
@@ -267,11 +267,12 @@
`url`| object| `url`, `ref?`, `sha?`| Git URL source
`git-subdir`| object| `url`, `path`, `ref?`, `sha?`| Subdirectory within a git repo. Clones sparsely to minimize bandwidth for monorepos
`npm`| object| `package`, `version?`, `registry?`| Installed via `npm install`
+`archive`| object| `url`, `sha256?`| Zip archive downloaded over HTTPS. Works without git or npm on the user’s machine. Requires Claude Code v2.1.224 or later
**Marketplace sources vs plugin sources** : These are different concepts that control different things.
- * **Marketplace source** : where to fetch the `marketplace.json` catalog itself. Set when users run `/plugin marketplace add` or in `extraKnownMarketplaces` settings. Supports `ref` (branch/tag) but not `sha`.
- * **Plugin source** : where to fetch an individual plugin listed in the marketplace. Set in the `source` field of each plugin entry inside `marketplace.json`. Supports both `ref` (branch/tag) and `sha` (exact commit).
+ * **Marketplace source** : where to fetch the `marketplace.json` catalog itself. Set when users run `/plugin marketplace add` or in `extraKnownMarketplaces` settings. Git-based marketplace sources support `ref` (branch/tag) but not `sha`.
+ * **Plugin source** : where to fetch an individual plugin listed in the marketplace. Set in the `source` field of each plugin entry inside `marketplace.json`. Git-based plugin sources support both `ref` (branch/tag) and `sha` (exact commit).
For example, a marketplace hosted at `acme-corp/plugin-catalog` (marketplace source) can list a plugin fetched from `acme-corp/code-formatter` (plugin source). The marketplace source and plugin source point to different repositories and are pinned independently.
@@ -280,7 +281,7 @@
If you distribute this marketplace through [Organization settings > Plugins](<https://claude.ai/admin-settings/plugins>) on a Team or Enterprise plan, different source rules apply:
* The marketplace repository must be private or internal. Organization sync reads it through the Claude GitHub App or your organization’s GitHub Enterprise App.
- * Plugin sources of type `github`, `url`, and `git-subdir` are supported. `npm` sources are not.
+ * Plugin sources of type `github`, `url`, and `git-subdir` are supported. `npm` and `archive` sources are not.
* A plugin source can be private in two cases: a github.com source that shares the marketplace repository’s owner, or a source on your organization’s GitHub Enterprise host with the GHE App installed on the repository. Organization sync fetches every other source without credentials, so github.com repositories under a different owner and repositories on other hosts, such as GitLab or Bitbucket, must be public.
To include private plugins, place the plugin folders inside the marketplace repository and reference them with a relative path. Organization sync packages each plugin during distribution, so users never need access to a separate source repository. See [Manage plugins for your organization](<https://support.claude.com/en/articles/13837433>) for the admin workflow.
@@ -300,7 +301,7 @@
Paths resolve relative to the marketplace root, which is the directory containing `.claude-plugin/`. In the example above, `./plugins/my-plugin` points to `<repo>/plugins/my-plugin`, even though `marketplace.json` lives at `<repo>/.claude-plugin/marketplace.json`. Don’t use `../` to reference paths outside the marketplace root.
-Relative paths resolve against a local copy of the marketplace, so they work when users add your marketplace from a git source or a local directory. If users add your marketplace via a direct URL to the `marketplace.json` file, relative paths won’t resolve, because only that file is downloaded. For URL-based distribution, use GitHub, npm, or git URL sources instead. See Troubleshooting for details.
+Claude Code resolves relative paths against a local copy of the marketplace, so they work when users add your marketplace from a git source or a local directory. If users add your marketplace via a direct URL to the `marketplace.json` file, relative paths won’t resolve, because Claude Code downloads only that file. For URL-based distribution, use GitHub, npm, git URL, or archive sources instead. See Troubleshooting for details.
###
@@ -449,6 +450,50 @@
`package`| string| Required. Package name or scoped package (for example, `@org/plugin`)
`version`| string| Optional. Version or version range (for example, `2.1.0`, `^2.0.0`, `~1.5.0`)
`registry`| string| Optional. Custom npm registry URL. Defaults to the system npm registry (typically npmjs.org)
+
+###
+
+
+
+Zip archives
+
+Use `archive` to distribute a plugin as a zip file that Claude Code downloads over HTTPS, so installs work without git or npm on the user’s machine. Host the file on any static file server or artifact repository, such as an S3 bucket, an Artifactory generic repository, or nginx. Requires Claude Code v2.1.224 or later. On versions v2.1.120 through v2.1.223, installing the plugin fails with `This plugin uses a source type your Claude Code version does not support. Update Claude Code and try again.`; on older versions, a marketplace containing an `archive` entry fails to load entirely. This entry installs the plugin from a zip file on an artifact server:
+
+ {
+ "name": "my-plugin",
+ "source": {
+ "source": "archive",
+ "url": "https://artifacts.example.com/claude-plugins/my-plugin-2.1.0.zip"
+ }
+ }
+
+When you build the zip, you can zip the plugin’s contents directly or zip the plugin folder itself. Claude Code looks for `.claude-plugin/` at the top of the archive, then inside a single top-level folder, so both layouts install:
+
+ my-plugin.zip my-plugin.zip
+ ├── .claude-plugin/ └── my-plugin/
+ │ └── plugin.json ├── .claude-plugin/
+ └── commands/ │ └── plugin.json
+ └── commands/
+
+Claude Code doesn’t look deeper than one folder, so a plugin nested further down fails to install. Claude Code refuses archives larger than 256 MiB. To pin the exact file, add a `sha256` field with the archive’s digest:
+
+ {
+ "name": "my-plugin",
+ "source": {
+ "source": "archive",
+ "url": "https://artifacts.example.com/claude-plugins/my-plugin-2.1.0.zip",
+ "sha256": "6bfa50e3d2e00c052b46abe51fff89346ac803e45771f76dcf6df1ab74cca5e1"
+ }
+ }
+
+If the downloaded file doesn’t match the pin, Claude Code refuses the install and reports [`Plugin archive integrity check failed`](</docs/en/errors#plugin-archive-integrity-check-failed>). Archive sources accept these fields:
+
+Field| Type| Description
+---|---|---
+`url`| string| Required. HTTPS URL of the zip archive. Claude Code rejects `http://` URLs, along with loopback, link-local, and cloud-metadata hosts. Every redirect hop must satisfy the same rules, or Claude Code refuses the download
+`sha256`| string| Optional. SHA-256 digest of the archive as 64 hex characters, uppercase or lowercase. Claude Code verifies every download against it and refuses the install on a mismatch
+
+The `sha256` digest also serves as the plugin’s version when neither `plugin.json` nor the marketplace entry declares one. See [Version management](</docs/en/plugins-reference#version-management>). If you declare a `version`, that version string is the update signal, so after changing the zip and its digest, bump the version too, or users keep the cached copy. If you register the marketplace from a URL source with `headers`, such as an [`extraKnownMarketplaces` entry](</docs/en/settings#extraknownmarketplaces>), Claude Code sends those headers with archive downloads whose URL shares the marketplace URL’s origin: the same scheme, host, and port. Claude Code downloads an archive on a different origin without the headers, and drops them when a redirect leaves the origin, so it never sends a marketplace credential to a third-party host.
###
@@ -506,7 +551,7 @@
Key things to notice:
* **`commands` and `agents`**: you can specify multiple directories or individual files. Paths are relative to the plugin root.
- * **`${CLAUDE_PLUGIN_ROOT}`** : use this variable in hook commands and MCP server configs to reference files within the plugin’s installation directory. This is necessary because plugins are copied to a cache location when installed.
+ * **`${CLAUDE_PLUGIN_ROOT}`** : use this variable in hook commands and MCP server configs to reference files within the plugin’s installation directory.
* See the [substitution table](</docs/en/plugins-reference#environment-variables>) for which config fields substitute it per server type
* For dependencies or state that should survive plugin updates, use [`${CLAUDE_PLUGIN_DATA}`](</docs/en/plugins-reference#persistent-data-directory>) instead
* **`strict: false`** : since this is set to false, the plugin doesn’t need its own `plugin.json`. The marketplace entry defines everything. See Strict mode below.
@@ -612,19 +657,6 @@
The rewrite stores the token in plaintext in your gitconfig, so use a token with read-only access to the marketplace repository.
In CI/CD environments, configure a git credential helper before installing plugins from private repositories. On GitHub Actions, export a token with read access to the marketplace repository as `GH_TOKEN`, then run `gh auth setup-git`. The default workflow token can only access the workflow’s own repository, so a private marketplace in another repository needs a personal access token or app token. A global URL rewrite configured in the pipeline also authenticates the background pull directly.
-
-###
-
-
-
-Test locally before distribution
-
-Test your marketplace locally before sharing:
-
- /plugin marketplace add ./my-marketplace
- /plugin install quality-review-plugin@my-plugins
-
-For the full range of add commands (GitHub, Git URLs, local paths, remote URLs), see [Add marketplaces](</docs/en/discover-plugins#add-marketplaces>).
###
@@ -798,10 +830,11 @@
1. `version` in the plugin’s `plugin.json`
2. `version` in the plugin’s marketplace entry
3. The git commit SHA of the plugin’s source
-
-For the git-based source types `github`, `url`, `git-subdir`, and relative paths inside a git-hosted marketplace, you can omit `version` entirely and every new commit is treated as a new version. This is the simplest setup for internal or actively-developed plugins.
-
-Setting `version` pins the plugin. If `plugin.json` declares `"version": "1.0.0"`, pushing new commits without changing that string does nothing for existing users, because Claude Code sees the same version and keeps the cached copy. Bump the field on every release, or omit it to use the commit SHA.Avoid setting `version` in both `plugin.json` and the marketplace entry. Claude Code always uses the `plugin.json` value without warning, so a stale manifest version can mask a version you set in `marketplace.json`.
+ 4. For `archive` sources, the `sha256` pin in the marketplace entry, or the digest of the downloaded file when you set no pin
+
+For the git-based source types `github`, `url`, `git-subdir`, and relative paths inside a git-hosted marketplace, you can omit `version` entirely. This is the simplest setup for internal or actively-developed plugins.
+
+Setting `version` pins the plugin. If you declare `"version": "1.0.0"` in `plugin.json` and push new commits without changing that string, existing users keep the cached copy, because Claude Code sees the same version. Bump the field on every release, or omit it to fall back to the resolved version above.Avoid setting `version` in both `plugin.json` and the marketplace entry. Claude Code always uses the `plugin.json` value without warning, so a stale manifest version can mask a version you set in `marketplace.json`.
####
@@ -1163,7 +1196,7 @@
**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** : URL-based marketplaces only download the `marketplace.json` file itself. They don’t download plugin files from the 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 use GitHub, npm, or git URL sources instead of relative paths:
+ * **Use external sources** : change plugin entries to use GitHub, npm, git URL, or archive sources instead of relative paths:
{ "name": "my-plugin", "source": { "source": "github", "repo": "owner/repo" } }
--- a/plugin-relevance.md
+++ b/plugin-relevance.md
@@ -74,7 +74,7 @@
`filesRead`| array of strings| Glob patterns matched against the paths of files Claude has read this session, for example `["**/*.tf"]`. Forward-slash normalized and case-insensitive. Maximum 10 patterns of 256 characters each.
`manifestDeps`| array of objects| Dependencies declared in package manifests Claude has read this session. Each entry is `{ "file": "...", "pattern": "..." }`, where `file` is a regular expression matched against the manifest file’s path as recorded in session state, typically an absolute path, and `pattern` is a regular expression matched against that file’s contents. Anchor `file` at the end, for example `[/\\\\]package\\.json$` in JSON-escaped form, because a start-anchored pattern never matches an absolute path. Paths are not separator-normalized for this signal, so Windows paths use backslashes. Manifest files larger than 512 KB are skipped. Both values are JavaScript `RegExp` source strings of at most 256 characters. `file` matches case-insensitively. `pattern` is case-sensitive. Maximum 10 entries.
-The `cli`, `hosts`, `filesRead`, and `manifestDeps` signals need session history, so they can only match on the spinner tip and the Discover tab. Only `cwd` can match at session start. The `filesRead` and `manifestDeps` signals test the session’s recorded file state, which also includes files Claude has written or edited and auto-loaded `CLAUDE.md` memory files. The following example uses `manifestDeps` to suggest a Stripe plugin once Claude has read a `package.json` that depends on `stripe`. The `file` pattern uses `[/\\\\]` so it matches both forward-slash and backslash path separators, and `\\.` so the dot is literal. In JSON, each backslash in the regular expression is written twice.
+The `cli`, `hosts`, `filesRead`, and `manifestDeps` signals need session history, so they can only match on the spinner tip and the Discover tab. The `filesRead` and `manifestDeps` signals test the session’s recorded file state, which also includes files Claude has written or edited and auto-loaded `CLAUDE.md` memory files. The following example uses `manifestDeps` to suggest a Stripe plugin once Claude has read a `package.json` that depends on `stripe`. The `file` pattern uses `[/\\\\]` so it matches both forward-slash and backslash path separators, and `\\.` so the dot is literal. In JSON, each backslash in the regular expression is written twice.
{
"name": "stripe-helpers",
@@ -92,7 +92,7 @@
}
}
-Claude Code ignores unknown fields under `relevance` and `relevance.signals` at load time, so older clients continue to load your marketplace. Run `claude plugin validate` against your marketplace directory, for example `claude plugin validate ./my-marketplace`, to surface them as warnings.
+Claude Code ignores unknown fields under `relevance` and `relevance.signals` at load time, so older clients continue to load your marketplace.
##
@@ -120,8 +120,6 @@
"pluginSuggestionMarketplaces": ["claude-plugins-official"]
}
-See the [settings reference](</docs/en/settings>) for `pluginSuggestionMarketplaces` and [`extraKnownMarketplaces`](</docs/en/settings#extraknownmarketplaces>) for full configuration details.
-
##
@@ -137,7 +135,7 @@
plugin suggestion: terraform-helpers@acme-corp-plugins · /plugin
-A given plugin’s suggestion appears at most once every three sessions across the spinner tip and the session-start notification combined, and neither repeats once the plugin is installed. The session-start notification additionally stops appearing after the suggestion has been shown twice. In the `/plugin` Discover tab, the plugin is pinned above the other results with an annotation that names the matching signal, such as `suggested for this directory` or `suggested for terraform commands`. The Discover tab pins a given plugin once; later visits list it in normal order. The Discover-tab pin requires Claude Code v2.1.154 or later. On v2.1.152 only the spinner tip appears; the session-start notification is added in v2.1.153.
+A given plugin’s suggestion appears at most once every three sessions across the spinner tip and the session-start notification combined, and neither repeats once the plugin is installed. The session-start notification additionally stops appearing after the suggestion has been shown twice. In the `/plugin` Discover tab, the plugin is pinned above the other results with an annotation that names the matching signal, such as `suggested for this directory` or `suggested for terraform commands`. The Discover tab pins a given plugin once; later visits list it in normal order.
##
--- a/plugins.md
+++ b/plugins.md
@@ -13,21 +13,6 @@
**Standalone** (`.claude/` directory)| `/hello`| Personal workflows, project-specific customizations, quick experiments
**Plugins** (self-contained directories with skills, agents, hooks, or a `.claude-plugin/plugin.json` manifest)| `/plugin-name:hello`| Sharing with teammates, distributing to community, versioned releases, reusable across projects
-**Use standalone configuration when** :
-
- * You’re customizing Claude Code for a single project
- * The configuration is personal and doesn’t need to be shared
- * You’re experimenting with skills or hooks before packaging them
- * You want short skill names like `/hello` or `/deploy`
-
-**Use plugins when** :
-
- * You want to share functionality with your team or community
- * You need the same skills/agents across multiple projects
- * You want version control and easy updates for your extensions
- * You’re distributing through a marketplace
- * You’re okay with namespaced skills like `/my-plugin:hello` (namespacing prevents conflicts between plugins)
-
Start with standalone configuration in `.claude/` for quick iteration, then convert to a plugin when you’re ready to share.
##
@@ -45,8 +30,6 @@
Prerequisites
* Claude Code [installed and authenticated](</docs/en/quickstart#step-1-install-claude-code>)
-
-If you don’t see the `/plugin` command, update Claude Code to the latest version. See [Troubleshooting](</docs/en/troubleshooting>) for upgrade instructions.
###
@@ -89,7 +72,7 @@
---|---
`name`| Unique identifier and skill namespace. Skills are prefixed with this (e.g., `/my-first-plugin:hello`).
`description`| Shown in the plugin manager when browsing or installing plugins.
-`version`| Optional. If set, users only receive updates when you bump this field. If omitted and your plugin is distributed via git, the commit SHA is used and every commit counts as a new version. See [version management](</docs/en/plugins-reference#version-management>).
+`version`| Optional. If set, users only receive updates when you bump this field. If omitted, the version comes from the next source in [version management](</docs/en/plugins-reference#version-management>).
`author`| Optional. Helpful for attribution.
For additional fields like `homepage`, `repository`, and `license`, see the [full manifest schema](</docs/en/plugins-reference#plugin-manifest-schema>).
@@ -150,12 +133,6 @@
/my-first-plugin:hello Alex
Claude will greet you by name. For more on passing arguments to skills, see [Skills](</docs/en/skills#pass-arguments-to-skills>).
-
-You’ve successfully created and tested a plugin with these key components:
-
- * **Plugin manifest** (`.claude-plugin/plugin.json`): describes your plugin’s metadata
- * **Skills directory** (`skills/`): contains your custom skills
- * **Skill arguments** (`$ARGUMENTS`): captures user input for dynamic behavior
The `--plugin-dir` flag is useful for development and testing. When you’re ready to share your plugin with others, see [Create and distribute a plugin marketplace](</docs/en/plugin-marketplaces>).
@@ -313,7 +290,7 @@
claude --plugin-dir ./my-plugin
-The flag also accepts a `.zip` archive of the plugin directory, which requires Claude Code v2.1.128 or later.
+The flag also accepts a `.zip` archive of the plugin directory.
claude --plugin-dir ./my-plugin.zip
@@ -356,7 +333,7 @@
When your plugin is ready to share:
1. **Add documentation** : Include a `README.md` with installation and usage instructions
- 2. **Choose a versioning strategy** : Decide whether to set an explicit `version` or rely on the git commit SHA. See [version management](</docs/en/plugins-reference#version-management>)
+ 2. **Choose a versioning strategy** : Decide whether to set an explicit `version` or rely on the fallback described in [version management](</docs/en/plugins-reference#version-management>).
3. **Create or use a marketplace** : Distribute through [plugin marketplaces](</docs/en/plugin-marketplaces>) for installation
4. **Test with others** : Have team members test the plugin before wider distribution
@@ -379,8 +356,6 @@
* **Console** : [platform.claude.com/plugins/submit](<https://platform.claude.com/plugins/submit>)
The claude.ai form requires a Team or Enterprise organization and directory management access; organization Owners have this access by default. Individual authors who aren’t part of a Team or Enterprise organization can use the Console form instead. Run `claude plugin validate ./your-plugin` locally before you submit, replacing `./your-plugin` with the path to your plugin directory. The review pipeline runs the same check on every submission, along with automated safety screening. When validation passes, Claude Code prints `✔ Validation passed`, or `✔ Validation passed with warnings` if there are warnings. Warnings don’t fail validation; add `--strict` to treat them as errors. Approved plugins are pinned to a specific commit SHA in the [`anthropics/claude-plugins-community`](<https://github.com/anthropics/claude-plugins-community>) catalog, and CI bumps the pin automatically as you push new commits to your repository. The public catalog syncs nightly from the review pipeline, so there can be a delay between approval and your plugin appearing in `marketplace.json`. To check whether your plugin is installable yet, search for its name in the [community catalog](<https://github.com/anthropics/claude-plugins-community/blob/main/.claude-plugin/marketplace.json>). The official marketplace, `claude-plugins-official`, is curated separately. Anthropic decides which plugins to include at its discretion. There is no application process, and the submission form does not add plugins to the official marketplace. If Anthropic lists your plugin in the official marketplace, your CLI can prompt Claude Code users to install it. See [Recommend your plugin from your CLI](</docs/en/plugin-hints>).
-
-For complete technical specifications, debugging techniques, and distribution strategies, see [Plugins reference](</docs/en/plugins-reference>).
##
Show diff (144 lines)
--- a/plugins-reference.md
+++ b/plugins-reference.md
@@ -1,6 +1,6 @@
Looking to install plugins? See [Discover and install plugins](</docs/en/discover-plugins>). For creating plugins, see [Plugins](</docs/en/plugins>). For distributing plugins, see [Plugin marketplaces](</docs/en/plugin-marketplaces>).
-This reference provides complete technical specifications for the Claude Code plugin system, including component schemas, CLI commands, and development tools. A **plugin** is a self-contained directory of components that extends Claude Code with custom functionality. Plugin components include skills, agents, hooks, MCP servers, LSP servers, and monitors.
+A **plugin** is a self-contained directory of components that extends Claude Code with custom functionality. Plugin components include skills, agents, hooks, MCP servers, LSP servers, and monitors.
##
@@ -24,13 +24,7 @@
└── code-reviewer/
└── SKILL.md
-**Integration behavior** :
-
- * Skills and commands are automatically discovered when the plugin is installed
- * Claude can invoke them automatically based on task context
- * Skills can include supporting files alongside SKILL.md
-
-If a plugin has no `skills/` directory and no `skills` manifest field, a `SKILL.md` at the plugin root is loaded as a single skill. Set the frontmatter `name` field to control the skill’s invocation name. Without it, Claude Code falls back to the install directory name, which for marketplace-installed plugins is a version string that changes on every update. For plugins that ship more than one skill, use the `skills/` directory layout shown above. In plugin skills and commands, Boolean frontmatter fields such as `disable-model-invocation` accept `yes`, `no`, `on`, `off`, `1`, and `0` in any letter case, in addition to `true` and `false`. Before v2.1.218, Claude Code recognized only `true` and `false`. For complete details, see [Skills](</docs/en/skills>).
+Skills and commands are automatically discovered when the plugin is installed. If a plugin has no `skills/` directory and no `skills` manifest field, a `SKILL.md` at the plugin root is loaded as a single skill. Set the frontmatter `name` field to control the skill’s invocation name. Without it, Claude Code falls back to the install directory name, which for marketplace-installed plugins is a version string that changes on every update. For plugins that ship more than one skill, use the `skills/` directory layout shown above. In plugin skills and commands, Boolean frontmatter fields such as `disable-model-invocation` accept `yes`, `no`, `on`, `off`, `1`, and `0` in any letter case, in addition to `true` and `false`. Before v2.1.218, Claude Code recognized only `true` and `false`. For complete details, see [Skills](</docs/en/skills>).
###
@@ -51,14 +45,7 @@
Detailed system prompt for the agent describing its role, expertise, and behavior.
-Plugin agents support `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, and `isolation` frontmatter fields. The only valid `isolation` value is `"worktree"`. For security reasons, `hooks`, `mcpServers`, and `permissionMode` are not supported for plugin-shipped agents. **Integration points** :
-
- * Agents appear in the [@-mention typeahead](</docs/en/sub-agents#invoke-subagents-explicitly>) under their scoped name, such as `my-plugin:code-reviewer`, once the plugin is enabled
- * Claude can invoke agents automatically based on task context
- * Agents can be invoked manually by users
- * Plugin agents work alongside built-in Claude agents
-
-For complete details, see [Subagents](</docs/en/sub-agents>).
+Plugin agents support `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, and `isolation` frontmatter fields. The only valid `isolation` value is `"worktree"`. For security reasons, `hooks`, `mcpServers`, and `permissionMode` are not supported for plugin-shipped agents. Agents appear in the [@-mention typeahead](</docs/en/sub-agents#invoke-subagents-explicitly>) under their scoped name, such as `my-plugin:code-reviewer`, once the plugin is enabled. For complete details, see [Subagents](</docs/en/sub-agents>).
###
@@ -158,7 +145,6 @@
* Plugin MCP servers start automatically when the plugin is enabled
* Servers appear as standard MCP tools in Claude’s toolkit
- * Server capabilities integrate seamlessly with Claude’s existing tools
* Plugin servers can be configured independently of user MCP servers
* If you run [`/reload-plugins`](</docs/en/discover-plugins#apply-plugin-changes-without-restarting>) mid-session, Claude Code keeps the live connections of servers whose configuration is unchanged
@@ -226,7 +212,7 @@
`maxRestarts`| Maximum number of restart attempts before giving up
`diagnostics`| Whether to push diagnostics into Claude’s context after edits (default `true`). Set to `false` to keep code navigation but suppress automatic diagnostic injection.
-`restartOnCrash` and `shutdownTimeout` require Claude Code v2.1.205 or later. Before v2.1.205, the config schema accepted both options but setting either one caused Claude Code to skip that LSP server entirely at startup, with the reason visible only in `claude --debug` output. **Multiple servers for the same extension** : when more than one enabled LSP server declares the same file extension in `extensionToLanguage`, whether the servers come from one plugin or from different plugins, the first server registered handles files with that extension and the others never start. The `/plugin` interface shows a warning naming the plugin whose server is active. **Servers that fail to initialize** : Claude Code skips a server whose configuration is invalid, for example one missing `command` or `extensionToLanguage`, and the other configured servers still start. Run `claude --debug` to see why a server was skipped. A skipped server doesn’t claim its file extensions, so another valid server that declares the same extension, from the same or a different plugin, still handles those files. Before v2.1.205, a server that failed to initialize still claimed its extensions and blocked another valid server for the same extension.
+`restartOnCrash` and `shutdownTimeout` require Claude Code v2.1.205 or later. Before v2.1.205, the config schema accepted both options but setting either one caused Claude Code to skip that LSP server entirely at startup, with the reason visible only in `claude --debug` output. **Multiple servers for the same extension** : when more than one enabled LSP server declares the same file extension in `extensionToLanguage`, whether the servers come from one plugin or from different plugins, the first server registered handles files with that extension and the others never start. The `/plugin` interface shows a warning naming the plugin whose server is active. **Servers that fail to initialize** : Claude Code skips a server whose configuration is invalid, for example one missing `command` or `extensionToLanguage`, and the other configured servers still start. Run `claude --debug` to see why a server was skipped. A skipped server doesn’t claim its file extensions, so another valid server that declares the same extension, from the same or a different plugin, still handles those files.
**You must install the language server binary separately.** LSP plugins configure how Claude Code connects to a language server, but they don’t include the server itself. If you see `Executable not found in $PATH` in the `/plugin` Errors tab, install the required binary for your language.
@@ -451,7 +437,7 @@
---|---|---|---
`$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. Requires Claude Code v2.1.143 or later.| `"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. If omitted, Claude Code falls back to the git commit SHA, so every commit is treated as a new version. If also set in the marketplace entry, `plugin.json` wins. See Version management.| `"2.1.0"`
+`version`| string| Optional. Semantic version. Setting this pins the plugin to that version string, so users only receive updates when you bump it. 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"}`
`homepage`| string| Documentation URL| `"https://docs.example.com"`
@@ -611,7 +597,7 @@
* Claude Code takes the skill’s invocation name from the frontmatter `name` field in `SKILL.md`, so the name stays stable whatever the install directory is named
* If `name` isn’t set in the frontmatter, Claude Code falls back to the directory basename
-A plugin that has a `SKILL.md` at its root, no `skills/` subdirectory, and no `skills` manifest field is automatically loaded as a single-skill plugin in Claude Code v2.1.142 and later. You do not need to set `"skills": ["./"]` in `plugin.json` for this layout. The skill’s invocation name follows the same rule as above: the frontmatter `name` field, or the directory basename as a fallback. **Path examples** :
+A plugin that has a `SKILL.md` at its root, no `skills/` subdirectory, and no `skills` manifest field is automatically loaded as a single-skill plugin in Claude Code v2.1.142 and later. You do not need to set `"skills": ["./"]` in `plugin.json` for this layout. **Path examples** :
{
"commands": [
@@ -719,7 +705,7 @@
* Through `claude --plugin-dir` or `claude --plugin-url`, for the duration of a session.
* Through a marketplace, installed for future sessions.
-For security and verification purposes, Claude Code copies _marketplace_ plugins to the user’s local **plugin cache** (`~/.claude/plugins/cache`) rather than using them in-place. Understanding this behavior is important when developing plugins that reference external files. Each installed version is a separate directory in the cache. When you update or uninstall a plugin, the previous version directory is marked as orphaned and removed automatically 14 days later. The grace period lets concurrent Claude Code sessions that already loaded the old version keep running without errors. Claude’s Glob and Grep tools skip orphaned version directories during searches, so file results don’t include outdated plugin code.
+For security and verification purposes, Claude Code copies _marketplace_ plugins to the user’s local **plugin cache** (`~/.claude/plugins/cache`) rather than using them in-place. Each installed version is a separate directory in the cache. When you update or uninstall a plugin, the previous version directory is marked as orphaned and removed automatically 14 days later. The grace period lets concurrent Claude Code sessions that already loaded the old version keep running without errors. Claude’s Glob and Grep tools skip orphaned version directories during searches, so file results don’t include outdated plugin code.
###
@@ -744,8 +730,6 @@
For plugins installed with `--plugin-dir` or from a local path, only symlinks that resolve within the plugin’s own directory are preserved. All others are skipped. The following command creates a link from inside a marketplace plugin to a shared skill defined by a sibling plugin. On Windows, use `mklink /D` from an elevated Command Prompt or enable Developer Mode:
ln -s ../../shared-plugin/skills/foo ./skills/foo
-
-This provides flexibility while maintaining the security benefits of the caching system.
* * *
@@ -968,8 +952,6 @@
**Aliases:** `autoremove` The command lists orphaned dependencies and asks for confirmation before removing them. To remove a plugin and clean up its dependencies in one step, run `claude plugin uninstall <plugin> --prune`.
-`claude plugin prune` requires Claude Code v2.1.121 or later.
-
###
@@ -1235,16 +1217,7 @@
Directory structure mistakes
-**Symptoms** : Plugin loads but components (skills, agents, hooks) are missing. **Correct structure** : Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`.
-
- my-plugin/
- ├── .claude-plugin/
- │ └── plugin.json ← Only manifest here
- ├── commands/ ← At root level
- ├── agents/ ← At root level
- └── hooks/ ← At root level
-
-If your components are inside `.claude-plugin/`, move them to the plugin root. **Debug checklist** :
+**Symptoms** : Plugin loads but components (skills, agents, hooks) are missing. **Correct structure** : Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`. **Debug checklist** :
1. Run `claude --debug` and look for “loading plugin” messages
2. Check that each component directory is listed in the debug output
@@ -1269,16 +1242,16 @@
1. The `version` field in the plugin’s `plugin.json`
2. The `version` field in the plugin’s marketplace entry in `marketplace.json`
3. The git commit SHA of the plugin’s source, for `github`, `url`, `git-subdir`, and relative-path sources in a git-hosted marketplace
- 4. `unknown`, for `npm` sources or local directories not inside a git repository
-
-This gives you two ways to version a plugin:
+ 4. The SHA-256 digest, for [`archive` sources](</docs/en/plugin-marketplaces#zip-archives>): the `sha256` pin in the marketplace entry, or the digest of the downloaded file when you set no pin. Claude Code shortens it to the first 12 characters
+ 5. `unknown`, for `npm` sources or local directories not inside a git repository
+
+This gives you three ways to version a plugin:
Approach| How| Update behavior| Best for
---|---|---|---
**Explicit version**| Set `"version": "2.1.0"` in `plugin.json`| Users get updates only when you bump this field. Pushing new commits without bumping it has no effect, and `/plugin update` reports “already at the latest version”.| Published plugins with stable release cycles
-**Commit-SHA version**| Omit `version` from both `plugin.json` and the marketplace entry| Users get updates on every new commit to the plugin’s git source| Internal or team plugins under active development
-
-If you set `version` in `plugin.json`, you must bump it every time you want users to receive changes. Pushing new commits alone is not enough, because Claude Code sees the same version string and keeps the cached copy. If you’re iterating quickly, leave `version` unset so the git commit SHA is used instead.
+**Commit-SHA version**| Omit `version` from both `plugin.json` and the marketplace entry| Users get updates whenever the source’s resolved commit changes| Internal or team plugins under active development
+**Digest version**| Use an [`archive` source](</docs/en/plugin-marketplaces#zip-archives>) and omit `version` from both `plugin.json` and the marketplace entry| With a `sha256` pin, users get updates when you change the pin. Without one, users get updates whenever the hosted zip file’s bytes change| Plugins published as zip files to a static server or artifact repository
If you use explicit versions, follow [semantic versioning](<https://semver.org>) (`MAJOR.MINOR.PATCH`): bump MAJOR for breaking changes, MINOR for new features, PATCH for bug fixes. Document changes in a `CHANGELOG.md`.
--- a/python.md
+++ b/python.md
@@ -2367,7 +2367,7 @@
`tool_input`| `dict[str, Any]`| Input parameters that were used
`tool_use_id`| `str`| Unique identifier for this tool use
`error`| `str`| Error message from the failed execution
-`is_interrupt`| `bool` (optional)| Whether the failure was caused by an interrupt
+`is_interrupt`| `bool` (optional)| True when the failure reached Claude Code as an abort rather than as an error the tool reported. Cancelling a running tool with `interrupt()` does not fire this hook; the tool result carries the interruption message instead
`agent_id`| `str` (optional)| Subagent identifier, present when the hook fires inside a subagent
`agent_type`| `str` (optional)| Subagent type, present when the hook fires inside a subagent
@@ -2838,10 +2838,11 @@
**Output:**
{
- "output": str, # Combined stdout and stderr output
- "exitCode": int, # Exit code of the command
- "killed": bool | None, # Whether command was killed due to timeout
- "shellId": str | None, # Shell ID for background processes
+ "stdout": str, # The command's output; stdout and stderr arrive merged into this one interleaved stream
+ "stderr": str, # Notices the tool itself adds, not the command's stderr
+ "interrupted": bool, # Whether the command was interrupted
+ "isImage": bool | None, # Whether stdout contains image data
+ "backgroundTaskId": str | None, # ID of the background task if command is running in background
}
###
@@ -3216,7 +3217,7 @@
**Tool name:** `TaskOutput`. The previous name `BashOutput` is still accepted as an alias.
-`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. Deprecated since Claude Code v2.1.83. The schemas below remain valid for hooks and permission handlers that encounter the tool.
+`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. The schemas below remain valid for hooks and permission handlers that encounter the tool.
**Input:**
--- a/remote-control.md
+++ b/remote-control.md
@@ -227,7 +227,7 @@
Remote Control vs Claude Code on the web
-Remote Control and [Claude Code on the web](</docs/en/claude-code-on-the-web>) both use the claude.ai/code interface. The key difference is where the session runs: Remote Control executes on your machine, so your local MCP servers, tools, and project configuration stay available. Claude Code on the web executes in Anthropic-managed cloud infrastructure. Use Remote Control when you’re in the middle of local work and want to keep going from another device. Use Claude Code on the web when you want to kick off a task without any local setup, work on a repo you don’t have cloned, or run multiple tasks in parallel.
+Remote Control and [Claude Code on the web](</docs/en/claude-code-on-the-web>) both use the claude.ai/code interface. The key difference is where the session runs: Remote Control executes on your machine, so your local MCP servers, tools, and project configuration stay available. Claude Code on the web executes in the cloud. Use Remote Control when you’re in the middle of local work and want to keep going from another device. Use Claude Code on the web when you want to kick off a task without any local setup, work on a repo you don’t have cloned, or run multiple tasks in parallel.
##
@@ -421,6 +421,7 @@
[Remote Control](</docs/en/remote-control>)| Drive a running session from [claude.ai/code](<https://claude.ai/code>) or the Claude mobile app| Your machine (CLI or VS Code)| Run `claude remote-control`| Steering in-progress work from another device
[Channels](</docs/en/channels>)| Push events from a chat app like Telegram or Discord, or your own server| Your machine (CLI)| [Install a channel plugin](</docs/en/channels#quickstart>) or [build your own](</docs/en/channels-reference>)| Reacting to external events like CI failures or chat messages
[Slack](</docs/en/slack>)| Mention `@Claude` in a team channel| Anthropic cloud| [Install the Slack app](</docs/en/slack#setting-up-claude-code-in-slack>) with [Claude Code on the web](</docs/en/claude-code-on-the-web>) enabled| PRs and reviews from team chat
+[Self-hosted environments](</docs/en/self-hosted-environments>)| Start a [cloud session](</docs/en/claude-code-on-the-web>) and pick your organization’s environment| Your organization’s infrastructure| [Deploy runners](</docs/en/self-hosted-environments-quickstart>), on Team and Enterprise plans| Cloud sessions that must run inside your network
[Scheduled tasks](</docs/en/scheduled-tasks>)| Set a schedule| [CLI](</docs/en/scheduled-tasks>), [Desktop](</docs/en/desktop-scheduled-tasks>), or [cloud](</docs/en/routines>)| Pick a frequency| Recurring automation like daily reviews
##
@@ -429,7 +430,7 @@
Related resources
- * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions on Anthropic-managed infrastructure instead of your machine, configured through [cloud environments](</docs/en/cloud-environments>)
+ * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions in the cloud instead of your machine, configured through [cloud environments](</docs/en/cloud-environments>)
* [Channels](</docs/en/channels>): forward Telegram, Discord, or iMessage into a session so Claude reacts to messages while you’re away
* [Dispatch](</docs/en/desktop#sessions-from-dispatch>): message a task from your phone and it can spawn a Desktop session to handle it
* [Authentication](</docs/en/authentication>): set up `/login` and manage credentials for claude.ai
--- a/routines.md
+++ b/routines.md
@@ -1,6 +1,6 @@
Routines are in research preview. Behavior, limits, and the API surface may change.
-A routine is a saved Claude Code configuration: a prompt, one or more repositories, and a set of [connectors](</docs/en/mcp>), packaged once and run automatically. Routines execute on Anthropic-managed cloud infrastructure, so they keep working when your laptop is closed. Each routine can have one or more triggers attached to it:
+A routine is a saved Claude Code configuration: a prompt, one or more repositories, and a set of [connectors](</docs/en/mcp>), packaged once and run automatically. Routines execute on Anthropic-managed cloud infrastructure, or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there, so they keep working when your laptop is closed. Each routine can have one or more triggers attached to it:
* **Scheduled** : run on a recurring cadence like hourly, nightly, or weekly, or once at a specific future time
* **API** : trigger on demand by sending an HTTP POST to a per-routine endpoint with a bearer token
--- a/sandbox-environments.md
+++ b/sandbox-environments.md
@@ -48,7 +48,7 @@
How isolation relates to permission modes
-[Permission modes](</docs/en/permission-modes>) decide whether a tool call runs and whether you are prompted first. Isolation restricts what a command can access once it runs. The two work together: when a permission mode lets actions run without asking you, an isolation boundary limits what those actions can reach. When you pass `--dangerously-skip-permissions`, Claude acts without asking you first; you’re only prompted for explicit [ask rules](</docs/en/permissions#manage-permissions>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and removals targeting `/` or your home directory. With no prompts to catch mistakes, the isolation boundary you choose is what protects your system. Always run `--dangerously-skip-permissions` sessions inside a container, a VM, or the sandbox runtime, so that file tools, MCP servers, and hooks are also inside the boundary. On Linux and macOS, Claude Code refuses to start with this flag when running as root, so run the container, VM, or sandbox runtime as a non-root user. [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) replaces the prompt with a classifier that reviews actions and blocks ones that escalate beyond the request, target unrecognized infrastructure, or appear driven by hostile content Claude read. The classifier is a per-action control, not an isolation boundary, so an isolation boundary still adds defense in depth for unattended runs, and is not required the way it is for `--dangerously-skip-permissions`. The sandboxed Bash tool on its own constrains only Bash, so it is not sufficient for fully unattended runs in either mode. You can layer approaches: running the sandboxed Bash tool inside a container or VM gives you OS-level command restrictions on top of the outer environment boundary. For how the Bash sandbox itself interacts with permission rules and modes, see [How sandboxing relates to permissions and permission modes](</docs/en/sandboxing#how-sandboxing-relates-to-permissions-and-permission-modes>).
+[Permission modes](</docs/en/permission-modes>) decide whether a tool call runs and whether you are prompted first. Isolation restricts what a command can access once it runs. The two work together: when a permission mode lets actions run without asking you, an isolation boundary limits what those actions can reach. When you pass `--dangerously-skip-permissions`, Claude acts without asking you first; you’re only prompted for explicit [ask rules](</docs/en/permissions#manage-permissions>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and removals targeting `/` or your home directory. With no prompts to catch mistakes, the isolation boundary you choose is what protects your system. Always run `--dangerously-skip-permissions` sessions inside a container, a VM, or the sandbox runtime, so that file tools, MCP servers, and hooks are also inside the boundary. On Linux and macOS, Claude Code refuses to start with this flag when running as root, so run the container, VM, or sandbox runtime as a non-root user. [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) replaces the prompt with a classifier that reviews actions. The classifier is a per-action control, not an isolation boundary, so an isolation boundary still adds defense in depth for unattended runs, and is not required the way it is for `--dangerously-skip-permissions`. The sandboxed Bash tool on its own constrains only Bash, so it is not sufficient for fully unattended runs in either mode. You can layer approaches: running the sandboxed Bash tool inside a container or VM gives you OS-level command restrictions on top of the outer environment boundary. For how the Bash sandbox itself interacts with permission rules and modes, see [How sandboxing relates to permissions and permission modes](</docs/en/sandboxing#how-sandboxing-relates-to-permissions-and-permission-modes>).
##
@@ -58,7 +58,7 @@
This option does not support native Windows. On Windows hosts, use WSL2 or one of the container or VM approaches below.
-The sandboxed Bash tool is built into Claude Code. It uses operating system primitives to restrict the filesystem and network access of every Bash command Claude runs: Seatbelt, the built-in macOS sandbox, and [bubblewrap](<https://github.com/containers/bubblewrap>) on Linux and WSL2. By default it allows writes to the working directory and prompts the first time a command needs a new network domain. Run the `/sandbox` command to open the sandbox panel and choose a mode. The [Sandboxing](</docs/en/sandboxing>) guide covers the approval modes, the default boundary, and how to widen or narrow it. The per-command sandbox does not cover everything that runs in a session:
+The sandboxed Bash tool is built into Claude Code. It uses operating system primitives to restrict the filesystem and network access of every Bash command Claude runs. Run the `/sandbox` command to open the sandbox panel and choose a mode. The [Sandboxing](</docs/en/sandboxing>) guide covers the approval modes, the default boundary, and how to widen or narrow it. The per-command sandbox does not cover everything that runs in a session:
* Other [built-in tools](</docs/en/tools-reference>) such as Read, Edit, and WebFetch run inside the Claude Code process and do not spawn arbitrary code. [Permission rules](</docs/en/permissions>) for path or domain gate them instead.
* [MCP](</docs/en/mcp>) servers and hooks are separate processes that run unconstrained on the host.
@@ -155,7 +155,7 @@
Claude Code on the web
-[Claude Code on the web](</docs/en/claude-code-on-the-web>) runs each session in an isolated, Anthropic-managed virtual machine. A network proxy enforces a default allowlist, and a separate proxy holds your GitHub token outside the sandbox while issuing scoped credentials for repository access inside it. Use this approach when you want full VM isolation without provisioning infrastructure yourself, or when you are delegating tasks from a device that does not have a local development environment. It requires a Claude subscription. When you launch a session from the web interface, you also need a connected GitHub account so the sandbox can clone your repository. When you launch from the CLI with `--cloud`, Claude Code can [bundle and upload your local repository](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) instead if GitHub isn’t connected. See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for plan availability and GitHub authentication options.
+[Claude Code on the web](</docs/en/claude-code-on-the-web>) runs each session in an isolated, Anthropic-managed virtual machine. A network proxy enforces a default allowlist, and a separate proxy holds your GitHub token outside the sandbox while issuing scoped credentials for repository access inside it. Sessions your organization routes to a [self-hosted environment](</docs/en/self-hosted-environments>) run on infrastructure you provision instead, where isolation, egress control, and git credentials are your deployment’s responsibility. Use this approach when you want full VM isolation without provisioning infrastructure yourself, or when you are delegating tasks from a device that does not have a local development environment. It requires a Claude subscription. When you launch a session from the web interface, you also need a connected GitHub account so the sandbox can clone your repository. When you launch from the CLI with `--cloud`, Claude Code can [bundle and upload your local repository](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) instead if GitHub isn’t connected. See [Claude Code on the web](</docs/en/claude-code-on-the-web>) for plan availability and GitHub authentication options.
##
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -148,7 +148,7 @@
}
}
-The `.` in `allowRead` resolves to the project root because this configuration lives in project settings. If you placed the same configuration in `~/.claude/settings.json`, `.` would resolve to `~/.claude` instead, and project files would remain blocked by the `denyRead` rule.
+If you placed the same configuration in `~/.claude/settings.json`, `.` would resolve to `~/.claude` instead, and project files would remain blocked by the `denyRead` rule.
###
@@ -340,7 +340,7 @@
* **Git worktrees** : when the working directory is a [linked git worktree](</docs/en/worktrees>), the sandbox also allows writes to the main repository’s shared `.git` directory so commands such as `git commit` can update refs and the index. Writes to `hooks/` and `config` inside that directory remain denied.
* **Configurable** : define custom allowed and denied paths through settings
-You can grant write access to additional paths using `sandbox.filesystem.allowWrite` in your settings. These restrictions are enforced at the OS level, so they apply to all subprocess commands, including tools like `kubectl`, `terraform`, and `npm`, not just Claude’s file tools. To skip filesystem isolation entirely while keeping network isolation, set `sandbox.filesystem.disabled`.
+To skip filesystem isolation entirely while keeping network isolation, set `sandbox.filesystem.disabled`.
###
@@ -350,7 +350,7 @@
Network access is controlled through a proxy server running outside the sandbox:
- * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval. As of v2.1.191, choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules.
+ * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval. Choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules.
* **Strict allowlist** : if you set [`strictAllowlist`](</docs/en/settings#sandbox-settings>) to `true` in user, managed, or CLI `--settings` settings, Claude Code denies sandboxed commands access to any host outside the allowlist instead of prompting. The allowlist is the same one the sandbox otherwise prompts against: `allowedDomains` plus domains from `WebFetch(domain:...)` allow rules, or only the managed settings entries when `allowManagedDomainsOnly` is set. Claude Code enforces this for sandboxed commands only; in-process tools such as `WebFetch` still follow their permission rules. Setting it in a repository’s `.claude/settings.json` or `.claude/settings.local.json` has no effect. Requires Claude Code v2.1.219 or later.
* **Managed lockdown** : if [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, non-allowed domains are blocked automatically instead of prompting, and only `allowedDomains` and `WebFetch(domain:...)` allow rules from managed settings are honored.
* **Custom proxy support** : advanced users can implement custom rules on outgoing traffic
@@ -500,7 +500,6 @@
* **`open`, `osascript`, or browser-based auth flows fail with error `-600` on macOS**: the sandbox blocks Apple Events by default. Set [`allowAppleEvents`](</docs/en/settings#sandbox-settings>) to `true` in your user, managed, or CLI settings to allow them. Project settings are ignored for this key. Enabling it removes code-execution isolation, since sandboxed commands can then launch other applications unsandboxed with no user prompt and send AppleScript commands to running applications, subject to the macOS automation-consent prompt (TCC). Alternatively, add the command to `excludedCommands` to run it outside the sandbox.
* **`docker` commands fail**: `docker` is incompatible with the sandbox. Add `docker *` to `excludedCommands` to run it outside the sandbox.
* **Bubblewrap fails to start inside a container** : in an unprivileged container, bubblewrap cannot mount a fresh `/proc` filesystem. Set [`enableWeakerNestedSandbox`](</docs/en/settings#sandbox-settings>) 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.
- * **Seccomp filter on Linux** : the seccomp filter is required to block Unix domain sockets. The Dependencies tab in `/sandbox` appears only when a dependency is missing; if you don’t see the tab after a restart, the filter is already installed. If the filter is missing, run `npm install -g @anthropic-ai/sandbox-runtime` to install the helper, then restart Claude Code so the startup dependency check detects it.
* **`--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/scheduled-tasks.md
+++ b/scheduled-tasks.md
@@ -1,4 +1,4 @@
-Scheduled tasks let Claude re-run a prompt automatically on an interval. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session. To react to events as they happen instead of polling, see [Channels](</docs/en/channels>): your CI can push the failure into the session directly. To keep the session working turn after turn until a condition is met rather than on an interval, see [`/goal`](</docs/en/goal>). Tasks are session-scoped: they live in the current conversation and stop when you start a new one. Resuming with `--resume` or `--continue` brings back any task that hasn’t expired: a recurring task created within the last 7 days, or a one-shot whose scheduled time hasn’t passed yet. For scheduling that survives independently of any session, use [Routines](</docs/en/routines>) to create a routine on Anthropic-managed infrastructure, set up a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), or use [GitHub Actions](</docs/en/github-actions>).
+Scheduled tasks let Claude re-run a prompt automatically on an interval. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session. To react to events as they happen instead of polling, see [Channels](</docs/en/channels>): your CI can push the failure into the session directly. To keep the session working turn after turn until a condition is met rather than on an interval, see [`/goal`](</docs/en/goal>). Tasks are session-scoped: they live in the current conversation and stop when you start a new one. Resuming with `--resume` or `--continue` brings back any task that hasn’t expired: a recurring task created within the last 7 days, or a one-shot whose scheduled time hasn’t passed yet. For scheduling that survives independently of any session, use [Routines](</docs/en/routines>) to create a routine on the cloud, set up a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), or use [GitHub Actions](</docs/en/github-actions>).
##
@@ -10,7 +10,7 @@
| [Cloud](</docs/en/routines>)| [Desktop](</docs/en/desktop-scheduled-tasks>)| [`/loop`](</docs/en/scheduled-tasks>)
---|---|---|---
-Runs on| Anthropic cloud| Your machine| Your machine
+Runs on| Cloud, Anthropic-managed by default| Your machine| Your machine
Requires machine on| No| Yes| Yes
Requires open session| No| No| Yes
Persistent across restarts| Yes| Yes| Restored on `--resume` if unexpired
@@ -230,6 +230,6 @@
For cron-driven automation that needs to run unattended:
- * [Routines](</docs/en/routines>): run on Anthropic-managed infrastructure on a schedule, via API call, or on GitHub events
+ * [Routines](</docs/en/routines>): run in the cloud on a schedule, via API call, or on GitHub events
* [GitHub Actions](</docs/en/github-actions>): use a `schedule` trigger in CI
* [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>): run locally on your machine
--- a/security-guidance.md
+++ b/security-guidance.md
@@ -42,7 +42,7 @@
Enable in cloud sessions and shared repositories
-User-scoped plugins do not carry into [Claude Code on the web](</docs/en/claude-code-on-the-web>), because those sessions run on Anthropic infrastructure rather than your machine. To enable the plugin there, or to turn it on for everyone who clones a repository, declare it in the project’s checked-in settings:
+User-scoped plugins do not carry into [Claude Code on the web](</docs/en/claude-code-on-the-web>), because those sessions run in the cloud rather than on your machine. To enable the plugin there, or to turn it on for everyone who clones a repository, declare it in the project’s checked-in settings:
.claude/settings.json
@@ -193,7 +193,7 @@
Usage cost
-The per-edit pattern check makes no model call and adds no cost. The end-of-turn and commit reviews each spend additional model usage that counts toward your [usage](</docs/en/costs>) like any other Claude request. The commit review is agentic and may take several model turns per commit, capped at 20 reviews per rolling hour. Expect roughly one review call per turn that changes files and one deeper review per commit, both subject to the caps above. Both model-backed reviews use Claude Opus 4.7 by default. Set `SECURITY_REVIEW_MODEL` to choose a different model for the end-of-turn review and `SG_AGENTIC_MODEL` for the commit review. The plugin is available on all plans.
+The per-edit pattern check makes no model call and adds no cost. The end-of-turn and commit reviews each spend additional model usage that counts toward your [usage](</docs/en/costs>) like any other Claude request. The commit review is agentic and may take several model turns per commit. Expect roughly one review call per turn that changes files and one deeper review per commit, both subject to the caps above. Both model-backed reviews use Claude Opus 4.7 by default. Set `SECURITY_REVIEW_MODEL` to choose a different model for the end-of-turn review and `SG_AGENTIC_MODEL` for the commit review. The plugin is available on all plans.
##
@@ -219,7 +219,7 @@
/plugin uninstall security-guidance@claude-plugins-official
-If the plugin was enabled through a project’s `.claude/settings.json`, disabling it from `/plugin` writes an override to your `.claude/settings.local.json` rather than editing the checked-in file, so the plugin stays off for you while teammates are unaffected. The same dialog also offers to uninstall the plugin for everyone by removing it from the shared `.claude/settings.json`; that option requires Claude Code v2.1.203 or later. If it was enabled through [managed settings](</docs/en/admin-setup>), only an administrator can disable it.
+If the plugin was enabled through a project’s `.claude/settings.json`, disabling it from `/plugin` writes an override to your `.claude/settings.local.json` rather than editing the checked-in file, so the plugin stays off for you while teammates are unaffected. The same dialog also offers to uninstall the plugin for everyone by removing it from the shared `.claude/settings.json`. If it was enabled through [managed settings](</docs/en/admin-setup>), only an administrator can disable it.
##
Show diff (144 lines)
--- a/self-hosted-environments.md
+++ b/self-hosted-environments.md
@@ -0,0 +1,141 @@
+Self-hosted environments are in public beta on Team and Enterprise plans and are off by default. See Availability and limitations for the enablement path and what’s excluded.
+
+A self-hosted environment executes Claude Code cloud sessions on infrastructure your organization operates. A [cloud session](</docs/en/claude-code-on-the-web>) is any session that runs somewhere other than the developer’s machine: developers start them from claude.ai, the mobile and desktop apps, the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>), and [scheduled routines](</docs/en/routines>), and by default they execute on Anthropic’s infrastructure. In a self-hosted environment, those same sessions execute inside your network, and the developer experience is otherwise the same apart from the differences in Availability and limitations and the deploy page’s [known issues](</docs/en/self-hosted-environments-deploy#known-issues-and-limitations>). If your team doesn’t use cloud sessions, there’s nothing here to configure: sessions in a terminal or IDE always run on the developer’s own machine. If you want to run Claude Code on your own always-on machine and drive it from other devices, use [Remote Control](</docs/en/remote-control>), which is also available on Pro and Max plans. When you’re ready to set up, go straight to the [quickstart](</docs/en/self-hosted-environments-quickstart>); to review the security posture first, start with [Deploy to production](</docs/en/self-hosted-environments-deploy>). The rest of this page explains how self-hosting works and when to choose it.
+
+##
+
+
+
+How self-hosted environments work
+
+Self-hosting has three parts:
+
+ * **Environment** : a named destination that cloud sessions can be sent to. Your organization creates environments in claude.ai admin settings, and each one groups a set of runners.
+ * **Runner** : a program running on hosts inside your network. Runners execute the sessions; the idea is the same as a self-hosted CI runner.
+ * **Session** : one Claude Code task a developer started.
+
+When a developer starts a cloud session, the session-start UI shows an environment picker listing Anthropic-hosted environments alongside any your organization has created. If they choose yours, Anthropic’s control plane places the session on your environment’s queue, where a runner claims it, clones the repository the developer chose, and starts a Claude Code process on your host to run it. The runner authenticates to your git host with credentials you configure; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options. Sessions reach your internal services from inside your network, and your git host the same way when it’s internal; the traffic to Anthropic, queue polling, the session’s event stream, and model inference, is outbound HTTPS to `api.anthropic.com`, with the short list of further hosts sessions can reach in [Network requirements](</docs/en/self-hosted-environments-deploy#network-requirements>). Anthropic never connects into your network.
+
+The two Claude Code boxes in the diagram are session processes: one runner executing two sessions at once, up to its configured capacity. A runner serves one user at a time, locking to that user’s account when it claims its first session, so checked-out code never mixes between users; Runner lifecycle covers the rule. You can start runners yourself and keep them running, or run the [autoscaling orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>), a second process you host, which starts runners as sessions queue; each runner exits on its own when its work finishes. Either way, you set the environment up once, and it appears in the picker on every supported surface.
+
+##
+
+
+
+Availability and limitations
+
+Check these before planning a rollout:
+
+ * **Plans** : public beta for Team and Enterprise organizations. Self-hosted environments are off by default; an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) turns on **Allow self-hosted environments** on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>), which requires [Claude Code on the web](</docs/en/claude-code-on-the-web>) to be enabled for the organization.
+ * **Zero Data Retention** : unavailable for organizations with [Zero Data Retention](</docs/en/zero-data-retention>) enabled.
+ * **Model inference** : sessions use the Anthropic API, and inference can’t be routed through [Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry](</docs/en/third-party-integrations>), or an [LLM gateway](</docs/en/llm-gateway>).
+ * **Surfaces** : sessions started from [Claude Code on the web](</docs/en/claude-code-on-the-web>), the mobile and desktop apps, [scheduled routines](</docs/en/routines>), and the terminal, with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>) or a scripted [`--environment` dispatch](</docs/en/self-hosted-environments-testing#run-the-test-loop>), can run in self-hosted environments. [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [Claude Security](</docs/en/claude-security>), and [Code Review](</docs/en/code-review>) sessions don’t route to them yet; support for those surfaces follows separately.
+ * **Repositories** : sessions check out repositories from GitHub; see [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>).
+ * **Billing** : sessions in a self-hosted environment consume your organization’s Claude Code usage the same way sessions in Anthropic-hosted environments do.
+
+##
+
+
+
+Why self-host
+
+Most teams are better served by Anthropic-hosted environments, which need no infrastructure to run or maintain. Self-hosting is for teams whose network, tooling, or compliance requirements call for keeping session execution on infrastructure they control. If that’s you, plan for the operational ownership it carries: you build and maintain the runner image, operate the fleet, and control its network. In exchange, self-hosting gives you network access, custom tooling, and compliance control:
+
+ * **Network access** : sessions run inside your network and can reach internal services, databases, and registries without exposing them to the public internet
+ * **Custom tooling** : pre-install compilers, SDKs, and internal CLIs in your runner image so every session starts ready to build
+ * **Compliance** : repository checkouts and build artifacts stay on infrastructure you control. Session content still goes to `api.anthropic.com` for model inference.
+
+##
+
+
+
+Environments, runners, and sessions
+
+Environments are managed on the **Cloud environments** page in claude.ai admin settings; runners are processes you start and manage on your own infrastructure.
+
+###
+
+
+
+Key concepts
+
+These terms appear throughout the self-hosted pages:
+
+Term| What it is
+---|---
+Environment| A named group of your runners, created in claude.ai settings. Sessions are routed to an environment, not to an individual runner.
+Environment secret| The single shared credential runners use to authenticate and register with the environment. Shown once at environment creation, labeled **environment key** in the admin UI.
+Runner| The long-lived process you deploy. A runner registers with the environment, receives a runner token, and polls for sessions.
+Session| One Claude Code task, started from claude.ai, the mobile app, or another Anthropic surface such as a scheduled routine or an agent. Each session runs as a child Claude Code process the runner spawns.
+
+In API fields, token claims, and metric names, the environment appears as `pool`, and the environment ID is the `pool_id`. The [reference](</docs/en/self-hosted-environments-reference>) maps the two spellings, including the deprecated `pool` flag names. A runner serves one user at a time. The first session a runner picks up locks the runner to that user, and the runner then runs sessions only for that user, up to a configured capacity. The minimum fleet size is therefore the number of users you expect to be active at once.
+
+###
+
+
+
+Session lifecycle
+
+When a developer starts a session and selects your environment, Anthropic’s control plane places the session on the environment’s queue. From there:
+
+ 1. A runner with free capacity claims the session and holds a lease on it.
+ 2. The runner clones the repository into its working directory and spawns a child Claude Code process.
+ 3. The child streams events back over HTTPS while the runner keeps polling; each poll refreshes the lease and doubles as the heartbeat.
+ 4. If the runner stops polling for about 60 seconds, the server requeues the session for another runner.
+
+###
+
+
+
+Runner lifecycle
+
+The first session a runner picks up locks the runner to the account of the user who started that session, and the runner runs up to `--capacity` concurrent sessions for that account. While the runner has active sessions, the runner keeps claiming the locked account’s queued work. What happens once they finish depends on [`--drain-grace-sec`](</docs/en/self-hosted-environments-reference#runner-cli-flags>):
+
+ * **At the default of`0`**: the runner exits as soon as its active sessions finish, without polling for more, so the orchestrator you deploy it under, such as Kubernetes, can restart it with a fresh disk, ready to serve any account.
+ * **At a positive value** : the runner keeps polling the locked account’s queue for that many seconds before exiting.
+
+This lifecycle isolates each user’s checked-out code without requiring the runner to delete disk state between users. A kill that delivers `SIGTERM` needs no flag: the runner drains as [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) describes. If your infrastructure instead destroys hosts at a known wall-clock time without a signal, or with a grace period too short to drain, such as a sandbox lifetime cap or spot-instance reclamation, pass `--retire-at <epoch-seconds>` set to a few minutes before that time. At the retire time:
+
+ 1. The runner stops taking new work.
+ 2. The runner releases each active session through the same release path the [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) flag uses, so the session resumes on a fresh runner when the user sends their next message. A session that’s mid-turn is released as soon as that turn finishes; a session whose finished turn left background tasks running gets up to 60 seconds of grace before releasing anyway.
+ 3. The runner exits 0 once all its sessions are released.
+
+A turn that outlives the kill is still lost; [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) covers sizing the margin. Without `--retire-at`, a signal-less host kill is indistinguishable from a crash: the control plane records a lost worker rather than a clean release, and the session requeues to another runner.
+
+###
+
+
+
+Network paths
+
+The runner and its sessions make several kinds of outbound connection, and no inbound connectivity from Anthropic is required:
+
+ * **Control plane** : the runner polls `api.anthropic.com` for work and posts setup-progress and failure events, all outbound HTTPS. Polling doubles as the runner’s heartbeat.
+ * **SCM connector** : the optional orchestrator [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) tunnel is the only WebSocket connection.
+ * **Git** : the runner clones from and pushes to your git host over HTTPS or SSH, authenticated with credentials your deployment provides; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options, including per-session minted credentials and the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), which routes git through `api.anthropic.com` instead.
+ * **Session child** : the child Claude Code process holds the session’s event stream to `api.anthropic.com`, and makes its own outbound calls for model inference and for git commands run during the session. See [Network requirements](</docs/en/self-hosted-environments-deploy#network-requirements>) for the full egress list. The diagram above shows these paths, apart from the optional SCM connector.
+
+Model inference uses the Anthropic API. The control plane delivers the API endpoint to each session, and the session authenticates with an Anthropic-issued, session-scoped OAuth token, so inference can’t be routed through [Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry](</docs/en/third-party-integrations>), or an [LLM gateway](</docs/en/llm-gateway>) in self-hosted environments. Corporate egress proxies are supported. The runner and the optional [autoscaling orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>) honor the proxy and mTLS environment variables described in [Network configuration](</docs/en/network-config>), such as `HTTPS_PROXY` and `NO_PROXY`; set them in each process’s environment. The variables cover control-plane calls, the orchestrator’s [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) WebSocket, and the built-in clone for HTTPS remotes, and sessions inherit them from the runner. Session streaming uses server-sent events over HTTPS, so a proxy in the path must not buffer responses.
+
+##
+
+
+
+What stays on your infrastructure
+
+Repository checkouts, build artifacts, secrets, and any files a session creates or modifies stay on the machines you provision. The conversation itself, including prompts, responses, and tool results, goes to `api.anthropic.com` for model inference, and the session transcript is stored by Anthropic so a session can be picked up from any surface. Session orchestration, queueing, and the claude.ai interface remain Anthropic-hosted: a self-hosted environment moves session execution into your network, not the control plane.
+
+##
+
+
+
+Get started
+
+The self-hosted environments pages are organized by what you’re doing:
+
+ * [Quickstart](</docs/en/self-hosted-environments-quickstart>): install Claude Code, create an environment, start a runner, and route your first session
+ * [Deploy to production](</docs/en/self-hosted-environments-deploy>): security hardening, network egress, git credentials, Kubernetes and Compose recipes, known issues, and troubleshooting
+ * [Customize sessions](</docs/en/self-hosted-environments-configuration>): wrapper scripts for per-session credentials, lifecycle hooks, on-demand runners, MCP servers, and permissions
+ * [Test end to end](</docs/en/self-hosted-environments-testing>): a CI smoke test that verifies a runner image before you promote it
+ * [Reference](</docs/en/self-hosted-environments-reference>): every CLI flag, environment variable, metric, and the health endpoint
+ * [Verify session identity](</docs/en/self-hosted-environments-identity>): validate the session token from your own services before granting access
Show diff (371 lines)
--- a/self-hosted-environments-configuration.md
+++ b/self-hosted-environments-configuration.md
@@ -0,0 +1,368 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) enables them by turning on **Allow self-hosted environments** on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>). This page assumes a working runner; see the [quickstart](</docs/en/self-hosted-environments-quickstart>) for setup and [Deploy to production](</docs/en/self-hosted-environments-deploy>) for the fleet recipes.
+
+A [self-hosted environment](</docs/en/self-hosted-environments>) runs Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on your own infrastructure, executed by a runner process you deploy. With no configuration, that runner clones the session’s repository, spawns Claude Code, and cleans up. This page is for the platform engineer operating the runners: it covers the extension points for when those defaults don’t fit, from per-session credential provisioning to replacing checkout entirely. Wrappers and hooks run as executable files on the runner host, which is Linux or macOS, and the examples on this page assume a POSIX shell. A few hook environment variables on this page still use `pool`, such as `CLAUDE_RUNNER_POOL_ID`; the CLI flag and env var names use `environment`, such as `--environment-secret-file`.
+
+##
+
+
+
+Wrapper scripts
+
+Use a wrapper script when each session needs setup the runner can’t do on its own: provisioning short-lived credentials scoped to the session creator, exporting environment-specific secrets, preparing language toolchains, or applying resource limits around the child process. The runner starts your wrapper in place of the Claude Code binary, once per session. End the wrapper by `exec`-ing into `$CLAUDE_RUNNER_CLAUDE_BIN`, the runner’s own binary, so signals and exit codes propagate correctly. Point `--exec-path`, or `SELF_HOSTED_RUNNER_EXEC_PATH`, at the wrapper when you start the runner:
+
+ claude self-hosted-runner --environment-secret-file /etc/claude/environment-secret --exec-path /etc/claude/session-wrapper.sh
+
+The runner sets the following in the wrapper’s environment:
+
+Variable| Description
+---|---
+`CLAUDE_CODE_SESSION_ACCESS_TOKEN`| The session JWT, prefixed `sk-ant-cc-`. Its `act` claim identifies the session creator, with the creator’s email and upstream identity-provider subject when the creating surface recorded them. The value is the token at spawn time; refreshes arrive over the child’s stdin, so a wrapper sees only the initial value. See [Verify session identity](</docs/en/self-hosted-environments-identity>).
+`CCR_SESSION_ACCOUNT_EMAIL`| The session creator’s email, pre-extracted by the runner from the token’s `act.email` claim without signature verification. Suitable for labelling, such as commit trailers. When the email gates credential issuance, verify the token and read the claim from it instead; see Provision credentials scoped to the session creator. Unset when the token carries no creator email. Treat as personally identifiable information.
+`CLAUDE_RUNNER_CLAUDE_BIN`| Absolute path to the runner’s own Claude Code binary. End your wrapper with `exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@"` to hand off to the pinned binary without hardcoding an install path.
+`CLAUDE_CODE_REMOTE_SESSION_ID`| Session ID in the tagged `cse_...` form. This is the same session the lifecycle hooks see as `CLAUDE_RUNNER_SESSION_ID` in `session_...` form; the UUID variables match across both, and substituting the `cse_` prefix with `session_` yields the ID shown in the session URL.
+`CLAUDE_CODE_REMOTE_SESSION_UUID`| The same session ID in canonical UUID form, for systems that key on UUIDs.
+`CLAUDE_SESSION_INGRESS_TOKEN_FILE`| Absolute path to a per-session file holding the current session JWT, kept fresh across token refreshes. Shell subprocesses read it for their `Authorization` header when downloading attachments the user added to the session. `exec` preserves the variable automatically; a wrapper that rebuilds the child’s environment must carry the variable over, or attachment downloads silently stop working.
+`CLAUDE_CONFIG_DIR`| Per-session Claude config directory, written at session start from the snapshot of the runner host’s config that the runner captures at startup; see Permissions and tool approval. Writes here are isolated to this session.
+`ANTHROPIC_BASE_URL`| The API base URL the child will use, delivered by the control plane per session and normally `https://api.anthropic.com`. Don’t override it: the session’s inference credential is an Anthropic-issued OAuth token that other providers don’t accept, so inference in self-hosted environments isn’t routable elsewhere.
+`CLAUDE_CODE_OAUTH_TOKEN`| The short-lived OAuth access token the child uses for model inference, scoped to model inference and file upload only, with a lifetime of about 30 minutes. The runner re-mints it before expiry and delivers the rotation over the child’s stdin, so a wrapper that doesn’t keep stdin attached sees only the initial value. Don’t rely on your organization’s IP allowlist to bound this token’s use: treat it as a bearer credential that stays usable for roughly 30 minutes if it leaks, and don’t log it, write it to disk, or forward it outside the session container.
+
+The wrapper also inherits the rest of the child’s managed environment, including any server-provided environment variables. `exec` propagates all of it automatically; if your wrapper spawns the child another way, forward the full environment.
+
+###
+
+
+
+Keep stdin and file descriptor 3 attached
+
+The child’s stdin is the runner’s control channel. Token rotations and session-end signals arrive on it. The runner also opens a pipe on file descriptor 3 and reads the child’s activity signals from it to drive idle and startup timeouts. A plain `exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@"` preserves both automatically. If your wrapper backgrounds the child with a bare `&`, it severs the child’s stdin: the session looks healthy until the initial OAuth token’s roughly 30-minute lifetime expires, then every API call fails with `401 authentication_error`. If your wrapper must background the child, for example to keep a teardown trap alive, save stdin on file descriptor 4 or higher and re-attach it explicitly:
+
+ exec 4<&0
+ "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" <&4 4<&- &
+ CHILD=$!
+ trap 'teardown' EXIT
+ wait "$CHILD"
+
+Don’t close or reuse file descriptor 3 in the wrapper. Redirecting the child’s stdout and stderr is fine.
+
+###
+
+
+
+Provision credentials scoped to the session creator
+
+Use the `decode-token` subcommand to read claims from the session JWT. It reads the token from an argument, from `CLAUDE_CODE_SESSION_ACCESS_TOKEN`, or from stdin, in that order; see [Verify the token inside the session](</docs/en/self-hosted-environments-identity#verify-the-token-inside-the-session>) for what it checks. The example below decodes the creator identity, exchanges it for short-lived AWS credentials, and execs into Claude Code:
+
+ #!/bin/bash
+ # Key on the stable Anthropic user ID and require a human creator.
+ CREATOR_SUB=$("$CLAUDE_RUNNER_CLAUDE_BIN" self-hosted-runner decode-token \
+ | jq -re '.act.sub // "" | select(startswith("user:"))') \
+ || { echo "decode-token: verification failed or no human creator" >&2; exit 1; }
+
+ creds=$(your-sts-helper assume-role --subject "$CREATOR_SUB") \
+ || { echo "credential exchange failed" >&2; exit 1; }
+ eval "$creds"
+
+ exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@"
+
+Use `jq -re` rather than `jq -r` when the extracted claim gates an auth decision, so an absent claim exits non-zero instead of passing the literal string `null` downstream. Sessions created by an organization service identity, such as bot and agent sessions, carry an `agent:` subject rather than `user:`, so this example refuses them; if your environment serves those sessions, decide explicitly whether the wrapper falls back to a default credential for them instead of exiting. When your credential exchange needs the SSO subject or email instead, read `.act.attested_by.sub` or `.act.email` and handle their absence: the token carries them only when the creating surface recorded them, and a [CLI-dispatched session](</docs/en/self-hosted-environments-testing#run-the-test-loop>) can lack both. For the full claim reference and verification from services outside the runner, see [Verify session identity](</docs/en/self-hosted-environments-identity>).
+
+##
+
+
+
+Lifecycle hooks
+
+Lifecycle hooks replace stages of the runner’s per-session pipeline with your own scripts. Point the runner at a directory of hooks with `--hooks-dir <path>`, or `SELF_HOSTED_RUNNER_HOOKS_DIR`. The runner looks for executable files with well-known names; any hook that isn’t present falls through to the built-in behavior, so you only write the ones you need. Hooks run with the runner’s own privileges, and session children share that UID, so mount the hooks directory read-only, or bake it into the image, so session code can’t modify it; see the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>). These hooks are distinct from [Claude Code hooks](</docs/en/hooks>), which run inside the session; lifecycle hooks run on the runner, around the session.
+
+###
+
+
+
+checkout
+
+Runs once per repository, in place of the runner’s built-in clone and fetch. Use the hook to clone from a read-through mirror, seed a working tree from an archive, or apply per-session git auth. The runner sets:
+
+Variable| Description
+---|---
+`CLAUDE_RUNNER_REPO_URL`| Repository URL to clone, after any `--git-host-rewrite` and `--git-ssh-rewrite` have been applied
+`CLAUDE_RUNNER_REPO_REF`| Revision to check out: branch, tag, or commit SHA as the session requested it. Empty means the repository’s default branch.
+`CLAUDE_RUNNER_CHECKOUT_PATH`| Absolute path where the working tree must be left
+`CLAUDE_RUNNER_SESSION_ID`| Session ID in the tagged `session_...` form, for logging and correlation
+`CLAUDE_RUNNER_SESSION_UUID`| The same session ID in canonical UUID form
+`CLAUDE_RUNNER_API_BASE_URL`| Anthropic API base URL for session-scoped calls
+`CLAUDE_CODE_SESSION_ACCESS_TOKEN`| The session access token, for session-scoped API calls
+
+The script must leave a working tree at `CLAUDE_RUNNER_CHECKOUT_PATH` checked out at the requested revision. Detached HEAD is fine; the runner creates the session’s working branch on top. The runner verifies the path contains a `.git` afterwards; if your hook materializes a non-git source such as Perforce or an unpacked tarball, set `CLAUDE_RUNNER_SKIP_GIT_VERIFY=1` in the runner’s environment to skip that check. Git-based flows such as working-branch creation and pushing results require a git checkout, so export outcomes from non-git trees with a `post-session` hook. The runner doesn’t pass a git credential to the hook. Instead, mint a per-session clone credential from the session’s identity: verify `CLAUDE_CODE_SESSION_ACCESS_TOKEN` with a standard JWT library against the JWKS endpoint under `CLAUDE_RUNNER_API_BASE_URL`, as described in [Verify the token from your service](</docs/en/self-hosted-environments-identity#verify-the-token-from-your-service>), then have your credential service issue a short-lived clone credential for the identity in the token’s `act` claim. `CLAUDE_RUNNER_CLAUDE_BIN` isn’t set in the checkout-hook environment, so the `decode-token` subcommand isn’t available here. Falling back to whatever git authentication the host already has, such as an SSH agent, credential helper, or `.netrc`, is also an option. A non-zero exit fails the session, and the tail of the script’s stderr is surfaced to the user. The runner removes the checkout path after the session ends.
+
+###
+
+
+
+post-session
+
+Runs once per session, after the Claude Code child has exited and before the runner tears the workspace down. This hook is your only chance to save uncommitted work: at `--capacity` above one, the runner deletes per-session worktrees right after the hook returns, and at `--capacity 1` the reused [canonical clone](</docs/en/self-hosted-environments-deploy#reuse-a-pre-warmed-checkout>) is hard-reset when the next session starts, so uncommitted tracked changes don’t survive on either path. Typical uses are pushing a snapshot branch of uncommitted changes, archiving logs, or emitting a session-ended event to your own systems. The hook fires on every session end where a child process was spawned, whatever the cause; the `CLAUDE_RUNNER_EXIT_REASON` values below enumerate the cases. It can’t fire when the runner terminates abruptly, such as a VM preemption or a power loss; if you need guarantees against abrupt termination, snapshot periodically from inside the session with a Claude Code `PostToolUse` hook instead. The runner sets:
+
+Variable| Description
+---|---
+`CLAUDE_RUNNER_SESSION_ID`| Session ID in the tagged `session_...` form
+`CLAUDE_RUNNER_SESSION_UUID`| The same session ID in canonical UUID form
+`CLAUDE_RUNNER_EXIT_REASON`| How the session ended; see the values below the table
+`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_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, watchdog kill, or the [`released=false` backstop](</docs/en/self-hosted-environments-reference#session-lifecycle-counter-semantics>).
+ * `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:
+
+ #!/usr/bin/env bash
+ set -u
+ IFS=':'
+ # Pin config the session could have planted in the checkout's .git/config:
+ # -c overrides beat repo-local settings, blocking session-written fsmonitor,
+ # hook-path, and gpg-program config from executing code with the hook's
+ # privileges. Repo-local credential.helper, core.sshCommand, and pushurl
+ # still apply; if the hook holds credentials the session didn't, pin the
+ # push URL and helper too (see the note below the script).
+ g() { git -c core.fsmonitor=false -c core.hooksPath=/dev/null \
+ -c commit.gpgsign=false "$@"; }
+ for ws in $CLAUDE_RUNNER_WORKSPACE_PATHS; do
+ cd "$ws" 2>/dev/null || continue
+ [ -z "$(g status --porcelain 2>/dev/null)" ] && continue
+ g add -A
+ g commit -q -m "runner snapshot: $CLAUDE_RUNNER_SESSION_ID ($CLAUDE_RUNNER_EXIT_REASON)" || continue
+ g push -q origin "HEAD:refs/heads/rescue/$CLAUDE_RUNNER_SESSION_ID" || true
+ done
+
+The hook pushes with whatever git credentials are available in its own environment on the runner host. Under the [no-credentials-in-the-image posture](</docs/en/self-hosted-environments-deploy#configure-git>), including when the built-in clone goes through the Anthropic git proxy, there are none, so mint a short-lived push credential inside the hook before pushing: exchange the session token the hook receives in `CLAUDE_CODE_SESSION_ACCESS_TOKEN` with your own token service, verifying it as [Verify session identity](</docs/en/self-hosted-environments-identity>) describes. When the hook holds a credential the session didn’t, also pin where it pushes: replace `origin` with an operator-supplied URL and pass `-c credential.helper=` plus your own helper, so repo-local config the session wrote can’t redirect the credentialed push.
+
+###
+
+
+
+command
+
+Runs once per session after checkout, in place of the built-in child spawn. The hook receives the same environment as a wrapper script and should `exec` into `"$CLAUDE_RUNNER_CLAUDE_BIN"` the same way. Use the `command` hook to keep all customization in one hooks directory; use `--exec-path` when the wrapper lives elsewhere. If `--exec-path` is also set, the flag takes precedence and the `command` hook is ignored. Always `exec` the runner’s own binary rather than a PATH-resolved `claude`; otherwise you defeat [version pinning](</docs/en/self-hosted-environments-deploy#pin-the-version>).
+
+##
+
+
+
+On-demand runners
+
+Instead of running a fixed fleet, you can boot one runner per session. The orchestrator is a separate, stateless subcommand that polls Anthropic for spawn requests, one per session that’s queued with no runner available, and runs your `spawn-runner` hook for each. Your hook submits a workload to your platform: a Kubernetes Job, an EC2 instance, a Nomad dispatch. On-demand runners improve credential hygiene. On a fixed fleet, the environment secret lives on every runner host, which is the same host that runs user sessions. With the orchestrator, the environment secret stays only on the orchestrator host, which never runs user code; each spawned runner receives a single-use work order that registers exactly one runner and then expires. To start the orchestrator, pass the environment secret and a hooks directory containing an executable `spawn-runner` script:
+
+ claude self-hosted-runner orchestrator \
+ --environment-secret-file /etc/claude/environment-secret \
+ --hooks-dir /etc/claude/hooks
+
+The orchestrator keeps no state between polls, so you can run two or more replicas against the same environment for availability. Each spawn request is claimed server-side by exactly one replica. All replicas must use the same `--expected-spawn-seconds` value; see the hook contract.
+
+###
+
+
+
+The spawn-runner hook
+
+The orchestrator runs `${hooks-dir}/spawn-runner` once per spawn request. The hook must submit work asynchronously and return within `--hook-timeout`, 60 seconds by default. It must not wait for the runner to boot. The hook receives:
+
+Variable| Description
+---|---
+`CLAUDE_RUNNER_WORK_ORDER_FILE`| Path to a temp file containing the signed work-order JWT the new runner registers with. Deleted after the hook exits. Don’t log the file’s contents.
+`CLAUDE_RUNNER_ORDER_ID`| Opaque idempotency key, unique per spawn request and safe for Kubernetes resource names. Use it as your provisioner’s dedup key.
+`CLAUDE_RUNNER_SESSION_ID`| The session this request is for. Empty for pre-warming requests, which boot a standby runner ahead of any specific session when [`--min-idle`](</docs/en/self-hosted-environments-reference#orchestrator-cli-flags>) is set, so don’t assume the variable is set.
+`CLAUDE_RUNNER_SESSION_UUID`| The same session ID in canonical UUID form. Empty for pre-warming requests.
+`CLAUDE_RUNNER_ATTEMPT`| How many spawn requests this session has had. `0` for pre-warming requests.
+`CLAUDE_RUNNER_ORDER_SERVER_TIME`| Server time from the poll response’s HTTP `Date` header. When the hook verifies the work-order JWT’s `exp`, compare against this value instead of the local clock to tolerate skew. Empty when the gateway omitted the header.
+`CLAUDE_RUNNER_POOL_ID`| The ID of the environment the new runner should join, in `ccpool_...` form
+`CLAUDE_RUNNER_ACCOUNT_ID`| Tagged ID of the account that enqueued the session, for per-account routing, quota, or chargeback. Empty when unavailable.
+`CLAUDE_RUNNER_ACCOUNT_EMAIL`| Email of the account that enqueued the session. Empty when unavailable. Treat the email as personally identifiable information and don’t log it.
+`CLAUDE_RUNNER_PRIMARY_REPO_URL`| URL of the session’s first git source, for routing to a runner with that repository pre-warmed. Empty when the session has no git sources.
+`CLAUDE_RUNNER_PRIMARY_REPO_REVISION`| Revision of the session’s first git source: branch, SHA, or tag. Empty when unspecified.
+`CLAUDE_RUNNER_REPO_SOURCES`| JSON array of `{url, revision}` for all the session’s git sources, for hooks that route on a secondary repository. Empty when there are no sources.
+`CLAUDE_RUNNER_CORRELATION_ID`| The correlation ID supplied at session create, echoed back so the hook can map this work order to the request that created the session. Empty when the session has none.
+
+The spawned runner registers with the work order in place of the environment secret:
+
+ * **Start it with the work order** : point [`--environment-secret-file`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) at a file containing the work-order JWT, or set `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET` to the JWT value.
+ * **Copy the JWT before the hook exits** : the orchestrator deletes the work-order file after the hook exits, so copy the JWT into the workload you submit, such as a Kubernetes Secret on the spawned Job, rather than passing the file path through.
+ * **Use`--capacity 1` on spawned runners**: a session-bound work order registers exactly one runner bound to that session, so a higher capacity adds slots that never receive work, and the runner logs a warning at startup.
+ * **Pre-warming work orders register unbound** : the standby runner isn’t bound to a session and claims queued work like a fixed-fleet runner.
+
+The contract has four provisioner-agnostic rules:
+
+ 1. **Be idempotent on`CLAUDE_RUNNER_ORDER_ID`.** Redelivery of the same request must spawn at most one runner. Derive a deterministic resource name from the ID and let your platform reject the duplicate.
+ 2. **Don’t retry the workload.** One order ID means at most one created workload. If the runner never registers, Anthropic re-requests with a fresh order ID after `--expected-spawn-seconds`.
+ 3. **Use the exit-code contract.** Exit 0 means submitted. Exit 1 means retryable failure; the session backs off and is re-offered. Exit 2 or higher means non-retryable; the session is blocked from spawning again until an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) selects **Retry** on it in the environment’s **Activity** tab. On non-zero exit, the tail of the hook’s stderr appears there as the failure reason, so write the actionable error to stderr and never secrets. For a pre-warming request there is no session to fail: the orchestrator logs a non-zero exit locally only, and the server re-requests the spawn after the lease.
+ 4. **Set`--expected-spawn-seconds` to at least your p99 boot time.** This is the server-side lease. All orchestrator replicas must use the same value.
+
+Everything the hook writes to stdout or stderr appears in the orchestrator’s log with credentials automatically redacted. If sessions stay queued, check the orchestrator’s `/healthz` body for queue counts, then open your environment’s **Activity** tab on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>): expand a failed session there for its spawn error, and select **Retry** to re-request it.
+
+##
+
+
+
+MCP servers
+
+To make [MCP servers](</docs/en/mcp>) available in every session, add them at image build time with the same `claude mcp add` command used on a desktop install. If your runner is a bare process rather than a container, run the same command as the runner’s user on the host, then restart the runner: it reads host config once at startup. The `--scope user` flag is required; the default local scope writes under a per-directory key that the runner doesn’t seed into sessions. For example, in your Dockerfile:
+
+ 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 the drop is visible instead of the server silently failing to load. 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 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.
+ * `<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.
+
+##
+
+
+
+Prompt sessions to push their work
+
+Anthropic-hosted sessions run a [`Stop` hook](</docs/en/hooks#stop>), the Claude Code hook that runs when Claude finishes responding, that prompts Claude to commit and push its work. The runner doesn’t install one. Without it, a session that ends with uncommitted changes leaves that work only on the runner’s disk, and the **Create PR** button in claude.ai/code stays inactive until the branch exists on the remote. The reference implementation below has two parts. Merge the settings block into `~/.claude/settings.json` on the runner host, which the runner seeds into every session, and save the script as `~/.claude/hooks/stop-hook-nudge.sh` on the runner host and make it executable:
+
+ {
+ "hooks": {
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "timeout": 10,
+ "command": "\"$CLAUDE_CONFIG_DIR/hooks/stop-hook-nudge.sh\""
+ }
+ ]
+ }
+ ]
+ }
+ }
+
+ #!/bin/sh
+ # Stop-hook reference implementation for self-hosted runners.
+ #
+ # Nudges Claude once per turn if the project directory has uncommitted
+ # changes OR unpushed commits, so work isn't lost when an idle session
+ # is released and so the "Create PR" button on claude.ai/code lights up.
+ #
+ # Runner-level (no repo changes): drop this file at ~/.claude/hooks/ on
+ # the runner host and merge the accompanying Stop-hook settings block
+ # into ~/.claude/settings.json — the runner seeds both into every session.
+ # Repo-level alternative: commit to <repo>/.claude/hooks/ and change the
+ # settings.json command path to $CLAUDE_PROJECT_DIR/.claude/hooks/.
+ #
+ # stdin: hook JSON payload (see https://code.claude.com/docs/en/hooks)
+ # stdout: {"decision":"block","reason":"..."} to nudge, or nothing to allow stop.
+
+ # Re-entry guard: the harness sets stop_hook_active=true when re-invoking
+ # the Stop hook after a block. Bail so we only nudge once per turn. The
+ # harness emits compact JSON (no space after the colon), which this
+ # pattern relies on; use jq if you need a whitespace-tolerant check.
+ in=$(cat)
+ case "$in" in *'"stop_hook_active":true'*) exit 0 ;; esac
+
+ d="$CLAUDE_PROJECT_DIR"
+
+ # Not a git repo → nothing to nudge.
+ git -C "$d" rev-parse --git-dir >/dev/null 2>&1 || exit 0
+
+ # No remote → "push to the remote" is unsatisfiable; bail.
+ [ -z "$(git -C "$d" remote 2>/dev/null)" ] && exit 0
+
+ # Uncommitted changes (staged, unstaged, or untracked). Exclude .claude/
+ # entirely — operator-seeded settings and CLI-written runtime state
+ # (scheduler lock, worktrees, routine state) live there and neither is
+ # "uncommitted work" the model needs to push.
+ s=$(git -C "$d" status --porcelain -- . ':(exclude).claude/' 2>/dev/null)
+ if [ -n "$s" ]; then
+ printf '{"decision":"block","reason":"There are uncommitted changes in the repository. Please commit and push these changes to the remote branch."}'
+ exit 0
+ fi
+
+ # Unpushed commits. Count commits on HEAD not reachable from any
+ # remote-tracking ref or FETCH_HEAD. This works uniformly for:
+ # - init+fetch checkouts (runner default: only FETCH_HEAD exists)
+ # - clone-based checkouts (origin/* exist)
+ # - the runner default: the child starts on the session's outcome
+ # branch, which the runner creates with checkout -B after checkout
+ # - detached HEAD, when a custom setup skips that branch creation
+ # With no reference point at all (never fetched), stay silent rather
+ # than false-positive on a read-only turn.
+ base=""
+ git -C "$d" rev-parse --verify -q FETCH_HEAD >/dev/null && base="FETCH_HEAD"
+ if [ -z "$base" ] && [ -z "$(git -C "$d" for-each-ref --count=1 refs/remotes/origin 2>/dev/null)" ]; then
+ exit 0
+ fi
+ # shellcheck disable=SC2086 # $base is either "" or "FETCH_HEAD", intentional word-split
+ unpushed=$(git -C "$d" rev-list HEAD --not $base --remotes=origin --count 2>/dev/null) || unpushed=0
+ if [ "$unpushed" -gt 0 ]; then
+ branch=$(git -C "$d" symbolic-ref --short -q HEAD)
+ if [ -n "$branch" ]; then
+ # $branch is attacker-influenced — git-check-ref-format(1) allows `"`
+ # in ref names. `\` is forbidden (rule 10) but escaped anyway as cheap
+ # defense-in-depth.
+ # Escape JSON metacharacters before interpolating into the hand-built
+ # payload so a branch like x","continue":false can't inject keys into
+ # the hook-output JSON the harness parses. $unpushed is safe — the
+ # -gt guard above rejects anything that isn't a plain integer.
+ branch_esc=$(printf '%s' "$branch" | sed 's/\\/\\\\/g; s/"/\\"/g')
+ printf '{"decision":"block","reason":"There are %s unpushed commit(s) on branch '\''%s'\''. Please push these changes to the remote repository."}' "$unpushed" "$branch_esc"
+ else
+ printf '{"decision":"block","reason":"There are %s unpushed commit(s) on a detached HEAD. Please create a branch and push it to the remote repository."}' "$unpushed"
+ fi
+ exit 0
+ fi
+
+ exit 0
+
+The hook prompts Claude to commit and push before the session ends, and stays silent when the directory isn’t a git repository or has no remote.
+
+##
+
+
+
+Permissions and tool approval
+
+A self-hosted session has no terminal attached, so an unanswered permission prompt stalls the turn until the user responds in the UI. Anthropic’s control plane sends each session’s tool list and permission rules with the work payload; the default configuration pre-approves routine tool calls, including `Bash`, and cloud sessions [pre-approve file edits regardless of mode](</docs/en/permission-modes#switch-permission-modes>). A call that nothing pre-approves prompts through the session UI.
+
+Only enable auto mode on an environment whose session containers run with [default-deny network egress](</docs/en/self-hosted-environments-deploy#default-deny-egress>) and the rest of the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>) in place. Routine tool calls, including `Bash` network requests, run without a human in the loop on both the default pre-approved tool set and in auto mode, so the network boundary is what limits where those calls can reach.
+
+To keep prompts to a minimum regardless of what the control plane sends, pin [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from your wrapper script or `command` hook. Auto mode lets sessions run without routine permission prompts: a separate classifier model reviews actions before they run and blocks the ones it rejects, and explicit ask rules still force a prompt; the permission modes page covers what the classifier checks. The runner appends server-computed flags before invoking the wrapper, and for single-value flags such as `--permission-mode` the parser honors the last occurrence, so a flag you append after `"$@"` overrides the server-sent value:
+
+ #!/bin/bash
+ exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" --permission-mode auto
+
+To pre-approve specific tools instead, append `--allowed-tools` with your rules, for example `--allowed-tools "Bash(bazel *) Bash(yarn *) mcp__internal__*"`. List flags such as `--allowed-tools` and `--disallowed-tools` accumulate across occurrences rather than overriding, so your rules apply on top of any rules the control plane sends. To narrow, append `--disallowed-tools`, which denies tools even if another rule allows them.
+
+###
+
+
+
+How each session’s config is assembled
+
+The runner gives each session its own config directory, seeded from an in-memory snapshot of the host’s `~/.claude/` that the runner captures once at startup: `settings.json`, `CLAUDE.md`, hooks, agents, commands, and skills in your runner image apply to every session as the user-level baseline. Because the snapshot is taken at startup, config changes on a running host take effect only after a runner restart. Set `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` to seed from a different path, or point it at an empty directory to disable seeding. Repository-committed `.claude/settings.json` layers on top as project settings. Sessions also read [`managed-settings.json`](</docs/en/settings#settings-files>) from the standard system path in your runner image, but the managed tier uses one source at a time, and [server-managed settings](</docs/en/server-managed-settings>) are checked first: if your organization delivers any server-managed keys, sessions ignore the runner image’s managed file, except that `env` blocks merge per key across managed sources. See [settings precedence](</docs/en/settings#settings-precedence>).
+
+###
+
+
+
+Repository-committed permission rules
+
+Don’t put a bare `"Edit"`, `"Write"`, or `"NotebookEdit"` entry in a repository-committed `permissions.allow`. A bare file-tool rule matches the tool regardless of path, granting writes anywhere on the host rather than only the workspace, so the runner’s write-scope confine guard flags the session; with [`--confine-repo-settings enforce`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) it refuses to spawn the session instead of logging and continuing. See the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>). A repository needs no file-tool rule at all: cloud sessions [pre-approve file edits regardless of mode](</docs/en/permission-modes#switch-permission-modes>). If you do commit a rule, scope it to the workspace, such as `"Edit(/**)"`; a single leading slash is relative to the project root, which is the session’s workspace. Bare file-tool rules are fine in the operator’s host-level `settings.json`, since that file isn’t repository-committed. A `defaultMode` of `auto` is only honored from the image-wide or user-level settings file, so a checked-out repository can’t grant itself auto mode. For which modes cloud sessions accept and the full rule syntax, see [permission modes](</docs/en/permission-modes>).
+
+##
+
+
+
+What’s next
+
+ * [Reference](</docs/en/self-hosted-environments-reference>): every CLI flag, environment variable, and metric
+ * [Verify session identity](</docs/en/self-hosted-environments-identity>): validate the session token from services outside the runner
Show diff (393 lines)
--- a/self-hosted-environments-deploy.md
+++ b/self-hosted-environments-deploy.md
@@ -0,0 +1,390 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers the enablement path. This page covers running the fleet in production; see the [quickstart](</docs/en/self-hosted-environments-quickstart>) for your first runner and session.
+
+A [self-hosted environment](</docs/en/self-hosted-environments>) runs Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on runners you deploy inside your network, and in production those sessions execute model-directed code on behalf of anyone in your organization. This page is for the operator taking a working environment to production. It works through the deployment in order: what to lock down before connecting real systems, the egress the fleet needs, how sessions authenticate to your git host, the deployment recipes themselves, and what to check when sessions misbehave.
+
+##
+
+
+
+Harden your deployment
+
+A self-hosted runner executes arbitrary, model-directed code on your infrastructure on behalf of any member of your Anthropic organization. Work through each item before you connect an environment to production systems:
+
+ * **Ephemeral, per-session containers** : run each runner process in a fresh container or VM that’s destroyed when the process exits, with `--capacity 1` and the default `--drain-grace-sec 0` so each container serves exactly one session. At a higher capacity, or with a positive drain grace, one container serves multiple sessions from the same locked account instead of one session each; see [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>). Don’t reuse a filesystem between runner restarts, except in the deliberate pre-warmed checkout setup, and never across accounts.
+ * **No broad credentials in the image** : don’t include long-lived SSH keys, cloud-provider credentials, or personal access tokens that grant more than a session needs. Mint credentials used during a session, such as push or API tokens, per session from your [wrapper script](</docs/en/self-hosted-environments-configuration#wrapper-scripts>). For the initial clone, which happens before the wrapper runs, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) or `--use-anthropic-git-proxy`; see Configure git.
+ * **Keep the environment secret off session-running hosts** : the environment secret can register runners and pick up any org member’s queued sessions. On a fixed fleet it lives on every runner host, where any session’s code can read the secret file. Prefer [on-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>), where the secret stays on the orchestrator host, which never runs user code, and each runner receives a single-use work order that registers exactly one runner. On a fixed fleet, treat the environment-secret file as readable by every session and rotate the secret after any suspected session compromise.
+ * **Default-deny network egress** : restrict runner and session container outbound traffic at your own network boundary on every environment; Default-deny egress covers what to allow and why.
+ * **Least-privilege host IAM** : the compute identity attached to the runner host, such as an instance profile or node service account, should grant only what the runner itself needs. Sessions should obtain their own credentials through your wrapper script rather than inheriting the host’s.
+ * **Block the cloud metadata endpoint from sessions** : keeping sessions off the host identity requires blocking their access to the cloud metadata endpoint, and subnet-level egress policies don’t intercept link-local metadata traffic, so block it in the container itself:
+ * IMDSv2 with a hop limit of one
+ * GKE Workload Identity with metadata concealment
+ * An explicit deny for `169.254.169.254` in the session container’s network namespace
+The block applies to your wrapper script and lifecycle hooks too, since they share the container. Authenticate any token exchange with the [session JWT](</docs/en/self-hosted-environments-identity>) against your own token service over allowlisted egress, or use a file-based web identity such as IAM Roles for Service Accounts (IRSA) on Amazon EKS.
+ * **Per-runner filesystem isolation** : each runner process gets its own working directory that no other process on the host can read or write. Make `--hooks-dir`, the wrapper script, and the host’s `~/.claude/` read-only to the session, either built into the image or mounted read-only.
+ * **Dispatch is organization-wide** : any member of your Anthropic organization can dispatch a session to any of its environments, and there’s no per-environment access control on dispatch. Treat every runner host as reachable for code execution by every org member, and don’t place data or credentials on a runner host that any org member shouldn’t be able to read. [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) bounds which account’s sessions a given host executes, but dispatch into the environment itself stays organization-wide. To make self-hosted environments the only picker option, an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) can hide Anthropic-hosted environments for the whole organization from the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>).
+ * **Enforce the repo-settings guard** : choose the guard mode with [`--confine-repo-settings`](</docs/en/self-hosted-environments-reference#runner-cli-flags>). The default `warn` logs a violation and still spawns the session, `enforce` refuses the session, and `off` disables the scan. The runner scans each repository’s committed settings for:
+ * A grant that resolves outside that session’s own workspace: an `additionalDirectories` entry, an `Edit`, `Write`, or `NotebookEdit` rule in `permissions.allow`, or a `sandbox.filesystem.allowWrite` or `allowRead` entry
+ * A non-empty `env` block
+ * An operator-posture override such as `sandbox.enabled: false`
+The guard runs regardless of [`--trust-workspace`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), and doesn’t cover repository hooks, `.mcp.json`, or Bash rules; see [Permissions and tool approval](</docs/en/self-hosted-environments-configuration#permissions-and-tool-approval>) for where those grants belong.
+
+Your organization’s IP allowlist doesn’t cover self-hosted runner traffic by default. Don’t rely on it as a network control for runner or session traffic; apply default-deny egress at your own network boundary instead, and contact your Anthropic account team if you want IP-allowlist enforcement for your organization.
+
+##
+
+
+
+Network requirements
+
+The runner and the session children it spawns make outbound connections to the hosts below. Restrict session-container egress to these hosts and the specific internal services sessions need to reach; Default-deny egress covers how and why. These hosts are always required:
+
+Host| Port| Used for
+---|---|---
+`api.anthropic.com`| 443, HTTPS; WSS for the SCM connector only| Runner control plane and session streaming, model inference, feature flags, product analytics, [JWKS](</docs/en/self-hosted-environments-identity>) key fetches, commit signing, the git proxy when `--use-anthropic-git-proxy` is set, and the orchestrator’s [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) tunnel when `--scm-connector-host` is set
+Your git host, such as `github.com` or your GitHub Enterprise host| 443 or 22| Cloning and pushing repositories. Not needed if the runner uses `--use-anthropic-git-proxy`, which routes git traffic through `api.anthropic.com`.
+
+Whether these hosts are needed depends on your configuration:
+
+Host| Port| When required
+---|---|---
+`downloads.claude.ai`| 443| At install time, when you install or update Claude Code on the host with the native installer; the `install.sh` script itself is served from `claude.ai`. At session runtime, only when sessions install plugins from the official Anthropic marketplace.
+`storage.googleapis.com`| 443| At session runtime, for marketplace plugin catalog fetches and Artifact publishing when the Artifact tool is enabled; Artifact publishing falls back to `api.anthropic.com` when this host is blocked.
+`code.claude.com` and `claude.com`| 443| Documentation lookups by the built-in claude-code-guide agent and pre-approved WebFetch requests during sessions. Blocking these hosts only affects documentation lookups.
+`*.frame.claudeusercontent.com`| 443| Only when the [Artifact tool](</docs/en/artifacts#availability>) is available for sessions in your organization; defaults vary by plan, per the availability table there. Set `CLAUDE_CODE_DISABLE_ARTIFACT=1` on the runner to keep the tool disabled regardless of the organization setting.
+`raw.githubusercontent.com`| 443| Only for the changelog fetch behind `/release-notes` and the release notes shown after a CLI version change. Suppressed by `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`.
+`registry.npmjs.org`| 443| Only when a session installs a plugin that includes Node.js dependencies, or when an `npx`-launched MCP server runs
+`http-intake.logs.us5.datadoghq.com`| 443| Anthropic operational metrics. Only when `CLAUDE_CODE_BYOC_ENABLE_DATADOG=1` is set; off by default in self-hosted environments.
+`browser-intake-us5-datadoghq.com`| 443| Anthropic error-report uploads, sent only when [error reporting](</docs/en/data-usage#telemetry-services>) is enabled for the session’s account. Suppressed by `DISABLE_ERROR_REPORTING=1` or `DISABLE_TELEMETRY=1`.
+
+The runner doesn’t reach `statsig.anthropic.com`, `*.sentry.io`, `claude.ai`, or `platform.claude.com`. These hosts appear in some older enterprise network checklists, but you don’t need to allowlist them for runner or session traffic: feature-flag fetches go to `api.anthropic.com`, and the runner authenticates with the environment secret rather than interactive OAuth. Two host-side flows do reach `claude.ai`, so run them from a host whose egress allows it rather than widening session-container egress: the one-line installer fetches `install.sh` from `claude.ai` at install time, and interactive `claude auth login`, which the [guided setup](</docs/en/self-hosted-environments-quickstart#set-up-an-environment-and-runner>), `doctor`’s signed-in mode, and [CI dispatch](</docs/en/self-hosted-environments-testing#authenticate-from-ci>) use, signs in through `claude.ai`, `claude.com`, and `platform.claude.com`. `mcp-proxy.anthropic.com` isn’t required either: self-hosted sessions don’t use it, and delivery of your organization’s claude.ai connectors to sessions, when enabled for your organization, routes through `api.anthropic.com`. See [MCP servers](</docs/en/self-hosted-environments-configuration#mcp-servers>).
+
+###
+
+
+
+Default-deny egress
+
+Deploy runner and session containers in a network segment or namespace whose outbound traffic is limited to the hosts in the network requirements table, your git host, and the specific internal services sessions need to reach. The product can’t verify or enforce this, so apply it at your own network boundary on every environment. Session code is model-directed and can attempt connections to arbitrary hosts; default-deny egress at the network layer bounds where those attempts can land. This applies regardless of permission mode: the default pre-approved tool set already includes `Bash`, so shell egress runs without a prompt even without [auto mode](</docs/en/self-hosted-environments-configuration#permissions-and-tool-approval>). For details on which telemetry each session emits and how to turn it off, see [Telemetry](</docs/en/self-hosted-environments-reference#telemetry>).
+
+##
+
+
+
+Configure git
+
+The runner manages repository checkouts but doesn’t configure git identity or credentials by default. You control the runner’s image and process environment, so you control the git config. Choose one of two approaches:
+
+ * **Let the runner configure git** : start the runner with `--configure-git` to have it write the same identity and commit-signing config that Anthropic-hosted sessions use
+ * **Ship git config in your image** : set identity and push credentials yourself, for example to commit under your own bot identity
+
+Git version floors on the runner host: `--configure-git` SSH commit signing requires Git 2.34 or newer, `--use-anthropic-git-proxy` requires 2.32 or newer, and resuming sessions from branches pushed by [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) requires 2.29 or newer. Git 2.24 is sufficient if you omit all three and manage git identity yourself.
+
+###
+
+
+
+Let the runner configure git
+
+Start the runner with `--configure-git`, or set `SELF_HOSTED_RUNNER_CONFIGURE_GIT=1`, to have it write global git config at startup:
+
+ * `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.
+
+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.
+
+###
+
+
+
+Ship git config in your image
+
+Git identity is required for any commit. Set it system-wide in your Dockerfile so the config applies regardless of which user the runner process runs as:
+
+ RUN git config --system user.name "Claude" && \
+ git config --system user.email "noreply@anthropic.com"
+
+Without an identity, `git commit` fails with `Please tell me who you are` and sessions can’t make progress. You can use your own bot identity instead; the runner doesn’t override these values. Don’t bake long-lived or broadly-scoped push credentials into a shared runner image: a credential in the image is available to every session the image runs, across every member of your organization. Instead, mint a short-lived, least-scoped token per session from your [wrapper script](</docs/en/self-hosted-environments-configuration#wrapper-scripts>), using the session creator’s identity decoded from the session JWT. Pair it with an ephemeral per-session container, which requires `--capacity 1`, so no credential outlives the session that minted it; see the hardening section. If you must configure push credentials at the image level, for example for a read-only deploy key, scope them as tightly as your git host allows:
+
+ * An SSH deploy key limited to one repository with a `url.<base>.insteadOf` rewrite
+ * A `credential.helper` that returns a minimally-scoped token
+ * `GIT_SSH_COMMAND` pointing at a narrowly-scoped key
+
+If checkout directories are owned by a different uid than the runner process, git refuses to operate on them; add `safe.directory`:
+
+ RUN git config --system --add safe.directory '*'
+
+###
+
+
+
+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.
+
+###
+
+
+
+Rewrite git URLs for private networks
+
+Repository URLs arrive from the control plane as HTTPS, with the hostname of your git host; for GitHub Enterprise, that’s the hostname you configured for the [GitHub Enterprise integration](</docs/en/github-enterprise-server>) in Claude Code admin settings on claude.ai. Two repeatable flags rewrite those URLs before clone:
+
+ * `--git-host-rewrite <from>=<to>`: for split-horizon DNS, where Anthropic reaches your git host via an external hostname but runners must use an internal one
+ * `--git-ssh-rewrite <host>`: for git hosts that only accept SSH, rewriting `https://<host>/owner/repo` to `git@<host>:owner/repo`
+
+Host rewriting runs first, so list the internal hostname in `--git-ssh-rewrite` if you need both. For full control over checkout, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>).
+
+##
+
+
+
+Build the runner image
+
+Anthropic doesn’t publish a pre-built runner image. Build your own around the `claude` binary, layering in whatever toolchain your repositories need: language runtimes, compilers, package managers, and [MCP](</docs/en/mcp>) sidecars. The recipes below use `--capacity 4`, so one container serves up to four concurrent sessions from the same locked account. That doesn’t provide the per-session container isolation in the hardening section: before connecting an environment to production systems, either run the recipes at `--capacity 1` with one container per session, or use [on-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>), which also keep the environment secret off session-running hosts. This Dockerfile is a minimal starting point:
+
+ FROM debian:bookworm-slim
+ ARG CLAUDE_CODE_VERSION
+ RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates openssh-client \
+ && rm -rf /var/lib/apt/lists/*
+ RUN curl -fsSL "https://downloads.claude.ai/claude-code-releases/${CLAUDE_CODE_VERSION:?set with --build-arg CLAUDE_CODE_VERSION}/linux-x64/claude" \
+ -o /usr/local/bin/claude && chmod +x /usr/local/bin/claude
+ RUN git config --system user.name "Claude" \
+ && git config --system user.email "noreply@anthropic.com" \
+ && git config --system --add safe.directory '*'
+ ENTRYPOINT ["claude"]
+
+Swap `linux-x64` for `linux-arm64` if your nodes are ARM, or for `linux-x64-musl` or `linux-arm64-musl` on a musl-based image such as Alpine; see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>) for the extra packages musl images need. The URL is the standard Claude Code release location, so you can verify the downloaded binary against the release’s signed manifest as described in [Binary integrity and code signing](</docs/en/setup#binary-integrity-and-code-signing>). Build the image with Claude Code version 2.1.224 or later, then push it to your registry and reference it in the recipes below:
+
+ docker build --build-arg CLAUDE_CODE_VERSION=2.1.224 -t <your-registry>/claude-runner:latest .
+
+##
+
+
+
+Kubernetes
+
+The runner serves `GET /healthz` on port 8080 by default, configurable with `--health-port`, so Kubernetes probes work with no extra setup. The endpoint returns `200` whenever the process is alive, so the probes below detect a dead process, not a stuck one; to catch a runner that stopped polling, alert on the `last_poll_age_seconds` series from [`/metrics`](</docs/en/self-hosted-environments-reference#prometheus-metrics>). The Deployment below mounts the environment secret from a Kubernetes Secret, points the liveness and readiness probes at `/healthz`, and sets a 90-second termination grace period. See Shutdown timing for why the grace period matters.
+
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: claude-runner
+ namespace: claude-runners
+ spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: claude-runner
+ template:
+ metadata:
+ labels:
+ app: claude-runner
+ app.kubernetes.io/part-of: claude-code-self-hosted-runner
+ spec:
+ terminationGracePeriodSeconds: 90
+ containers:
+ - name: runner
+ image: <your-registry>/claude-runner:latest
+ args:
+ - self-hosted-runner
+ - --environment-secret-file
+ - /etc/claude/environment-secret
+ - --capacity
+ - "4"
+ volumeMounts:
+ - name: environment-secret
+ mountPath: /etc/claude
+ readOnly: true
+ ports:
+ - name: health
+ containerPort: 8080
+ readinessProbe:
+ httpGet:
+ path: /healthz
+ port: 8080
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ livenessProbe:
+ httpGet:
+ path: /healthz
+ port: 8080
+ initialDelaySeconds: 30
+ periodSeconds: 30
+ volumes:
+ - name: environment-secret
+ secret:
+ secretName: claude-runner-environment-secret
+
+The Deployment above lives in a `claude-runners` namespace. Create the namespace first:
+
+ kubectl create namespace claude-runners
+
+Create the backing Secret from a local file holding the value you copied in the admin UI’s [**Copy environment key** step](</docs/en/self-hosted-environments-quickstart#set-up-an-environment-and-runner>), so the secret never appears in your shell history. Run `(umask 077 && cat > ./environment-secret)`, paste the secret, press Enter, then Ctrl-D. Then create the Secret and delete the file:
+
+ kubectl create secret generic claude-runner-environment-secret -n claude-runners --from-file=environment-secret=./environment-secret
+
+##
+
+
+
+Docker Compose
+
+The Compose service below restarts the runner whenever it exits, which covers both crashes and the normal exit after draining. A Docker restart policy restarts the same container with its writable layer intact, so the runner comes back on a reused filesystem rather than the fresh one the hardening posture recommends; use this recipe for evaluation, and for production either recreate the container per run or use an orchestrator that does.
+
+ services:
+ claude-runner:
+ image: <your-registry>/claude-runner:latest
+ command:
+ - self-hosted-runner
+ - --environment-secret-file
+ - /run/secrets/environment-secret
+ - --capacity
+ - "4"
+ secrets:
+ - environment-secret
+ restart: always
+ stop_grace_period: 90s
+
+ secrets:
+ environment-secret:
+ file: ./environment-secret
+
+##
+
+
+
+Shutdown timing
+
+On `SIGTERM`, the runner stops taking new work, waits up to `--drain-wait-sec`, zero by default, for in-flight turns to finish, terminates each child process, and runs the [`post-session` lifecycle hook](</docs/en/self-hosted-environments-configuration#post-session>). The full drain path needs up to `--session-stop-grace-sec` \+ `--drain-wait-sec` \+ `--post-session-hook-timeout-sec`, plus 15 seconds of fixed overhead for process cleanup, plus 30 more seconds when [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) is set. That is 80 seconds at defaults, and the runner logs the total at startup. Sessions drain in parallel under this one budget, so the total doesn’t grow with `--capacity`. At the default `--drain-wait-sec 0`, a rolling restart interrupts in-flight turns; each session resumes on another runner, losing unpushed work as described under Known issues. Set `--drain-wait-sec`, and raise the grace period to match, to let turns finish first. Throughout that whole path, the runner keeps heartbeating to the control plane at zero capacity, so the session lease doesn’t expire and get requeued to another runner while the `post-session` hook is still writing out uncommitted work. The heartbeat stops just before the runner deregisters. Set `terminationGracePeriodSeconds` on Kubernetes, `stop_grace_period` on Docker Compose, or your orchestrator’s equivalent to at least the total the runner logs, so a container-wide kill never lands while a `post-session` hook is mid-run. If your hosts die at a known wall-clock time and you pass [`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), size the margin between the retire time and the kill to cover typical turns plus this same budget, and compute the value at each launch, for example `date +%s` plus the runner’s intended lifetime, rather than baking a static value into a restartable manifest. The Kubernetes default of 30 seconds is shorter than the runner’s drain path and will kill the pod mid-cleanup. For the flags that control each phase, see the [runner CLI reference](</docs/en/self-hosted-environments-reference#runner-cli-flags>).
+
+###
+
+
+
+What reaches a running post-session hook
+
+The `post-session` hook and the Claude session child each run in their own POSIX process group, separate from the runner’s, so stop mechanisms reach them differently:
+
+ * **A second`SIGTERM` to the runner**: force-exits the runner immediately, skipping whatever remains of the drain path. Nothing signals a mid-run `post-session` hook, so on a bare host where an init process adopts orphans, it finishes on its own, but unsupervised: its timeout budget no longer applies, and a write to the closed log pipe can kill it with `SIGPIPE`, so a hook that needs to survive a forced exit there should redirect its own output to a file. In the container recipes on this page the runner is the container’s PID 1 and its exit ends the container, and under systemd’s default `KillMode=control-group` the cgroup kill in the third bullet applies; in both, treat a forced exit as fatal to the hook and rely on the grace period instead.
+ * **Process-group-wide signals** , such as `kill -- -<pid>` in a wrapper script, shell job control, or a group-wide watchdog: reach the runner and a mid-`checkout`-hook subprocess, which stays group-attached deliberately, but not a mid-run `post-session` hook or the session child.
+ * **Cgroup-wide kills** , such as systemd’s default `KillMode=control-group` or the `SIGKILL` Kubernetes delivers to the whole container when `terminationGracePeriodSeconds` expires: reach everything, including the hook. Process-group isolation doesn’t protect against these, which is why the grace period must cover the full drain path.
+ * **The hook’s own timeout** : when a hook exceeds `--post-session-hook-timeout-sec`, the runner sends `SIGTERM` to the hook’s whole process group, then `SIGKILL` two seconds later, so a worker the hook forked, such as tar, rsync, or git, terminates with the wrapper shell instead of surviving as an orphan. The runner’s supervision ends once the hook’s stdio closes: a worker that redirected its own output to a file and outlives the `SIGTERM` stage is past the runner’s reach.
+
+On the first `SIGTERM`, and again on a forced exit, the runner logs how many `post-session` hooks are still running, so you can tell a quiet drain from one that’s mid-snapshot.
+
+##
+
+
+
+Keep the base directory and capacity identical across runners
+
+If a runner dies mid-session, the server requeues the session and another runner in the environment picks it up. That runner derives the checkout path from its own `--base-dir` and `--capacity`: `--capacity 1` checks out directly under `--base-dir`, and a `--capacity` above `1` uses per-session worktrees instead. When runners in the same environment use different values for either flag, the resumed session’s working directory changes, and absolute paths the agent recorded earlier, in edits, tool calls, or its own notes, point at a location that no longer exists. Use the same `--base-dir` and `--capacity` on every runner in an environment, and don’t use a per-host value such as an instance ID or hostname. The base directory must be writable by the user the runner runs as: the runner creates per-session directories under it when each session starts and doesn’t check it at startup, so a missing or read-only base directory typically shows up as sessions that fail immediately after pickup rather than as a startup error. The default is `/workspace`, which a runner running as root creates on first use; for a non-root runner, create the directory and give that user ownership before starting the runner, or point `--base-dir` at a directory the user already owns.
+
+##
+
+
+
+Reuse a pre-warmed checkout
+
+For large repositories, the clone can dominate session startup. At `--capacity 1` with no [`checkout` hook](</docs/en/self-hosted-environments-configuration#checkout>), the runner keeps one canonical clone per repository at `<base-dir>/<owner>/<repo>` and reuses it across sessions: it fetches the requested ref, detaches `HEAD`, and resets hard to it, which is near-instant when little has changed. To skip the cold clone, bake a clone into your runner image at that path, which gives every fresh container the warm clone without reusing a disk, or point `--base-dir` at a persistent volume paired with [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) so the disk only ever serves one account. What the reuse path does and doesn’t guarantee:
+
+ * **Any clone shape works** : a full, shallow, or single-branch clone at the path is used as-is. The runner never passes `--depth` when fetching into an existing clone, so a full pre-warm keeps its full history and a shallow one stays shallow. `CLAUDE_RUNNER_FETCH_DEPTH` (`full`, `0`, or a number; default 50) controls only the cold clone the runner makes when no clone exists yet.
+ * **Tracked changes reset, untracked files persist** : each session starts from a hard reset that wipes the previous session’s tracked modifications, but the runner never runs `git clean`, so untracked files from the locked account’s earlier sessions stay in the tree.
+ * **With the git proxy, the reset becomes a checkout** : with `--use-anthropic-git-proxy`, the runner sanitizes the clone’s `.git/` before each session, keeping the object store, refs, and shallow state but deleting the index, so each session pays a full working-tree checkout instead of a near-instant reset; it still never re-clones. Submodule pre-warms aren’t supported under the proxy.
+ * **Long clones need no workaround** : the runner bounds each git operation with a 120-second no-progress watchdog and a 30-minute hard cap, not a flat timeout, so a slow cold clone that keeps reporting progress completes.
+
+##
+
+
+
+Pin the version
+
+Each session’s child Claude Code process runs the runner’s own binary, and the runner turns off auto-update inside the sessions it spawns, so every session runs the version you installed on the host or built into the image. A host-level update takes effect the next time the runner starts.
+
+ * **To hold a fleet on one version** : build the image with a pinned version, or on a bare host install a specific version and [disable auto-updates](</docs/en/setup#disable-auto-updates>)
+ * **To upgrade** : install the newer version or rebuild the image, then restart the runners
+ * **Plugins** : plugin marketplaces don’t auto-update either; set `FORCE_AUTOUPDATE_PLUGINS=1` in the runner’s environment to let plugins auto-update while the binary stays pinned
+
+##
+
+
+
+Scale the fleet
+
+Your orchestrator decides when to add or remove runners. Because of the [one-user-per-runner lock](</docs/en/self-hosted-environments#runner-lifecycle>), the minimum replica count is the number of users you expect to be active concurrently; `--capacity` controls parallelism within one user’s sessions, not across users. Two scaling approaches are available:
+
+ * **Fixed fleet** : run a static set of runner replicas and scale on the [Prometheus metrics](</docs/en/self-hosted-environments-reference#prometheus-metrics>) each runner serves
+ * **On-demand runners** : run the `claude self-hosted-runner orchestrator` subcommand, which polls Anthropic for sessions that are queued with no runner available and invokes your `spawn-runner` hook to boot one per session. See [On-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>).
+
+##
+
+
+
+Known issues and limitations
+
+The following are the limitations in this release, with workarounds where one exists.
+
+###
+
+
+
+Connector traffic leaves your network
+
+Connector tools, such as GitHub, Slack, Linear, and the other claude.ai connectors, are called from Anthropic’s side rather than from your runner, so when a self-hosted session uses a connector, that traffic routes through `api.anthropic.com`, not from 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>), which apply to server-delivered connectors too. An allowlist you deploy for other servers also blocks delivered connectors. To keep connectors available alongside a URL-based allowlist, add an entry matching the session proxy URL, such as `https://api.anthropic.com/v2/ccr-sessions/*`. If tool traffic must stay inside your network, run the equivalent tools as local MCP servers on the runner image instead. See [MCP servers](</docs/en/self-hosted-environments-configuration#mcp-servers>).
+
+###
+
+
+
+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.
+
+###
+
+
+
+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.
+ * **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.
+
+###
+
+
+
+Report an issue
+
+For issues with self-hosted environments, contact your Anthropic account team.
+
+##
+
+
+
+Troubleshooting
+
+For guided diagnosis, run the doctor subcommand on the runner host. It starts an interactive Claude Code session with read-only access to the runner’s logs and state; the only change it can make is requeuing a stuck session. Sign in with `claude auth login` on that host first so the session can query your environment, its runners, and its queued sessions. Without that sign-in, for example when the host authenticates with an API key, it’s limited to the local health endpoint, metrics, and the runner’s log, and it reads the log only if you started the runner with `--log-file`.
+
+ claude self-hosted-runner doctor
+
+Common issues:
+
+ * **Runner doesn’t appear in the environment** : confirm the host can reach `api.anthropic.com` over HTTPS, the environment secret is current, and the host clock is within five minutes of real time; larger skew causes authentication to fail. The runner logs `[runner:fatal]` with the rejection reason on auth failure.
+ * **Sessions stay queued** : every online runner may be locked to a different account. Check each runner’s `claude_code_self_hosted_runner_locked_account` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) or its `Picked up session` log lines to see which account holds it. Add replicas, or wait for an existing runner to drain and restart. If the environment uses on-demand runners, check the orchestrator instead; see [On-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>).
+ * **Sessions fail immediately after pickup** : open the session in claude.ai/code to see the error. The most common causes are missing git credentials in the runner image, build tools that aren’t installed, and a base directory the runner’s user can’t write to. For the last one the error is `EACCES` on a path under `--base-dir`, default `/workspace`; fix the directory’s ownership or point `--base-dir` at a writable path, as described in Keep the base directory and capacity identical across runners.
+ * **A session’s branch no longer exists on the remote** : for a git source the session only reads from, the runner skips that source and continues on the remaining ones. For the source the session pushes results to, a deleted branch, typically because it was merged and auto-deleted, fails the session with an error naming the repository and branch and asking you to restore the branch and retry.
+ * **Sessions take minutes to start** : the initial clone usually dominates. Watch the `claude_code_self_hosted_runner_session_init_duration_seconds` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) to confirm, and cut the clone with a pre-warmed checkout or a smaller `CLAUDE_RUNNER_FETCH_DEPTH`.
+ * **Pod is killed mid-drain** : raise `terminationGracePeriodSeconds` to at least the value the runner logs at startup. See Shutdown timing.
+
+The runner writes its lifecycle log, including `[runner:fatal]` lines, to stdout, and debug output to stderr, all as plain-text lines rather than JSON; capture both streams with `--log-file`, which also lets `self-hosted-runner doctor` tail them, or with your platform’s log collection. Each session’s child process writes a separate debug log; on failure the runner preserves the log, prints the log’s path in the runner log, and surfaces the log’s tail alongside the session in claude.ai/code.
+
+##
+
+
+
+What’s next
+
+ * [Customize sessions](</docs/en/self-hosted-environments-configuration>): wrapper scripts, lifecycle hooks, on-demand runners, MCP servers, and permissions
+ * [Test end to end](</docs/en/self-hosted-environments-testing>): verify a new runner image from CI before promoting it
+ * [Reference](</docs/en/self-hosted-environments-reference>): every CLI flag, environment variable, and metric
Show diff (270 lines)
--- a/self-hosted-environments-identity.md
+++ b/self-hosted-environments-identity.md
@@ -0,0 +1,267 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) enables them by turning on **Allow self-hosted environments** on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>). This page covers session identity verification; see the [quickstart](</docs/en/self-hosted-environments-quickstart>) for setup and [Deploy to production](</docs/en/self-hosted-environments-deploy>) for the fleet recipes.
+
+A [self-hosted environment](</docs/en/self-hosted-environments>) lets [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions run on infrastructure you operate instead of on Anthropic’s. Because the session runs inside your network, Claude can call your internal services directly. Those services need a way to confirm that a request really came from a Claude Code session in your environment, and to identify which user created that session. Every session in a self-hosted environment receives a signed JSON Web Token (JWT) in the `CLAUDE_CODE_SESSION_ACCESS_TOKEN` environment variable. A session presents the token like any bearer credential; for example, a script Claude runs can call your service with `curl -H "Authorization: Bearer $CLAUDE_CODE_SESSION_ACCESS_TOKEN"`. Anthropic signs the token and publishes the verification keys at a public JWKS endpoint. Your services fetch those keys, verify the signature, and read the claims to decide what access to grant.
+
+##
+
+
+
+The session token
+
+Before you write verification code, know what the token establishes and the shape your JWT library will see.
+
+###
+
+
+
+What the token proves
+
+A valid token establishes some facts and deliberately not others:
+
+ * **Proves** : Anthropic issued the token for a specific session in a specific environment, and how the session was created: by a user in your organization, or with an organization service key
+ * **Doesn’t prove** : which process on the runner host presents it. The token sits in an environment variable inside the session, so any code Claude runs, and any tool or MCP server the session starts, can read and present it.
+
+Two consequences for your services:
+
+ * Verify the `aud` claim against your environment ID, the `ccpool_...` value shown with your environment on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>), to reject tokens issued to any other organization’s environment.
+ * Scope credentials you derive from the token to what a single coding session should be able to do, not to everything the creating user can do. See Scope derived credentials.
+
+###
+
+
+
+Token format
+
+The value of `CLAUDE_CODE_SESSION_ACCESS_TOKEN` has an `sk-ant-cc-` prefix followed by a standard three-part JWT:
+
+ sk-ant-cc-<base64url header>.<base64url payload>.<base64url signature>
+
+Strip the prefix before passing the value to a JWT library. Tokens issued to Anthropic-hosted cloud sessions carry an `sk-ant-si-` prefix instead and are signed by a different key set, so reject any value that doesn’t start with `sk-ant-cc-`. The signature algorithm is `ES256`, which is ECDSA on the P-256 curve with SHA-256. The token header carries a `kid` that identifies which key in the JWKS signed it.
+
+##
+
+
+
+Verify the token
+
+Verification runs in one of two places. Services on your network verify the token cryptographically against Anthropic’s published keys, and wrapper scripts inside the session can use the runner binary’s built-in decoder instead.
+
+###
+
+
+
+Verify the token from your service
+
+Anthropic publishes the verification keys at a public, unauthenticated endpoint:
+
+ https://api.anthropic.com/v1/code/.well-known/jwks.json
+
+The response is a standard [JSON Web Key Set](<https://www.rfc-editor.org/rfc/rfc7517>). Anthropic rotates the signing keys periodically, and keys from before a rotation remain in the set long enough that tokens they signed continue to verify, so don’t pin a single key. The endpoint sets `Cache-Control: public, max-age=300`, so caching the key set and refetching every five minutes is safe. Verify each incoming token against these checks:
+
+1
+
+Check the prefix
+
+Reject the value if it doesn’t start with `sk-ant-cc-`, then remove that prefix. The remainder is a standard compact JWT.
+
+2
+
+Verify the signature
+
+Fetch the JWKS, select the key whose `kid` matches the token header, and verify the `ES256` signature. Reject tokens whose `alg` header is not `ES256`. If a token arrives with a `kid` that isn’t in your cached key set, refetch the JWKS once before rejecting it: after a rotation, new tokens are signed with a key your cached set doesn’t have yet.
+
+3
+
+Verify the issuer
+
+Reject the token if `iss` is not exactly `ccr`.
+
+4
+
+Verify the audience against your environment
+
+The `aud` claim is an array. Reject the token unless it contains your environment ID, which has the form `ccpool_...`. The environment ID is shown in your environment’s detail dialog on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>), and appears as the `ccr:pool_id` claim in any of the environment’s session tokens. This check is what scopes the token to your environment and rejects tokens issued to other organizations.
+
+5
+
+Verify the role
+
+Reject the token if `ccr:role` is not exactly `session_worker`. Other tokens issued for self-hosted environments, such as environment secrets, runner tokens, and work orders, are signed by the same key set but carry different roles.
+
+6
+
+Verify expiry
+
+Reject the token if `exp` is in the past. Anthropic issues session tokens with a four-hour lifetime by default and a maximum of eight hours. The runner refreshes the token before expiry and pushes the new value to the session, so subprocesses that Claude starts after a refresh inherit it. One session can therefore present several distinct valid tokens to your service over its lifetime.
+
+7
+
+Read the identity
+
+The creating user’s identity is in the `act` claim: `act.sub` is their Anthropic user ID in the prefixed form `user:<id>`, and `act.email`, when the creating surface recorded one, is their email address. Sessions created with an organization service key carry no user identity, so treat a session as user-created only when `act.sub` carries the `user:` prefix, rather than testing whether identity claims are absent. See the claims reference for the full structure and the flat duplicate claims.
+
+The checks map directly onto standard JWT libraries. The examples below implement the full sequence in Node.js with [`jose`](<https://www.npmjs.com/package/jose>), which handles JWKS fetching, caching, and `kid` selection, and in Python with [`PyJWT`](<https://pyjwt.readthedocs.io/>) and its built-in JWKS client.
+
+ * Node.js (jose)
+
+ * Python (PyJWT)
+
+ import { createRemoteJWKSet, jwtVerify } from "jose";
+
+ const JWKS = createRemoteJWKSet(
+ new URL("https://api.anthropic.com/v1/code/.well-known/jwks.json")
+ );
+
+ const PREFIX = "sk-ant-cc-";
+ const EXPECTED_POOL_ID = "ccpool_...";
+
+ export async function verifySessionToken(raw: string) {
+ if (!raw.startsWith(PREFIX)) {
+ throw new Error("not a self-hosted runner session token");
+ }
+ const jwt = raw.slice(PREFIX.length);
+
+ const { payload } = await jwtVerify(jwt, JWKS, {
+ issuer: "ccr",
+ audience: EXPECTED_POOL_ID,
+ algorithms: ["ES256"],
+ });
+
+ if (payload["ccr:role"] !== "session_worker") {
+ throw new Error("token is not a session_worker token");
+ }
+
+ const act = payload.act as { email?: string; sub?: string };
+ return {
+ sessionId: payload["ccr:session_id"] as string,
+ poolId: payload["ccr:pool_id"] as string,
+ orgId: payload["ccr:org_id"] as string,
+ creatorEmail: act?.email,
+ creatorSub: act?.sub,
+ };
+ }
+
+ import jwt
+ from jwt import PyJWKClient
+
+ JWKS_URL = "https://api.anthropic.com/v1/code/.well-known/jwks.json"
+ PREFIX = "sk-ant-cc-"
+ EXPECTED_POOL_ID = "ccpool_..."
+
+ jwks = PyJWKClient(JWKS_URL)
+
+ def verify_session_token(raw: str) -> dict:
+ if not raw.startswith(PREFIX):
+ raise ValueError("not a self-hosted runner session token")
+ token = raw.removeprefix(PREFIX)
+
+ signing_key = jwks.get_signing_key_from_jwt(token)
+ payload = jwt.decode(
+ token,
+ signing_key.key,
+ algorithms=["ES256"],
+ issuer="ccr",
+ audience=EXPECTED_POOL_ID,
+ )
+
+ if payload.get("ccr:role") != "session_worker":
+ raise ValueError("token is not a session_worker token")
+
+ act = payload.get("act") or {}
+ return {
+ "session_id": payload["ccr:session_id"],
+ "pool_id": payload["ccr:pool_id"],
+ "org_id": payload["ccr:org_id"],
+ "creator_email": act.get("email"),
+ "creator_sub": act.get("sub"),
+ }
+
+###
+
+
+
+Verify the token inside the session
+
+[Wrapper scripts](</docs/en/self-hosted-environments-configuration#wrapper-scripts>) run inside the session, before Claude starts. Instead of calling a JWT library, they can run the runner binary’s `self-hosted-runner decode-token` subcommand. The subcommand reads the token from a positional argument, from `CLAUDE_CODE_SESSION_ACCESS_TOKEN`, or from piped stdin, in that order, then strips the prefix, verifies the signature against the JWKS endpoint, checks expiry, and prints the claims as JSON. The subcommand performs the signature and expiry checks only; it doesn’t check `iss`, `aud`, or `ccr:role`. When your wrapper’s auth decision depends on those claims, read them from the printed JSON and compare them explicitly. This command extracts the creator identity, preferring the SSO provider’s subject, then the email address, then the always-present Anthropic user ID:
+
+ "$CLAUDE_RUNNER_CLAUDE_BIN" self-hosted-runner decode-token | jq -re '.act.attested_by.sub // .act.email // .act.sub'
+
+Wrappers receive the absolute path to the runner’s own binary in `CLAUDE_RUNNER_CLAUDE_BIN`; use that path rather than a PATH-resolved `claude` so the decode runs on the same binary the runner itself uses. Use `jq -re` rather than `jq -r` so a missing claim causes a non-zero exit. With `-r` alone, a missing claim prints the literal string `null` and exits zero, which silently passes a bad value downstream. Pass `--no-verify` to `decode-token` only for offline inspection where the JWKS endpoint is unreachable.
+
+##
+
+
+
+Claims reference
+
+The table below lists the session token claims relevant to verification. Read identity from the `ccr:*` namespace and the `act` chain; the flat `account_email`, `organization_uuid`, and `account_uuid` claims are backward-compatibility duplicates that may be removed. Sessions created with an organization service key omit `act.email`, `ccr:account_id`, `account_email`, and `account_uuid`. The two email claims are optional for user-created sessions too: Anthropic records them at session creation only when the creating request’s credentials carry an email, and a session dispatched from the CLI can lack both, so key identity on `act.sub` or `ccr:account_id` rather than on email. Tokens can also carry additional claims beyond this table; ignore claims you don’t recognize.
+
+Claim| Type| Description
+---|---|---
+`iss`| string| Always `ccr`.
+`sub`| string| `ccr:session:<session_id>`.
+`aud`| array of strings| Always contains `anthropic-api`. For sessions in self-hosted environments the array also contains your environment ID, such as `ccpool_...`. Verify the environment ID, not `anthropic-api`.
+`exp`| number| Expiry as a Unix timestamp. Four-hour default lifetime, eight-hour maximum.
+`iat`| number| Issued-at as a Unix timestamp.
+`jti`| string| Unique token identifier.
+`ccr:role`| string| Always `session_worker` for session tokens.
+`ccr:session_id`| string| The session ID. Same value as the suffix of `sub`.
+`ccr:pool_id`| string| Your environment ID. Same value that appears in `aud`.
+`ccr:org_id`| string| Your Anthropic organization ID.
+`ccr:account_id`| string| The creating user’s Anthropic account ID: the value of `act.sub` without the `user:` prefix, a tagged `user_...` ID. The same value the [spawn-runner hook](</docs/en/self-hosted-environments-configuration#the-spawn-runner-hook>)’s `CLAUDE_RUNNER_ACCOUNT_ID` carries and [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) accepts, so the three compare as equal strings.
+`account_email`| string| Duplicate of `act.email`; absent whenever `act.email` is.
+`organization_uuid`| string| Your Anthropic organization UUID.
+`account_uuid`| string| The creating user’s Anthropic account UUID.
+`act`| object| [RFC 8693](<https://www.rfc-editor.org/rfc/rfc8693>) delegation chain. See The `act` chain.
+
+###
+
+
+
+The `act` chain
+
+The `act` claim records the full delegation path from the user who created the session down to the [environment](</docs/en/self-hosted-environments#key-concepts>) whose secret admitted the runner, and the identity that created that secret. The creating user is the outermost actor, so `act.sub` identifies them directly.
+
+Path| Description
+---|---
+`act.sub`| The creating user’s Anthropic user ID, in the form `user:<id>`.
+`act.email`| The creating user’s email address, when one was recorded at session creation. Don’t require it; key on `act.sub`.
+`act.attested_by`| The upstream identity provider’s attestation for the creating user, when available. `act.attested_by.sub` is the subject your SSO provider, such as Google or Okta, issued. Prefer this over `act.email` when mapping to identities in your own systems.
+`act.act`| The runner that spawned the session. `act.act.sub` is `ccr:runner:<runner_id>`.
+`act.act.act`| The environment. `act.act.act.sub` is `ccr:pool:<pool_id>`.
+`act.act.act.act`| The identity that created the environment secret the runner registered with. The chain ends here.
+
+##
+
+
+
+Scope derived credentials
+
+The session token identifies the creating user, but don’t treat it as equivalent to that user logging in directly. The token sits in an environment variable inside the session, so any code Claude runs, and any tool or MCP server the session starts, can read and present it. Verification is also offline: a token that verifies against the JWKS stays valid until its `exp`, whatever has happened to the session since, and Anthropic doesn’t publish a revocation feed for session tokens. Bound anything you derive from the token accordingly. When your service exchanges the token for internal credentials, issue credentials scoped to what one coding session should reach:
+
+ * **Limit capabilities** : grant read and write access to the resources the session needs for coding tasks, not administrative capabilities the user holds elsewhere.
+ * **Limit lifetime** : bound derived credentials to the token’s `exp`, or shorter.
+ * **Audit as the session** : record the `ccr:session_id` and `jti` alongside the user identity so you can trace actions back to a specific session.
+
+##
+
+
+
+Related environment variables
+
+The creator identity also appears in plain environment variables on two surfaces that never verify the token:
+
+ * **The[`spawn-runner` hook](</docs/en/self-hosted-environments-configuration#the-spawn-runner-hook>), on the orchestrator**: the hook runs before any runner exists for a queued session and receives the creator identity in variables such as `CLAUDE_RUNNER_ACCOUNT_EMAIL` and `CLAUDE_RUNNER_ACCOUNT_ID`. The orchestrator reads them from the work order, the signed single-use token that authorizes spawning one runner, without verifying the work order’s signature itself; the claims are trusted because the work order arrives over the orchestrator’s connection to Anthropic, which the environment secret authenticates.
+ * **[Wrapper scripts](</docs/en/self-hosted-environments-configuration#wrapper-scripts>), inside the session**: wrappers receive `CCR_SESSION_ACCOUNT_EMAIL`, the creator’s email pre-extracted from the token without signature verification. The variable is suitable for labelling, such as commit trailers, not for auth decisions.
+
+Use the plain variables for orchestrator-side decisions such as selecting a machine image. Use `CLAUDE_CODE_SESSION_ACCESS_TOKEN` when a downstream service needs independent cryptographic proof rather than trusting the runner’s environment.
+
+##
+
+
+
+What’s next
+
+ * [Self-hosted environments](</docs/en/self-hosted-environments>): the environment, runner, and session model; the [quickstart](</docs/en/self-hosted-environments-quickstart>) and [Deploy to production](</docs/en/self-hosted-environments-deploy>) hold setup and operations
+ * [Customize sessions](</docs/en/self-hosted-environments-configuration>): wrapper scripts that consume the token, and the `spawn-runner` hook
+ * [Reference](</docs/en/self-hosted-environments-reference>): CLI flags, environment variables, and metrics
Show diff (125 lines)
--- a/self-hosted-environments-quickstart.md
+++ b/self-hosted-environments-quickstart.md
@@ -0,0 +1,122 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers the enablement path. This page gets your first session running; see [Self-hosted environments](</docs/en/self-hosted-environments>) for what they are and [Deploy to production](</docs/en/self-hosted-environments-deploy>) for hardening and fleet recipes.
+
+A [self-hosted environment](</docs/en/self-hosted-environments>) runs Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on infrastructure your organization operates, executed by runner processes you deploy. This quickstart stands up your first one, the smallest that works: one runner on a single host, running one test session. There are two steps: create the environment, start a runner, and route a session to it, then message that session from your terminal. You’ll move between two surfaces: claude.ai for creating the environment, checking its status, and routing a session, and a terminal on the host for everything the runner does. By the end you’ll have an environment on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>), a runner polling for work, and a session running on your host. Before you connect real repositories or internal systems, work through [Deploy to production](</docs/en/self-hosted-environments-deploy>), which covers the security posture, egress control, git credentials, and orchestration.
+
+##
+
+
+
+Prerequisites
+
+###
+
+
+
+Organization and roles
+
+The claude.ai side needs:
+
+ * **Allow self-hosted environments** turned on by an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>); the **New** button doesn’t appear until it is. If you don’t hold the role, someone who does can create the environment and hand you its secret; the runner and terminal steps on this page need no claude.ai role, and where a step checks status in the admin UI, the runner’s own log lines give you the same signal.
+ * A [GitHub connection](</docs/en/claude-code-on-the-web#github-authentication-options>) for your organization, so developers can pick repositories when they start sessions.
+
+###
+
+
+
+Host and network
+
+The runner host needs:
+
+ * A Linux or macOS host or container with outbound HTTPS to `api.anthropic.com`, to `claude.ai` and the download hosts it redirects to for the install step below, and to your git host for the clone; the [network requirements table](</docs/en/self-hosted-environments-deploy#network-requirements>) has the full list. Windows isn’t supported as a runner host; run the runner in a Linux container instead. Developer workstations aren’t affected, since sessions start from claude.ai in a browser.
+ * A clock synchronized to real time, for example with NTP. Authentication fails when the clock is more than five minutes off; see [Troubleshooting](</docs/en/self-hosted-environments-deploy#troubleshooting>).
+
+###
+
+
+
+Software on the runner host
+
+Install on the host before you start:
+
+ * **Claude Code v2.1.224 or later** , with any of the [standard install methods](</docs/en/setup>). The runner is part of the standard `claude` binary, and earlier versions don’t recognize the `self-hosted-runner` subcommand. The native installer’s default `latest` channel carries each release as soon as it’s published; the `stable` channel, the Homebrew `claude-code` cask, and the stable apt, dnf, and apk repositories trail by about a week. To pin the exact version your fleet runs, see [Install a specific version](</docs/en/setup#install-a-specific-version>). For container images, see the Dockerfile in [Deploy to production](</docs/en/self-hosted-environments-deploy#build-the-runner-image>).
+ * **Git 2.24 or newer**. Some git options on the deploy page need newer versions; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) states each floor.
+
+Confirm the host is ready:
+
+ claude self-hosted-runner --help
+
+A ready host prints the runner’s usage text, listing flags such as `--environment-secret-file`. On versions older than 2.1.224, the command prints the general `claude --help` output instead; upgrade with `claude update` or reinstall from the `latest` channel.
+
+##
+
+
+
+Set up an environment and runner
+
+Claude Code includes a guided setup: an interactive Claude Code session that walks you through creating the environment in the admin UI, starts a local runner with the secret file you save, confirms that the runner registers, and writes a cheat sheet to `./runner-setup/CHEAT-SHEET.md`. Run it on a machine where you’ve signed in with `claude auth login` using an account that holds an Owner or admin role; it isn’t available with API keys or third-party model providers. On hosts where an interactive session isn’t possible, use the manual steps below instead. Confirm the version check passed first: on versions older than 2.1.224, this command starts an ordinary Claude session with the words as the prompt instead of the guided setup. To start the guided setup, run the setup subcommand and follow the prompts:
+
+ claude self-hosted-runner setup
+
+To set up manually instead:
+
+1
+
+Create an environment
+
+Go to the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>) in admin settings. Under **Self-hosted environments** , select **New** , name the environment, and select **Create**. On the wizard’s second step, select **Copy environment key** to copy the environment secret, which the admin UI labels an environment key. claude.ai shows the secret once, and you can’t retrieve it later; it expires 365 days after creation. The environment’s `ccpool_...` ID stays visible in its detail dialog; you’ll need it for the `aud` check in [token verification](</docs/en/self-hosted-environments-identity>) and for dispatching [test sessions from CI](</docs/en/self-hosted-environments-testing#run-the-test-loop>).If you lose the secret or need to rotate it, create a new secret from the environment’s **Configuration** tab, roll the new secret out to your runners, then revoke the old one. Runners holding a revoked secret fail their next authenticated poll and exit, logging `poll auth failed`, and your orchestrator restarts them with the new secret.
+
+2
+
+Start a runner
+
+Create the secret directory. This step and the next need root for the `/etc/claude` path; any path the runner process can read works, so adjust both commands and the `--environment-secret-file` value together if you use a different one.
+
+ mkdir -p /etc/claude
+
+Write the environment secret to a file. The command below reads from your terminal so the secret stays out of shell history: paste the value you copied, press Enter, then Ctrl-D, and the subshell’s `umask` makes the file readable only by its owner.
+
+ (umask 077 && cat > /etc/claude/environment-secret)
+
+Create the base directory, replacing `<writable-dir>` here and in the next command with an absolute path that the user running the runner can write to. The runner checks repositories out and creates per-session directories under this path. Without `--base-dir` it uses `/workspace`, which only works if that directory already exists and is writable or the runner runs as root.
+
+ mkdir -p '<writable-dir>'
+
+Then start the runner with `--environment-secret-file` and `--base-dir`. The runner registers with your environment and begins polling for work. If the runner exits, restart it by hand. Production deployments run the runner under an orchestrator that restarts exited runners, normally with a fresh filesystem per restart; [Reuse a pre-warmed checkout](</docs/en/self-hosted-environments-deploy#reuse-a-pre-warmed-checkout>) covers the supported persistent-disk setup.
+
+ claude self-hosted-runner --environment-secret-file '/etc/claude/environment-secret' --base-dir '<writable-dir>'
+
+3
+
+Verify the runner appears
+
+Return to the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>). Your environment’s status changes from **No runners deployed** to **Healthy** within a few seconds of the runner starting; open the environment and select **Activity** to see the runner itself.
+
+4
+
+Route a session to the environment
+
+Start a session at claude.ai/code and select your environment from the environment picker, where self-hosted environments appear alongside Anthropic-hosted ones. The runner clones with whatever git credentials the host already has, so pick a repository this host can already clone, or a public one; credential options for private repositories in production are on [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>). The next available runner picks up the queued session and logs `Picked up session <session-id>` along with its active count and capacity, so you can confirm from the runner’s own output which host took the session. Watch the session work and read Claude’s replies at [claude.ai/code](<https://claude.ai/code>). If the session sits queued instead, see [Troubleshooting](</docs/en/self-hosted-environments-deploy#troubleshooting>).
+
+The runner exits by design once its active sessions finish; see [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>). For production, deploy it under an orchestrator that restarts it on exit. See [Deploy to production](</docs/en/self-hosted-environments-deploy>).
+
+##
+
+
+
+Send a follow-up message to a running session
+
+Once a session is running on your environment, send it a follow-up from the `claude` CLI on any machine where you’re logged in with `claude auth login`; the command doesn’t need to run from the machine that started the session. The queue-and-exit form posts one message:
+
+ claude -p "your message" --cloud <session-id>
+
+For `<session-id>`, pass the bare `session_...` or `cse_...` ID or the session’s claude.ai/code URL. A successful send prints `Sent to cloud session.` with the session ID and a view link. Accepted ID forms, JSON output, the interactive attach form, the account and policy requirements, and the error reference are on [Send follow-ups from the CLI](</docs/en/claude-code-on-the-web#send-follow-ups-from-the-cli>), since the command works the same against Anthropic-hosted sessions.
+
+##
+
+
+
+What’s next
+
+ * [Deploy to production](</docs/en/self-hosted-environments-deploy>): harden the deployment, control egress, configure git credentials, and run the fleet under Kubernetes or Compose
+ * [Customize sessions](</docs/en/self-hosted-environments-configuration>): wrapper scripts, lifecycle hooks, on-demand runners, MCP servers, and permissions
+ * [Test end to end](</docs/en/self-hosted-environments-testing>): a CI smoke test that dispatches a session and reads Claude’s replies
Show diff (320 lines)
--- a/self-hosted-environments-reference.md
+++ b/self-hosted-environments-reference.md
@@ -0,0 +1,317 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) enables them by turning on **Allow self-hosted environments** on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>). This page is the flag and metric reference; see the [quickstart](</docs/en/self-hosted-environments-quickstart>) for setup and [Deploy to production](</docs/en/self-hosted-environments-deploy>) for the fleet recipes.
+
+This page is the reference for the two processes you run in a [self-hosted environment](</docs/en/self-hosted-environments>): the runner, which executes Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on your hosts, and the optional autoscaling orchestrator, which starts runners as sessions queue. Each has its own flag table. Both run on Linux or macOS hosts, which the defaults such as `/workspace` and `~/.claude` assume. Run `claude self-hosted-runner --help` for the authoritative list on your installed version. Metric series and a few API fields still use `pool` for what these pages call an environment; both terms name the same thing. The environment ID is the `pool_id` field, with the form `ccpool_...`: wherever these pages show a `pool` identifier, it names the environment. CLI flags and environment variables spell it `environment`, such as `--environment-secret-file`; the deprecated `pool` spellings still work, as the `--environment-secret-file` row describes.
+
+##
+
+
+
+Runner CLI flags
+
+Most flags have a corresponding environment variable. When both are set, the flag takes precedence. Duration flags take minutes or seconds on the CLI, but the paired environment variable is always in milliseconds, indicated by the `_MS` suffix, and the Default column shows the flag’s unit: `--exit-if-unused-min 10` is equivalent to `SELF_HOSTED_RUNNER_IDLE_SHUTDOWN_MS=600000`, and a Helm value like `SELF_HOSTED_RUNNER_STARTUP_TIMEOUT_MS: "15"` means 15 milliseconds, not the 15-minute default.
+
+Flag| Env var| Default| Description
+---|---|---|---
+`--api-url <url>`| none| `https://api.anthropic.com`| API base URL. Override only for testing.
+`--base-dir <path>`| `SELF_HOSTED_RUNNER_BASE_DIR`| `/workspace`| Directory for repository checkouts and per-session working directories. The runner creates it and its subdirectories on first use, so the user running the runner needs write access to this path or its parent. 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 account. 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>).
+`--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>).
+`--confine-repo-settings <mode>`| `SELF_HOSTED_RUNNER_CONFINE_REPO_SETTINGS`| `warn`| Warn without refusing (`warn`, the default), enforce (`enforce`), or disable (`off`) 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`. 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.
+`--drain-grace-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_GRACE_MS`| `0`| Controls when the runner exits after its active sessions finish: `0` exits immediately without polling for more, and a positive value keeps the runner alive and re-polling the locked account’s queue for that many seconds first, at the cost of the per-session container isolation described in the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>)
+`--drain-wait-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_WAIT_MS`| `0`| On `SIGTERM`, wait up to N seconds for each session’s in-flight turn and background tasks to finish before terminating the child
+`--environment-secret-file <path>`| `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET`| required| Path to a file containing the environment secret, or, for runners spawned by the [orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>), the single-use work-order JWT. `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET` carries the secret value directly, not a file path. The older `--pool-secret-file` flag and `SELF_HOSTED_RUNNER_POOL_SECRET` variable still work and print a deprecation notice to stderr; preview-program runner builds older than 2.1.216 only recognize those older names.
+`--exec-path <path>`| `SELF_HOSTED_RUNNER_EXEC_PATH`| own binary| Binary or wrapper script to spawn for each session. See [Wrapper scripts](</docs/en/self-hosted-environments-configuration#wrapper-scripts>).
+`--exit-if-unused-min <n>`| `SELF_HOSTED_RUNNER_IDLE_SHUTDOWN_MS`| `0`| Exit after N minutes of polling with no work ever assigned, for autoscaler scale-down. `0` disables.
+`--git-host-rewrite <from>=<to>`| none| unset| Rewrite `https://<from>/...` source URLs to `https://<to>/...` before cloning, for split-horizon DNS. Repeatable; flag only.
+`--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. A kill that falls mid-turn is deferred until the turn finishes, bounded by a grace window. `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.
+`--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`
+`--post-session-hook-timeout-sec <n>`| `SELF_HOSTED_RUNNER_POST_SESSION_HOOK_TIMEOUT_MS`| `60`| Budget for the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) on every session end, including runner shutdown
+`--push-outcome-on-release`| `SELF_HOSTED_RUNNER_PUSH_OUTCOME_ON_RELEASE`| off| On a runner-initiated session end such as a drain or idle release, push tracked outcome branches to `origin` before deleting the workspace, so in-flight commits survive a restart. Best-effort; adds 30 seconds to the shutdown budget, and requires git 2.29 or newer to resume from the pushed branch. Restrict push access to `claude/*` refs before enabling; see [Resumed sessions lose unpushed work](</docs/en/self-hosted-environments-deploy#additional-limitations>). Repositories checked out via a `checkout` lifecycle hook aren’t pushed; snapshot those from the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) instead.
+`--release-idle-session-min <n>`| `SELF_HOSTED_RUNNER_SESSION_IDLE_MS`| `0`| Release a session slot after N minutes of inactivity once a turn finishes or the session waits for the user’s action. A session that’s still mid-turn, including one holding a never-finishing background task or an approval requested from inside a running tool call, doesn’t count as idle; pair with `--kill-session-after-min` as the hard backstop. A release that leaves the runner with no active sessions starts the same exit path as a normal drain, governed by `--drain-grace-sec`. `0` disables.
+`--retire-at <epoch-seconds>`| `SELF_HOSTED_RUNNER_RETIRE_AT`| unset| Retire the runner at an absolute Unix timestamp in seconds, for infrastructure that kills the runner at a known time; [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>) describes the release sequence and how to size the margin. Values before 2001 or after the year 5138 are rejected by the flag and ignored by the environment variable.
+`--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.
+
+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:
+
+ * **Flag** : startup fails with an error.
+ * **Environment variable** : the runner clamps the value to the timer ceiling rather than rejecting it.
+
+##
+
+
+
+Orchestrator CLI flags
+
+The `self-hosted-runner orchestrator` subcommand, which spawns [on-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>), accepts `--api-url`, `--environment-secret-file`, `--hooks-dir`, `--health-port`, and `--log-level` with the same defaults as the runner and, where the runner’s flag has one, the same environment variable, except that `--hooks-dir` is required and must contain a `spawn-runner` hook. It also takes its own flags:
+
+Flag| Default| Description
+---|---|---
+`--hook-concurrency <n>`| `4`| Maximum `spawn-runner` hooks running in parallel. Also caps how many spawn requests are claimed per poll.
+`--hook-timeout <sec>`| `60`| Terminate the hook’s process tree after this many seconds. The timeout plus its 5-second kill grace must stay below `--expected-spawn-seconds`; the orchestrator enforces this at startup.
+`--expected-spawn-seconds <sec>`| `120`| Expected p99 boot time for spawned runners, in the server-enforced range 10 to 3600. Sent on every poll as the server-side lease; if no runner registers before it elapses, the session is re-offered with a fresh order ID. All replicas must share this value.
+`--min-idle <n>`| `0`| Keep at least N idle session slots free by spawning standby runners proactively. `0` disables pre-warming. Pair with the runner’s `--exit-if-unused-min` so surplus standby runners reclaim themselves.
+`--debug-dir <path>`| unset| Write each spawn request’s work order and hook stderr to disk. Debug only; never set in production.
+
+###
+
+
+
+SCM connector flags
+
+The orchestrator can hold a standing WebSocket connection to Anthropic’s control plane so that hosted pre-session flows, such as the repository picker and the branch or ref resolver, can reach a GitHub Enterprise Server host that’s only routable from inside your network. The connector stays off unless you set `--scm-connector-host`.
+
+Flag| Default| Description
+---|---|---
+`--scm-connector-host <host[:port]>`| unset| GitHub Enterprise Server hostname to forward requests to. Port defaults to `443`. Setting this flag enables the connector.
+`--scm-connector-id <n>`| required with `--scm-connector-host`| The numeric ID of your organization’s GitHub Enterprise Server connection. Contact your Anthropic account team for the value when you enable the connector.
+`--scm-connector-provider <slug>`| `ghe`| Path segment identifying the provider, matching `^[a-z0-9-]{1,32}$`.
+`--scm-connector-ca-file <path>`| unset| Extra CA bundle, in PEM format, for TLS connections to the GitHub Enterprise Server host.
+`--scm-connector-host-rewrite <from>=<to_host:to_port>`| unset| For end-to-end testing only: redirects the TCP connection while keeping the Host header and TLS SNI as `--scm-connector-host`.
+
+The connector authenticates with the orchestrator’s existing environment secret and reconnects automatically: with exponential backoff on a dropped connection, or a fixed 30-second delay when the control plane closes the connection because another orchestrator replica already holds it.
+
+##
+
+
+
+Environment-variable-only settings
+
+These runner settings are read from the environment only and cover behavior most deployments leave at the default:
+
+Env var| Default| Description
+---|---|---
+`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_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.
+`FORCE_AUTOUPDATE_PLUGINS`| unset| When `1`, let plugin marketplaces auto-update even though the binary is pinned
+`CLAUDE_CODE_DISABLE_ARTIFACT`| unset| When `1`, disable the Artifact tool in sessions regardless of the organization’s admin setting, and drop the `*.frame.claudeusercontent.com` egress requirement
+
+##
+
+
+
+Telemetry
+
+Session children send operational telemetry to Anthropic unless you turn it off. No code or repository content is sent. Set telemetry variables on the runner process; the runner re-asserts them after applying server-provided environment variables, so the operator’s setting always takes precedence. One control is specific to self-hosted environments: `CLAUDE_CODE_BYOC_ENABLE_DATADOG=1` opts in to Datadog operational metrics, which are off by default in self-hosted environments. The general Claude Code telemetry controls, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `DISABLE_ERROR_REPORTING`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, apply to session children as documented in the [environment variable reference](</docs/en/env-vars>). `DISABLE_GROWTHBOOK` is related but different: setting `DISABLE_GROWTHBOOK=1` disables feature-flag fetching, and telemetry stays on unless `DISABLE_TELEMETRY` is also set. `CLAUDE_CODE_ENABLE_TELEMETRY` is unrelated: it enables OpenTelemetry export to your own collector, as described in [Monitoring](</docs/en/monitoring-usage>), and doesn’t control Anthropic’s analytics.
+
+##
+
+
+
+Health endpoint
+
+The runner serves `GET /healthz` on the configured health port. The response is `200 OK` whenever the process is alive, whatever state the poll loop is in, so an HTTP probe on this endpoint detects a dead process only. The JSON body describes current state:
+
+ {
+ "status": "ok",
+ "runner_id": "ccrunner_...",
+ "active_sessions": 2,
+ "last_poll_at": "2026-03-31T18:04:11.220Z",
+ "last_poll_age_ms": 842
+ }
+
+Use `last_poll_age_ms` as a liveness signal in custom probes; a value that grows unbounded indicates the poll loop is stuck. Both `last_poll_at` and `last_poll_age_ms` are `null` until the first poll completes. The orchestrator serves its own `/healthz` on its health port. Its endpoint always returns `200`, and the body carries a `connected` field reporting whether the most recent poll succeeded, plus per-state spawn-queue counts in `queue_counts`. Gate readiness and alerting on `connected` rather than the status code. When the SCM connector is configured, the orchestrator’s `/healthz` body also carries `scm_connector_connected` and a `scm_connector` object with `connected`, `last_connected_at`, `last_error`, `reconnects`, and `requests_forwarded`. Both fields are `null` when `--scm-connector-host` isn’t set.
+
+##
+
+
+
+Prometheus metrics
+
+Each runner serves Prometheus metrics at `GET /metrics` on the same port as `/healthz`. Key series:
+
+Series| Notes
+---|---
+`claude_code_self_hosted_runner_info{runner_id,version,client_label}`| Always `1`; useful for fleet inventory and version-drift detection
+`claude_code_self_hosted_runner_capacity`| Configured `--capacity`
+`claude_code_self_hosted_runner_active_sessions`| Sessions currently running
+`claude_code_self_hosted_runner_locked_account{email}`| Present once the runner has locked to a user. The label value is the account email, and the runner always emits it once locked; if your metrics store is broadly readable, drop or hash the label at scrape time, for example with Prometheus `metric_relabel_configs`.
+`claude_code_self_hosted_runner_last_poll_age_seconds`| Seconds since the last successful poll. Alert if over 60.
+`claude_code_self_hosted_runner_poll_errors_total{error_kind}`| Cumulative PollWork failures by kind: `transport`, `timeout`, `5xx`, `429`, or `4xx`. All five series are present from process start; alert on `rate(...[5m]) > 0`.
+`claude_code_self_hosted_runner_sessions_started_total{client_platform}`| Session child processes spawned over the runner’s lifetime, one series per session origin such as `web_claude_ai`, `ios`, `android`, `desktop_app`, or `claude-code-cli`, or `unknown` when the server didn’t send one. The Slack values `claude_in_slack` and `claude-in-slack` are reserved: [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions can’t route to self-hosted environments yet, so neither value appears until that support ships. Use `sum()` for the fleet total.
+`claude_code_self_hosted_runner_sessions_completed_total{client_platform}`| Sessions that ended cleanly, labeled the same way. Broader than a plain clean exit: see session lifecycle counter semantics for what counts.
+`claude_code_self_hosted_runner_sessions_failed_total{client_platform}`| Sessions that ended in failure, labeled the same way. Same caveat: see session lifecycle counter semantics.
+`claude_code_self_hosted_runner_sessions_interrupted_total{client_platform}`| Sessions the runner terminated for an operational reason rather than a session outcome, labeled the same way. See session lifecycle counter semantics.
+`claude_code_self_hosted_runner_initializing_sessions`| Sessions currently in the init phase, from assignment until the child’s init event
+`claude_code_self_hosted_runner_session_init_duration_seconds`| Histogram of session init durations
+`claude_code_self_hosted_runner_session_init_errors_total`| Sessions that failed before reaching init: a checkout hook failure, git prep, token issue, or a pre-init child crash
+`claude_code_self_hosted_runner_session_start_hook_errors_total`| `SessionStart` hooks that reported an error outcome, one per failing hook execution
+`claude_code_self_hosted_runner_session_idle_seconds{session_id,client_platform}`| Per-session gauge of seconds since the session went idle. Useful for terminating sessions stuck on an unanswered permission prompt.
+
+The orchestrator serves its own series at `GET /metrics` on the same port as its `/healthz`:
+
+Series| Notes
+---|---
+`claude_code_self_hosted_orchestrator_info{version,pool_id,orchestrator_uuid,hostname}`| Always `1`
+`claude_code_self_hosted_orchestrator_connected`| `1` when the most recent poll succeeded; drops to `0` after any failed poll, whatever the failure kind
+`claude_code_self_hosted_orchestrator_last_poll_age_seconds`| Seconds since the last poll attempt, success or failure, unlike the runner’s identically-named metric, which measures since the last success; pair with `connected` to catch failing polls. The orchestrator’s poll loop waits on hook execution, so alert above `--hook-timeout` plus a margin, around 90 seconds at defaults, rather than a flat 60.
+`claude_code_self_hosted_orchestrator_poll_errors_total{error_kind}`| Cumulative PollSpawnHints failures by kind: `transport`, `timeout`, `5xx`, `429`, or `4xx`. All five series are present from process start; alert on `rate(...[5m]) > 0`.
+`claude_code_self_hosted_orchestrator_queue_pending_sessions`| Spawn requests claimable right now
+`claude_code_self_hosted_orchestrator_queue_backing_off_sessions`| Spawn requests in retry backoff after a retryable hook failure
+`claude_code_self_hosted_orchestrator_queue_circuit_broken_sessions`| Spawn requests blocked until an Owner or admin retries them from the environment’s **Activity** tab; alert if above zero
+`claude_code_self_hosted_orchestrator_pool_pending_sessions`| Total sessions waiting on a runner for this environment. Environment-wide aggregate, identical on every orchestrator instance: use `MAX` rather than `SUM` across instances.
+`claude_code_self_hosted_orchestrator_pool_active_sessions`| Sessions currently assigned to an alive runner in this environment. Environment-wide aggregate, identical on every orchestrator instance: use `MAX` rather than `SUM` across instances.
+`claude_code_self_hosted_orchestrator_spawn_hooks_total{result}`| Cumulative `spawn-runner` hook outcomes: `ok`, `retryable`, `non_retryable`. Counts orchestrator hook invocations, not session children the runners spawn: not comparable to `sessions_started_total`, since capacity above one, warm pools, and runners spawned again for the same session all diverge the two.
+`claude_code_self_hosted_orchestrator_spawn_hook_duration_seconds`| Histogram of hook durations
+`claude_code_self_hosted_orchestrator_warm_hints_dispatched_total`| Standby spawn requests dispatched since process start
+`claude_code_self_hosted_orchestrator_session_queue_wait_seconds`| Histogram of seconds each session waited in the queue before the orchestrator claimed it for spawn, recorded from the queue-wait timestamp the control plane sends with each session’s spawn request. Use for p50/p99 queue-time alerting. Pre-warming spawns aren’t sampled.
+`claude_code_self_hosted_orchestrator_clock_skew_seconds`| Local-minus-server clock skew; diagnostic, present once measured
+`claude_code_self_hosted_orchestrator_scm_connector_connected`| `1` when the SCM connector’s WebSocket is open; `0` while dialing or backing off. Absent when `--scm-connector-host` isn’t set.
+`claude_code_self_hosted_orchestrator_scm_connector_requests_forwarded_total`| Cumulative HTTP requests proxied to the configured SCM host since process start. Absent when `--scm-connector-host` isn’t set.
+
+For autoscaling, pick the series that matches your scaling style and gate it before it feeds the scaler:
+
+ * **Queue-depth scaling** : feed `claude_code_self_hosted_orchestrator_pool_pending_sessions` into your HPA or KEDA scaler, not `queue_pending_sessions`.
+ * **Capacity scaling** : scale on the ratio of the runner’s `active_sessions` to `capacity`.
+ * **Gate on`connected`**: filter the query with `claude_code_self_hosted_orchestrator_connected == 1` per instance, so a disconnected replica’s stale value doesn’t feed the scaler.
+
+During a full poll outage, every replica disconnected, the gated query returns no data. HPA holds the current replica count on a missing metric, but KEDA’s Prometheus scaler at its default `ignoreNullValues: "true"` reads the empty result as zero and scales in; set `ignoreNullValues: "false"` on the ScaledObject, optionally with a `fallback` replica floor. The following Prometheus Operator `PodMonitor` covers both processes. It selects pods by the `app.kubernetes.io/part-of: claude-code-self-hosted-runner` label and the named `health` port that the [Kubernetes recipe](</docs/en/self-hosted-environments-deploy#kubernetes>) sets; adjust the namespaces to match your deployment:
+
+ # Example Prometheus Operator PodMonitor for the Claude Code self-hosted
+ # runner + orchestrator. Adjust the namespace and label selectors to match
+ # your deployment. Both the runner and the orchestrator serve /metrics on
+ # their --health-port (default 8080).
+ apiVersion: monitoring.coreos.com/v1
+ kind: PodMonitor
+ metadata:
+ name: claude-code-self-hosted-runner
+ namespace: monitoring
+ spec:
+ namespaceSelector:
+ matchNames:
+ - claude-runners
+ selector:
+ matchExpressions:
+ # Matches the runner Deployment from the Kubernetes recipe, plus any
+ # on-demand runner Jobs and orchestrator pods you label the same way
+ # and give a named 'health' containerPort.
+ - key: app.kubernetes.io/part-of
+ operator: In
+ values: [claude-code-self-hosted-runner]
+ podMetricsEndpoints:
+ - port: health
+ path: /metrics
+ interval: 30s
+
+These sample alert rules are a starting point; tune the thresholds for your fleet size:
+
+ # Example Prometheus alert rules for the Claude Code self-hosted runner
+ # + orchestrator. Tune thresholds for your fleet size and SLOs.
+ groups:
+ - name: claude-code-self-hosted-runner
+ rules:
+ - alert: ClaudeRunnerPollStale
+ expr: claude_code_self_hosted_runner_last_poll_age_seconds > 60
+ for: 2m
+ labels: {severity: warning}
+ annotations:
+ summary: "Runner {{ $labels.pod }} has not polled in >60s"
+ - alert: ClaudeRunnerVersionDrift
+ expr: count(count by (version) (claude_code_self_hosted_runner_info)) > 1
+ for: 30m
+ labels: {severity: info}
+ annotations:
+ summary: "Runners are running mixed versions"
+ - alert: ClaudeRunnerInitErrorsHigh
+ expr: increase(claude_code_self_hosted_runner_session_init_errors_total[10m]) > 3
+ for: 5m
+ labels: {severity: warning}
+ annotations:
+ summary: "Runner {{ $labels.pod }}: >3 session init failures in 10m (checkout hook / git / token / pre-init crash)"
+ - alert: ClaudeRunnerPollErrors
+ expr: sum by (pod) (rate(claude_code_self_hosted_runner_poll_errors_total[5m])) > 0
+ for: 2m
+ labels: {severity: warning}
+ annotations:
+ summary: "Runner {{ $labels.pod }}: PollWork failing ({{ $value | humanize }}/s over 5m)"
+ - alert: ClaudeRunnerSessionStartHookErrors
+ expr: increase(claude_code_self_hosted_runner_session_start_hook_errors_total[10m]) > 3
+ for: 5m
+ labels: {severity: warning}
+ annotations:
+ summary: "Runner {{ $labels.pod }}: >3 SessionStart hook failures in 10m"
+
+ - name: claude-code-self-hosted-orchestrator
+ rules:
+ - alert: ClaudeOrchestratorDisconnected
+ expr: claude_code_self_hosted_orchestrator_connected == 0
+ for: 2m
+ labels: {severity: critical}
+ annotations:
+ summary: "Orchestrator {{ $labels.pod }} cannot reach the Anthropic control plane"
+ - alert: ClaudeOrchestratorPollStale
+ expr: claude_code_self_hosted_orchestrator_last_poll_age_seconds > 90
+ for: 2m
+ labels: {severity: warning}
+ annotations:
+ summary: "Orchestrator {{ $labels.pod }} has not polled in >90s (poll loop waits on hook execution)"
+ - alert: ClaudeOrchestratorCircuitBroken
+ expr: claude_code_self_hosted_orchestrator_queue_circuit_broken_sessions > 0
+ for: 1m
+ labels: {severity: critical}
+ annotations:
+ summary: "{{ $value }} sessions circuit-broken — spawn-runner hook is repeatedly non-retryable; fix infra then retry from the Activity tab"
+ - alert: ClaudeOrchestratorPollErrors
+ expr: sum by (pod) (rate(claude_code_self_hosted_orchestrator_poll_errors_total[5m])) > 0
+ for: 2m
+ labels: {severity: warning}
+ annotations:
+ summary: "Orchestrator {{ $labels.pod }}: PollSpawnHints failing ({{ $value | humanize }}/s over 5m)"
+ - alert: ClaudeOrchestratorSpawnHookFailing
+ expr: sum by (pod) (increase(claude_code_self_hosted_orchestrator_spawn_hooks_total{result!="ok"}[5m])) > 3
+ for: 5m
+ labels: {severity: warning}
+ annotations:
+ summary: "Orchestrator {{ $labels.pod }}: >3 spawn-runner hook failures in 5m"
+
+###
+
+
+
+Pass through session-child metrics
+
+Each session runs in its own child process with its own OpenTelemetry metrics; at `--capacity` above one, the runner rewrites how those child metrics are exposed. Setting `OTEL_METRICS_EXPORTER=prometheus` on the runner host and `CLAUDE_CODE_ENABLE_TELEMETRY=1` in the session’s environment, for example from your [wrapper script](</docs/en/self-hosted-environments-configuration#wrapper-scripts>) or the runner’s own environment, which sessions inherit, re-exposes each child’s counter and gauge instruments on the runner’s own `/metrics` endpoint, alongside the runner’s series. The runner rewrites the child’s exporter to push over OTLP to a loopback-only receiver on the health port, tags each series with `session_id` and `client_platform` labels, and evicts a session’s series when that session ends. Histograms don’t pass through, and a child metric whose name would collide with the runner’s own prefix is dropped. At the default `--capacity 1`, the rewrite doesn’t apply: the session’s child binds its own Prometheus endpoint on port 9464 as usual.
+
+###
+
+
+
+Session lifecycle counter semantics
+
+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`.
+ * `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, for example a Kubernetes rolling restart sending `SIGTERM`, the max-lifetime watchdog `--kill-session-after-min`, or the `released=false` backstop: the runner terminates the child after the control plane declines three consecutive idle-release requests, each because a user message was still waiting to be processed. 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:
+
+Goal| Use
+---|---
+Throughput| `claude_code_self_hosted_orchestrator_spawn_hooks_total{result="ok"}`, a counter on the long-lived orchestrator that increments once per successful `spawn-runner` hook and stays meaningful under `rate()`. It counts hook invocations rather than sessions, so pre-warming and repeated spawns for the same session diverge it from session counts.
+Utilization| `sum(claude_code_self_hosted_runner_active_sessions)` against `sum(claude_code_self_hosted_runner_capacity)`, both gauges valid at every scrape regardless of runner lifetime
+Backlog| `claude_code_self_hosted_orchestrator_pool_pending_sessions` for queue depth, and `claude_code_self_hosted_orchestrator_queue_circuit_broken_sessions`, alerting if above zero
+Failures| `claude_code_self_hosted_runner_sessions_failed_total`, best effort: real crashes after spawn do increment it, and `rate()` is meaningful on runners that outlive their sessions with `--drain-grace-sec` above `0`. A one-shot environment has the same scrape-window problem as the other terminal counters, so treat any non-zero value you do see as worth investigating. Failures before spawn, such as a checkout hook failure, git preparation, or a token issue, appear only in `session_init_errors_total`.
+
+The `orchestrator_*` rows exist only on environments running the [on-demand orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>). On a fixed fleet whose runners outlive their sessions, with `--drain-grace-sec` above `0`, use `sum(rate(claude_code_self_hosted_runner_sessions_started_total[5m]))` for throughput; on a one-shot fleet that series has the same scrape-window problem as the terminal counters, so rely on the queued-sessions count instead. Check backlog on the environment’s **Activity** tab, on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>): the runners don’t export a queue-depth series. For per-session outcome reporting, use the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) instead: it fires at every session end where a child process was spawned, apart from abrupt runner termination such as a VM preemption, per the [hook’s own contract](</docs/en/self-hosted-environments-configuration#post-session>).
+
+##
+
+
+
+What’s next
+
+ * [Self-hosted environments](</docs/en/self-hosted-environments>): the environment, runner, and session model; the [quickstart](</docs/en/self-hosted-environments-quickstart>) and [Deploy to production](</docs/en/self-hosted-environments-deploy>) hold setup and operations
+ * [Customize sessions](</docs/en/self-hosted-environments-configuration>): wrapper scripts, lifecycle hooks, and on-demand runners
+ * [Verify session identity](</docs/en/self-hosted-environments-identity>): the session token, its claims, and how to verify it
Show diff (260 lines)
--- a/self-hosted-environments-testing.md
+++ b/self-hosted-environments-testing.md
@@ -0,0 +1,257 @@
+Self-hosted environments are in public beta on Team and Enterprise plans; [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers the enablement path. This page is the CI test recipe; see the [quickstart](</docs/en/self-hosted-environments-quickstart>) for setup and [Deploy to production](</docs/en/self-hosted-environments-deploy>) for the fleet recipes.
+
+In a [self-hosted environment](</docs/en/self-hosted-environments>), Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) run on a runner image you build and maintain. Before rolling a new image to your production environment, drive a full session against a test environment from a script: create a session, read Claude’s reply, send a follow-up, and read that reply too. This is the shape of a CI smoke test that verifies your runner image, git access, and any custom tools before you promote a change. This recipe assumes you’ve already [set up an environment and a runner](</docs/en/self-hosted-environments-quickstart#set-up-an-environment-and-runner>), and that your CI job starts the runner process on the same host as the test script, the natural setup for testing a new runner image. A Stop hook you install on the runner writes each turn’s final reply to a local file, and the script reads it from there, so the only calls to the Anthropic API are the two dispatches themselves. If your test runners are on separate infrastructure, see Remote test runners.
+
+##
+
+
+
+Install the capture hook on your test runner
+
+The read-back works through a Claude Code [Stop hook](</docs/en/hooks#stop>): when Claude finishes a turn, the hook receives the final assistant message as `last_assistant_message` in its stdin JSON and appends it to `$E2E_REPLY_DIR/<session_id>.txt`. Install it the same way as the [commit-nudge Stop hook](</docs/en/self-hosted-environments-configuration#prompt-sessions-to-push-their-work>), on the runner host’s `~/.claude/`, which the runner seeds into every session.
+
+###
+
+
+
+Save the hook files
+
+Save the two files below on the runner host:
+
+ * The settings block: merge into `~/.claude/settings.json` on the runner host
+ * The script: save as `~/.claude/hooks/e2e-stop-hook-capture.sh` on the runner host and make it executable
+
+ {
+ "hooks": {
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "timeout": 10,
+ "command": "\"$CLAUDE_CONFIG_DIR/hooks/e2e-stop-hook-capture.sh\""
+ }
+ ]
+ }
+ ]
+ }
+ }
+
+ #!/bin/sh
+ # Stop hook for testing a self-hosted environment end to end: writes each
+ # turn's final assistant reply to $E2E_REPLY_DIR/<session_id>.txt so a
+ # co-located test driver can read it without calling the Anthropic API.
+ # Install on the TEST runner only. Requires jq.
+
+ # No-op unless the driver is listening. Never fail the turn.
+ [ -n "${E2E_REPLY_DIR:-}" ] && [ -d "$E2E_REPLY_DIR" ] || exit 0
+
+ # CLAUDE_CODE_REMOTE_SESSION_ID is exported in cse_... form; the session
+ # id the dispatch CLI prints is in session_... form. Same id, different
+ # prefix.
+ sid=$(printf '%s' "${CLAUDE_CODE_REMOTE_SESSION_ID:-}" | sed 's/^cse_/session_/')
+ [ -n "$sid" ] || exit 0
+
+ # last_assistant_message is absent when the final assistant turn had no
+ # text, such as a tool-use-only turn. The `// empty` filter makes that a
+ # zero-byte write rather than the literal string "null".
+ jq -r '.last_assistant_message // empty' >> "$E2E_REPLY_DIR/$sid.txt" 2>/dev/null
+ exit 0
+
+###
+
+
+
+Before you start the runner
+
+Two things the hook depends on:
+
+ * Install it before you start the runner. The runner snapshots `~/.claude/` once at startup, so a hook added to a running runner takes effect only after a restart.
+ * Export `E2E_REPLY_DIR` to the runner process. The hook is a no-op when the variable is unset or the directory doesn’t exist, so set it wherever you start the runner, such as the systemd unit, pod spec, or CI step. The test script below requires it too.
+
+Install this hook only on runners serving your test environment. It writes every session’s final reply to disk whenever `E2E_REPLY_DIR` exists, which is harmless on a throwaway CI runner but not something to carry into a production-environment runner image where the variable might be set by accident.
+
+##
+
+
+
+Run the test loop
+
+The `--environment` and `--ref` dispatch flags require Claude Code v2.1.224 or later on the machine that runs the script, the same floor as the runner itself. With the hook in place and a runner started on this host, the test script:
+
+ 1. Creates a session on the test environment with `claude -p "<prompt>" --environment <environment-id> --output-format json`, run from a git checkout so the CLI can auto-detect the repository from the `origin` remote. The optional `--ref <branch>` bases the session’s checkout on a named ref instead of local HEAD. The command creates the session, prints one line of JSON containing `session_id`, and exits without waiting for Claude’s reply.
+ 2. Waits for the reply to appear in `$E2E_REPLY_DIR/<session_id>.txt`, written by the Stop hook on the runner once the turn completes.
+ 3. Sends a follow-up with `claude -p "<message>" --cloud <session_id> --output-format json` (see [Send a follow-up message to a running session](</docs/en/claude-code-on-the-web#send-follow-ups-from-the-cli>)), which posts a user event to the existing session and exits.
+ 4. Waits for the follow-up’s reply the same way as step 2.
+
+##
+
+
+
+Example script
+
+The script below runs the full loop against `$CLAUDE_TEST_ENVIRONMENT_ID`, your test environment’s `ccpool_...` ID, shown in the environment’s detail dialog on the admin page or returned by the create-environment call, and asserts on a sentinel phrase in each reply. Run it from a git checkout of the repository you want the session to work in, after starting a runner on this host with the capture hook installed and `E2E_REPLY_DIR` exported.
+
+ #!/usr/bin/env bash
+ # End-to-end test against a self-hosted environment, using Stop-hook read-back.
+ # Prereqs: `claude auth login` has been run on this machine (see "Authenticate
+ # from CI" below); jq is installed; CLAUDE_TEST_ENVIRONMENT_ID names an
+ # environment whose runner is the one on this host, with the capture hook
+ # installed and E2E_REPLY_DIR in its environment.
+
+ set -euo pipefail
+
+ : "${CLAUDE_TEST_ENVIRONMENT_ID:=${CLAUDE_TEST_POOL_ID:-}}" # CLAUDE_TEST_POOL_ID is the legacy spelling
+ : "${CLAUDE_TEST_ENVIRONMENT_ID:?set CLAUDE_TEST_ENVIRONMENT_ID to a ccpool_... id served by a runner on this host}"
+ : "${E2E_REPLY_DIR:?set E2E_REPLY_DIR to the directory the Stop hook on your test runner writes to, and export it to the runner process}"
+ : "${TEST_REPO_REF:=main}"
+
+ [ -d "$E2E_REPLY_DIR" ] || {
+ echo "FAIL: E2E_REPLY_DIR ($E2E_REPLY_DIR) does not exist. The Stop hook on the runner needs it." >&2
+ exit 1
+ }
+
+ # Waits until $E2E_REPLY_DIR/<session_id>.txt contains $2, or fails after
+ # 90 seconds. Tune the timeout to your environment's cold-start time. The
+ # file is written by the Stop hook on the runner.
+ await_reply() {
+ local expect="$2" f="$E2E_REPLY_DIR/$1.txt"
+ local deadline=$(($(date +%s) + 90))
+ while :; do
+ if [ -f "$f" ] && grep -qF -- "$expect" "$f"; then
+ return
+ fi
+ [ "$(date +%s)" -lt "$deadline" ] || {
+ echo "FAIL: '$expect' not in $f within 90s. The Stop hook on the runner did not write it." >&2
+ echo "-- $E2E_REPLY_DIR contents --" >&2; ls -la "$E2E_REPLY_DIR" >&2
+ [ -f "$f" ] && { echo "-- $f --" >&2; cat "$f" >&2; }
+ exit 1
+ }
+ sleep 1
+ done
+ }
+
+ # 1. Create the session on the test environment. Run from a git checkout
+ # so the CLI can auto-detect the repo. --ref pins the checkout to a named
+ # ref regardless of local HEAD.
+ TURN1="e2e-probe-$(date +%s)-$$: say exactly 'ok: custom tools are reachable' and nothing else"
+ EXPECT1="ok: custom tools are reachable"
+ create_json=$(claude -p "$TURN1" --environment "$CLAUDE_TEST_ENVIRONMENT_ID" \
+ --ref "$TEST_REPO_REF" --output-format json)
+ echo "create: $create_json"
+ SESSION_ID=$(jq -er '.session_id' <<<"$create_json")
+
+ # 2. Wait for the turn-1 reply.
+ await_reply "$SESSION_ID" "$EXPECT1"
+ echo "turn-1 reply ok"
+
+ # 3. Post a follow-up via the CLI.
+ TURN2="e2e-probe-followup-$(date +%s): say exactly 'ok: follow-up delivered' and nothing else"
+ EXPECT2="ok: follow-up delivered"
+ followup_json=$(claude -p "$TURN2" --cloud "$SESSION_ID" --output-format json)
+ echo "followup: $followup_json"
+ jq -e '.ok == true' <<<"$followup_json" >/dev/null
+
+ # 4. Wait for the turn-2 reply.
+ await_reply "$SESSION_ID" "$EXPECT2"
+ echo "turn-2 reply ok"
+
+ echo "PASS: test-environment round-trip (session $SESSION_ID)"
+
+Replace the `TURN1`/`TURN2` prompts and `EXPECT1`/`EXPECT2` sentinels with whatever exercises your setup, such as asking Claude to run one of your custom MCP tools and asserting on its output.
+
+##
+
+
+
+Remote test runners
+
+If your test runners are on separate infrastructure, such as a persistent Kubernetes fleet your CI job can’t share a filesystem with, swap the file write in the Stop hook for a POST to an endpoint your driver listens on:
+
+ #!/bin/sh
+ # Variant of the capture hook for runners on separate infrastructure.
+ # Set E2E_REPLY_URL on the runner to an endpoint the driver controls.
+ [ -n "${E2E_REPLY_URL:-}" ] || exit 0
+ sid=$(printf '%s' "${CLAUDE_CODE_REMOTE_SESSION_ID:-}" | sed 's/^cse_/session_/')
+ [ -n "$sid" ] || exit 0
+ jq -r '.last_assistant_message // empty' | \
+ curl -fsS -X POST --data-binary @- "$E2E_REPLY_URL/$sid" >/dev/null 2>&1
+ exit 0
+
+On the driver side, run anything that accepts the POST and holds the reply until the test asks for it, such as a small HTTP listener inside the CI job or a webhook receiver you already run. The hook runs on your infrastructure, so the endpoint only needs to be reachable from your runners.
+
+##
+
+
+
+Authenticate from CI
+
+Both `claude -p ... --environment` and `claude -p ... --cloud` authenticate with a claude.ai OAuth token; API keys, such as `sk-ant-xxxxx`, aren’t accepted for either call. Two approaches make a token available in CI.
+
+###
+
+
+
+Long-lived CI host
+
+Run `claude auth login` once interactively on the machine that executes the script, using a dedicated user account for automation. The token lives in the OS keychain on macOS, or in `~/.claude/.credentials.json` on Linux and Windows. The CLI refreshes the short-lived access token automatically on each invocation, but the underlying refresh-token grant is capped at 30 days from the initial login, so re-run `claude auth login` interactively on that host every 30 days.
+
+###
+
+
+
+Ephemeral CI runners
+
+There is no long-lived CI token for this today. The scope that grants remote-session control, `user:sessions:claude_code`, is capped server-side at 30 days, so `claude setup-token`, which mints a one-year inference-only token, doesn’t cover it. The [environment secret](</docs/en/self-hosted-environments-quickstart#set-up-an-environment-and-runner>) isn’t accepted either, since it only authorizes a runner to register with the environment, not to create sessions. To provision a stored login onto an ephemeral runner, set [`CLAUDE_CODE_OAUTH_REFRESH_TOKEN` and `CLAUDE_CODE_OAUTH_SCOPES`](</docs/en/env-vars#variables>) so `claude auth login` exchanges the token without a browser; the same 30-day cap applies to the refresh grant. Contact your Anthropic account team if you need a machine-identity path that isn’t bound to a human account.
+
+##
+
+
+
+Create a dedicated test environment
+
+Create and delete environments programmatically so each CI run gets a clean one; the runner your CI job starts registers into the fresh environment. The create and delete calls below are the same endpoints that the **Cloud environments** admin page on claude.ai uses, and they require the `anthropic-beta: ccr-byoc-2025-07-29` header.
+
+###
+
+
+
+Mint the admin token
+
+`$ADMIN_TOKEN` is a claude.ai OAuth access token for an account that holds an Owner or admin role, minted the same way as Authenticate from CI:
+
+ * **Mint it** : run `claude auth login` with an account that holds an Owner or admin role, then read the current access token from the OS keychain on macOS or `~/.claude/.credentials.json` on Linux and Windows.
+ * **Read it fresh each run** : the CLI rotates the access token, and the same 30-day refresh-grant cap applies, so don’t store a copy.
+ * **Pass it via stdin** : as the example does, so the token never lands in curl’s argument list or your build log.
+
+###
+
+
+
+Create the environment
+
+Capture the response without echoing it: `pool_secret` is a long-lived credential that can register runners into the environment, so store it as a masked CI secret and print only the environment ID. The `-H @-` form that keeps the token out of the process list requires curl 7.55 or later; older curl treats `@-` as a literal header and sends the request without authorization.
+
+ create=$(curl -fsS -X POST -H @- \
+ -H "anthropic-beta: ccr-byoc-2025-07-29" -H "anthropic-version: 2023-06-01" \
+ -H "content-type: application/json" \
+ -d '{"name":"ci-test-environment"}' \
+ https://api.anthropic.com/v1/code/runners/self-hosted/pools \
+ <<<"Authorization: Bearer $ADMIN_TOKEN")
+ ENVIRONMENT_ID=$(jq -er .pool.pool_id <<<"$create")
+ ENVIRONMENT_SECRET=$(jq -er .pool_secret <<<"$create")
+
+Until an [Owner or admin turns on **Allow self-hosted environments**](</docs/en/self-hosted-environments#availability-and-limitations>) for the organization, the call fails with a `403` `permission_error` reading `self-hosted runners are disabled by your organization's policy`. Start a runner on this host with `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET=$ENVIRONMENT_SECRET`, plus the capture hook and `E2E_REPLY_DIR` per Install the capture hook, then run the test script.
+
+###
+
+
+
+Delete the environment
+
+Delete the environment when the run finishes, so each CI run starts clean:
+
+ curl -fsS -X DELETE -H @- \
+ -H "anthropic-beta: ccr-byoc-2025-07-29" -H "anthropic-version: 2023-06-01" \
+ "https://api.anthropic.com/v1/code/runners/self-hosted/pools/$ENVIRONMENT_ID" \
+ <<<"Authorization: Bearer $ADMIN_TOKEN"
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -27,7 +27,7 @@
**Server-managed settings**| Organizations without MDM, or users on unmanaged devices| Settings delivered from Anthropic’s servers at authentication time
**[Endpoint-managed settings](</docs/en/settings#settings-files>)**| Organizations with MDM or endpoint management| Settings deployed to devices via MDM configuration profiles, registry policies, or managed settings files
-If your devices are enrolled in an MDM or endpoint management solution, endpoint-managed settings provide stronger security guarantees because the settings file can be protected from user modification at the OS level. Endpoint-managed settings don’t reach [cloud sessions](</docs/en/model-config#surface-coverage>), so organizations using Claude Code on the web should configure server-managed settings as well.
+If your devices are enrolled in an MDM or endpoint management solution, endpoint-managed settings provide stronger security guarantees because the settings file can be protected from user modification at the OS level. Endpoint-managed settings don’t reach [cloud sessions](</docs/en/model-config#surface-coverage>) in Anthropic-hosted environments, so organizations using Claude Code on the web should configure server-managed settings as well. Sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) read the managed settings file in the runner image, but only when server-managed settings deliver no keys, per the settings precedence below and its per-key exceptions.
##
@@ -148,7 +148,20 @@
Settings precedence
-Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) 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 listed in the [settings reference’s precedence section](</docs/en/settings#settings-precedence>). Within the managed tier, a configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts every other managed source, including server-managed settings: its output becomes the only managed configuration for the run. Otherwise, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. A small set of [cross-source lock keys](</docs/en/settings#settings-precedence>), such as the sandbox allowlist locks, is honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read. 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. Run `/status` to see which managed source is active.
+Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) 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 listed in the [settings reference’s precedence section](</docs/en/settings#settings-precedence>). Within the managed tier, a configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts every other managed source, including server-managed settings: its output becomes the only managed configuration for the run. Otherwise, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Apart from the exception keys covered next, sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. 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. Run `/status` to see which managed source is active.
+
+###
+
+
+
+Per-key exceptions across managed sources
+
+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 in the settings reference](</docs/en/settings#settings-precedence>). 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#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read.
+ * **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 winning 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 winning source: a non-winning source that 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 winner-only credential key, such as `apiKeyHelper` or `otelHeadersHelper`, contributes those routing variables only when it wins the slot.
###
@@ -164,17 +177,19 @@
**Subsequent launches with cached settings:**
- * Cached settings apply immediately at startup, except for the transport, routing, and authentication environment variables described below
+ * Cached settings apply immediately at startup, except for the withheld environment variables described below
* Claude Code fetches fresh settings in the background
* Cached settings persist through network failures. The withheld environment variables remain withheld until a fetch succeeds
-As of v2.1.198, Claude Code withholds three 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/settings#settings-files>) deployed through MDM or `managed-settings.json` are unaffected. The withheld categories are:
+Claude Code withholds the following 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/settings#settings-files>) 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 are:
* Proxy and TLS configuration, such as `HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`, and the mTLS client certificate variables `CLAUDE_CODE_CLIENT_CERT` and `CLAUDE_CODE_CLIENT_KEY`
* API routing and provider selection, including `ANTHROPIC_BASE_URL`, the provider selection variables such as `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_VERTEX`, and the provider endpoint URLs such as `ANTHROPIC_BEDROCK_BASE_URL`
* Authentication credentials, such as `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `CLAUDE_CODE_OAUTH_TOKEN`
-
-Every other key in the cached `env` block, such as telemetry and OpenTelemetry configuration, applies at startup as before. Once the fetch succeeds, the withheld variables apply for the rest of the session. If your organization needs a proxy to reach `api.anthropic.com`, set it in the shell environment or in [user settings](</docs/en/settings#settings-files>) rather than only in the managed `env` block. The first launch has no cache, so those sources were already required for the initial fetch. Claude Code applies settings updates automatically without a restart, except for advanced settings like OpenTelemetry configuration, which require a full restart to take effect.
+ * 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/settings#settings-files>) 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 fetch succeeds, 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/settings#settings-files>) `env` block through MDM or `managed-settings.json`, in the shell environment, or in [user settings](</docs/en/settings#settings-files>) 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 settings updates automatically without a restart, except for advanced settings like OpenTelemetry configuration, which require a full restart to take effect.
###
@@ -271,11 +286,11 @@
Scenario| Behavior
---|---
-User edits the cached settings file| Tampered file applies at startup, but correct settings restore on the next server fetch. As of v2.1.198, the transport, API-routing, and authentication environment variables in the `env` block are withheld until the server confirms the payload
+User edits the cached settings file| Tampered file applies at startup, but correct settings restore on the next server fetch. 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
User deletes the cached settings file| First-launch behavior occurs: settings fetch asynchronously with a brief unenforced window
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, otherwise managed settings are not enforced until the next successful fetch. As of v2.1.198, the transport, API-routing, and authentication environment variables in the cached `env` block are withheld on fetch failure; the rest of the cache still applies. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing, except for `claude auth` subcommands
+API is unavailable| Cached settings apply if available, otherwise managed settings are not enforced until the next successful fetch. In Claude Code v2.1.198 or later, the withheld environment variables in the cached `env` block don’t apply on fetch failure; the rest of the cache still applies. With `forceRemoteSettingsRefresh: true`, the CLI exits instead of continuing, except for `claude auth` subcommands
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/sessions.md
+++ b/sessions.md
@@ -16,7 +16,7 @@
`claude --from-pr <number>`| Opens the session picker filtered to sessions linked to that pull request
`/resume`| Switches to a different conversation from inside an active session
-Sessions created with [`claude -p`](</docs/en/headless>) or the [Agent SDK](</docs/en/agent-sdk/overview>) do not appear in the session picker, but you can still resume one by passing its session ID to `claude --resume <session-id>`. Run this from the directory the session was started in: session ID lookup is scoped to the current project directory and its git worktrees, so a session created elsewhere reports `No conversation found with session ID: <session-id>`.
+Sessions created with [`claude -p`](</docs/en/headless>) or the [Agent SDK](</docs/en/agent-sdk/overview>) don’t appear in the session picker, but you can still resume one by passing its session ID to `claude --resume <session-id>`. You can run `claude --resume <session-id>` from any directory: Claude Code looks for the ID in the current project directory and its git worktrees first, then in every other project on this machine, so it finds a session that started elsewhere or moved with [`/cd`](</docs/en/commands>). The cross-project search resolves the ID only when exactly one other project holds a transcript for it, so a hand-copied duplicate makes Claude Code report not-found rather than resume an arbitrary copy. If no stored session matches the ID, Claude Code reports `No conversation found with session ID: <session-id>`. Before v2.1.223, the lookup stopped at the current project directory and its git worktrees, so you had to resume from the directory the session last worked in.
###
@@ -82,7 +82,7 @@
From the session picker| Highlight a session and press `Ctrl+R`
On plan accept| Accepting a plan in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) names the session from the plan content unless you’ve already set one
From claude.ai or the Claude app| Rename a [Remote Control session](</docs/en/remote-control#connect-from-another-device>); Claude Code applies the same name in the CLI. Requires Claude Code v2.1.221 or later
-From the desktop app| Rename a session in the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>); that section covers where the name is visible from the CLI. Requires Claude Code v2.1.221 or later
+From the desktop app| Rename a session in the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>)
Once you name a session through a CLI route or from claude.ai, return to it with `claude --resume <name>` or `/resume <name>`; a desktop-app session resumes in the app, which keeps its own session history. See Resume a session for how name resolution behaves across worktrees. Interactive sessions you never name still get a default display name when they start. Requires Claude Code v2.1.196 or later. The default combines the working directory’s name with a two-character suffix, for example `my-app-3f`, and identifies the session in listings of running sessions, such as [agent view](</docs/en/agent-view>) and `claude agents --json` output. The default isn’t a resume handle: `claude --resume <name>`, `/resume <name>`, and the session picker match only names you set. Naming the session replaces the default. If you don’t name a session, Claude Code generates a session title for it: a short summary of your first prompt, written by a background request to the small/fast model, normally a Haiku-class model. Naming the session with `--name` or `/rename` replaces the generated title. You see the generated title in the session picker and in the statusline [`session_name`](</docs/en/statusline>) field when no name is set; like the default display name, it isn’t a resume handle.
--- a/settings.md
+++ b/settings.md
@@ -212,7 +212,7 @@
---|---|---
`advisorModel`| Model for the server-side [advisor tool](</docs/en/advisor>). Accepts the model aliases `"opus"` and `"sonnet"`, or a full model ID. Written automatically when you run `/advisor`. Unset to disable the advisor. [Claude Code doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>): a saved `"fable"` value attaches no advisor and raises no error.| `"opus"`
`agent`| Run the main thread as a named subagent, and set the default agent for sessions dispatched from `claude agents`. Applies that subagent’s system prompt, tool restrictions, and model. See [Invoke subagents explicitly](</docs/en/sub-agents#invoke-subagents-explicitly>)| `"code-reviewer"`
-`agentPushNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Appears in `/config` as **Push when Claude decides**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). Requires Claude Code v2.1.119 or later| `true`
+`agentPushNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Appears in `/config` as **Push when Claude decides**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>)| `true`
`allowAllClaudeAiMcps`| (Managed settings only) Load claude.ai connectors alongside a deployed `managed-mcp.json`, which otherwise takes exclusive control and suppresses them. See [Managed MCP configuration](</docs/en/managed-mcp>)| `true`
`allowedChannelPlugins`| (Managed settings only) Allowlist of channel plugins that may push messages. Replaces the default Anthropic allowlist when set. Undefined = fall back to the default, empty array = block all channel plugins. Requires `channelsEnabled: true`. See [Restrict which channel plugins can run](</docs/en/channels#restrict-which-channel-plugins-can-run>)| `[{ "marketplace": "claude-plugins-official", "plugin": "telegram" }]`
`allowedHttpHookUrls`| Allowlist of URL patterns that HTTP hooks may target. Supports `*` as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restrictions, empty array = block all HTTP hooks. Arrays merge across settings sources. See Hook configuration| `["https://hooks.example.com/*"]`
@@ -256,7 +256,7 @@
`disableDeepLinkRegistration`| Set to `"disable"` to prevent Claude Code from registering the `claude-cli://` protocol handler with the operating system when you send the first prompt of an interactive session. [Deep links](</docs/en/deep-links>) let external tools open a Claude Code session with a pre-filled prompt. Useful in environments where protocol handler registration is restricted or managed separately| `"disable"`
`disabledMcpjsonServers`| List of specific MCP servers from `.mcp.json` files to reject| `["filesystem"]`
`disableMobileSimulatorTools`| (Managed settings only) Set to `true` to block Claude’s tools for the desktop app’s [iOS Simulator pane](</docs/en/desktop-ios-simulator#turn-off-simulator-access>). Users keep manual use of the pane; only Claude’s access is removed. The value must be the JSON boolean `true`; any other value is ignored, and a malformed value such as `"true"` or `1` logs a warning| `true`
-`disableRemoteControl`| Disable [Remote Control](</docs/en/remote-control>): blocks `claude remote-control`, the `--remote-control` flag, auto-start, and the in-session toggle. Typically placed in [managed settings](</docs/en/permissions#managed-settings>) for per-device MDM enforcement, but works from any scope. Requires Claude Code v2.1.128 or later| `true`
+`disableRemoteControl`| Disable [Remote Control](</docs/en/remote-control>): blocks `claude remote-control`, the `--remote-control` flag, auto-start, and the in-session toggle. Typically placed in [managed settings](</docs/en/permissions#managed-settings>) for per-device MDM enforcement, but works from any scope| `true`
`disableSideloadFlags`| (Managed settings only) Reject the `--plugin-dir`, `--plugin-url`, `--agents`, and `--mcp-config` CLI flags at startup, which users could otherwise pass to bypass `strictKnownMarketplaces` for a single run. Also rejects these flags from any surface that spawns the CLI with them internally, currently [Cowork](</docs/en/desktop>) local sessions in the desktop app. A `--mcp-config` whose servers are all in-process `type: "sdk"` entries is still accepted, so the Agent SDK and VS Code extension keep working. Doesn’t block `claude mcp add`, `.mcp.json`, or SDK `setMcpServers()`; pair with [`allowedMcpServers`](</docs/en/managed-mcp>) for per-server MCP control. Requires Claude Code v2.1.193 or later| `true`
`disableSkillShellExecution`| Disable inline shell execution for `!`...`` and ````!` blocks in [skills](</docs/en/skills>) and custom commands from user, project, plugin, or additional-directory sources. Commands are replaced with `[shell command execution disabled by policy]` instead of being run. Bundled and managed skills are not affected. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `true`
`disableWorkflows`| **Default** : `false`. Disable [dynamic workflows](</docs/en/workflows#turn-workflows-off>) and the bundled workflow commands. Equivalent to setting `CLAUDE_CODE_DISABLE_WORKFLOWS` to `1`| `true`
@@ -283,7 +283,7 @@
`hooks`| Configure custom commands to run at lifecycle events. See [hooks documentation](</docs/en/hooks>) for format| See [hooks](</docs/en/hooks>)
`httpHookAllowedEnvVars`| Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook’s effective `allowedEnvVars` is the intersection with this list. Undefined = no restriction. Arrays merge across settings sources. See Hook configuration| `["MY_TOKEN", "HOOK_SECRET"]`
`includeGitInstructions`| **Default** : `true`. Include built-in commit and PR workflow instructions and the git status snapshot in Claude’s system prompt. Set to `false` to remove both, for example when using your own git workflow skills. The `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS` environment variable takes precedence over this setting when set| `false`
-`inputNeededNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, send a push notification to your phone when a permission prompt or question is waiting for your input. Appears in `/config` as **Push when actions required**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). Requires Claude Code v2.1.119 or later| `true`
+`inputNeededNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, send a push notification to your phone when a permission prompt or question is waiting for your input. Appears in `/config` as **Push when actions required**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>)| `true`
`language`| Configure Claude’s preferred response language (e.g., `"japanese"`, `"spanish"`, `"french"`). Claude will respond in this language by default. Also sets the language for [voice dictation](</docs/en/voice-dictation#change-the-dictation-language>) and auto-generated session titles. As of v2.1.176, when not set, session titles match the language of your conversation| `"japanese"`
`minimumVersion`| Floor that prevents background auto-updates and `claude update` from installing a version below this one. Switching from the `"latest"` channel to `"stable"` via `/config` prompts you to stay on the current version or allow the downgrade. Choosing to stay sets this value. Also useful in [managed settings](</docs/en/permissions#managed-settings>) to pin an organization-wide minimum. For a hard floor that blocks startup entirely, see `requiredMinimumVersion`| `"2.1.100"`
`model`| Override the default model to use for Claude Code. `--model` and [`ANTHROPIC_MODEL`](</docs/en/model-config#environment-variables>) override this for one session| `"claude-sonnet-5"`
@@ -346,8 +346,6 @@
These settings are stored in `~/.claude.json` rather than `settings.json`. If you add these keys to `settings.json`, Claude Code silently ignores them at startup, so double-check the table below for which file each key belongs in.
-Versions before v2.1.119 also store a number of `/config` preference keys here instead of in `settings.json`, including `theme`, `verbose`, `editorMode`, `autoCompactEnabled`, and `preferredNotifChannel`.
-
Key| Description| Example
---|---|---
`autoConnectIde`| **Default** : `false`. Automatically connect to a running IDE when Claude Code starts from an external terminal. Appears in `/config` as **Auto-connect to IDE (external terminal)** when running outside a VS Code or JetBrains terminal. The [`CLAUDE_CODE_AUTO_CONNECT_IDE`](</docs/en/env-vars>) environment variable overrides this when set| `true`
@@ -662,7 +660,7 @@
* A `true` for `disableClaudeAiConnectors` applies from any scope, even when a managed source sets `false`
* A `false` for `remoteControlAtStartup` in project or local settings (`.claude/settings.json`, `.claude/settings.local.json`) applies even when a managed source sets `true`. Claude Code ignores a `true` there; only user settings, the `--settings` flag, and managed sources can turn auto-connect on, and a user `false` doesn’t override a managed `true`
* Host platforms that embed Claude Code and set [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) are also an exception. The host’s model configuration takes precedence over the `model`, `fallbackModel`, and `modelOverrides` keys from every managed source, and over the model-selection environment variables in a managed `env` block, such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family. A managed `availableModels` allowlist stays in force unless the host supplies its own
- * Within the managed tier, only one source is used and the others are ignored rather than merged. Precedence, highest first:
+ * Within the managed tier, apart from the exception keys listed after the ranking, only one source is used and the others are ignored rather than merged. Precedence, highest first:
* `policyHelper` output: when configured, this is the only managed source used
* Remote (claude.ai [server-managed](</docs/en/server-managed-settings>) or [Claude apps gateway](</docs/en/claude-apps-gateway>)-delivered)
* MDM/OS-level policies
@@ -673,9 +671,10 @@
* `allowAllClaudeAiMcps`
* the sandbox binary paths `sandbox.bwrapPath` and `sandbox.socatPath`
* [`forceRemoteSettingsRefresh`](</docs/en/server-managed-settings>)
+ * `env`, which 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, or for which a cached server value is [withheld pending server confirmation](</docs/en/server-managed-settings#fetch-and-caching-behavior>). The telemetry unit and credential-paired routing variables follow their own rules; see [Per-key exceptions across managed sources](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>). Requires Claude Code v2.1.223 or later. Before v2.1.223, Claude Code applies the winning source’s whole `env` block only.
* Embedding hosts such as Claude Desktop can supply policy via the SDK `managedSettings` option. By default this is ignored when an admin-deployed managed source is present: server-managed settings, an MDM or OS-level policy, or a managed settings file. The user-writable HKCU registry fallback does not count as an admin-deployed source. Administrators can opt in by setting `parentSettingsBehavior` to `"merge"` in the highest-priority managed source; only that source’s value is read. The embedder’s values pass through a restrictive-only filter, but the filter isn’t strictly tighten-only: unless the `allowManaged*Only` locks are set, allow-direction settings such as permission allow rules and sandbox allowlists still apply. See [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) for the locks. While a `policyHelper` is configured, parent settings are never merged, regardless of this key.
* When any admin-controlled managed source sets `allowManagedPermissionRulesOnly`, Claude Code drops [parent-supplied](</docs/en/claude-apps-gateway#restrict-parent-settings>) permission allow rules and `additionalDirectories` as it reads them, even when a higher-priority source leaves the key unset; the key’s effect on the developer’s own permission rules comes from the highest-priority source only
- * The parent-settings gap-fill checks for `forceLoginOrgUUID` and `allowedMcpServers` also read every admin-controlled managed source: a value in any of them blocks a parent-supplied one, though the value that applies still comes from the highest-priority source
+ * A `forceLoginOrgUUID` or `allowedMcpServers` value in the highest-priority admin source blocks a parent-supplied one and is the value Claude Code enforces. A value in a non-winning admin source neither applies nor blocks the parent’s. Before v2.1.223, a value in any admin source blocked the parent’s
2. **Command line arguments**
* Temporary overrides for a specific session. JSON passed via `--settings <file-or-json>` merges with file-based settings using the same rules as the other layers: a key set here overrides the same key in local, project, or user settings, and omitting a key leaves the lower-layer value in place
3. **Local project settings** (`.claude/settings.local.json`)
@@ -869,6 +868,7 @@
* `github`: GitHub repository (uses `repo`)
* `git`: Any git URL (uses `url`)
+ * `url`: Direct URL to a `marketplace.json` file (uses `url`, plus optional `headers` for authenticated access)
* `directory`: Local filesystem path (uses `path`, for development only)
* `hostPattern`: regex pattern to match marketplace hosts (uses `hostPattern`)
* `settings`: inline marketplace declared directly in settings.json without a separate hosted repository (uses `name` and `plugins`)
@@ -945,7 +945,7 @@
Fields: `url` (required), `headers` (optional: HTTP headers for authenticated access)
-URL-based marketplaces only download the `marketplace.json` file. They do not download plugin files from the server. Plugins in URL-based marketplaces must use external sources (GitHub, npm, or git URLs) rather than relative paths. For plugins with relative paths, use a Git-based marketplace instead. See [Troubleshooting](</docs/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces>) for details.
+URL-based marketplaces only download the `marketplace.json` file. They do not download plugin files from the server. Plugins in URL-based marketplaces must use external sources (GitHub, npm, git URL, or archive) rather than relative paths. For plugins with relative paths, use a Git-based marketplace instead. See [Troubleshooting](</docs/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces>) for details.
4. **NPM packages** :
--- a/skills.md
+++ b/skills.md
@@ -565,7 +565,7 @@
Restrict Claude’s skill access
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init` and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
# Add to deny rules:
Skill
--- a/slash-commands.md
+++ b/slash-commands.md
@@ -202,8 +202,6 @@
`/clear` \- Reset conversation context
The `/clear` command resets the conversation to an empty context, so subsequent prompts start with no prior conversation history. The previous conversation remains on disk and can be returned to by passing its session ID to the [`resume` option](</docs/en/agent-sdk/sessions#resume-by-id>). This is useful in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), where you send multiple prompts over a single connection. For one-shot `query()` calls, each call already starts with empty context, so sending `/clear` has no practical effect; start a new `query()` instead.
-
-`/clear` in the SDK requires Claude Code v2.1.117 or later. In earlier versions it is omitted from `slash_commands`.
##
--- a/statusline.md
+++ b/statusline.md
@@ -5,7 +5,7 @@
* Work across multiple sessions and need to distinguish them
* Want git branch and status always visible
-The status line renders in its own row above the built-in footer badges and does not replace them. With a custom status line configured, Claude Code still shows contextual hints such as `esc to interrupt`, but stops showing two static hints: the `? for shortcuts` fallback and the `hold space to speak` [voice dictation](</docs/en/voice-dictation>) hint. To add clickable link badges to the footer when an ID appears in the conversation, without writing a script, configure [`footerLinksRegexes`](</docs/en/settings#footer-link-badges>) instead. Here’s an example of a multi-line status line that displays git info on the first line and a color-coded context bar on the second.
+The status line renders in its own row above the built-in footer badges and does not replace them. With a custom status line configured, Claude Code stops showing most of the footer’s keyboard hints, including `esc to interrupt`, the `? for shortcuts` fallback, and the `hold space to speak` [voice dictation](</docs/en/voice-dictation>) hint. To add clickable link badges to the footer when an ID appears in the conversation, without writing a script, configure [`footerLinksRegexes`](</docs/en/settings#footer-link-badges>) instead. Here’s an example of a multi-line status line that displays git info on the first line and a color-coded context bar on the second.
This page walks through setting up a basic status line, explains how the data flows from Claude Code to your script, lists all the fields you can display, and provides ready-to-use examples for common patterns like git status, cost tracking, and progress bars.
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -799,22 +799,14 @@
-Session subagent limit
-
-Three separate limits control subagent use, each with its own variable: this one caps the total spawned over a session, the concurrent subagent limit stops Claude from spawning more while too many are running, and the depth limit caps how deeply subagents nest. By default, Claude can spawn at most 200 subagents per session. To raise the limit, set [`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`](</docs/en/env-vars>) to any positive whole number; there is no upper bound, but the limit can’t be turned off. Requires Claude Code v2.1.212 or later. Every subagent Claude spawns with the Agent tool counts toward the limit: nested subagents, forks, and background subagents, including subagents that a [workflow](</docs/en/workflows>)’s agents spawn with the Agent tool. An in-session fork you start yourself with `/subtask` counts too: it spends the same budget, though the limit blocks only subagents Claude spawns with the Agent tool, so your own `/subtask` still starts after Claude reaches the limit. A session you create with `/fork` doesn’t count; it runs as a separate background session with its own budget. Before v2.1.212, the in-session fork was named `/fork`. Agents a workflow script spawns with `agent()` don’t count; workflows have their own per-run limit. A finished subagent still counts. When Claude reaches the limit, the Agent tool fails with `Subagent spawn limit reached`, and the error tells Claude to complete the remaining work directly with its own tools. Run [`/clear`](</docs/en/commands#all-commands>) to reset the count and start a new conversation with the full budget. If work that can still spawn subagents survives the clear, such as a running workflow, the count carries over instead.
-
-###
-
-
-
Concurrent subagent limit
-By default, when 20 subagents are running in a session, spawning another with the Agent tool fails with `Concurrent subagent limit reached`, and the error tells Claude not to retry. Spawning succeeds again when the running count drops below the limit. To change the limit, set [`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`](</docs/en/env-vars>) to any positive whole number. Sessions with [ultracode](</docs/en/model-config#adjust-effort-level>) active are exempt: the limit isn’t enforced there. Requires Claude Code v2.1.217 or later. The limit blocks only subagents Claude spawns with the Agent tool, but other runs occupy the same slots:
+Two limits control subagent use, each with its own variable: this one stops Claude from spawning more subagents while too many are running, and the depth limit caps how deeply subagents nest. There’s no limit on the total number of subagents Claude can spawn over a session. By default, when 20 subagents are running in a session, spawning another with the Agent tool fails with `Concurrent subagent limit reached`, and the error tells Claude not to retry. Spawning succeeds again when the running count drops below the limit. To change the limit, set [`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`](</docs/en/env-vars>) to any positive whole number. Sessions with [ultracode](</docs/en/model-config#adjust-effort-level>) active are exempt: the limit isn’t enforced there. Requires Claude Code v2.1.217 or later. The limit blocks only subagents Claude spawns with the Agent tool, but other runs occupy the same slots:
* An in-session fork you start with `/subtask` takes a slot while it runs and is never blocked by the limit.
* Resuming a subagent that already finished takes a fresh slot without checking the limit, so resumes can push the running count past it.
-Agents that other features run, such as [workflow](</docs/en/workflows>) agents and [agent team](</docs/en/agent-teams>) teammates, follow their own limits instead. The session subagent limit separately caps the total Claude spawns over the whole session.
+Agents that other features run, such as [workflow](</docs/en/workflows>) agents and [agent team](</docs/en/agent-teams>) teammates, follow their own limits instead.
###
--- a/terminal-config.md
+++ b/terminal-config.md
@@ -126,8 +126,6 @@
Create a custom theme
-
-Custom themes require Claude Code v2.1.118 or later.
In addition to the built-in presets, `/theme` lists any custom themes you have defined and any themes contributed by installed [plugins](</docs/en/plugins-reference#themes>). Select **New custom theme…** at the end of the list to create one interactively: you name the theme, then pick individual color tokens to override. Press `Ctrl+E` while a custom theme is highlighted to edit it. Each custom theme is a JSON file in `~/.claude/themes/`. The filename without the `.json` extension is the theme’s slug, and selecting the theme stores `custom:<slug>` as your theme preference. The file has three optional fields:
--- a/third-party-integrations.md
+++ b/third-party-integrations.md
@@ -6,7 +6,7 @@
Compare deployment options
-For most organizations, Claude for Teams or Claude for Enterprise provides the best experience. Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required. **Claude for Teams** is self-service and includes collaboration features, admin tools, and billing management. Best for smaller teams that need to get started quickly. **Claude for Enterprise** adds SSO and domain capture, role-based permissions, compliance API access, and managed policy settings for deploying organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements. Learn more about [Team plans](<https://support.claude.com/en/articles/9266767-what-is-the-team-plan>) and [Enterprise plans](<https://support.claude.com/en/articles/9797531-what-is-the-enterprise-plan>). If your organization has specific infrastructure requirements, compare the options below: Feature| Claude for Teams/Enterprise| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform, formerly Vertex AI| Microsoft Foundry
+For most organizations, Claude for Teams or Claude for Enterprise provides the best experience. Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required. **Claude for Teams** is self-service and includes collaboration features, admin tools, and billing management. Best for smaller teams that need to get started quickly. **Claude for Enterprise** adds SSO and domain capture, role-based permissions, compliance API access, and managed policy settings for deploying organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements. Learn more about [Team plans](<https://support.claude.com/en/articles/9266767-what-is-the-team-plan>) and [Enterprise plans](<https://support.claude.com/en/articles/9797531-what-is-the-enterprise-plan>). The deployment options compared below cover where model inference runs. To run [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions on compute your organization operates, see [self-hosted environments](</docs/en/self-hosted-environments>). If your organization has specific infrastructure requirements, compare the options below: Feature| Claude for Teams/Enterprise| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform, formerly Vertex AI| Microsoft Foundry
---|---|---|---|---|---|---
Best for| Most organizations (recommended)| Individual developers| AWS-native deployments| AWS Marketplace billing with Claude API features| GCP-native deployments| Azure-native deployments
Billing| **Teams:** $150/seat (Premium) with PAYG available
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -428,7 +428,7 @@
Session search limit
-A session can make at most 200 WebSearch calls, counted across the main conversation and every [subagent](</docs/en/sub-agents>) it spawns, so searches made by parallel research fan-outs count against the same limit. The limit requires Claude Code v2.1.212 or later. When Claude reaches the limit, further calls return a notice telling Claude to continue with the information it already gathered, rather than an error that would invite a retry. You don’t see the notice: a capped call appears in the conversation as a search that did nothing, and if Claude genuinely needs more searches, the notice tells it to ask you to raise the limit. Set the [`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`](</docs/en/env-vars>) environment variable to change the cap; it accepts a positive whole number, so the cap can be raised but not turned off. Running [`/clear`](</docs/en/commands#all-commands>) resets the count under the same rule as the [session subagent limit](</docs/en/sub-agents>).
+A session can make at most 200 WebSearch calls, counted across the main conversation and every [subagent](</docs/en/sub-agents>) it spawns, so searches made by parallel research fan-outs count against the same limit. The limit requires Claude Code v2.1.212 or later. When Claude reaches the limit, further calls return a notice telling Claude to continue with the information it already gathered, rather than an error that would invite a retry. You don’t see the notice: a capped call appears in the conversation as a search that did nothing, and if Claude genuinely needs more searches, the notice tells it to ask you to raise the limit. Set the [`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`](</docs/en/env-vars>) environment variable to change the cap; it accepts a positive whole number, so the cap can be raised but not turned off. Running [`/clear`](</docs/en/commands#all-commands>) resets the count. If work that can still spawn [subagents](</docs/en/sub-agents>) survives the clear, such as a running workflow, the count carries over instead.
##
--- a/troubleshoot-install.md
+++ b/troubleshoot-install.md
@@ -185,9 +185,11 @@
Remove the legacy local npm install:
+ * macOS/Linux
+
+ * Windows PowerShell
+
rm -rf ~/.claude/local
-
-On Windows, use PowerShell:
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\local"
@@ -223,9 +225,11 @@
If `claude --version` prints a version but `claude` crashes or hangs on startup, run these checks to narrow down the cause. If `claude --version` says command not found, go to Verify your PATH first; the commands below assume `claude` is on your PATH. Confirm the binary exists and is executable:
+ * macOS/Linux
+
+ * Windows PowerShell
+
ls -la "$(command -v claude)"
-
-On Windows, use PowerShell:
Get-Command claude | Select-Object Source
@@ -555,7 +559,7 @@
}
}
-If your Git is installed somewhere else, find the path by running `where.exe git` in PowerShell and use the `bin\bash.exe` path from that directory. **If the path is correct and the file exists** but Claude Code still doesn’t use it, check the file’s name first. Claude Code accepts only a file named `bash.exe`, `sh.exe`, `bash`, or `sh`; with any other name, such as Git for Windows’ `git-bash.exe` launcher, it ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. A path that doesn’t exist gets the same fallback and warning. Before v2.1.219, Claude Code used any existing file as the shell without checking its name, and exited at startup with `Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path` when the path didn’t exist. If the file’s name is right, endpoint security software such as AppLocker, Group Policy software restriction policies, or EDR agents may be interfering. On versions before v2.1.116, Claude Code spawned a `cmd.exe` child process to verify the path, which these policies can block. A common signal is that `cmd.exe /c dir "C:\Program Files\Git\bin\bash.exe"` works when you run it directly in PowerShell but fails silently when launched by `claude.exe`. Claude Code v2.1.116 and later check the filesystem directly, so update first. If the error persists on a current version, ask your IT team to allowlist `claude.exe` and the processes it spawns, including `cmd.exe` and `bash.exe`, in your endpoint protection policy.
+If your Git is installed somewhere else, find the path by running `where.exe git` in PowerShell and use the `bin\bash.exe` path from that directory. **If the path is correct and the file exists** but Claude Code still doesn’t use it, check the file’s name first. Claude Code accepts only a file named `bash.exe`, `sh.exe`, `bash`, or `sh`; with any other name, such as Git for Windows’ `git-bash.exe` launcher, it ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. A path that doesn’t exist gets the same fallback and warning. Before v2.1.219, Claude Code used any existing file as the shell without checking its name, and exited at startup with `Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path` when the path didn’t exist. If the file’s name is right, endpoint security software such as AppLocker, Group Policy software restriction policies, or EDR agents may be interfering. Ask your IT team to allowlist `claude.exe` and the processes it spawns, including `cmd.exe` and `bash.exe`, in your endpoint protection policy.
###
@@ -699,8 +703,6 @@
* **Unsupported platform.** Prebuilt binaries are published for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Claude Code does not ship a binary for other platforms; see the [system requirements](</docs/en/setup#system-requirements>). On FreeBSD, the installer reports the platform as unsupported. Before v2.1.205, it treated FreeBSD as Linux and downloaded a binary that couldn’t run.
* **Corporate npm mirror is missing the platform packages.** Ensure your registry mirrors all eight `@anthropic-ai/claude-code-*` platform packages in addition to the meta package.
-Before v2.1.113, the npm package shipped Claude Code as JavaScript that ran directly in Node rather than as a native binary, so there was no download or postinstall step to skip and this error didn’t exist.
-
##
@@ -755,7 +757,14 @@
If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode with the `-p` flag, the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile:
+ * macOS/Linux
+
+ * Windows PowerShell
+
unset ANTHROPIC_API_KEY
+ claude
+
+ Remove-Item Env:ANTHROPIC_API_KEY
claude
Check `~/.zshrc`, `~/.bashrc`, or `~/.profile` for `export ANTHROPIC_API_KEY=...` lines and remove them to make the change permanent. On Windows, check your PowerShell profile at `$PROFILE` and your User environment variables for `ANTHROPIC_API_KEY`. Run `/status` inside Claude Code to confirm which authentication method is active.
--- a/typescript.md
+++ b/typescript.md
@@ -2546,7 +2546,7 @@
**Tool name:** `TaskOutput`
-`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. Deprecated since Claude Code v2.1.83. The schemas below remain valid for hooks and permission handlers that encounter the tool.
+`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. The schemas below remain valid for hooks and permission handlers that encounter the tool.
type TaskOutputInput = {
task_id: string;
@@ -2995,7 +2995,7 @@
};
};
-Manages [Routines](</docs/en/routines>), the scheduled and triggered Claude Code runs hosted on Anthropic-managed cloud infrastructure. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, and `run` actions. `body` is required for `create` and `update`, and optional for `run`. This tool is available only when the session is authenticated with a claude.ai account on a plan with Routines enabled.
+Manages [Routines](</docs/en/routines>), the scheduled and triggered Claude Code runs hosted in the cloud. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, and `run` actions. `body` is required for `create` and `update`, and optional for `run`. This tool is available only when the session is authenticated with a claude.ai account on a plan with Routines enabled.
###
@@ -3359,7 +3359,15 @@
};
};
-Returns command output with stdout/stderr split. Background commands include a `backgroundTaskId`. `timedOutAfterMs` is the timeout in milliseconds, set when the command reached its timeout and moved to the background rather than starting there explicitly. `backgroundCwdHint` is set when the backgrounded command contained a directory-change builtin such as `cd`, `pushd`, `popd`, or `chdir`, and notes that the session working directory didn’t change. Both fields require Claude Code v2.1.210 or later.
+The `stdout`, `stderr`, and `backgroundTaskId` fields carry:
+
+Field| What it carries
+---|---
+`stdout`| The command’s stdout and stderr, merged into one interleaved stream
+`stderr`| Notices the tool itself adds, such as a shell working-directory reset, not the command’s stderr
+`backgroundTaskId`| Present for background commands
+
+`timedOutAfterMs` is the timeout in milliseconds, set when the command reached its timeout and moved to the background rather than starting there explicitly. `backgroundCwdHint` is set when the backgrounded command contained a directory-change builtin such as `cd`, `pushd`, `popd`, or `chdir`, and notes that the session working directory didn’t change. Both fields require Claude Code v2.1.210 or later.
###
--- a/ultrareview.md
+++ b/ultrareview.md
@@ -1,6 +1,6 @@
Ultrareview is a research preview feature. The feature, pricing, and availability may change based on feedback. The command is `/code-review ultra`. When ultrareview is available to your account, `/ultrareview` is an alias.
-Ultrareview is a deep code review that runs on Claude Code on the web infrastructure. When you run `/code-review ultra`, Claude Code launches a fleet of reviewer agents in a remote sandbox to find bugs in your branch or pull request. Compared to a local `/code-review` or `/review`, ultrareview offers:
+Ultrareview is a deep code review that runs on Claude Code on the web infrastructure. When you run `/code-review ultra`, Claude Code launches a fleet of reviewer agents in a remote sandbox to find bugs in your branch or pull request. Compared to a local `/code-review`, ultrareview offers:
* **Higher signal** : every reported finding is independently reproduced and verified, so the results focus on real bugs rather than style suggestions
* **Broader coverage** : a larger fleet of reviewer agents explores the change in parallel, which surfaces issues that a local review can miss
@@ -128,20 +128,20 @@
-How ultrareview compares to /code-review and /review
+How ultrareview compares to /code-review
-All three commands review code, but they target different stages of your workflow.
+Both reviews examine code, but you use them at different stages of your workflow.
-| `/code-review`| `/review <pr>`| `/code-review ultra`
----|---|---|---
-Target| your working diff| a GitHub pull request| your working diff or a pull request
-Runs| locally in your session| locally in your session| remotely in a cloud sandbox
-Depth| scales with the effort argument| a single-pass review at the session’s effort| multi-agent fleet with independent verification
-Duration| seconds to a few minutes| seconds to a few minutes| roughly 5 to 10 minutes
-Cost| counts toward normal usage| counts toward normal usage| free runs, then roughly $5 to $25 per review as usage credits
-Best for| quick feedback while iterating| reviewing a teammate’s PR before approving| pre-merge confidence on substantial changes
+| `/code-review`| `/code-review ultra`
+---|---|---
+Target| your working diff, a pull request, a branch, or a path| your working diff or a pull request
+Runs| locally in your session| remotely in a cloud sandbox
+Depth| scales with the effort argument| multi-agent fleet with independent verification
+Duration| seconds to a few minutes| roughly 5 to 10 minutes
+Cost| counts toward normal usage| free runs, then roughly $5 to $25 per review as usage credits
+Best for| quick feedback while iterating| pre-merge confidence on substantial changes
-Use `/code-review` for fast feedback as you work. Use `/review <pr>` to look over a pull request the same way you would before approving it. Use `/code-review ultra` before merging a substantial change when you want a deeper pass that catches issues a local review might miss.
+Use `/code-review` for fast feedback as you work, or pass a PR number to review a teammate’s pull request before approving it. Use `/code-review ultra` before merging a substantial change when you want a deeper pass that catches issues a local review might miss.
##
--- a/voice-dictation.md
+++ b/voice-dictation.md
@@ -1,8 +1,4 @@
-Speak your prompts instead of typing them in the Claude Code CLI. Your speech is transcribed live into the prompt input, so you can mix voice and typing in the same message. Enable dictation with `/voice`, then either hold a key while you speak or tap once to start and again to send.
-
-Tap mode requires Claude Code v2.1.116 or later. Check your version with `claude --version`.
-
-Dictation also works in [agent view](</docs/en/agent-view#peek-and-reply>). Hold or tap your push-to-talk key while the dispatch input or a peek-panel reply is focused to dictate to a background session.
+Speak your prompts instead of typing them in the Claude Code CLI. Your speech is transcribed live into the prompt input, so you can mix voice and typing in the same message. Enable dictation with `/voice`, then either hold a key while you speak or tap once to start and again to send. Dictation also works in [agent view](</docs/en/agent-view#peek-and-reply>). Hold or tap your push-to-talk key while the dispatch input or a peek-panel reply is focused to dictate to a background session.
##
--- a/web-quickstart.md
+++ b/web-quickstart.md
@@ -1,6 +1,6 @@
Claude Code on the web is in research preview for Pro, Max, and Team users, and for Enterprise users with premium seats or Chat + Claude Code seats.
-Claude Code on the web runs on Anthropic-managed cloud infrastructure instead of your machine. Submit tasks from [claude.ai/code](<https://claude.ai/code>) in your browser or the Claude mobile app. You’ll need a GitHub repository to get started. Claude clones it into an isolated virtual machine, makes changes, and pushes a branch for you to review. Sessions persist across devices, so a task you start on your laptop is ready to review from your phone later. Claude Code on the web works well for:
+Claude Code on the web runs on cloud infrastructure instead of your machine, Anthropic-managed by default. Submit tasks from [claude.ai/code](<https://claude.ai/code>) in your browser or the Claude mobile app. You’ll need a GitHub repository to get started. Claude clones it into an isolated virtual machine, makes changes, and pushes a branch for you to review. Sessions persist across devices, so a task you start on your laptop is ready to review from your phone later. Claude Code on the web works well for:
* **Parallel tasks** : run several independent tasks at once, each in its own session and branch, without managing multiple worktrees
* **Repos you don’t have locally** : Claude clones the repo fresh every session, so you don’t need it checked out
@@ -15,7 +15,7 @@
How sessions run
-When you submit a task:
+The steps below describe Anthropic-hosted sessions. In a [self-hosted environment](</docs/en/self-hosted-environments>), the clone and everything after it run on your organization’s own runners, where network boundaries, setup, and push behavior are operator-configured. When you submit a task:
1. **Clone and prepare** : your repository is cloned to an Anthropic-managed VM, and your [setup script](</docs/en/cloud-environments#setup-scripts>) runs if configured.
2. **Configure network** : internet access is set based on your environment’s [access level](</docs/en/cloud-environments#access-levels>).
@@ -34,7 +34,7 @@
| On the web| Remote Control| Terminal CLI| Desktop app
---|---|---|---|---
-**Code runs on**| Anthropic cloud VM| Your machine| Your machine| Your machine or cloud VM
+**Code runs on**| Cloud VM, Anthropic-managed by default| Your machine| Your machine| Your machine or cloud VM
**You chat from**| claude.ai or mobile app| claude.ai or mobile app| Your terminal| The Desktop UI
**Uses your local config**| No, repo only| Yes| Yes| Yes for local, no for cloud
**Requires GitHub**| Yes, or [bundle a local repo](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) via `--cloud`| No| No| Only for cloud sessions