Changes on
90 changes detected
--- a/2026-w13.md
+++ b/2026-w13.md
@@ -24,7 +24,7 @@
Claude Code
- > Open the iOS simulator, tap through the onboarding flow, and screenshot each step
+ Open the iOS simulator, tap through the onboarding flow, and screenshot each step
[Computer use guide](</docs/en/desktop#let-claude-use-your-computer>)
--- a/2026-w14.md
+++ b/2026-w14.md
@@ -8,7 +8,7 @@
Claude Code
- > Open the iOS simulator, tap through onboarding, and screenshot each step
+ Open the iOS simulator, tap through onboarding, and screenshot each step
[Computer use guide](</docs/en/computer-use>)
@@ -20,7 +20,7 @@
Claude Code
- > /powerup
+ /powerup
[Commands reference](</docs/en/commands>)
--- a/2026-w15.md
+++ b/2026-w15.md
@@ -8,7 +8,7 @@
Claude Code
- > /ultraplan migrate the auth service from sessions to JWTs
+ /ultraplan migrate the auth service from sessions to JWTs
[Ultraplan guide](</docs/en/ultraplan>)
@@ -20,13 +20,13 @@
Claude Code
- > Tail server.log in the background and tell me the moment a 5xx shows up
+ Tail server.log in the background and tell me the moment a 5xx shows up
This pairs with `/loop`, which now self-paces: omit the interval and Claude schedules the next tick based on the task, or reaches for the Monitor tool to skip polling altogether.
Claude Code
- > /loop check CI on my PR
+ /loop check CI on my PR
[Monitor tool reference](</docs/en/tools-reference#monitor-tool>)
@@ -38,7 +38,7 @@
Claude Code
- > /autofix-pr
+ /autofix-pr
[Auto-fix pull requests](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>)
@@ -50,7 +50,7 @@
Claude Code
- > /team-onboarding
+ /team-onboarding
[Commands reference](</docs/en/commands>)
--- a/2026-w22.md
+++ b/2026-w22.md
@@ -8,7 +8,7 @@
Claude Code
- > /model claude-opus-4-8
+ /model claude-opus-4-8
[Model configuration](</docs/en/model-config#available-models>)
@@ -20,7 +20,7 @@
Claude Code
- > create a workflow that migrates every internal fetch() call to the new HttpClient wrapper
+ create a workflow that migrates every internal fetch() call to the new HttpClient wrapper
[Dynamic workflows](</docs/en/workflows>)
@@ -32,13 +32,13 @@
Claude Code
- > /plugin install security-guidance@claude-plugins-official
+ /plugin install security-guidance@claude-plugins-official
Then activate it in the current session:
Claude Code
- > /reload-plugins
+ /reload-plugins
[Security guidance plugin](</docs/en/security-guidance>)
@@ -50,7 +50,7 @@
Claude Code
- > /fast
+ /fast
[Fast mode pricing](</docs/en/fast-mode#understand-the-cost-tradeoff>)
--- a/2026-w25.md
+++ b/2026-w25.md
@@ -8,7 +8,7 @@
Claude Code
- > Make an artifact that walks through this PR with the diff annotated inline.
+ Make an artifact that walks through this PR with the diff annotated inline.
[Create an artifact](</docs/en/artifacts#create-an-artifact>)
@@ -36,7 +36,7 @@
Claude Code
- > /config thinking=false
+ /config thinking=false
[Commands reference](</docs/en/commands#all-commands>)
--- a/2026-w29.md
+++ b/2026-w29.md
@@ -8,7 +8,7 @@
Claude Code
- > Build a dashboard artifact of open pull requests that pulls the live list through my GitHub connector when the page loads.
+ Build a dashboard artifact of open pull requests that pulls the live list through my GitHub connector when the page loads.
[Pull live data with MCP connectors](</docs/en/artifacts#pull-live-data-with-mcp-connectors>)
--- a/accessibility.md
+++ b/accessibility.md
@@ -16,7 +16,7 @@
The methods are listed in precedence order: the [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag overrides the [`CLAUDE_AX_SCREEN_READER`](</docs/en/env-vars>) environment variable, which overrides the [`axScreenReader`](</docs/en/settings#available-settings>) setting.
-If you use Claude Code over SSH, set the environment variable or setting on the remote machine where Claude Code runs. When the mode is on, the first thing Claude Code prints is a confirmation line naming the method that turned it on: `[Screen Reader Mode: on via flag]`, `[Screen Reader Mode: on via env]`, or `[Screen Reader Mode: on via settings]`. The method-naming format requires Claude Code v2.1.206 or later. When Claude Code relaunches itself, for example to finish installing an update, the new process inherits the mode through the `CLAUDE_AX_SCREEN_READER` environment variable, so its confirmation line reads `[Screen Reader Mode: on via env]` regardless of which method you used. Earlier versions print `[Accessible screen reader mode: on]`.
+If you use Claude Code over SSH, set the environment variable or setting on the remote machine where Claude Code runs. When the mode is on, the first thing Claude Code prints is a confirmation line naming the method that turned it on: `[Screen Reader Mode: on via flag]`, `[Screen Reader Mode: on via env]`, or `[Screen Reader Mode: on via settings]`. The method-naming format requires Claude Code v2.1.206 or later. When Claude Code relaunches itself, for example to finish installing an update, the new process inherits the mode through the `CLAUDE_AX_SCREEN_READER` environment variable, so its confirmation line reads `[Screen Reader Mode: on via env]` regardless of which method you used. Earlier versions print `[Accessible screen reader mode: on]`. After printing the confirmation line, Claude Code holds the rest of the interface back for three seconds so your screen reader can finish speaking the line, then renders the first prompt. Press any key to end the hold early. To change the hold’s length, set the `CLAUDE_AX_STARTUP_QUIET_MS` environment variable to a number of milliseconds. The default is `3000`; set it to `0` to skip the hold. Claude Code caps the hold at `600000` milliseconds, 10 minutes. Requires Claude Code v2.1.217 or later.
##
@@ -51,7 +51,7 @@
`Permission Required:`| A permission prompt waiting for your answer
`Cost:`| The session cost summary when Claude Code exits, if your account [shows costs](</docs/en/costs>)
-The terminal cursor follows the input caret, so a screen reader’s read-current-line command answers “where am I” with the prompt you’re editing. When you delete a word or a line in the input, Claude Code announces the deleted text. Requires Claude Code v2.1.218 or later. The announcement covers:
+The terminal cursor follows the input caret, so a screen reader’s read-current-line command answers “where am I” with the prompt you’re editing. As you type at the end of the input line, Claude Code writes only the characters you type, so your screen reader echoes only those characters. Requires Claude Code v2.1.219 or later; earlier versions rewrite the whole input line on every keystroke, so the screen reader re-reads it as you type. When you delete a word or a line in the input, Claude Code announces the deleted text. Requires Claude Code v2.1.218 or later. The announcement covers:
* Deleting a word with `Ctrl+W`, `Option+Delete` on macOS, or `Ctrl+Backspace` on Windows
* Deleting to the start of the line with `Ctrl+U` or `Cmd+Backspace`
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -86,7 +86,7 @@
[Version floor](</docs/en/settings>)| Prevent auto-update from installing below an org-wide minimum| `minimumVersion`
[Required version range](</docs/en/settings>)| Refuse to start at all when the running version is outside an org-approved range. Stronger than `minimumVersion`, which only blocks downgrades| `requiredMinimumVersion`, `requiredMaximumVersion`
-Organizations whose members authenticate through claude.ai or the Anthropic API can also govern models without deploying settings: [organization model restrictions](</docs/en/model-config#organization-model-restrictions>) disable individual models, an [organization default model](</docs/en/model-config#organization-default-model>) sets which model new sessions start on, and [organization effort limits](</docs/en/model-config#organization-effort-limits>) cap effort levels per role. All three controls require a Claude Enterprise plan. Model restrictions and effort limits are enforced server-side; the default model is a starting point that users can change, unless the organization enforces it. Enforcement is available to a limited set of organizations; ask your Anthropic account team about availability. None of these controls reach sessions on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>); on those providers, use `availableModels` above for restrictions and the `model` key in managed settings for a default. [Claude Code on the web](</docs/en/claude-code-on-the-web>) has its own admin surface: on the Cloud environments page in admin settings, owners and admins create [organization-shared environments](</docs/en/claude-code-on-the-web#organization-shared-environments>) that set the [network access level](</docs/en/claude-code-on-the-web#network-access>), environment variables, and setup script for members’ cloud sessions, and choose the organization’s default environment. Permission rules and sandboxing cover different layers. Denying WebFetch blocks Claude’s fetch tool, but if Bash is allowed, `curl` and `wget` can still reach any URL. Sandboxing closes that gap with a network domain allowlist enforced at the OS level. For the threat model these controls defend against, see [Security](</docs/en/security>).
+Organizations whose members authenticate through claude.ai or the Anthropic API can also govern models without deploying settings: [organization model restrictions](</docs/en/model-config#organization-model-restrictions>) disable individual models, an [organization default model](</docs/en/model-config#organization-default-model>) sets which model new sessions start on, and [organization effort limits](</docs/en/model-config#organization-effort-limits>) cap effort levels per role. All three controls require a Claude Enterprise plan. Model restrictions and effort limits are enforced server-side; the default model is a starting point that users can change, unless the organization enforces it. Enforcement is available to a limited set of organizations; ask your Anthropic account team about availability. None of these controls reach sessions on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>); on those providers, use `availableModels` above for restrictions and the `model` key in managed settings for a default. [Claude Code on the web](</docs/en/claude-code-on-the-web>) has its own admin surface: on the Cloud environments page in admin settings, owners and admins create [organization-shared environments](</docs/en/cloud-environments#organization-shared-environments>) that set the [network access level](</docs/en/cloud-environments#network-access>), environment variables, and setup script for members’ cloud sessions. Owners and admins choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). Permission rules and sandboxing cover different layers. Denying WebFetch blocks Claude’s fetch tool, but if Bash is allowed, `curl` and `wget` can still reach any URL. Sandboxing closes that gap with a network domain allowlist enforced at the OS level. For the threat model these controls defend against, see [Security](</docs/en/security>).
##
--- a/advisor.md
+++ b/advisor.md
@@ -79,7 +79,7 @@
Opus 4.7 or later| Fable, and Opus 4.7 or later| Opus 4.7 and later Opus models are ranked as equally capable, so any of them accepts another as an advisor. An Opus 4.7 main with an Opus 4.6 or Sonnet 5 advisor is rejected
Fable 5 (v2.1.170+)| Fable| An Opus or Sonnet advisor is rejected. Fable isn’t offered as the advisor, so a Fable 5 main model runs without one
-Fable 5 requires Claude Code v2.1.170 or later and Fable 5 access, whether it acts as the main model or the advisor. Set the advisor as `opus` or `sonnet`, or as `fable` once the rollout returns it as an option. These aliases resolve to the latest version of each model. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request:
+Fable 5 requires Claude Code v2.1.170 or later and Fable 5 access, whether it acts as the main model or the advisor. Set the advisor as `opus` or `sonnet`, or as `fable` once the rollout returns it as an option. These aliases resolve to Claude Code’s built-in default version for each model family, which advances with new Claude Code releases. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request:
* If the advisor is less capable than the main model, the advisor is not attached to the main model’s requests. The `/advisor` command output and a notification show this. Subagents whose own model satisfies the pairing may still use the advisor.
* If the main model or the advisor is a model Claude Code does not recognize, the advisor is not attached.
--- a/agent-loop.md
+++ b/agent-loop.md
@@ -210,7 +210,7 @@
If you don’t set `effort`, both SDKs leave the parameter unset and defer to the model’s default behavior.
-`effort` trades latency and token cost for reasoning depth within each response. [Extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) is a separate feature that produces visible chain-of-thought blocks in the output. They are independent: you can set `effort: "low"` with extended thinking enabled, or `effort: "max"` without it.
+`effort` trades latency and token cost for reasoning depth within each response. [Extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) is a separate feature that produces `thinking` blocks in the output, and the `display` field on `ThinkingConfig` for [Python](</docs/en/agent-sdk/python#thinkingconfig>) or [TypeScript](</docs/en/agent-sdk/typescript#thinkingconfig>) controls whether you receive their text. They are independent: you can set `effort: "low"` with extended thinking enabled, or `effort: "max"` without it.
Use lower effort for agents doing simple, well-scoped tasks (like listing files or running a single grep) to reduce cost and latency. Set `effort` in the top-level `query()` options for the whole session, or per subagent with the `effort` field on [`AgentDefinition`](</docs/en/agent-sdk/subagents#agentdefinition-configuration>) to override the session level.
@@ -261,7 +261,7 @@
---|---|---
**System prompt**| Every request| Small fixed cost, always present
**CLAUDE.md files**| Session start, via [`settingSources`](</docs/en/agent-sdk/claude-code-features>)| Full content in every request (but prompt-cached, so only the first request pays full cost)
-**Tool definitions**| Every request; MCP schemas deferred by default| Built-in tool schemas load every request. [Tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default, falling back to upfront loading on Google Cloud’s Agent Platform or a non-first-party `ANTHROPIC_BASE_URL`. See [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) for the full matrix
+**Tool definitions**| Every request; MCP schemas deferred by default| Built-in tool schemas load every request. [Tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default, falling back to upfront loading on Google Cloud’s Agent Platform, a non-first-party `ANTHROPIC_BASE_URL`, or a Microsoft Foundry deployment hosted on Azure. See [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) for the full matrix
**Conversation history**| Accumulates over turns| Grows with each turn: prompts, responses, tool inputs, tool outputs
**Skill descriptions**| Session start, via setting sources| Short summaries; full content loads only when invoked
@@ -303,7 +303,7 @@
* **Use subagents for subtasks.** Each subagent starts with a fresh conversation (no prior message history, though it does load its own system prompt and project-level context like CLAUDE.md). It does not see the parent’s turns, and only its final response returns to the parent as a tool result. The main agent’s context grows by that summary, not by the full subtask transcript. See [What subagents inherit](</docs/en/agent-sdk/subagents#what-subagents-inherit>) for details.
* **Be selective with tools.** Every tool definition takes context space. Use the `tools` field on [`AgentDefinition`](</docs/en/agent-sdk/subagents#agentdefinition-configuration>) to scope subagents to the minimum set they need.
- * **Watch MCP server costs.** [MCP tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default and loads them on demand. When tool search is off, on Google Cloud’s Agent Platform, or behind a non-first-party `ANTHROPIC_BASE_URL`, each MCP server adds all its tool schemas to every request, so a few servers with many tools can consume significant context before the agent does any work.
+ * **Watch MCP server costs.** [MCP tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default and loads them on demand. When tool search is off or has fallen back to upfront loading, each MCP server adds all its tool schemas to every request, so a few servers with many tools can consume significant context before the agent does any work. The fallback applies on Google Cloud’s Agent Platform, behind a non-first-party `ANTHROPIC_BASE_URL`, and on a Microsoft Foundry deployment hosted on Azure.
* **Use lower effort for routine tasks.** Set effort to `"low"` for agents that only need to read files or list directories. This reduces token usage and cost.
For a detailed breakdown of per-feature context costs, see [Understand context costs](</docs/en/features-overview#understand-context-costs>).
@@ -462,6 +462,8 @@
console.log(`Session ended with an error: ${error}`);
}
+When the agent finishes successfully, the example prints a `Done:` line with the agent’s summary of the fix, then a line like `Cost: $0.0312`.
+
##
--- a/agent-teams.md
+++ b/agent-teams.md
@@ -228,7 +228,7 @@
* **Team config** : `~/.claude/teams/{team-name}/config.json`
* **Task list** : `~/.claude/tasks/{team-name}/`
-Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`; a teammate’s entry includes an agent type only when the teammate was spawned from a subagent definition. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file.
+Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file.
###
--- a/authentication.md
+++ b/authentication.md
@@ -6,7 +6,7 @@
Log in to Claude Code
-After [installing Claude Code](</docs/en/setup#install-claude-code>), run `claude` in your terminal. On first launch, Claude Code opens a browser window for you to log in. If the browser doesn’t open automatically, press `c` to copy the login URL to your clipboard, then paste it into your browser. If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the `Paste code here if prompted` prompt. This happens when the browser can’t reach Claude Code’s local callback server, which is common in WSL2, SSH sessions, and containers. When login completes, the terminal shows `Login successful` and prompts you to press `Enter` to continue. You can authenticate with any of these account types:
+After [installing Claude Code](</docs/en/setup#install-claude-code>), run `claude` in your terminal. On first launch, Claude Code opens a browser window for you to log in. If you’ve set the `ANTHROPIC_API_KEY` environment variable, Claude Code skips the login prompt and asks you to approve the key instead. If the browser doesn’t open automatically, press `c` to copy the login URL to your clipboard, then paste it into your browser. If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the `Paste code here if prompted` prompt. This happens when the browser can’t reach Claude Code’s local callback server, which is common in WSL2, SSH sessions, and containers. When login completes, the terminal shows `Login successful` and prompts you to press `Enter` to continue. You can authenticate with any of these account types:
* **Claude Pro or Max subscription** : log in with your Claude.ai account. Subscribe at [claude.com/pricing](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=authentication_pro_max>).
* **Claude for Teams or Enterprise** : log in with the Claude.ai account your team admin invited you to.
--- a/auto-mode-config.md
+++ b/auto-mode-config.md
@@ -1,6 +1,6 @@
[Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) lets Claude Code run without routine permission prompts by routing tool calls through a classifier that blocks anything irreversible, destructive, or aimed outside your environment. Deny and explicit ask rules are evaluated before the classifier and still block or prompt. Use the `autoMode` settings block to tell that classifier which repos, buckets, and domains your organization trusts, so it stops blocking routine internal operations.
-Auto mode is available to all users on every provider, including the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. If Claude Code reports auto mode as unavailable for your account, check the [full requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), which also cover the supported models and Owner enablement on Team and Enterprise plans. In v2.1.158 through v2.1.206, auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude apps gateway sessions required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
+Auto mode is available to all users on every provider, including the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. If Claude Code reports auto mode as unavailable for your account, check the [full requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), which also cover the supported models and the organization-level control on Team and Enterprise plans. In v2.1.158 through v2.1.206, auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude apps gateway sessions required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
By default, the classifier trusts only the working directory and the current repo’s configured remotes. Actions like pushing to your company’s source-control org or writing to a team cloud bucket are blocked until you add them to `autoMode.environment`. For how to enable auto mode and what it blocks by default, see [Permission modes](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). This page is the configuration reference. This page covers how to:
--- a/best-practices.md
+++ b/best-practices.md
@@ -401,7 +401,7 @@
* Use `/clear` frequently between tasks to reset the context window entirely
* When auto compaction triggers, Claude summarizes what matters most, including code patterns, file states, and key decisions
* For more control, run `/compact <instructions>`, like `/compact Focus on the API changes`
- * To compact only part of the conversation, use `Esc + Esc` or `/rewind`, select a message checkpoint, and choose **Summarize from here** or **Summarize up to here**. The first condenses messages from that point forward while keeping earlier context intact; the second condenses earlier messages while keeping recent ones in full. See [Restore vs. summarize](</docs/en/checkpointing#restore-vs-summarize>).
+ * To compact only part of the conversation, use `Esc + Esc` or `/rewind`, select a message checkpoint, and choose **Summarize from here** or **Summarize up to here**. The first condenses messages from that point forward while keeping earlier context intact; the second condenses earlier messages while keeping recent ones in full. See [the rewind menu’s summarize options](</docs/en/checkpointing#rewind-and-summarize>).
* Customize compaction behavior in CLAUDE.md with instructions like `"When compacting, always preserve the full list of modified files and any test commands"` to ensure critical context survives summarization
* For quick questions that don’t need to stay in context, use [`/btw`](</docs/en/interactive-mode#side-questions-with-%2Fbtw>). The answer appears in a dismissible overlay and never enters conversation history, so you can check a detail without growing context.
--- a/checkpointing.md
+++ b/checkpointing.md
@@ -54,16 +54,11 @@
-Restore vs. summarize
+Guide a summary
-The restore options revert state: they undo code changes, conversation history, or both. The summarize options compress part of the conversation into an AI-generated summary without changing files on disk:
+Summarizing doesn’t change files on disk, and the original messages stay in the session transcript, so Claude can still reference the details. To guide what the summary focuses on, highlight a **Summarize** option with the arrow keys and type instructions where the row reads **add context (optional)** , then press `Enter`. Selecting the option with its number key summarizes immediately without instructions.
- * **Summarize from here** : messages before the selected message stay intact. The selected message and everything after it are replaced with a summary. Use this to discard a side discussion while keeping early context in full detail.
- * **Summarize up to here** : messages before the selected message are replaced with a summary. The selected message and everything after it stay intact, and you remain at the end of the conversation. Use this to compress early setup discussion while keeping recent work in full detail.
-
-In both cases the original messages are preserved in the session transcript, so Claude can reference the details if needed. To guide what the summary focuses on, highlight a **Summarize** option with the arrow keys and type instructions inline where the row reads **add context (optional)** , then press `Enter` to summarize; selecting the option by its number key summarizes immediately without instructions. This is similar to `/compact`, but targeted: instead of summarizing the entire conversation, you choose which side of the selected message to compress.
-
-Summarize keeps you in the same session and compresses context. If you want to branch off and try a different approach while preserving the original session intact, use [`/branch`](</docs/en/sessions#branch-a-session>) or `claude --continue --fork-session` instead.
+Summarize keeps you in the same session and compresses context, like a targeted `/compact`. To branch off and try a different approach while preserving the original session intact, use [`/branch`](</docs/en/sessions#branch-a-session>) or `claude --continue --fork-session` instead.
##
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
@@ -126,7 +126,7 @@
This config is enough for a working sign-in loop with the default Amazon Bedrock model catalog. Once it’s running, add per-group RBAC and managed settings via [`managed.policies`](</docs/en/claude-apps-gateway-config#managed>), telemetry fan-out via [`telemetry`](</docs/en/claude-apps-gateway-config#telemetry>), and multi-upstream failover, provisioned-throughput ARNs, or non-US regions via [`models`](</docs/en/claude-apps-gateway-config#models>).
-The Amazon Bedrock upstream needs an AWS principal with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the `inference-profile/us.anthropic.*` ARNs and the underlying `foundation-model/anthropic.*` ARNs, and model access enabled in the Amazon Bedrock console for the Claude models you want. Supply the credential with IRSA on EKS, an ECS task role, or an EC2 instance profile rather than static keys. The [`upstreams` reference](</docs/en/claude-apps-gateway-config#upstreams>) has the full IAM details, the cross-cloud credential matrix, and the `auth` blocks for the other providers.
+The Amazon Bedrock upstream needs an AWS principal with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both the `inference-profile/us.anthropic.*` ARNs and the underlying `foundation-model/anthropic.*` ARNs, and Anthropic’s one-time use case form submitted for the account from the Bedrock console’s Model catalog. Supply the credential with IRSA on EKS, an ECS task role, or an EC2 instance profile rather than static keys. The [`upstreams` reference](</docs/en/claude-apps-gateway-config#upstreams>) has the full IAM details, the cross-cloud credential matrix, and the `auth` blocks for the other providers.
4
@@ -422,4 +422,5 @@
* Expand `gateway.yaml` beyond the minimal config, for example to add per-group RBAC, multi-upstream failover, or telemetry destinations. The [configuration reference](</docs/en/claude-apps-gateway-config>) covers every option.
* Move from Compose to a production deployment on Kubernetes or Cloud Run, set up your IdP properly, and review the security model. The [deployment and operations guide](</docs/en/claude-apps-gateway-deploy>) covers per-IdP setup, container image requirements, health probes, and troubleshooting.
* Put spend caps on individual developers or groups so a runaway workload can’t consume your whole commitment. [Spend limits](</docs/en/claude-apps-gateway-spend-limits>) covers the admin API and how enforcement works.
+ * For a complete worked example on AWS, with ECS Fargate or EKS, Amazon RDS, and Secrets Manager, see [Deploy on AWS](</docs/en/claude-apps-gateway-on-aws>).
* For a complete worked example on Google Cloud, with Cloud Run, Cloud SQL, and Secret Manager, see [Deploy on Google Cloud](</docs/en/claude-apps-gateway-on-gcp>).
--- a/claude-apps-gateway-config.md
+++ b/claude-apps-gateway-config.md
@@ -493,19 +493,14 @@
`env`| CLI| Environment variables merged into the CLI process. Use for telemetry, auto-update, and model-name overrides.
`hooks`| CLI| Org-wide [hooks](</docs/en/hooks>)
-Because these settings arrive over the network, the CLI shows each developer a one-time security approval dialog before applying anything that can run a shell command or alter where traffic goes. The dialog covers:
+Because these settings arrive over the network, the CLI shows each developer a one-time security approval dialog before applying the settings listed below:
* `hooks`
- * `env` variables that aren’t on the CLI’s built-in safe list
+ * `env` variables that require the developer’s approval, such as proxy and base-URL variables
* shell-execution settings such as `apiKeyHelper` and `statusLine`
* managed CLAUDE.md content
-The safe list determines which `env` variables apply without approval:
-
- * **On the safe list** : auto-update and model-name vars
- * **Not on the safe list** : proxy vars, base-URL vars, and `OTEL_EXPORTER_OTLP_ENDPOINT`
-
-The gateway’s telemetry configuration pushes `OTEL_EXPORTER_OTLP_ENDPOINT`, so setting `telemetry.forward_to` triggers the dialog on each interactive client. The dialog protects the developer’s machine from a compromised or hostile gateway, not the organization from the developer. A non-interactive run with the `-p` flag can’t show the dialog. It applies the pushed settings for that run only and doesn’t record them as approved, so the developer’s next interactive session still shows the dialog. Before v2.1.207, a non-interactive run saved the settings as approved and no later interactive session showed the dialog for them. If a developer declines, Claude Code exits rather than applying the policy. Pushing a new hook or non-safe env var to a broad policy therefore means an approval prompt on every matching developer’s next startup. The `cli` key was named `settings` in earlier releases. That spelling is still accepted as an alias, but new deployments should use `cli`.
+Claude Code applies some delivered `env` variables without showing the developer the approval dialog, such as model selection settings and numeric limits. Other delivered variables can require the developer’s approval before they take effect; a non-empty proxy, base-URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` value always does. When a delivered variable needs approval, the dialog names it. [Environment variables and the approval dialog](</docs/en/server-managed-settings#environment-variables-and-the-approval-dialog>) has the details, including four privacy toggles whose delivered value decides whether they need approval. Before v2.1.218, Claude Code applied fewer variables without asking the developer, so more delivered variables triggered the dialog. The gateway’s telemetry configuration pushes `OTEL_EXPORTER_OTLP_ENDPOINT`, so setting `telemetry.forward_to` triggers the dialog on each interactive client. The dialog protects the developer’s machine from a compromised or hostile gateway, not the organization from the developer. A non-interactive run with the `-p` flag can’t show the dialog. It applies the pushed settings for that run only and doesn’t record them as approved, so the developer’s next interactive session still shows the dialog. Before v2.1.207, a non-interactive run saved the settings as approved and no later interactive session showed the dialog for them. If a developer declines, Claude Code exits rather than applying the policy. Pushing a new hook, or any env var that triggers the dialog, to a broad policy therefore means an approval prompt on every matching developer’s next startup. The `cli` key was named `settings` in earlier releases. That spelling is still accepted as an alias, but new deployments should use `cli`.
####
@@ -611,15 +606,16 @@
Enable logs and traces only on destinations with the access controls and retention policy that data warrants.
-Telemetry is off in the CLI by default. Configuring `telemetry.forward_to` together with `listen.public_url` turns it on. The gateway pushes five env vars to every connected client through `/managed/settings`:
+Telemetry is off in the CLI by default. Configuring `telemetry.forward_to` together with `listen.public_url` turns it on. The gateway pushes six env vars to every connected client through `/managed/settings`:
* `CLAUDE_CODE_ENABLE_TELEMETRY=1`
* `OTEL_METRICS_EXPORTER=otlp`
* `OTEL_LOGS_EXPORTER=otlp`
* `OTEL_TRACES_EXPORTER=otlp`
* `OTEL_EXPORTER_OTLP_ENDPOINT=<public_url>`
-
-The pushed endpoint is built from the public URL, so metrics and logs need no OTEL configuration from developers or policies. The pushed configuration is applied at the managed tier, overriding `OTEL_*` variables a developer sets locally. [Traces](</docs/en/monitoring-usage#traces-beta>) additionally require `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1` on each client. The gateway doesn’t push that variable, so set it through a managed policy’s `env` block. It isn’t on the CLI’s safe list, so delivering it through a policy is covered by the same security approval dialog that the pushed OTLP endpoint already triggers. Both protobuf and JSON OTLP encodings are relayed, and any OpenTelemetry-compatible backend works as a destination.
+ * `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`
+
+The pushed endpoint is built from the public URL, so metrics and logs need no OTEL configuration from developers or policies. The pushed configuration is applied at the managed tier, overriding `OTEL_*` variables a developer sets locally. [Traces](</docs/en/monitoring-usage#traces-beta>) additionally require `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1` on each client. The gateway doesn’t push that variable, so set it through a managed policy’s `env` block. It isn’t among the variables Claude Code applies without the developer’s approval, so delivering it through a policy is covered by the same security approval dialog that the pushed OTLP endpoint already triggers. Both protobuf and JSON OTLP encodings are relayed, and any OpenTelemetry-compatible backend works as a destination.
###
--- a/claude-apps-gateway-deploy.md
+++ b/claude-apps-gateway-deploy.md
@@ -44,7 +44,7 @@
* **Multiple gateways** : each gateway is a separate deployment with its own config. The CLI stores its trust fingerprint and credentials per gateway hostname, so different teams can connect to different gateways without conflict. To serve multiple OIDC issuers, run separate instances.
* **Serverless** : Cloud Run works; set `min-instances: 1` to avoid cold OIDC discovery. Lambda and Cloud Functions don’t, because the gateway is a long-running HTTP server.
-Every production topology here puts an L7 proxy, such as an Ingress, Cloud Run’s front end, or an ALB, in front of plain-HTTP replicas. Set [`listen.trusted_proxies`](</docs/en/claude-apps-gateway-config#listen>) to the proxy’s source ranges so the gateway reads client IPs from `X-Forwarded-For`. The gateway honors the header only when the TCP peer is trusted; the [Google Cloud worked example](</docs/en/claude-apps-gateway-on-gcp>) has concrete values per topology. Without trusted proxies, every request appears to come from the proxy’s IP, which collapses per-IP rate limits into one shared bucket and records the proxy’s IP in audit events.
+Every production topology here puts an L7 proxy, such as an Ingress, Cloud Run’s front end, or an ALB, in front of plain-HTTP replicas. Set [`listen.trusted_proxies`](</docs/en/claude-apps-gateway-config#listen>) to the proxy’s source ranges so the gateway reads client IPs from `X-Forwarded-For`. The gateway honors the header only when the TCP peer is trusted; the [Google Cloud](</docs/en/claude-apps-gateway-on-gcp>) and [AWS](</docs/en/claude-apps-gateway-on-aws>) worked examples have concrete values per topology. Without trusted proxies, every request appears to come from the proxy’s IP, which collapses per-IP rate limits into one shared bucket and records the proxy’s IP in audit events.
###
@@ -75,6 +75,8 @@
* Mount the config from a ConfigMap and secrets from a Secret; reference secrets in the YAML via `${file:/path/to/secret}` or as environment variables
* Terminate TLS at the Ingress and set `listen.public_url` to the Ingress hostname
* Point the readiness probe at `GET /readyz` and the liveness probe at `GET /healthz`
+
+For a complete worked example on AWS, covering ECS Fargate or EKS, Amazon RDS, and AWS Secrets Manager, see [Deploy on AWS](</docs/en/claude-apps-gateway-on-aws>).
**Workload identity** Prefer the platform’s workload identity over static keys: IRSA on EKS for Amazon Bedrock and for Claude Platform on AWS, Workload Identity on GKE for Google Cloud’s Agent Platform, and workload identity on AKS for Microsoft Foundry. Set `auth: {}` in the upstream block, or `use_azure_ad: true` for Microsoft Foundry, and the gateway picks up the pod’s identity through that provider’s default credential chain. For a cross-cloud pairing, such as an Amazon Bedrock upstream on GKE, set explicit credentials in the upstream’s `auth` block instead. The [`upstreams` reference](</docs/en/claude-apps-gateway-config#upstreams>) has per-platform setup details.
Show diff (499 lines)
--- a/claude-apps-gateway-on-aws.md
+++ b/claude-apps-gateway-on-aws.md
@@ -0,0 +1,496 @@
+This page walks through one way to run Claude apps gateway on AWS. The configuration is a working example for customer-managed infrastructure rather than a supported production deployment; use it to see how the pieces fit together before adapting it to your own environment. For the platform-agnostic requirements, see the [deployment guide](</docs/en/claude-apps-gateway-deploy>).
+
+This example provisions Claude apps gateway on AWS with Amazon Bedrock as the model upstream, using either [Amazon ECS](<https://aws.amazon.com/ecs/>) on [AWS Fargate](<https://aws.amazon.com/fargate/>) or [Amazon EKS](<https://aws.amazon.com/eks/>) for compute. [Okta](<https://www.okta.com/>) is the example identity provider (IdP), but any OpenID Connect (OIDC) compliant IdP works; see [Identity provider setup](</docs/en/claude-apps-gateway-deploy#identity-provider-setup>) for per-IdP details.
+
+Bedrock isn’t the only Claude upstream on AWS. The gateway also supports Claude Platform on AWS, the Anthropic-operated Claude API with AWS authentication and AWS Marketplace billing, in place of Bedrock or alongside it. Its upstream entry, credentials, and IAM permissions differ from this page’s Bedrock-scoped ones; the [Claude Platform on AWS upstream reference](</docs/en/claude-apps-gateway-config#claude-platform-on-aws>) covers what changes, and the rest of this page applies unchanged.
+
+##
+
+
+
+Architecture
+
+The example architecture, with Amazon Bedrock as the model upstream. A Claude Platform on AWS upstream occupies the same position.
+
+The gateway runs as a private HTTPS endpoint on your network that developers sign in to through your IdP. Their Claude Code sessions reach Claude models on Amazon Bedrock through the gateway’s IAM role, so no model credentials land on developer machines. The reference configuration provisions:
+
+ * **Amazon ECS on AWS Fargate** service or **Amazon EKS** Deployment running the gateway container
+ * **Amazon ECR** repository for the gateway image
+ * **Amazon RDS for PostgreSQL** instance in private subnets, not publicly accessible, for the gateway’s [store](</docs/en/claude-apps-gateway-config#store>)
+ * **AWS Secrets Manager** secrets for the JWT signing key, the OIDC client secret, and the Postgres URL
+ * **IAM role** with `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream`, attached as the ECS task role or bound via IAM Roles for Service Accounts (IRSA) on EKS
+ * **Internal Application Load Balancer** for HTTPS
+
+##
+
+
+
+Prerequisites
+
+The walkthrough creates the gateway’s own resources, but it builds on network and identity infrastructure you already have. Before you start, you need:
+
+ * An AWS account with permission to create the resources above
+ * The [AWS CLI v2](<https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html>) installed and [authenticated](<https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html>), and [Docker](<https://docs.docker.com/get-started/get-docker/>) installed locally
+ * A [VPC](<https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html>) with at least two [private subnets](<https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html>) in different Availability Zones, with outbound internet access through a [NAT gateway](<https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html>); the internal load balancer needs subnets in two AZs, and the gateway needs egress to Bedrock and your IdP
+ * An Okta OIDC web application with redirect URI `https://<gateway-host>/oauth/callback`; see [Identity provider setup](</docs/en/claude-apps-gateway-deploy#identity-provider-setup>)
+ * A TLS hostname for the gateway, typically an internal DNS name in a [Route 53 private hosted zone](<https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-private.html>) pointing at the load balancer, with an [ACM certificate](<https://docs.aws.amazon.com/acm/latest/userguide/gs.html>) for that name, imported or issued by [AWS Private CA](<https://docs.aws.amazon.com/privateca/latest/userguide/PcaWelcome.html>)
+
+###
+
+
+
+Set your environment variables
+
+Every command on this page reads four values from your shell: `AWS_REGION`, `ACCOUNT_ID`, `VPC_ID`, and `PRIVATE_SUBNETS`. Pick a US region where Bedrock serves the Claude models you need. The walkthrough relies on the gateway’s built-in model catalog, which resolves to `us.anthropic.*` inference profiles, and the IAM policy grants those ARNs. In a non-US region, add a [`models:` block](</docs/en/claude-apps-gateway-config#models>) with that geo’s inference-profile IDs and change the IAM policy’s ARN prefix to match. If you don’t have the VPC ID at hand, list your VPCs with `aws ec2 describe-vpcs`, then list that VPC’s subnets to find two private ones in different Availability Zones:
+
+ aws ec2 describe-subnets --filters "Name=vpc-id,Values=<your-vpc-id>" \
+ --query 'Subnets[].{ID:SubnetId,AZ:AvailabilityZone,CIDR:CidrBlock}' --output table
+
+Export all four before continuing:
+
+ export AWS_REGION=us-east-1 # a US region where Bedrock serves the Claude models you need
+ export ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"
+ export VPC_ID=<your-vpc-id>
+ export PRIVATE_SUBNETS="<subnet-id-a> <subnet-id-b>"
+
+##
+
+
+
+Deploy the gateway
+
+The steps below provision the full deployment with `aws` commands.
+
+1
+
+Create the security groups
+
+Three security groups chain the traffic path: your corporate network reaches the load balancer on 443, the load balancer reaches the gateway on 8080, and the gateway reaches Postgres on 5432. Nothing else is reachable. How you attach them depends on the compute track:
+
+ * On ECS Fargate, the deploy step attaches `$ALB_SG` to the load balancer and `$GW_SG` to the service.
+ * On EKS, the AWS Load Balancer Controller creates its own frontend security group for the ALB, so `$ALB_SG` and `$GW_SG` go unused: the deploy step’s `inbound-cidrs` annotation restricts the listener to your corporate network, and the database security group admits the cluster’s security group instead.
+
+ ALB_SG="$(aws ec2 create-security-group --group-name claude-gateway-alb \
+ --description "Claude gateway ALB" --vpc-id "$VPC_ID" \
+ --query GroupId --output text)"
+ GW_SG="$(aws ec2 create-security-group --group-name claude-gateway-svc \
+ --description "Claude gateway service" --vpc-id "$VPC_ID" \
+ --query GroupId --output text)"
+ DB_SG="$(aws ec2 create-security-group --group-name claude-gateway-db \
+ --description "Claude gateway Postgres" --vpc-id "$VPC_ID" \
+ --query GroupId --output text)"
+
+ aws ec2 authorize-security-group-ingress --group-id "$ALB_SG" \
+ --protocol tcp --port 443 --cidr <your-corporate-cidr>
+ aws ec2 authorize-security-group-ingress --group-id "$GW_SG" \
+ --protocol tcp --port 8080 --source-group "$ALB_SG"
+ aws ec2 authorize-security-group-ingress --group-id "$DB_SG" \
+ --protocol tcp --port 5432 --source-group "$GW_SG"
+
+2
+
+Create the IAM roles and submit the use case form
+
+The gateway runs with a dedicated task role whose only permission is invoking Claude models on Bedrock. Per the [Bedrock upstream reference](</docs/en/claude-apps-gateway-config#amazon-bedrock>), the policy must cover both the cross-region inference-profile ARNs and the underlying foundation-model ARNs:
+
+ cat > bedrock-invoke.json <<EOF
+ {
+ "Version": "2012-10-17",
+ "Statement": [{
+ "Effect": "Allow",
+ "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
+ "Resource": [
+ "arn:aws:bedrock:${AWS_REGION}:${ACCOUNT_ID}:inference-profile/us.anthropic.*",
+ "arn:aws:bedrock:*::foundation-model/anthropic.*"
+ ]
+ }]
+ }
+ EOF
+ cat > ecs-trust.json <<'EOF'
+ {
+ "Version": "2012-10-17",
+ "Statement": [{
+ "Effect": "Allow",
+ "Principal": { "Service": "ecs-tasks.amazonaws.com" },
+ "Action": "sts:AssumeRole"
+ }]
+ }
+ EOF
+
+ aws iam create-role --role-name claude-gateway-task \
+ --assume-role-policy-document file://ecs-trust.json
+ aws iam put-role-policy --role-name claude-gateway-task \
+ --policy-name bedrock-invoke --policy-document file://bedrock-invoke.json
+
+ECS also needs an execution role, which the ECS agent itself uses to pull the image from ECR and inject the Secrets Manager values created later. It is separate from the task role the gateway’s AWS SDK uses at runtime:
+
+ aws iam create-role --role-name claude-gateway-execution \
+ --assume-role-policy-document file://ecs-trust.json
+ aws iam attach-role-policy --role-name claude-gateway-execution \
+ --policy-arn arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
+ cat > secrets-read.json <<EOF
+ {
+ "Version": "2012-10-17",
+ "Statement": [{
+ "Effect": "Allow",
+ "Action": ["secretsmanager:GetSecretValue", "secretsmanager:DescribeSecret"],
+ "Resource": [
+ "arn:aws:secretsmanager:${AWS_REGION}:${ACCOUNT_ID}:secret:gateway-jwt-secret-??????",
+ "arn:aws:secretsmanager:${AWS_REGION}:${ACCOUNT_ID}:secret:gateway-oidc-client-secret-??????",
+ "arn:aws:secretsmanager:${AWS_REGION}:${ACCOUNT_ID}:secret:gateway-postgres-url-??????"
+ ]
+ }]
+ }
+ EOF
+ aws iam put-role-policy --role-name claude-gateway-execution \
+ --policy-name read-gateway-secrets --policy-document file://secrets-read.json
+
+The policy names one ARN per secret rather than a bare `gateway-*` wildcard, which in a shared account would also match unrelated secrets; the trailing `-??????` matches exactly the random six-character suffix Secrets Manager appends to every secret’s ARN. A trailing `-*` would be a plain prefix glob and would also match longer names such as `gateway-postgres-url-prod`.The IAM policy grants the gateway permission to call Bedrock, and Bedrock enables model access by default in commercial regions. The remaining account-level gate is Anthropic’s one-time use case form: if no one in your account has submitted it, open the [Amazon Bedrock console](<https://console.aws.amazon.com/bedrock/>), select an Anthropic model from the Model catalog, and complete the form. Access is granted immediately after submission; see [Claude Code on Amazon Bedrock](</docs/en/amazon-bedrock#1-submit-use-case-details>) for the AWS Organizations form and the IAM permissions the submitter needs.The EKS track reuses both policy documents on an IRSA role instead of the two ECS roles; see the deploy step.
+
+3
+
+Provision Amazon RDS for PostgreSQL
+
+The instance runs in the private subnets with no public address and storage encryption on. The engine version is pinned to Postgres 16, which satisfies the gateway’s supported floor of PostgreSQL 14 and guarantees the parameter-group family below matches the instance.First, create the subnet group that places the database in the private subnets, and a parameter group with `rds.force_ssl=1` so the server rejects plaintext connections. The engine version is pinned once because the parameter group’s family must match the engine major version the instance runs:
+
+ aws rds create-db-subnet-group --db-subnet-group-name claude-gateway-db \
+ --db-subnet-group-description "Claude gateway" --subnet-ids $PRIVATE_SUBNETS
+
+ PG_VERSION=16
+ PG_FAMILY="postgres${PG_VERSION}"
+ aws rds create-db-parameter-group --db-parameter-group-name claude-gateway-db \
+ --db-parameter-group-family "$PG_FAMILY" \
+ --description "Claude gateway - require TLS on every connection"
+ aws rds modify-db-parameter-group --db-parameter-group-name claude-gateway-db \
+ --parameters "ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=immediate"
+
+Then create the instance with a generated master password:
+
+ PGPASS="$(openssl rand -hex 24)"
+ aws rds create-db-instance --db-instance-identifier claude-gateway-db \
+ --engine postgres --engine-version "$PG_VERSION" \
+ --db-instance-class db.t4g.micro \
+ --allocated-storage 20 --db-name claude_gateway \
+ --master-username gateway --master-user-password "$PGPASS" \
+ --db-subnet-group-name claude-gateway-db \
+ --db-parameter-group-name claude-gateway-db \
+ --vpc-security-group-ids "$DB_SG" \
+ --no-publicly-accessible --storage-encrypted
+
+The literal `--master-user-password` argument is visible in the process table and in audit/EDR logs while the command runs, the same exposure the secrets step’s note covers. On a shared or monitored host, pass the password via `--cli-input-json` from a `0600` file instead, the way the bundle’s `setup.sh` does.Wait for the instance to come up, which can take several minutes, then read its private endpoint and assemble the connection string the gateway will use:
+
+ aws rds wait db-instance-available --db-instance-identifier claude-gateway-db
+ DB_HOST="$(aws rds describe-db-instances --db-instance-identifier claude-gateway-db \
+ --query 'DBInstances[0].Endpoint.Address' --output text)"
+ GATEWAY_POSTGRES_URL="postgres://gateway:${PGPASS}@${DB_HOST}:5432/claude_gateway?sslmode=verify-full"
+
+`sslmode=verify-full` makes the gateway verify the RDS server certificate’s chain and hostname, not only encrypt. The trust anchor is the [AWS RDS certificate bundle](<https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem>), which the image build step below copies to `/etc/claude/rds-global-bundle.pem` and trusts via `NODE_EXTRA_CA_CERTS`. Don’t append a libpq-style `sslrootcert=` parameter to the URL: the gateway’s driver reads only `sslmode` from the query string and would forward `sslrootcert` to Postgres as a startup parameter, which the server rejects.The ECS service or EKS pods must run in this VPC so they can reach the instance’s private endpoint, and the `claude-gateway-db` security group only admits the gateway’s security group.
+
+4
+
+Write gateway.yaml
+
+The `upstreams` block points at Bedrock with `auth: {}`, so the gateway authenticates via the AWS default credential chain from the task role on ECS or the IRSA role on EKS. See the [configuration reference](</docs/en/claude-apps-gateway-config>) for every field.Two `listen` fields depend on what fronts the gateway:
+
+ * `public_url`: required behind a load balancer. The gateway builds the IdP `redirect_uri` and its discovery document only from this value, never from `X-Forwarded-*` headers.
+ * `trusted_proxies`: the front end’s source ranges. The gateway honors `X-Forwarded-For` only when the TCP peer is in this list, then walks the chain past trusted hops, so per-IP sign-in rate limits and audit events record developer IPs instead of the load balancer’s.
+
+On both tracks the front end is an internal ALB, whether created directly or by the AWS Load Balancer Controller, and an ALB’s nodes take addresses from the subnets it is attached to, so set `trusted_proxies` to those subnets’ CIDRs. This trusts every host in those subnets as a proxy. Keep the ALB’s ingress source, your corporate CIDR, from overlapping them, and don’t share the subnets with untrusted workloads that could spoof client IPs via `X-Forwarded-For`.
+
+gateway.yaml
+
+ listen:
+ host: 0.0.0.0
+ port: 8080
+ public_url: https://claude-gateway.internal.example.com
+ trusted_proxies: [<your-alb-subnet-cidrs>]
+
+ oidc:
+ issuer: https://example.okta.com
+ client_id: 0oa1example2
+ client_secret: ${OIDC_CLIENT_SECRET} # EKS: ${file:/secrets/oidc-client-secret}
+ allowed_email_domains: [example.com]
+ # The Okta org authorization server returns a thin id_token that omits
+ # email and groups; the gateway fills them from /userinfo.
+ userinfo_fallback: true
+ # Okta emits groups only when the `groups` scope is requested and the
+ # app's groups claim filter allows them.
+ scopes: [openid, profile, email, offline_access, groups]
+
+ session:
+ jwt_secret: ${GATEWAY_JWT_SECRET} # EKS: ${file:/secrets/jwt-secret}
+ ttl_hours: 8 # bounds deprovision latency; lower
+ # toward 1 for tighter revocation
+
+ store:
+ postgres_url: ${GATEWAY_POSTGRES_URL} # EKS: ${file:/secrets/postgres-url}
+
+ upstreams:
+ - provider: bedrock
+ region: <your-region> # match $AWS_REGION so the IAM
+ # policy's ARNs cover it
+ auth: {} # AWS default credential chain:
+ # ECS task role, or IRSA on EKS
+
+Only the `oidc` block is Okta-specific. To use Microsoft Entra ID instead, set `issuer` to `https://login.microsoftonline.com/<tenant-id>/v2.0`, drop `userinfo_fallback` and the `groups` scope, and note that Entra emits group Object IDs rather than names, so [`managed.policies`](</docs/en/claude-apps-gateway-config#managed>) must match on the GUIDs, or on App Roles with `oidc.groups_claim: roles`. See [Identity provider setup](</docs/en/claude-apps-gateway-deploy#identity-provider-setup>).
+
+5
+
+Store secrets in AWS Secrets Manager
+
+Create three secrets; the execution role from the IAM step can already read them:
+
+ aws secretsmanager create-secret --name gateway-jwt-secret \
+ --secret-string "$(openssl rand -base64 32)"
+ aws secretsmanager create-secret --name gateway-oidc-client-secret \
+ --secret-string '<your-okta-client-secret>'
+ aws secretsmanager create-secret --name gateway-postgres-url \
+ --secret-string "$GATEWAY_POSTGRES_URL"
+
+Note the ARN each call prints; the ECS task definition references secrets by ARN.
+
+Literal `--secret-string` arguments are visible in the process table and in audit/EDR logs while each command runs. On a shared or monitored host, put the value in a `0600` file and pass `--secret-string file://<path>` instead. The bundle’s `setup.sh` keeps secret values off process argv the same way, passing `0600` temporary files to `--cli-input-json`.
+
+Unlike the secrets, `gateway.yaml` itself contains no secret values, because every credential resolves at boot through [`${VAR}` or `${file:...}` expansion](</docs/en/claude-apps-gateway-config#secret-expansion>). How everything reaches the container differs by track:
+
+ * On ECS, the next step’s build copies `gateway.yaml` into the image at `/etc/claude/gateway.yaml`, and the task definition injects the three secrets as environment variables via its `secrets` field, so the YAML references `${GATEWAY_JWT_SECRET}`, `${OIDC_CLIENT_SECRET}`, and `${GATEWAY_POSTGRES_URL}`.
+ * On EKS, mount `gateway.yaml` from a ConfigMap and the secrets as files at `/secrets`, referenced as `${file:/secrets/...}`. Source the Kubernetes Secrets from Secrets Manager with External Secrets Operator or the Secrets Store CSI driver’s AWS provider, or create them directly with `kubectl`.
+
+6
+
+Build and push the image to Amazon ECR
+
+Build the image per the [container image requirements](</docs/en/claude-apps-gateway-deploy#container-image>), placing the `linux-x64` glibc binary at `./claude` in the build context. Write your own Dockerfile per those requirements or start from the bundle’s [`Dockerfile`](<https://github.com/anthropics/claude-code/blob/main/examples/gateway/aws/Dockerfile>), which copies the filled-in `gateway.yaml` from the previous steps into the image at `/etc/claude/gateway.yaml`. On ECS that embedded copy is how the configuration reaches the container, which is why the build comes after the file is written. The EKS track instead mounts `gateway.yaml` from a ConfigMap at deploy, so the embedded copy is unused there.The image also carries the AWS RDS certificate bundle as the trust anchor for the connection string’s `sslmode=verify-full`, so download it into the build context first. AWS rotates the bundle (new regional CAs get appended), so download it per build rather than pinning a checksum or committing it:
+
+ curl -fL --proto '=https' -o rds-global-bundle.pem \
+ https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem
+
+The container image requirements don’t cover the bundle, so if you write your own Dockerfile, add the two lines that copy and trust it; the bundle’s `Dockerfile` already includes both:
+
+ COPY rds-global-bundle.pem /etc/claude/rds-global-bundle.pem
+ ENV NODE_EXTRA_CA_CERTS=/etc/claude/rds-global-bundle.pem
+
+Create the ECR repository and sign Docker in to it. Immutable tags mean the `<version>` tag the deploy step pins cannot later be silently re-pointed at a different image:
+
+ aws ecr create-repository --repository-name claude-gateway \
+ --image-tag-mutability IMMUTABLE \
+ --image-scanning-configuration scanOnPush=true
+ aws ecr get-login-password --region "$AWS_REGION" \
+ | docker login --username AWS --password-stdin \
+ "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com"
+
+Build and push the image. The task definition below runs `linux/amd64`, so the platform must match here; for Fargate on ARM64 (Graviton), build `linux/arm64` with the `linux-arm64` binary and set `cpuArchitecture` to `ARM64` instead:
+
+ docker build --platform=linux/amd64 \
+ -t "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/claude-gateway:<version>" .
+ docker push "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/claude-gateway:<version>"
+
+7
+
+Deploy
+
+ * ECS Fargate
+
+ * EKS
+
+Create the cluster and a log group for the gateway’s stderr, which carries both its audit events and operational logs. Retention is a separate call, and without one CloudWatch keeps the logs forever; align the 90 days with your audit retention policy:
+
+ aws ecs create-cluster --cluster-name claude-gateway
+ aws logs create-log-group --log-group-name /ecs/claude-gateway
+ aws logs put-retention-policy --log-group-name /ecs/claude-gateway \
+ --retention-in-days 90
+
+Write the task definition. The task role carries the Bedrock permission and the execution role injects the secrets; use the secret ARNs from the Secrets Manager step:
+
+claude-gateway-task.json
+
+ {
+ "family": "claude-gateway",
+ "networkMode": "awsvpc",
+ "requiresCompatibilities": ["FARGATE"],
+ "cpu": "1024",
+ "memory": "2048",
+ "runtimePlatform": { "cpuArchitecture": "X86_64", "operatingSystemFamily": "LINUX" },
+ "executionRoleArn": "arn:aws:iam::<account-id>:role/claude-gateway-execution",
+ "taskRoleArn": "arn:aws:iam::<account-id>:role/claude-gateway-task",
+ "containerDefinitions": [
+ {
+ "name": "gateway",
+ "image": "<account-id>.dkr.ecr.<region>.amazonaws.com/claude-gateway:<version>",
+ "portMappings": [{ "containerPort": 8080 }],
+ "secrets": [
+ { "name": "GATEWAY_JWT_SECRET", "valueFrom": "<gateway-jwt-secret ARN>" },
+ { "name": "OIDC_CLIENT_SECRET", "valueFrom": "<gateway-oidc-client-secret ARN>" },
+ { "name": "GATEWAY_POSTGRES_URL", "valueFrom": "<gateway-postgres-url ARN>" }
+ ],
+ "logConfiguration": {
+ "logDriver": "awslogs",
+ "options": {
+ "awslogs-group": "/ecs/claude-gateway",
+ "awslogs-region": "<region>",
+ "awslogs-stream-prefix": "gateway"
+ }
+ }
+ }
+ ]
+ }
+
+Register it:
+
+ aws ecs register-task-definition --cli-input-json file://claude-gateway-task.json
+
+Put an internal ALB in front with a target group that health-checks the gateway. `--ip-address-type ipv4` matters: an internal dual-stack ALB publishes public-range AAAA records, which the `/login` private-network check rejects:
+
+ ALB_ARN="$(aws elbv2 create-load-balancer --name claude-gateway \
+ --scheme internal --type application --ip-address-type ipv4 \
+ --subnets $PRIVATE_SUBNETS --security-groups "$ALB_SG" \
+ --query 'LoadBalancers[0].LoadBalancerArn' --output text)"
+
+ TG_ARN="$(aws elbv2 create-target-group --name claude-gateway \
+ --protocol HTTP --port 8080 --vpc-id "$VPC_ID" --target-type ip \
+ --health-check-path /readyz \
+ --query 'TargetGroups[0].TargetGroupArn' --output text)"
+
+Add the HTTPS listener and raise the idle timeout. `--ssl-policy` pins a modern TLS floor, since omitting it falls back to the legacy `ELBSecurityPolicy-2016-08` default, which still accepts TLS 1.0/1.1. The idle timeout matters for streaming: the ALB closes a connection after 60 seconds with no data by default, which cuts off streams during quiet periods, such as long prompt processing before the first token:
+
+ aws elbv2 create-listener --load-balancer-arn "$ALB_ARN" \
+ --protocol HTTPS --port 443 \
+ --ssl-policy ELBSecurityPolicy-TLS13-1-2-2021-06 \
+ --certificates CertificateArn=<your-acm-certificate-arn> \
+ --default-actions Type=forward,TargetGroupArn="$TG_ARN"
+
+ aws elbv2 modify-load-balancer-attributes --load-balancer-arn "$ALB_ARN" \
+ --attributes Key=idle_timeout.timeout_seconds,Value=3600
+
+Create the service. The deployment circuit breaker rolls a deployment whose tasks keep failing, from a bad image or an unbootable config, back to the last steady state instead of relaunching failing tasks forever:
+
+ aws ecs create-service --cluster claude-gateway --service-name claude-gateway \
+ --task-definition claude-gateway --desired-count 1 --launch-type FARGATE \
+ --deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true}" \
+ --health-check-grace-period-seconds 60 \
+ --network-configuration "awsvpcConfiguration={subnets=[$(echo $PRIVATE_SUBNETS | tr ' ' ',')],securityGroups=[$GW_SG],assignPublicIp=DISABLED}" \
+ --load-balancers "targetGroupArn=$TG_ARN,containerName=gateway,containerPort=8080"
+
+The 60-second grace period gives a cold task time to pull the image, connect to the store, and answer its first health check before ECS starts counting failures against the deployment. The target group’s health check on `GET /readyz` verifies the store is reachable, so a task that can’t reach Postgres never enters rotation; see [Outage behavior](</docs/en/claude-apps-gateway-deploy#outage-behavior>) for the tradeoff and the `/healthz` alternative.The tasks run in private subnets with no public IP, so all egress (to Bedrock, your IdP, Secrets Manager, ECR, and CloudWatch Logs) goes through the NAT gateway. To keep Bedrock traffic off the public path, create a `bedrock-runtime` interface VPC endpoint and point the upstream’s `base_url` at it, as shown in the [Bedrock upstream reference](</docs/en/claude-apps-gateway-config#amazon-bedrock>); the IdP still needs internet egress.Finish by giving developers a privately resolvable hostname: in a Route 53 private hosted zone, alias the gateway’s internal DNS name to the ALB, and set `listen.public_url` to that hostname. The ALB’s own `*.elb.amazonaws.com` name resolves to private addresses on an internal ALB, but it can’t carry your ACM certificate, so use your own name.Update the OAuth client’s authorized redirect URI to `<public_url>/oauth/callback` before the first sign-in. After changing `public_url`, rebuild and push the image under a new tag, register a new task definition revision, and redeploy. On ECS the setting lives in the image’s embedded `gateway.yaml`, and the gateway builds its public origin only from that setting, ignoring `X-Forwarded-Host` and `X-Forwarded-Proto`. `X-Forwarded-For` is honored for client IPs only when `listen.trusted_proxies` is set.
+
+This track needs `kubectl` and `eksctl` installed locally, and an existing EKS cluster with an IAM OIDC provider and the AWS Load Balancer Controller installed. The cluster must be on `$VPC_ID` so pods can reach the RDS private endpoint, and the `claude-gateway-db` security group must admit the cluster’s pod or node security group in place of `$GW_SG`.On EKS the gateway gets its Bedrock credentials through IRSA rather than the ECS roles. The `ecs-tasks.amazonaws.com` trust policy from the IAM step does not apply here; IRSA needs a role whose trust policy federates on the cluster’s OIDC provider, scoped to `system:serviceaccount:claude-gateway:gateway`. `eksctl create iamserviceaccount` creates that role, attaches the policies, and annotates the Kubernetes service account with the role ARN in one step. Turn the two policy documents from the IAM step into managed policies it can attach:
+
+ BEDROCK_POLICY_ARN="$(aws iam create-policy --policy-name claude-gateway-bedrock-invoke \
+ --policy-document file://bedrock-invoke.json --query Policy.Arn --output text)"
+ SECRETS_POLICY_ARN="$(aws iam create-policy --policy-name claude-gateway-secrets-read \
+ --policy-document file://secrets-read.json --query Policy.Arn --output text)"
+
+ kubectl create namespace claude-gateway
+ eksctl create iamserviceaccount --cluster <your-cluster> --region "$AWS_REGION" \
+ --namespace claude-gateway --name gateway --role-name claude-gateway \
+ --attach-policy-arn "$BEDROCK_POLICY_ARN" \
+ --attach-policy-arn "$SECRETS_POLICY_ARN" \
+ --approve
+
+The secrets policy is needed only when the pods read Secrets Manager themselves, as the Secrets Store CSI driver’s AWS provider does using the mounting pod’s service account; drop it if you create the Kubernetes Secrets another way. The provider needs both of the policy’s actions: it calls `DescribeSecret` when it reconciles rotated secrets, so a `GetSecretValue`-only grant mounts on the first deploy but stops picking up rotations.Deploy the gateway as a standard Deployment plus a Service and an Ingress, as described in [Kubernetes deployment](</docs/en/claude-apps-gateway-deploy#kubernetes>), with:
+
+ * `serviceAccountName: gateway`
+ * `gateway.yaml` mounted from a ConfigMap and the secrets mounted at `/secrets`
+ * the readiness probe pointed at `GET /readyz`
+
+For the front end, an Ingress managed by the AWS Load Balancer Controller provisions the internal ALB. Annotate it with:
+
+ * `alb.ingress.kubernetes.io/scheme: internal` and `alb.ingress.kubernetes.io/target-type: ip`
+ * `alb.ingress.kubernetes.io/ip-address-type: ipv4`, so no public-range AAAA records are published for the `/login` [private-network check](</docs/en/claude-apps-gateway#prerequisites>) to reject
+ * `alb.ingress.kubernetes.io/inbound-cidrs: <your-corporate-cidr>`, so the controller-managed frontend security group admits only your corporate network in place of its `0.0.0.0/0` default
+ * `alb.ingress.kubernetes.io/certificate-arn` with the ACM certificate
+ * `alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS13-1-2-2021-06`, so the listener doesn’t fall back to the legacy default policy that accepts TLS 1.0 and 1.1
+ * `alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=3600`, so a 60-second data gap in a stream doesn’t close the connection
+
+With IRSA, the AWS SDK reads a projected service-account token and exchanges it with AWS STS, so the pod never needs the EC2 instance metadata service; an egress NetworkPolicy may block `169.254.169.254` for gateway pods. The node hop-limit problem in Troubleshooting below applies only to clusters that skip IRSA and rely on node instance roles.
+
+8
+
+Push the gateway URL to developer machines
+
+The gateway is now running, but developers can’t reach it from `/login` until the gateway URL is on their machines. Set `forceLoginMethod` and `forceLoginGatewayUrl` in the [managed settings file](</docs/en/claude-apps-gateway#set-the-gateway-url>) you deploy to each device via MDM. There is no gateway option in the login picker for a developer to select manually.
+
+##
+
+
+
+Terraform reference
+
+The companion bundle at [`examples/gateway/aws`](<https://github.com/anthropics/claude-code/tree/main/examples/gateway/aws>) packages this page as code:
+
+ * **`setup.sh`** scripts the provisioning walkthrough above with the same `aws` commands, on the ECS Fargate track. It is idempotent: existing resources are detected and skipped, so re-running it is safe, and any default can be overridden via environment variable. You still create the Okta OIDC client secret and the ACM certificate yourself: a run without them skips the ECS/ALB deploy, names the missing inputs, and prints the `create-secret` command; create both and re-run. The Bedrock use case form and the Route 53 alias print as next steps rather than running automatically, and the client MDM push stays a manual step from this page.
+ * **`gateway.yaml.example`** is the configuration template from the gateway.yaml step, with the optional keys included commented out. Copy it to `gateway.yaml` and replace every `REPLACE_ME` before building.
+ * **`Dockerfile`** builds the runtime image from the prebuilt `linux-x64` binary and copies in your filled-in `gateway.yaml` at `/etc/claude/gateway.yaml`, plus the AWS RDS certificate bundle that anchors the store’s `sslmode=verify-full`. `setup.sh` downloads the bundle only when it isn’t already in the build context; delete the file and rebuild under a new tag to pick up an AWS CA rotation. The config file holds no secret values, since every credential resolves at boot through `${VAR}` expansion. A config edit therefore means a rebuild under a new tag; `setup.sh` automates this by tagging images with a hash of the file.
+ * **`terraform/`** provisions the same ECS Fargate scope declaratively: the security groups, IAM roles, ECR repository, RDS instance, Secrets Manager secrets, and the ECS service behind the internal ALB. The VPC and private subnets stay prerequisites, passed in as variables. Terraform creates the ECR repository but doesn’t build the image, and the service definition references the image, so the apply is two passes: a targeted apply for the repository, then the build and push, then the full apply. The bundle’s `terraform/README.md` covers the variables, remote state, and teardown.
+
+Like this page, the bundle is a working example for customer-managed infrastructure rather than a supported production deployment; review and adapt it to your own environment before relying on it.
+
+##
+
+
+
+Troubleshooting
+
+For gateway boot and login errors, see the platform-agnostic [troubleshooting table](</docs/en/claude-apps-gateway-deploy#troubleshooting>). The entries below are specific to AWS.
+
+Symptom| Cause| Fix
+---|---|---
+CLI `/login`: `Gateway hosts must be on your organization's private network; <host> resolves to the public (or unrecognized) address <ip>`| The gateway name resolves to at least one public address. A dual-stack internal ALB publishes public-range AAAA records, and the [private-network check](</docs/en/claude-apps-gateway#prerequisites>) requires every resolved address to be private| Create the ALB with `--ip-address-type ipv4`, or serve a separate internal-only DNS name with no public AAAA record
+Every Bedrock request returns 502; log shows `Could not load credentials from any providers`| The task runs on the ECS EC2 launch type without a task role, or the pod runs on an EKS node without IRSA, so credentials come from instance metadata, which IMDSv2’s default hop limit of 1 stops inside a container. Neither track on this page is affected: Fargate task roles and IRSA don’t use instance metadata| Prefer task roles and IRSA. Where instance credentials are unavoidable, raise the hop limit with `aws ec2 modify-instance-metadata-options --instance-id <id> --http-put-response-hop-limit 2`; the [platform-agnostic table](</docs/en/claude-apps-gateway-deploy#troubleshooting>) covers the tradeoffs
+Bedrock requests return `403 AccessDeniedException`| The account hasn’t submitted Anthropic’s one-time use case form, the automatic AWS Marketplace subscription that starts on the account’s first invoke hasn’t finished yet, or the task role’s policy is missing the inference-profile or foundation-model ARNs| Submit the use case form from the Bedrock console’s Model catalog; if it was just submitted or this is the account’s first invoke, retry after a few minutes. Grant `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on both ARN families.
+Bedrock returns a `ValidationException` saying on-demand throughput isn’t supported| A custom `models:` entry maps to a bare foundation-model ID that the region serves only through inference profiles| Map the model to its cross-region inference profile ID (`us.anthropic.*`) instead; the built-in catalog already does this
+ECS task stops with `ResourceInitializationError` before the gateway logs anything| The execution role can’t read the Secrets Manager secrets, or the private subnets have no path to Secrets Manager or ECR| Grant `secretsmanager:GetSecretValue` on the three `gateway-` secrets’ ARNs to the execution role, and provide egress via the NAT gateway, or, without one, interface endpoints for Secrets Manager, ECR, and CloudWatch Logs, which the `awslogs` driver needs at the same stage, plus an S3 gateway endpoint
+Gateway boot exits with a Postgres connection-timeout error| The database security group doesn’t admit the gateway’s security group on 5432, or the service runs outside the database’s VPC; the store stops waiting after 5 seconds| Allow 5432 from the gateway’s security group on the database’s, and run the service in the same VPC as the DB subnet group
+Gateway boot exits with a Postgres TLS certificate verification error| The connection string sets `sslmode=verify-full` but the image doesn’t trust the RDS CA bundle: the bundle wasn’t copied into the image, or `NODE_EXTRA_CA_CERTS` doesn’t point at it| Add the build step’s two Dockerfile lines that copy the bundle and set `NODE_EXTRA_CA_CERTS`, then rebuild, push under a new tag, and redeploy
+Streaming responses drop mid-stream after a quiet period| The ALB idle timeout closes the connection after 60 seconds with no data by default. A stream that is actively emitting tokens isn’t affected; one that goes quiet, during long prompt processing before the first token or extended thinking with no streamed output, is cut at the gap| Set the `idle_timeout.timeout_seconds` attribute to `3600`, via `modify-load-balancer-attributes` or the `load-balancer-attributes` Ingress annotation on EKS
+
+##
+
+
+
+Telemetry
+
+The gateway gives you per-developer usage metrics without any per-machine OTEL configuration. Claude Code emits OpenTelemetry (OTLP) metrics, logs, and opt-in traces; [Monitoring usage](</docs/en/monitoring-usage>) covers everything the CLI reports. On gateway sessions the CLI stamps each export with the authenticated IdP identity attributes `user.id`, `user.email`, and `user.groups`, so usage rolls up per developer with no `OTEL_RESOURCE_ATTRIBUTES` plumbing. The gateway itself is an authenticated OTLP relay. Set [`telemetry.forward_to`](</docs/en/claude-apps-gateway-config#telemetry>) together with `listen.public_url`, and it pushes the OTEL exporter settings to every connected client and forwards their OTLP traffic verbatim to each destination you list. Each destination opts into metrics, logs, and traces independently, and the default is metrics only; see the [`telemetry` reference](</docs/en/claude-apps-gateway-config#telemetry>) for the per-signal fields and their sensitivity tradeoffs. The gateway doesn’t buffer, aggregate, or store telemetry, so where the data lands is entirely the collector’s exporter configuration. Client telemetry is off by default; configuring `telemetry.forward_to` is what turns it on for connected developers, and each interactive client shows a one-time security approval dialog for the pushed settings, as described in the [configuration reference](</docs/en/claude-apps-gateway-config#telemetry>). On AWS, each signal maps to a destination as follows.
+
+###
+
+
+
+Client metrics, logs, and traces
+
+Point `telemetry.forward_to` at an OpenTelemetry collector, such as the [AWS Distro for OpenTelemetry (ADOT) collector](<https://aws-otel.github.io/>), and export from there to Amazon CloudWatch, Amazon Managed Service for Prometheus, or any OTLP backend. Run the collector as its own internal service reachable over `https://`: the gateway accepts plaintext `http://` only for loopback URLs, and even then its [SSRF guard](</docs/en/claude-apps-gateway-deploy#threat-model-summary>) blocks loopback connections at send time by default. A sidecar collector on `http://localhost:4318` passes config validation but receives no traffic, with exports failing as `ECONNREFUSED_SSRF` in the gateway logs, unless `CLAUDE_GATEWAY_ALLOW_LOOPBACK=1` is set in the gateway’s environment. That variable relaxes the loopback block for every operator-configured URL, not only telemetry, so prefer the internal-service pattern and reserve the sidecar-plus-flag setup for tasks whose network is otherwise locked down.
+
+###
+
+
+
+Gateway logs
+
+On ECS Fargate, no extra setup: the `awslogs` driver delivers the gateway’s stderr, which carries its audit events and operational logs, to the `/ecs/claude-gateway` log group created above. On EKS, pod logs don’t reach CloudWatch by default, so the audit trail is lost until you install log collection: the Amazon CloudWatch Observability add-on with container log capture enabled, or a Fluent Bit DaemonSet. On either track, query the logs with CloudWatch Logs Insights and drive alarms from metric filters.
+
+###
+
+
+
+Container metrics
+
+Enable Container Insights on the cluster with `aws ecs update-cluster-settings --cluster claude-gateway --settings name=containerInsights,value=enabled` for per-task CPU, memory, and network. On EKS, install the Amazon CloudWatch Observability add-on.
+
+###
+
+
+
+Spend
+
+Telemetry shows usage after the fact; [spend limits](</docs/en/claude-apps-gateway-spend-limits>) are the gateway’s live per-developer view and enforcement on top of the shared upstream credential.
+
+##
+
+
+
+Next steps
+
+ * [Configuration reference](</docs/en/claude-apps-gateway-config>): every `gateway.yaml` option, including `managed.policies` and `telemetry`
+ * [Deployment and operations](</docs/en/claude-apps-gateway-deploy>): IdP setup, health checks, JWT secret rotation, upgrades, and the security model
+ * [Claude apps gateway overview](</docs/en/claude-apps-gateway>): quickstart and connecting developers
+ * [AWS samples for Claude apps gateway](<https://github.com/aws-samples/anthropic-on-aws/tree/main/claude-apps-gateway>): AWS-maintained deployment samples covering a range of customer environments
--- a/claude-apps-gateway-spend-limits.md
+++ b/claude-apps-gateway-spend-limits.md
@@ -45,7 +45,13 @@
How enforcement works
-On each `/v1/messages` request, the gateway resolves the developer’s caps and period-to-date spend in one Postgres query. If they’re over any cap, the request returns `429` with `error.type: billing_error` and the header `x-should-retry: false`. The message is `spend limit reached`, followed by your [`admin.blocked_message`](</docs/en/claude-apps-gateway-config#admin>) if set. `/v1/messages/count_tokens` is exempt. Token counting is free, so it runs regardless of cap state. After each response, a usage meter reads token counts off the response as it streams to the client, prices them at USD list price, and increments Postgres counters for all three period buckets. The meter is a single reader on the stream, so the client’s bytes are untouched and a metering failure doesn’t break the response. Spend limits estimate spend from token counts at USD list price; they’re a circuit breaker, not an invoice. For authoritative billing, reconcile against your provider’s own usage reporting, such as the Anthropic Usage & Cost Admin API, invocation logs on Amazon Bedrock, or Cloud Monitoring on Google Cloud. Pricing uses the same table the Claude Code CLI uses for its own cost display, with the same model-ID canonicalization across Anthropic, Amazon Bedrock (`us.anthropic.…-v1:0`), Google Cloud’s Agent Platform (`claude-…@date`), and Microsoft Foundry ID forms. A model ID the table can’t place, such as a Microsoft Foundry deployment name or an inference-profile ARN, is priced at the unknown-model default tier of $5/$25 per million input/output tokens rather than zero, so an unrecognized ID can’t bypass a cap by going unmetered. The gateway warns at boot and once per ID at runtime when a model prices through the fallback. Client aborts are billed too. The upstream reports output tokens only in the stream’s terminal frame, so an aborted stream doesn’t carry them. The meter keeps a conservative floor estimate from the streamed content size, about four characters per token, and bills it when and only when the terminal usage frame is missing. A complete stream always bills the upstream-reported count. Without this, a capped developer could stream output and abort each request immediately before the end, spending without ever being counted.
+On each `/v1/messages` request, the gateway resolves the developer’s caps and period-to-date spend in one Postgres query. If they’re over any cap, the request returns `429` with `error.type: billing_error` and the header `x-should-retry: false`. The message is `spend limit reached`, followed by your [`admin.blocked_message`](</docs/en/claude-apps-gateway-config#admin>) if set. `/v1/messages/count_tokens` is exempt. Token counting is free, so it runs regardless of cap state. After each response, a usage meter reads token counts off the response as it streams to the client, prices them at USD list price, and increments Postgres counters for all three period buckets. The meter is a single reader on the stream, so the client’s bytes are untouched and a metering failure doesn’t break the response. Spend limits estimate spend from token counts at USD list price; they’re a circuit breaker, not an invoice. For authoritative billing, reconcile against your provider’s own usage reporting, such as the Anthropic Usage & Cost Admin API, invocation logs on Amazon Bedrock, or Cloud Monitoring on Google Cloud. Pricing uses the same table the Claude Code CLI uses for its own cost display, with the same model-ID canonicalization across Anthropic, Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry ID forms, such as Bedrock’s `us.anthropic.…-v1:0` and Agent Platform’s `claude-…@date`. The meter resolves each request’s rate tier in order:
+
+ 1. Exact rates for the upstream model ID, the model string the gateway sends to the provider. When the table recognizes it, such as `us.anthropic.claude-…`, the meter prices the request by the model that served it.
+ 2. Rates for the configured [`models[].id`](</docs/en/claude-apps-gateway-config#models>) you mapped to the upstream ID. This step covers upstream strings that carry no model name, such as an Amazon Bedrock application-inference-profile ARN or a Microsoft Foundry deployment name, and requires Claude Code v2.1.218 or later on the gateway server.
+ 3. The unknown-model default tier of $5/$25 per million input/output tokens. The meter prices an ID that neither the table nor your `models` config can place, including a `models[].id` that is itself a custom alias, at this tier rather than zero, so an unrecognized ID can’t bypass a cap by going unmetered.
+
+The gateway warns at boot and once per ID at runtime when it prices a model at the unknown-model tier. Before v2.1.218, the meter skipped step 2: it priced any upstream ID the table couldn’t place at the unknown-model tier and warned about it even when the configured ID’s rates were known. Client aborts are billed too. The upstream reports output tokens only in the stream’s terminal frame, so an aborted stream doesn’t carry them. The meter keeps a conservative floor estimate from the streamed content size, about four characters per token, and bills it when and only when the terminal usage frame is missing. A complete stream always bills the upstream-reported count. Without this, a capped developer could stream output and abort each request immediately before the end, spending without ever being counted.
###
Show diff (681 lines)
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -4,12 +4,10 @@
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.
-This page covers:
-
+This page covers the web product itself:
+
+ * Cloud environments: where sessions run, and where to configure that
* GitHub authentication options: two ways to connect GitHub
- * The cloud environment: what config carries over, what tools are installed, and how to configure environments
- * Setup scripts and dependency management
- * Network access: levels, proxies, and the default allowlist
* Move tasks between web and terminal with `--cloud` and `--teleport`
* Work with sessions: reviewing, sharing, archiving, deleting
* Auto-fix pull requests: respond automatically to CI failures and review comments
@@ -20,6 +18,14 @@
+Cloud environments
+
+Every cloud session runs in a [cloud environment](</docs/en/cloud-environments>), the saved configuration that controls network access, environment variables, and setup scripts. When you onboard, Claude Code sets up a **Default** environment with [**Trusted** network access](</docs/en/cloud-environments#access-levels>). See [The Default environment](</docs/en/cloud-environments#the-default-environment>) for how it’s created and how sessions choose an environment when you have more than one. The same environments apply wherever you start a cloud session: the web, the terminal, [Claude Tag](<https://claude.com/docs/claude-tag/overview>), [routines](</docs/en/routines>), and the mobile and Desktop apps. Claude Tag channel sessions use [organization-shared environments](</docs/en/cloud-environments#organization-shared-environments>) only. See [Configure cloud environments](</docs/en/cloud-environments>) to change what an environment allows, set variables, or add a setup script, and [Installed tools](</docs/en/cloud-environments#installed-tools>) for what sessions include without any configuration.
+
+##
+
+
+
GitHub authentication options
Cloud sessions need access to your GitHub repositories to clone code and push branches. You can grant access in two ways:
@@ -39,579 +45,6 @@
-The cloud environment
-
-Each session runs in a fresh Anthropic-managed VM with your repository cloned. This section covers what’s available when a session starts and how to customize it.
-
-###
-
-
-
-What’s available in cloud sessions
-
-Cloud sessions start from a fresh clone of your repository. Anything committed to the repo is available. Anything you’ve installed or configured only on your own machine isn’t available in the session. Your organization’s policy arrives separately through [server-managed settings](</docs/en/server-managed-settings>).
-
-| Available in cloud sessions| Why
----|---|---
-Your repo’s `CLAUDE.md`| Yes| Part of the clone
-Your repo’s `.claude/settings.json` hooks| Yes| Part of the clone
-Your repo’s `.mcp.json` MCP servers| Yes| Part of the clone
-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 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. Skills you enable on claude.ai are loaded into cloud sessions automatically
-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
-MCP servers you added with `claude mcp add`| No| Those write to your local user config, not the repo. Declare the server in [`.mcp.json`](</docs/en/mcp#project-scope>) instead
-Transport variables in your repo’s `.claude/settings.json` `env` block, such as `NODE_EXTRA_CA_CERTS` and the [mTLS client certificate variables](</docs/en/network-config#mtls-authentication>)| No| The hosting environment manages the session’s API connection, so Claude Code ignores these keys and notes each ignored key in the session’s debug log
-Static API tokens and credentials| No| No dedicated secrets store exists yet. See below
-Interactive auth like AWS SSO| No| Not supported. SSO requires browser-based login that can’t run in a cloud session
-
-To make your own configuration available in cloud sessions, commit it to the repo; organization policy arrives separately through [server-managed settings](</docs/en/server-managed-settings>). A dedicated secrets store is not yet available. Both environment variables and setup scripts are stored in the environment configuration, visible to anyone who can edit that environment. If you need secrets in a cloud session, add them as environment variables with that visibility in mind.
-
-###
-
-
-
-Installed tools
-
-Cloud sessions come with common language runtimes, build tools, and databases pre-installed. The table below summarizes what’s included by category.
-
-Category| Included
----|---
-**Python**| Python 3.x with pip, poetry, uv, black, mypy, pytest, ruff
-**Node.js**| 20, 21, and 22 via nvm, with npm, yarn, pnpm, bun¹, eslint, prettier, chromedriver
-**Ruby**| 3.1, 3.2, 3.3 with gem, bundler, rbenv
-**PHP**| 8.4 with Composer
-**Java**| OpenJDK 21 with Maven and Gradle
-**Go**| latest stable with module support
-**Rust**| rustc and cargo
-**C/C++**| GCC, Clang, cmake, ninja, conan
-**Docker**| docker, dockerd, docker compose
-**Databases**| PostgreSQL 16, Redis 7.0
-**Utilities**| git, jq, yq, ripgrep, tmux, vim, nano
-
-¹ Bun is installed but has known proxy compatibility issues for package fetching. For exact versions, ask Claude to run `check-tools` in a cloud session. This command only exists in cloud sessions.
-
-###
-
-
-
-Work with GitHub issues and pull requests
-
-Cloud sessions include built-in GitHub tools that let Claude read issues, list pull requests, fetch diffs, and post comments without any setup. These tools authenticate through the GitHub proxy using whichever method you configured under GitHub authentication options, so your token never enters the container. You can set `GH_TOKEN` or `GITHUB_TOKEN` yourself in environment settings, or leave both unset and let the GitHub proxy authenticate for you:
-
- * If you set a token, it passes through to the container unchanged, so `gh` and your scripts use it directly.
- * If you set neither, the container sets both variables to the placeholder string `proxy-injected` and the proxy substitutes your real credentials on outbound GitHub requests. `gh` works without a token of your own, but a script that reads `GITHUB_TOKEN` directly gets the placeholder, not a usable token.
-
-To check which case applies to your session, ask Claude to run `echo $GH_TOKEN`. The `gh` CLI isn’t pre-installed. If you need a `gh` command the built-in tools don’t cover, like `gh release` or `gh workflow run`, install and authenticate it yourself:
-
-1
-
-Install gh in your setup script
-
-Add `apt update && apt install -y gh` to your setup script.
-
-2
-
-Provide a token if the proxy is not handling authentication
-
-If `echo $GH_TOKEN` prints `proxy-injected`, the GitHub proxy authenticates `gh` for you and this step is unnecessary. Otherwise, add a `GH_TOKEN` environment variable to your environment settings with a GitHub personal access token. `gh` reads `GH_TOKEN` automatically, so no `gh auth login` step is needed.
-
-###
-
-
-
-Link output back to the session
-
-Each cloud session has a transcript URL on claude.ai, and the session can read its own ID from the `CLAUDE_CODE_REMOTE_SESSION_ID` environment variable. Use this to put a traceable link in PR bodies, commit messages, Slack posts, or generated reports so a reviewer can open the run that produced them. As of v2.1.179, commits that Claude creates in a web session include a `Claude-Session: <url>` git trailer, and PR bodies include the session URL on its own line. From v2.1.182, set [`attribution.sessionUrl`](</docs/en/settings#attribution-settings>) to `false` to omit the trailer and the PR-body link. To include the session link in something other than a commit or PR, such as a Slack message Claude posts or a report file it writes, have Claude run the following command and use its output. The command converts the `cse_` prefix in the environment variable’s value to the `session_` prefix that the transcript URL expects:
-
- echo "https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID/#cse_/session_}"
-
-###
-
-
-
-Run tests, start services, and add packages
-
-Claude runs tests as part of working on a task. Ask for it in your prompt, like “fix the failing tests in `tests/`” or “run pytest after each change.” Test runners like pytest, jest, and cargo test are pre-installed and work without additional setup. PostgreSQL and Redis are pre-installed but not running by default. Ask Claude to start each one during the session:
-
- service postgresql start
-
- service redis-server start
-
-Docker is available for running containerized services. Ask Claude to run `docker compose up` to start your project’s services. Network access to pull images follows your environment’s access level, and the Trusted defaults include Docker Hub and other common registries. If your images are large or slow to pull, add `docker compose pull` or `docker compose build` to your setup script. The pulled images are saved in the cached environment, so each new session has them on disk. The cache stores files only, not running processes, so Claude still starts the containers each session. To add packages that aren’t pre-installed, use a setup script. The script’s output is cached, so packages you install there are available at the start of every session without reinstalling each time. You can also ask Claude to install packages mid-session, but those installs don’t carry over to other sessions.
-
-###
-
-
-
-Resource limits
-
-Cloud sessions run with approximate resource ceilings that may change over time:
-
- * 4 vCPUs
- * 16 GB of RAM
- * 30 GB of disk
-
-Tasks requiring significantly more memory, such as large build jobs or memory-intensive tests, may fail or be terminated. For workloads beyond these limits, use [Remote Control](</docs/en/remote-control>) to run Claude Code on your own hardware.
-
-###
-
-
-
-Configure your environment
-
-Environments control network access, environment variables, and the setup script that runs before a session starts. See Installed tools for what’s available without any configuration. You can manage environments from the web interface or the terminal:
-
-Action| How
----|---
-Add an environment| Select the current environment to open the selector, then select **Add environment**. The dialog includes name, network access level, environment variables, and setup script.
-Edit an environment| Select the cloud icon showing the current environment’s name to open the selector, hover over an environment, and click the settings icon that appears on the right.
-Archive an environment| Open the environment for editing and select **Archive**. Archived environments are hidden from the selector but existing sessions keep running.
-Set the default environment for CLI cloud sessions| Run `/remote-env` in your terminal. If you have a single environment, this command shows your current configuration. `/remote-env` only selects the default; add, edit, and archive environments from the web interface.
-
-Environment variables use `.env` format with one `KEY=value` pair per line. Don’t wrap values in quotes, since quotes are stored as part of the value. This example defines three variables:
-
- NODE_ENV=development
- LOG_LEVEL=debug
- DATABASE_URL=postgres://localhost:5432/myapp
-
-###
-
-
-
-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. Manage shared environments from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). From there you can:
-
- * Create, edit, and archive shared environments. Each one has the same fields as a personal environment: a name, a network access level, environment variables in `.env` format, and a setup script.
- * Set the default environment for the organization.
-
-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.
-
-##
-
-
-
-Setup scripts
-
-A setup script is a Bash script that runs when a new cloud session starts, before Claude Code launches. Use setup scripts to install dependencies, configure tools, or fetch anything the session needs that isn’t pre-installed. Scripts run as root on Ubuntu 24.04, so `apt install` and most language package managers work. To add a setup script, open the environment settings dialog and enter your script in the **Setup script** field. This example installs the `gh` CLI, which isn’t pre-installed:
-
- #!/bin/bash
- apt update && apt install -y gh
-
-If the script exits non-zero, the session fails to start. Append `|| true` to non-critical commands to avoid blocking the session on an intermittent install failure. Keep the script’s total runtime under roughly five minutes so the environment cache can build. Run independent installs in parallel with `&` and `wait`. If a single download won’t fit in the five-minute limit, move it to a SessionStart hook that launches it in the background.
-
-Setup scripts that install packages need network access to reach registries. The default **Trusted** network access allows connections to common package registries including npm, PyPI, RubyGems, and crates.io. Scripts fail to install packages if your environment uses **None** network access.
-
-###
-
-
-
-Environment caching
-
-The setup script runs the first time you start a session in an environment. After it completes, Anthropic snapshots the filesystem and reuses that snapshot as the starting point for later sessions. New sessions start with your dependencies, tools, and Docker images already on disk, and the setup script step is skipped. This keeps startup fast even when the script installs large toolchains or pulls container images. The cache captures files, not running processes. Anything the setup script writes to disk carries over. Services or containers it starts don’t, so start those per session by asking Claude or with a SessionStart hook. The setup script runs again to rebuild the cache when you change the environment’s setup script or allowed network hosts, and when the cache reaches its expiry after roughly seven days. Resuming an existing session never re-runs the setup script. You don’t need to enable caching or manage snapshots yourself.
-
-###
-
-
-
-Setup scripts vs. SessionStart hooks
-
-Use a setup script to install things the cloud needs but your laptop already has, like a language runtime or CLI tool. Use a [SessionStart hook](</docs/en/hooks#sessionstart>) for project setup that should run everywhere, cloud and local, like `npm install`. Both run at the start of a session, but they belong to different places:
-
-| Setup scripts| SessionStart hooks
----|---|---
-Attached to| The cloud environment| Your repository
-Configured in| Cloud environment UI| `.claude/settings.json` in your repo
-Runs| Before Claude Code launches, when no cached environment is available| After Claude Code launches, on every session including resumed
-Scope| Cloud environments only| Both local and cloud
-
-SessionStart hooks can also be defined in your user-level `~/.claude/settings.json` locally, but user-level settings don’t carry over to cloud sessions. In the cloud, hooks come from the repo and from your organization’s [server-managed settings](</docs/en/server-managed-settings>).
-
-###
-
-
-
-Install dependencies with a SessionStart hook
-
-To install dependencies only in cloud sessions, add a SessionStart hook to your repo’s `.claude/settings.json`:
-
- {
- "hooks": {
- "SessionStart": [
- {
- "matcher": "startup|resume",
- "hooks": [
- {
- "type": "command",
- "command": "\"$CLAUDE_PROJECT_DIR\"/scripts/install_pkgs.sh"
- }
- ]
- }
- ]
- }
- }
-
-Create the script at `scripts/install_pkgs.sh`. The `CLAUDE_CODE_REMOTE` environment variable is set to `true` in cloud sessions, so you can use it to skip local execution:
-
- #!/bin/bash
-
- if [ "$CLAUDE_CODE_REMOTE" != "true" ]; then
- exit 0
- fi
-
- npm install
- pip install -r requirements.txt
- exit 0
-
-Then make the script executable:
-
- chmod +x scripts/install_pkgs.sh
-
-SessionStart hooks have some limitations in cloud sessions:
-
- * **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.
- * **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. Replacing the base image with your own Docker image is not yet supported. Use a setup script to install what you need on top of the provided image, or run your image as a container alongside Claude with `docker compose`.
-
-##
-
-
-
-Network access
-
-Network access controls outbound connections from the cloud environment. Each environment specifies one access level, and you can extend it with custom allowed domains. The default is **Trusted** , which allows package registries and other allowlisted domains. To change an environment’s network access, open it for editing and use the **Network access** selector in the dialog. There is no separate Environments page. The cloud icon appears wherever you start a cloud session or configure a [routine](</docs/en/routines#environments-and-network-access>).
-
-MCP connector traffic is routed through Anthropic’s servers, so the connectors you enable on a session or routine work without adding their hosts to **Allowed domains**. Connectors are configured per session or per routine; remove any you don’t need to limit which tools Claude can reach. This relies on the same Anthropic-bound channel noted under Security and isolation.
-
-###
-
-
-
-Access levels
-
-Choose an access level when you create or edit an environment:
-
-Level| Outbound connections
----|---
-**None**| No outbound network access
-**Trusted**| Allowlisted domains only: package registries, GitHub, cloud SDKs
-**Full**| Any domain
-**Custom**| Your own allowlist, optionally including the defaults
-
-GitHub operations use a separate proxy that is independent of this setting.
-
-###
-
-
-
-Allow specific domains
-
-To allow domains that aren’t in the Trusted list, select **Custom** in the environment’s network access settings. An **Allowed domains** field appears. Enter one domain per line:
-
- api.example.com
- *.internal.example.com
- registry.example.com
-
-Use `*.` for wildcard subdomain matching. Check **Also include default list of common package managers** to keep the Trusted domains alongside your custom entries, or leave it unchecked to allow only what you list. Allowed domains are configured per environment. There’s no organization-level allowlist that Owners can push to all users’ environments; [server-managed settings](</docs/en/server-managed-settings>) can restrict cloud sessions but can’t add allowed domains.
-
-###
-
-
-
-GitHub proxy
-
-For security, all GitHub operations go through a dedicated proxy service that keeps your real GitHub credentials outside the sandbox. The proxy authenticates two kinds of traffic:
-
- * Git interactions: the git client inside the sandbox uses a custom-built scoped credential, which the proxy verifies and translates to your actual GitHub authentication token
- * GitHub API requests: the proxy substitutes your real credentials on requests from the built-in GitHub tools, and from `gh` when your session sets the `proxy-injected` placeholder described in Work with GitHub issues and pull requests
-
-The proxy also restricts git push operations to the current working branch for safety, and enables cloning, fetching, and PR operations while maintaining security boundaries. The proxy limits GitHub API and release-asset requests to repositories attached to the session, regardless of the environment’s network access level. Setup scripts that download release assets from unattached repositories return a 403. Committed files from public repositories are fetched through `raw.githubusercontent.com`, which the security proxy handles instead. That domain is in the default Trusted list, so the files stay reachable unless the environment’s access level excludes it.
-
-###
-
-
-
-Security proxy
-
-Environments run behind an HTTP/HTTPS network proxy for security and abuse prevention purposes. All outbound internet traffic passes through this proxy, which provides:
-
- * Protection against malicious requests
- * Rate limiting and abuse prevention
- * Content filtering for enhanced security
- * A DNS-level audit trail of requested hostnames
-
-###
-
-
-
-Default allowed domains
-
-When using **Trusted** network access, the following domains are allowed by default. Domains marked with `*` indicate wildcard subdomain matching, so `*.gcr.io` allows any subdomain of `gcr.io`.
-
-Anthropic services
-
- * api.anthropic.com
- * statsig.anthropic.com
- * docs.claude.com
- * platform.claude.com
- * code.claude.com
- * claude.ai
-
-Version control
-
- * github.com
- * [www.github.com](<http://www.github.com>)
- * api.github.com
- * npm.pkg.github.com
- * raw.githubusercontent.com
- * pkg-npm.githubusercontent.com
- * objects.githubusercontent.com
- * release-assets.githubusercontent.com
- * codeload.github.com
- * avatars.githubusercontent.com
- * camo.githubusercontent.com
- * gist.github.com
- * gitlab.com
- * [www.gitlab.com](<http://www.gitlab.com>)
- * registry.gitlab.com
- * bitbucket.org
- * [www.bitbucket.org](<http://www.bitbucket.org>)
- * api.bitbucket.org
-
-Container registries
-
- * registry-1.docker.io
- * auth.docker.io
- * index.docker.io
- * hub.docker.com
- * [www.docker.com](<http://www.docker.com>)
- * production.cloudflare.docker.com
- * download.docker.com
- * gcr.io
- * *.gcr.io
- * ghcr.io
- * mcr.microsoft.com
- * *.data.mcr.microsoft.com
- * public.ecr.aws
-
-Cloud platforms
-
- * cloud.google.com
- * accounts.google.com
- * gcloud.google.com
- * *.googleapis.com
- * storage.googleapis.com
- * compute.googleapis.com
- * container.googleapis.com
- * azure.com
- * portal.azure.com
- * microsoft.com
- * [www.microsoft.com](<http://www.microsoft.com>)
- * *.microsoftonline.com
- * packages.microsoft.com
- * dotnet.microsoft.com
- * dot.net
- * visualstudio.com
- * dev.azure.com
- * *.amazonaws.com
- * *.api.aws
- * oracle.com
- * [www.oracle.com](<http://www.oracle.com>)
- * java.com
- * [www.java.com](<http://www.java.com>)
- * java.net
- * [www.java.net](<http://www.java.net>)
- * download.oracle.com
- * yum.oracle.com
-
-JavaScript and Node package managers
-
- * registry.npmjs.org
- * [www.npmjs.com](<http://www.npmjs.com>)
- * [www.npmjs.org](<http://www.npmjs.org>)
- * npmjs.com
- * npmjs.org
- * yarnpkg.com
- * registry.yarnpkg.com
-
-Python package managers
-
- * pypi.org
- * [www.pypi.org](<http://www.pypi.org>)
- * files.pythonhosted.org
- * pythonhosted.org
- * test.pypi.org
- * pypi.python.org
- * pypa.io
- * [www.pypa.io](<http://www.pypa.io>)
-
-Ruby package managers
-
- * rubygems.org
- * [www.rubygems.org](<http://www.rubygems.org>)
- * api.rubygems.org
- * index.rubygems.org
- * ruby-lang.org
- * [www.ruby-lang.org](<http://www.ruby-lang.org>)
- * rubyforge.org
- * [www.rubyforge.org](<http://www.rubyforge.org>)
- * rubyonrails.org
- * [www.rubyonrails.org](<http://www.rubyonrails.org>)
- * rvm.io
- * get.rvm.io
-
-Rust package managers
-
- * crates.io
- * [www.crates.io](<http://www.crates.io>)
- * index.crates.io
- * static.crates.io
- * rustup.rs
- * static.rust-lang.org
- * [www.rust-lang.org](<http://www.rust-lang.org>)
-
-Go package managers
-
- * proxy.golang.org
- * sum.golang.org
- * index.golang.org
- * golang.org
- * [www.golang.org](<http://www.golang.org>)
- * goproxy.io
- * pkg.go.dev
-
-JVM package managers
-
- * maven.org
- * repo.maven.org
- * central.maven.org
- * repo1.maven.org
- * repo.maven.apache.org
- * jcenter.bintray.com
- * gradle.org
- * [www.gradle.org](<http://www.gradle.org>)
- * services.gradle.org
- * plugins.gradle.org
- * kotlinlang.org
- * [www.kotlinlang.org](<http://www.kotlinlang.org>)
- * spring.io
- * repo.spring.io
-
-Other package managers
-
- * packagist.org (PHP Composer)
- * [www.packagist.org](<http://www.packagist.org>)
- * repo.packagist.org
- * nuget.org (.NET NuGet)
- * [www.nuget.org](<http://www.nuget.org>)
- * api.nuget.org
- * pub.dev (Dart/Flutter)
- * api.pub.dev
- * hex.pm (Elixir/Erlang)
- * [www.hex.pm](<http://www.hex.pm>)
- * cpan.org (Perl CPAN)
- * [www.cpan.org](<http://www.cpan.org>)
- * metacpan.org
- * [www.metacpan.org](<http://www.metacpan.org>)
- * api.metacpan.org
- * cocoapods.org (iOS/macOS)
- * [www.cocoapods.org](<http://www.cocoapods.org>)
- * cdn.cocoapods.org
- * haskell.org
- * [www.haskell.org](<http://www.haskell.org>)
- * hackage.haskell.org
- * swift.org
- * [www.swift.org](<http://www.swift.org>)
-
-Linux distributions
-
- * archive.ubuntu.com
- * security.ubuntu.com
- * ubuntu.com
- * [www.ubuntu.com](<http://www.ubuntu.com>)
- * *.ubuntu.com
- * ppa.launchpad.net
- * launchpad.net
- * [www.launchpad.net](<http://www.launchpad.net>)
- * *.nixos.org
-
-Development tools and platforms
-
- * dl.k8s.io (Kubernetes)
- * pkgs.k8s.io
- * k8s.io
- * [www.k8s.io](<http://www.k8s.io>)
- * releases.hashicorp.com (HashiCorp)
- * apt.releases.hashicorp.com
- * rpm.releases.hashicorp.com
- * archive.releases.hashicorp.com
- * hashicorp.com
- * [www.hashicorp.com](<http://www.hashicorp.com>)
- * repo.anaconda.com (Anaconda/Conda)
- * conda.anaconda.org
- * anaconda.org
- * [www.anaconda.com](<http://www.anaconda.com>)
- * anaconda.com
- * continuum.io
- * apache.org (Apache)
- * [www.apache.org](<http://www.apache.org>)
- * archive.apache.org
- * downloads.apache.org
- * eclipse.org (Eclipse)
- * [www.eclipse.org](<http://www.eclipse.org>)
- * download.eclipse.org
- * nodejs.org (Node.js)
- * [www.nodejs.org](<http://www.nodejs.org>)
- * developer.apple.com
- * developer.android.com
- * pkg.stainless.com
- * binaries.prisma.sh
-
-Cloud services and monitoring
-
- * statsig.com
- * [www.statsig.com](<http://www.statsig.com>)
- * api.statsig.com
- * sentry.io
- * *.sentry.io
- * downloads.sentry-cdn.com
- * http-intake.logs.datadoghq.com
- * browser-intake-us5-datadoghq.com
- * *.datadoghq.com
- * *.datadoghq.eu
- * api.honeycomb.io
-
-Content delivery and mirrors
-
- * sourceforge.net
- * *.sourceforge.net
- * packagecloud.io
- * *.packagecloud.io
- * fonts.googleapis.com
- * fonts.gstatic.com
-
-Schema and configuration
-
- * json-schema.org
- * [www.json-schema.org](<http://www.json-schema.org>)
- * json.schemastore.org
- * [www.schemastore.org](<http://www.schemastore.org>)
-
-Model Context Protocol
-
- * *.modelcontextprotocol.io
-
-##
-
-
-
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.
@@ -628,7 +61,7 @@
claude --cloud "Fix the authentication bug in src/auth/login.ts"
-This creates a new cloud session on claude.ai. The session clones your current directory’s GitHub remote at your current branch, so push first if you have local commits, since the VM clones from GitHub rather than your machine. `--cloud` works with a single repository at a time. The task runs in the cloud while you continue working locally. The older `--remote` spelling still works as a deprecated alias for `--cloud`. As of v2.1.195, the CLI shows a live checklist of setup steps, such as cloning the repository and running your setup script, while the cloud container starts. Messages you type while the container is provisioning are queued and sent once the session is ready.
+This creates a new cloud session on claude.ai. The session clones your current directory’s GitHub remote at your current branch, so push first if you have local commits, since the VM clones from GitHub rather than your machine. `--cloud` works with a single repository at a time. The task runs in the cloud while you continue working locally. The older `--remote` spelling still works as a deprecated alias for `--cloud`. As of v2.1.195, the CLI shows a live checklist of setup steps, such as cloning the repository and running your [setup script](</docs/en/cloud-environments#setup-scripts>), while the cloud container starts. Messages you type while the container is provisioning are queued and sent once the session is ready.
`--cloud` creates cloud sessions. `--remote-control` is unrelated: it exposes a local CLI session for monitoring from the web. See [Remote Control](</docs/en/remote-control>).
@@ -728,7 +161,7 @@
Cloud sessions support [built-in commands](</docs/en/commands>) that produce text output. Commands that only run in the terminal interface, such as `/plugin` or `/resume`, aren’t available. Commands that open a picker or panel in the terminal behave differently in cloud sessions:
* **`/model`, `/effort`, `/fast`, `/color`, and `/rename`**: pass the value as an argument, for example `/model sonnet`, instead of opening the terminal picker or slider. The argument forms require Claude Code v2.1.205 or later in the session’s environment and follow each command’s [availability notes](</docs/en/commands#all-commands>): `/effort` reports `Not applied` while a model’s [launch-default effort hold](</docs/en/model-config#adjust-effort-level>) is in force, and `/fast` works only in a session that started with fast mode turned on.
- * **`/config`** : on the web, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change settings for a cloud session, use environment variables or commit [settings files](</docs/en/settings>) to the repository.
+ * **`/config`** : on the web, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change settings for a cloud session, use [environment variables](</docs/en/cloud-environments#set-environment-variables>) or commit [settings files](</docs/en/settings>) to the repository.
For context management specifically:
@@ -738,7 +171,7 @@
`/context`| Yes| Shows what’s currently in the context window
`/clear`| No| Start a new session from the sidebar instead
-Auto-compaction runs automatically when the context window approaches capacity. To trigger it earlier, set [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/env-vars>) in your environment variables. For example, `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70` compacts at 70% capacity instead of waiting until the window is nearly full. To change the effective window size for compaction calculations, use [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>). [Subagents](</docs/en/sub-agents>) work the same way they do locally. Claude can spawn them with the Task tool to offload research or parallel work into a separate context window, keeping the main conversation lighter. Subagents defined in your repo’s `.claude/agents/` are picked up automatically. [Agent teams](</docs/en/agent-teams>) are off by default but can be enabled by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to your environment variables.
+Auto-compaction runs automatically when the context window approaches capacity. To trigger it earlier, set [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](</docs/en/env-vars>) in your [environment variables](</docs/en/cloud-environments#set-environment-variables>). For example, `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70` compacts at 70% capacity instead of waiting until the window is nearly full. To change the effective window size for compaction calculations, use [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>). [Subagents](</docs/en/sub-agents>) work the same way they do locally. Claude can spawn them with the Task tool to offload research or parallel work into a separate context window, keeping the main conversation lighter. Subagents defined in your repo’s `.claude/agents/` are picked up automatically. [Agent teams](</docs/en/agent-teams>) are off by default but can be enabled by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to your [environment variables](</docs/en/cloud-environments#set-environment-variables>).
###
@@ -801,7 +234,7 @@
Claude can watch a pull request and automatically respond to CI failures and review comments. Claude subscribes to GitHub activity on the PR, and when a check fails or a reviewer leaves a comment, Claude investigates and pushes a fix if one is clear.
-Auto-fix requires the Claude GitHub App to be installed on your repository. If you haven’t already, install it from the [GitHub App page](<https://github.com/apps/claude>) or when prompted during [setup](</docs/en/web-quickstart#connect-github-and-create-an-environment>).
+Auto-fix requires the Claude GitHub App to be installed on your repository. If you haven’t already, install it from the [GitHub App page](<https://github.com/apps/claude>) or when prompted during [setup](</docs/en/web-quickstart#connect-github>).
There are a few ways to turn on auto-fix depending on where the PR came from and what device you’re using:
@@ -855,7 +288,7 @@
Session creation failed
-If a new session fails to start with `Session creation failed` or stalls at provisioning, Claude Code could not allocate a cloud environment.
+If a new session fails to start with `Session creation failed` or stalls at provisioning, Claude Code could not allocate a VM for the session.
* Check [status.claude.com](<https://status.claude.com>) for cloud session incidents
* Retry after a minute, as capacity is provisioned on demand
@@ -887,7 +320,7 @@
Environment expired
-Cloud sessions stop after a period of inactivity and the underlying environment is reclaimed. From a local terminal, this surfaces as `Could not resume session ... its environment has expired. Creating a fresh session instead.` On the web, the session is marked expired in the session list. Reopen the session from [claude.ai/code](<https://claude.ai/code>) to provision a fresh environment with your conversation history restored.
+Cloud sessions stop after a period of inactivity and the session’s VM is reclaimed. On the web, the session is marked expired in the session list. Reopen the session from [claude.ai/code](<https://claude.ai/code>) to provision a fresh VM with your conversation history restored.
##
@@ -908,6 +341,7 @@
Related resources
+ * [Cloud environments](</docs/en/cloud-environments>): configure network access, environment variables, and setup scripts for cloud sessions
* [Ultraplan](</docs/en/ultraplan>): draft a plan in a cloud session and review it in your browser
* [Ultrareview](</docs/en/ultrareview>): run a deep multi-agent code review in a cloud sandbox
* [Routines](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events
@@ -915,4 +349,4 @@
* [Settings reference](</docs/en/settings>): all configuration options
* [Security](</docs/en/security>): isolation guarantees and data handling
* [Data usage](</docs/en/data-usage>): what Anthropic retains from cloud sessions
- * [Claude Tag](<https://claude.com/docs/claude-tag/overview>): an organization-managed @Claude in Slack that runs on the same cloud environment
+ * [Claude Tag](<https://claude.com/docs/claude-tag/overview>): an organization-managed @Claude in Slack that runs on the same cloud infrastructure
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -68,7 +68,7 @@
`CLAUDE.md`| Project and global| ✓| Instructions loaded every session| [Memory](</docs/en/memory>)
`rules/*.md`| Project and global| ✓| Topic-scoped instructions, optionally path-gated| [Rules](</docs/en/memory#organize-rules-with-claude/rules/>)
`settings.json`| Project and global| ✓| Permissions, hooks, env vars, model defaults| [Settings](</docs/en/settings>)
-`settings.local.json`| Project only| | Your personal overrides, gitignored when Claude Code creates it| [Settings scopes](</docs/en/settings#settings-files>)
+`settings.local.json`| Project only| | Your personal overrides, gitignored when Claude Code saves a setting to it| [Settings scopes](</docs/en/settings#settings-files>)
`.mcp.json`| Project only| ✓| Team-shared MCP servers| [MCP scopes](</docs/en/mcp#mcp-installation-scopes>)
`.worktreeinclude`| Project only| ✓| Gitignored files to copy into new worktrees| [Worktrees](</docs/en/worktrees#copy-gitignored-files-into-worktrees>)
`skills/<name>/SKILL.md`| Project and global| ✓| Reusable prompts invoked with `/name` or auto-invoked| [Skills](</docs/en/skills>)
--- a/claude-security.md
+++ b/claude-security.md
@@ -23,7 +23,10 @@
/plugin install claude-security@claude-plugins-official
-If Claude Code reports that the marketplace is not found, run `/plugin marketplace add anthropics/claude-plugins-official` first, then retry the install.
+If the install fails, the fix depends on which message Claude Code reports:
+
+ * If it reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`, then retry the install.
+ * If it reports that it can’t find the plugin in the marketplace, check the plugin name for a typo, then refresh your local copy of the marketplace with `/plugin marketplace update claude-plugins-official` and retry the install.
Then activate the plugin in the current session with `/reload-plugins`, which applies pending plugin changes without a restart:
Show diff (686 lines)
--- a/cloud-environments.md
+++ b/cloud-environments.md
@@ -0,0 +1,683 @@
+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>).
+
+[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.
+
+##
+
+
+
+The Default environment
+
+Onboarding sets up the **Default** environment for you, whether you connect through [the web](</docs/en/web-quickstart#connect-github>) or a CLI flow such as `/web-setup`; if web onboarding shows an environment form instead of creating the environment, keep the form’s defaults to get the same **Default** environment. **Default** carries no configuration of its own:
+
+ * **Trusted** network access: sessions reach package registries and other allowlisted domains, and nothing else through the session’s network.
+ * No other configuration: **Default** defines no environment variables or setup script, so sessions start with just the pre-installed tools.
+
+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.
+
+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.
+
+##
+
+
+
+Configure your environment
+
+Create, edit, and archive environments from the environment selector at [claude.ai/code](<https://claude.ai/code>), which you reach after [web onboarding](</docs/en/web-quickstart>). Environments you create are personal to your account; shared environments created by your admins appear in the same selector. See Installed tools for what’s available without any configuration.
+
+1
+
+Open the environment selector
+
+On [claude.ai/code](<https://claude.ai/code>), select the cloud icon showing the current environment’s name, in the row above the message box. There’s no settings page or direct URL for the selector.
+
+2
+
+Add or edit an environment
+
+Select **Add cloud environment** , or hover over an existing environment and select the settings icon that appears on the right. The dialog includes the name, network access level, environment variables, and setup script.
+
+###
+
+
+
+Set environment variables
+
+Environment variables use `.env` format, one `KEY=value` pair per line. Plain values don’t need quotes, and if you quote a value with a matching pair, the quotes don’t become part of the value. Quote a value that spans multiple lines or contains a `#`: in an unquoted value, `#` starts a comment and the rest of the line is dropped. The following example defines three variables.
+
+ NODE_ENV=development
+ LOG_LEVEL=debug
+ DATABASE_URL=postgres://localhost:5432/myapp
+
+Each session copies the environment’s values once, at startup, into ordinary environment variables that any command Claude runs can read. Because running sessions don’t re-read the configuration, editing or adding variables affects sessions you start afterward; sessions already running keep the values they started with. Anyone who uses the environment can read the values, and cloud environments have no dedicated secrets store, so don’t add API keys or other credentials. If a session needs a credential anyway, see What carries over from your setup.
+
+###
+
+
+
+Select an environment from the CLI
+
+Run `/remote-env` in your terminal to choose the default environment for cloud sessions you create from the CLI, such as [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>). The command opens a picker of your existing environments and saves your choice to the `remote.defaultEnvironmentId` key in your [user settings](</docs/en/settings#settings-files>), so it applies in every project on your machine until you change it, unless the same key is set at a higher-precedence [settings layer](</docs/en/settings#settings-precedence>), such as a repo’s project settings. `/remote-env` only sets the default: it doesn’t start a session, and it can’t add or edit environments. Manage them at [claude.ai/code](<https://claude.ai/code>).
+
+###
+
+
+
+Archive an environment
+
+To archive an environment, open it for editing and select **Archive**. You can’t delete an environment, only archive it. Archiving affects new sessions, not running ones:
+
+ * Sessions already running in the environment continue to work.
+ * The environment disappears from the selector and from `/remote-env`, so you can’t pick it for new sessions.
+ * No new session can start in an archived environment, on any surface. If the environment was your saved CLI default, CLI cloud sessions fall back to your first available cloud environment. Anything configured with the environment explicitly, such as a [routine](</docs/en/routines#environments-and-network-access>), can’t start new sessions in it; point it at another environment.
+
+###
+
+
+
+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:
+
+ * 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.
+
+Shared environments add to members’ selectors rather than replacing them.
+
+##
+
+
+
+Network access
+
+Each environment sets one network access level, which controls the outbound connections its sessions can make. The default level, **Trusted** , allows package registries and other allowlisted domains; **Custom** takes your own domain list. To change an environment’s network access, open it for editing and use the **Network access** selector in the dialog. The cloud icon that opens the selector appears on the app surfaces listed under The Default environment and in the [routine editor](</docs/en/routines#environments-and-network-access>); personal environments don’t have a separate page in your claude.ai account settings.
+
+MCP connectors you enable on a session or routine work without adding their hosts to **Allowed domains** , because connector traffic travels through Anthropic’s servers rather than the session’s network. You configure connectors per session or per routine; remove any you don’t need to limit which tools Claude can reach. This relies on the same Anthropic-bound channel noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>).
+
+###
+
+
+
+Access levels
+
+The **Network access** field in the environment dialog takes one of four levels:
+
+Level| Outbound connections
+---|---
+**None**| No outbound network access through the session’s network
+**Trusted**| Allowlisted domains only: package registries, GitHub, cloud SDKs
+**Full**| Any domain
+**Custom**| Your own allowlist, optionally including the defaults
+
+GitHub operations use a separate proxy that is independent of this setting, and Claude Code’s connection to the Anthropic API still works at **None** , as noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>).
+
+###
+
+
+
+Allow specific domains
+
+To allow domains that aren’t in the Trusted list, select **Custom** in the environment’s network access settings, then list one domain per line in the **Allowed domains** field. This example allows three hosts an internal project might need.
+
+ api.example.com
+ *.internal.example.com
+ registry.example.com
+
+Sessions in this environment can now reach `api.example.com`, any subdomain of `internal.example.com`, and `registry.example.com`, and no other domains through the session’s network; GitHub traffic and MCP connector traffic don’t go through this allowlist. A leading `*.` matches every subdomain. To keep the Trusted domains too, check **Also include default list of common package managers** ; leave it unchecked to allow only what you list. Each environment has its own allowed-domains list; there’s no organization-level allowlist that admins can push to every member’s environments. [Server-managed settings](</docs/en/server-managed-settings>) still apply inside cloud sessions, but none of them adds domains to the environment’s network allowlist.
+
+###
+
+
+
+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:
+
+ * **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.
+ * **Push protection** : `git push` works only against the session’s current working branch; cloning, fetching, and PR operations work normally.
+ * **Repository scope** : GitHub API and release-asset requests reach only repositories attached to the session, so a setup script that downloads release assets from an unattached repository gets a 403.
+
+Committed files from public repositories arrive through `raw.githubusercontent.com`, which the security proxy handles instead. That domain is in the default Trusted list, so those files stay reachable unless the environment’s access level excludes it.
+
+###
+
+
+
+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:
+
+ * Protection against malicious requests
+ * Rate limiting and abuse prevention
+ * Content filtering for enhanced security
+ * A DNS-level audit trail of requested hostnames
+
+##
+
+
+
+What’s available in cloud sessions
+
+Each session gets a fresh virtual machine (VM) running Ubuntu 24.04, regardless of your own operating system, with your repository cloned and common toolchains pre-installed. This section covers those defaults, the built-in GitHub tools, how to run tests and services, and the resource limits each VM gets.
+
+###
+
+
+
+What carries over from your setup
+
+Cloud sessions start from a fresh clone of your repository. Anything you commit to the repo is available. Anything you’ve installed or configured only on your own machine isn’t available in the session. Your organization’s policy arrives separately through [server-managed settings](</docs/en/server-managed-settings>).
+
+| Available in cloud sessions| Why
+---|---|---
+Your repo’s `CLAUDE.md`| Yes| Part of the clone
+Your repo’s `.claude/settings.json` hooks| Yes| Part of the clone
+Your repo’s `.mcp.json` MCP servers| Yes| Part of the clone
+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 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
+MCP servers you added with `claude mcp add` at the default local scope or the user scope| No| Those write to `~/.claude.json` on your machine, not the repo. Add the server with `claude mcp add --scope project`, which writes the repo’s [`.mcp.json`](</docs/en/mcp#project-scope>), and commit that file
+Transport variables in your repo’s `.claude/settings.json` `env` block, such as `NODE_EXTRA_CA_CERTS` and the [mTLS client certificate variables](</docs/en/network-config#mtls-authentication>)| No| The hosting environment manages the session’s API connection, so Claude Code ignores these keys and notes each ignored key in the session’s debug log
+Static API tokens and credentials| No| No dedicated secrets store exists yet. See below
+Interactive auth like AWS SSO| No| Not supported. SSO requires browser-based login that can’t run in a cloud session
+
+To make your own configuration available in cloud sessions, commit it to the repo. A dedicated secrets store is not yet available, and the dialog warns against adding secrets or credentials: environment variables and setup scripts live in the environment configuration, where anyone who uses the environment can read them. If a session needs a credential anyway, add it with that visibility in mind.
+
+###
+
+
+
+Installed tools
+
+Cloud sessions come with common language runtimes, build tools, and databases pre-installed. The table below summarizes what’s included by category.
+
+Category| Included
+---|---
+**Python**| Python 3.x with pip, poetry, uv, black, mypy, pytest, ruff
+**Node.js**| 20, 21, and 22 via nvm, with npm, yarn, pnpm, bun¹, eslint, prettier, chromedriver
+**Ruby**| 3.1, 3.2, 3.3 with gem, bundler, rbenv
+**PHP**| 8.4 with Composer
+**Java**| OpenJDK 21 with Maven and Gradle
+**Go**| latest stable with module support
+**Rust**| rustc and cargo
+**C/C++**| GCC, Clang, cmake, ninja, conan
+**Docker**| docker, dockerd, docker compose
+**Databases**| PostgreSQL 16, Redis 7.0
+**Utilities**| git, jq, yq, ripgrep, tmux, vim, nano
+
+¹ Bun is installed but has known proxy compatibility issues for package fetching. For exact versions, ask Claude to run `check-tools` in a cloud session. It’s a shell command installed on the session VM, not a slash command; you ask Claude because Claude runs all VM commands for you. Toolchains outside this list, such as the .NET SDK, aren’t pre-installed even when their package registries are on the default allowlist. Install them with a setup script.
+
+###
+
+
+
+Work with GitHub issues and pull requests
+
+Cloud sessions include built-in GitHub tools that let Claude read issues, list pull requests, fetch diffs, and post comments without any setup. These tools authenticate through the GitHub proxy using whichever method you configured under [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>), so your token never enters the container. You can set `GH_TOKEN` or `GITHUB_TOKEN` yourself in environment settings, or leave both unset and let the GitHub proxy authenticate for you:
+
+ * If you set a token, it passes through to the container unchanged, so your scripts, and GitHub’s [`gh` CLI](<https://cli.github.com>) if you install it, use it directly.
+ * If you set neither and the GitHub proxy is handling authentication for your session, both variables read as the placeholder string `proxy-injected` in the commands Claude runs, and the proxy substitutes your real credentials on outbound GitHub requests. `gh` works without a token of your own, but a script that reads `GITHUB_TOKEN` directly gets the placeholder, not a usable token.
+
+A token you set is an ordinary environment variable, so anyone who uses the environment can read it; the proxy path keeps the credential out of the environment configuration and the session VM. To check which case applies to your session, ask Claude to run `echo $GH_TOKEN`. GitHub’s [`gh` CLI](<https://cli.github.com>) isn’t pre-installed. If you need a `gh` command the built-in tools don’t cover, like `gh release` or `gh workflow run`, install and authenticate it yourself:
+
+1
+
+Install gh in your setup script
+
+Add `apt update && apt install -y gh` to your setup script.
+
+2
+
+Provide a token if the proxy is not handling authentication
+
+If `echo $GH_TOKEN` prints `proxy-injected`, the GitHub proxy authenticates `gh` for you and this step is unnecessary. Otherwise, add a `GH_TOKEN` environment variable to your environment settings with a GitHub personal access token; like any environment variable, it’s readable by anyone who uses the environment, so scope the token narrowly. `gh` reads `GH_TOKEN` automatically, so you don’t need to run `gh auth login`.
+
+###
+
+
+
+Link output back to the session
+
+Each cloud session has a transcript URL on claude.ai, and the session can read its own ID from the `CLAUDE_CODE_REMOTE_SESSION_ID` environment variable. Use this to put a traceable link in PR bodies, commit messages, Slack posts, or generated reports so a reviewer can open the run that produced them. Commits that Claude creates in a cloud session include a `Claude-Session: <url>` git trailer, and PR bodies include the session URL on its own line. This requires v2.1.179 or later. To omit the trailer and the PR-body link, set [`attribution.sessionUrl`](</docs/en/settings#attribution-settings>) to `false`. The setting requires v2.1.182 or later. To include the session link in something other than a commit or PR, such as a Slack message Claude posts or a report file it writes, have Claude run the following command and use its output. The command converts the `cse_` prefix in the environment variable’s value to the `session_` prefix that the transcript URL expects:
+
+ echo "https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID/#cse_/session_}"
+
+###
+
+
+
+Run tests, start services, and add packages
+
+You don’t get a shell into the session VM. Claude runs every command for you, so phrase the tasks in this section as requests in your prompt.
+
+####
+
+
+
+Run tests
+
+Claude runs tests as part of working on a task. Ask for it in your prompt, like “fix the failing tests in `tests/`” or “run pytest after each change.” Test runners that come with the pre-installed toolchains, like pytest and cargo test, work without additional setup. A runner your project declares as a dependency, like jest, installs with your dependencies.
+
+####
+
+
+
+Start services
+
+PostgreSQL and Redis are pre-installed but not running by default. Ask Claude to start whichever you need; the commands it runs are:
+
+ service postgresql start
+
+ service redis-server start
+
+Docker is available for running containerized services. Ask Claude to run `docker compose up` to start your project’s services. Network access to pull images follows your environment’s access level, and the Trusted defaults include Docker Hub and other common registries. If your images are large or slow to pull, add `docker compose pull` or `docker compose build` to your setup script. The environment cache keeps the pulled images, so each new session has them on disk. The cache stores files only, not running processes, so Claude still starts the containers each session.
+
+####
+
+
+
+Add packages
+
+To add packages that aren’t pre-installed, use a setup script. The environment cache keeps what the script installs, so packages you install there are available at the start of every session without reinstalling each time. You can also ask Claude to install packages mid-session, but those installs don’t carry over to other sessions.
+
+###
+
+
+
+Resource limits
+
+Cloud sessions run with approximate resource ceilings that may change over time:
+
+ * 4 vCPUs
+ * 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.
+
+##
+
+
+
+Setup scripts
+
+A setup script is a Bash script that runs when a new cloud session starts, before Claude Code launches. Use setup scripts to install dependencies, configure tools, or fetch anything the session needs that isn’t pre-installed. Scripts run as root on Ubuntu 24.04, so `apt install` and most language package managers work. To add a setup script, open the environment settings dialog and enter your script in the **Setup script** field. This example installs GitHub’s [`gh` CLI](<https://cli.github.com>), which isn’t pre-installed.
+
+ #!/bin/bash
+ apt update && apt install -y gh
+
+###
+
+
+
+Script requirements
+
+A setup script has three constraints to write around:
+
+ * **Exit zero** : if the script exits non-zero, the session fails to start. Append `|| true` to non-critical commands so an intermittent install failure doesn’t block the session.
+ * **Finish within five minutes** : keep the script’s total runtime under roughly five minutes so the environment cache can build. Run independent installs in parallel with `&` and `wait`, and move any single download that won’t fit into a SessionStart hook that launches it in the background.
+ * **Network access for installs** : package installs need to reach registries. The default **Trusted** level covers common package registries including npm, PyPI, RubyGems, and crates.io; with **None** network access, installs fail.
+
+###
+
+
+
+Environment caching
+
+The setup script runs the first time you start a session in an environment. After it completes, Anthropic snapshots the filesystem and reuses that snapshot as the starting point for later sessions. New sessions start with your dependencies, tools, and Docker images already on disk, and skip the setup script step. This keeps startup fast even when the script installs large toolchains or pulls container images. The cache is a filesystem snapshot, so it keeps what the setup script writes to disk and loses anything that was only running. Packages you install, Docker images you pull, and files you write all carry over. A database the script started, a `docker compose up` stack, or any other background process doesn’t; start those per session by asking Claude or with a SessionStart hook. The setup script runs again to rebuild the cache when you change the environment’s setup script or allowed network hosts, and when the cache reaches its expiry after roughly seven days. Resuming an existing session never re-runs the setup script. You don’t need to enable caching or manage snapshots yourself.
+
+###
+
+
+
+Setup scripts vs. SessionStart hooks
+
+Use a setup script to provision the VM itself: toolchains and CLI tools that aren’t pre-installed. Use a [SessionStart hook](</docs/en/hooks#sessionstart>) for project setup that should run everywhere, cloud and local, like `npm install`. Setup scripts and SessionStart hooks run in a fixed order when a cloud session starts:
+
+ 1. The setup script runs first, before Claude Code launches, and only when no cached environment exists.
+ 2. Claude Code launches and runs your SessionStart hooks, as it does at the start of every session, local or cloud.
+
+| Setup scripts| SessionStart hooks
+---|---|---
+**Where you configure them**| The environment dialog at [claude.ai/code](<https://claude.ai/code>)| A [settings file](</docs/en/settings#settings-files>) such as your repo’s `.claude/settings.json`; see What carries over from your setup for which files reach a cloud session
+**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>).
+
+###
+
+
+
+Install dependencies with a SessionStart hook
+
+To install dependencies only in cloud sessions, pair a SessionStart hook with a script that checks where it’s running. First, add a SessionStart hook to your repo’s `.claude/settings.json`. This configuration tells Claude Code to run `scripts/install_pkgs.sh` from your repository whenever a session starts or resumes:
+
+ {
+ "hooks": {
+ "SessionStart": [
+ {
+ "matcher": "startup|resume",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash \"$CLAUDE_PROJECT_DIR\"/scripts/install_pkgs.sh"
+ }
+ ]
+ }
+ ]
+ }
+ }
+
+The `matcher` limits the hook to the `startup` and `resume` events, and `$CLAUDE_PROJECT_DIR` resolves to the repository root, so the hook finds the script regardless of the session’s working directory. Next, create the script at `scripts/install_pkgs.sh`. It exits immediately outside the cloud, then installs your dependencies:
+
+ #!/bin/bash
+
+ if [ "$CLAUDE_CODE_REMOTE" != "true" ]; then
+ exit 0
+ fi
+
+ npm install
+ pip install -r requirements.txt
+ exit 0
+
+The `CLAUDE_CODE_REMOTE` check is what scopes the install to cloud sessions: the session VM’s environment carries that variable as `true`, it’s never `true` locally, so on your laptop the script exits before installing anything. Together, the two files give every cloud session a fresh `npm install` and `pip install` at startup while leaving local sessions untouched.
+
+####
+
+
+
+Limitations in cloud sessions
+
+SessionStart hooks behave the same in the cloud as locally, with these caveats:
+
+ * **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.
+ * **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.
+
+##
+
+
+
+Default allowed domains
+
+With **Trusted** network access, sessions can reach the following domains by default. Domains marked with `*` indicate wildcard subdomain matching, so `*.gcr.io` allows any subdomain of `gcr.io`.
+
+Anthropic services
+
+ * api.anthropic.com
+ * statsig.anthropic.com
+ * docs.claude.com
+ * platform.claude.com
+ * code.claude.com
+ * claude.ai
+
+Version control
+
+ * github.com
+ * [www.github.com](<http://www.github.com>)
+ * api.github.com
+ * npm.pkg.github.com
+ * raw.githubusercontent.com
+ * pkg-npm.githubusercontent.com
+ * objects.githubusercontent.com
+ * release-assets.githubusercontent.com
+ * codeload.github.com
+ * avatars.githubusercontent.com
+ * camo.githubusercontent.com
+ * gist.github.com
+ * gitlab.com
+ * [www.gitlab.com](<http://www.gitlab.com>)
+ * registry.gitlab.com
+ * bitbucket.org
+ * [www.bitbucket.org](<http://www.bitbucket.org>)
+ * api.bitbucket.org
+
+Container registries
+
+ * registry-1.docker.io
+ * auth.docker.io
+ * index.docker.io
+ * hub.docker.com
+ * [www.docker.com](<http://www.docker.com>)
+ * production.cloudflare.docker.com
+ * download.docker.com
+ * gcr.io
+ * *.gcr.io
+ * ghcr.io
+ * mcr.microsoft.com
+ * *.data.mcr.microsoft.com
+ * public.ecr.aws
+
+Cloud platforms
+
+ * cloud.google.com
+ * accounts.google.com
+ * gcloud.google.com
+ * *.googleapis.com
+ * storage.googleapis.com
+ * compute.googleapis.com
+ * container.googleapis.com
+ * azure.com
+ * portal.azure.com
+ * microsoft.com
+ * [www.microsoft.com](<http://www.microsoft.com>)
+ * *.microsoftonline.com
+ * packages.microsoft.com
+ * dotnet.microsoft.com
+ * dot.net
+ * visualstudio.com
+ * dev.azure.com
+ * *.amazonaws.com
+ * *.api.aws
+ * oracle.com
+ * [www.oracle.com](<http://www.oracle.com>)
+ * java.com
+ * [www.java.com](<http://www.java.com>)
+ * java.net
+ * [www.java.net](<http://www.java.net>)
+ * download.oracle.com
+ * yum.oracle.com
+
+JavaScript and Node package managers
+
+ * registry.npmjs.org
+ * [www.npmjs.com](<http://www.npmjs.com>)
+ * [www.npmjs.org](<http://www.npmjs.org>)
+ * npmjs.com
+ * npmjs.org
+ * yarnpkg.com
+ * registry.yarnpkg.com
+
+Python package managers
+
+ * pypi.org
+ * [www.pypi.org](<http://www.pypi.org>)
+ * files.pythonhosted.org
+ * pythonhosted.org
+ * test.pypi.org
+ * pypi.python.org
+ * pypa.io
+ * [www.pypa.io](<http://www.pypa.io>)
+
+Ruby package managers
+
+ * rubygems.org
+ * [www.rubygems.org](<http://www.rubygems.org>)
+ * api.rubygems.org
+ * index.rubygems.org
+ * ruby-lang.org
+ * [www.ruby-lang.org](<http://www.ruby-lang.org>)
+ * rubyforge.org
+ * [www.rubyforge.org](<http://www.rubyforge.org>)
+ * rubyonrails.org
+ * [www.rubyonrails.org](<http://www.rubyonrails.org>)
+ * rvm.io
+ * get.rvm.io
+
+Rust package managers
+
+ * crates.io
+ * [www.crates.io](<http://www.crates.io>)
+ * index.crates.io
+ * static.crates.io
+ * rustup.rs
+ * static.rust-lang.org
+ * [www.rust-lang.org](<http://www.rust-lang.org>)
+
+Go package managers
+
+ * proxy.golang.org
+ * sum.golang.org
+ * index.golang.org
+ * golang.org
+ * [www.golang.org](<http://www.golang.org>)
+ * goproxy.io
+ * pkg.go.dev
+
+JVM package managers
+
+ * maven.org
+ * repo.maven.org
+ * central.maven.org
+ * repo1.maven.org
+ * repo.maven.apache.org
+ * jcenter.bintray.com
+ * gradle.org
+ * [www.gradle.org](<http://www.gradle.org>)
+ * services.gradle.org
+ * plugins.gradle.org
+ * kotlinlang.org
+ * [www.kotlinlang.org](<http://www.kotlinlang.org>)
+ * spring.io
+ * repo.spring.io
+
+Other package managers
+
+ * packagist.org (PHP Composer)
+ * [www.packagist.org](<http://www.packagist.org>)
+ * repo.packagist.org
+ * nuget.org (.NET NuGet)
+ * [www.nuget.org](<http://www.nuget.org>)
+ * api.nuget.org
+ * pub.dev (Dart/Flutter)
+ * api.pub.dev
+ * hex.pm (Elixir/Erlang)
+ * [www.hex.pm](<http://www.hex.pm>)
+ * cpan.org (Perl CPAN)
+ * [www.cpan.org](<http://www.cpan.org>)
+ * metacpan.org
+ * [www.metacpan.org](<http://www.metacpan.org>)
+ * api.metacpan.org
+ * cocoapods.org (iOS/macOS)
+ * [www.cocoapods.org](<http://www.cocoapods.org>)
+ * cdn.cocoapods.org
+ * haskell.org
+ * [www.haskell.org](<http://www.haskell.org>)
+ * hackage.haskell.org
+ * swift.org
+ * [www.swift.org](<http://www.swift.org>)
+
+Linux distributions
+
+ * archive.ubuntu.com
+ * security.ubuntu.com
+ * ubuntu.com
+ * [www.ubuntu.com](<http://www.ubuntu.com>)
+ * *.ubuntu.com
+ * ppa.launchpad.net
+ * launchpad.net
+ * [www.launchpad.net](<http://www.launchpad.net>)
+ * *.nixos.org
+
+Development tools and platforms
+
+ * dl.k8s.io (Kubernetes)
+ * pkgs.k8s.io
+ * k8s.io
+ * [www.k8s.io](<http://www.k8s.io>)
+ * releases.hashicorp.com (HashiCorp)
+ * apt.releases.hashicorp.com
+ * rpm.releases.hashicorp.com
+ * archive.releases.hashicorp.com
+ * hashicorp.com
+ * [www.hashicorp.com](<http://www.hashicorp.com>)
+ * repo.anaconda.com (Anaconda/Conda)
+ * conda.anaconda.org
+ * anaconda.org
+ * [www.anaconda.com](<http://www.anaconda.com>)
+ * anaconda.com
+ * continuum.io
+ * apache.org (Apache)
+ * [www.apache.org](<http://www.apache.org>)
+ * archive.apache.org
+ * downloads.apache.org
+ * eclipse.org (Eclipse)
+ * [www.eclipse.org](<http://www.eclipse.org>)
+ * download.eclipse.org
+ * nodejs.org (Node.js)
+ * [www.nodejs.org](<http://www.nodejs.org>)
+ * developer.apple.com
+ * developer.android.com
+ * pkg.stainless.com
+ * binaries.prisma.sh
+
+Cloud services and monitoring
+
+ * statsig.com
+ * [www.statsig.com](<http://www.statsig.com>)
+ * api.statsig.com
+ * sentry.io
+ * *.sentry.io
+ * downloads.sentry-cdn.com
+ * http-intake.logs.datadoghq.com
+ * browser-intake-us5-datadoghq.com
+ * *.datadoghq.com
+ * *.datadoghq.eu
+ * api.honeycomb.io
+
+Content delivery and mirrors
+
+ * sourceforge.net
+ * *.sourceforge.net
+ * packagecloud.io
+ * *.packagecloud.io
+ * fonts.googleapis.com
+ * fonts.gstatic.com
+
+Schema and configuration
+
+ * json-schema.org
+ * [www.json-schema.org](<http://www.json-schema.org>)
+ * json.schemastore.org
+ * [www.schemastore.org](<http://www.schemastore.org>)
+
+Model Context Protocol
+
+ * *.modelcontextprotocol.io
+
+##
+
+
+
+Related resources
+
+ * [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
+ * [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
+ * [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
@@ -331,6 +331,8 @@
Ask Claude to fix what the review found. If you passed `--fix` or `--comment`, the review has already applied or posted its findings.
+When the host application requests it, Claude reports the review’s findings through the [`ReportFindings` tool](</docs/en/tools-reference>) instead of as text in its reply. Claude Code renders the report as a findings list, one entry per finding. Each entry shows the file location, a one-sentence summary, and a category tag such as `correctness` when the finding carries one. A host request applies at every effort level and requires Claude Code v2.1.218 or later. In a terminal session, `/code-review` runs the review as a fork and reports the findings as text in the reply, and Claude reports as text in any `-p` run with text or JSON output, even when the host application requests the findings list. On v2.1.216 and v2.1.217, a terminal review at `medium` or higher effort reported the findings list instead. When Claude fixes reported findings later in the session, it reports them again, and Claude Code marks each finding in the new list as fixed, skipped, or no change needed.
+
###
--- a/commands.md
+++ b/commands.md
@@ -22,7 +22,7 @@
To add your own commands, see [skills](</docs/en/skills>). In the table below, `<arg>` indicates a required argument and `[arg]` indicates an optional one.
-Not every command appears for every user. Availability depends on your platform, plan, and environment. For example, `/desktop` only shows on macOS and Windows when signed in with a Claude subscription, and `/upgrade` doesn’t show on Enterprise plans.
+Not every command appears for every user. Availability depends on your platform, plan, and environment. For example, `/desktop` only shows on macOS and x64 Windows when signed in with a Claude subscription, and `/upgrade` doesn’t show on Enterprise plans.
Command| Purpose
---|---
@@ -51,7 +51,7 @@
`/deep-research <question>`| **[Workflow](</docs/en/workflows#bundled-workflows>).** Fan out web searches on a question, fetch and cross-check sources, and synthesize a cited report
`/design-login`| Authorize design-system access for `/design-sync` with your claude.ai account
`/design-sync [hint]`| **[Skill](</docs/en/skills#bundled-skills>).** Convert your repo’s React design system and upload it to [Claude Design](<https://claude.ai/design>), so designs it produces use your real components. Optionally name the design system, for example `/design-sync Acme DS`. A first-time sync verifies every component and can take a few hours on a large repo. Available on the Anthropic API; on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS the underlying tool can’t reach claude.ai, so the command is unavailable
-`/desktop`| Continue the current session in the Claude Code Desktop app. Requires macOS or Windows and a Claude subscription. Alias: `/app`
+`/desktop`| Continue the current session in the Claude Code Desktop app. Requires macOS or x64 Windows and a Claude subscription. Alias: `/app`
`/diff`| Open an interactive diff viewer showing uncommitted changes and per-turn diffs. Use left/right arrows to switch between the current git diff and individual Claude turns, and up/down to browse files. Press Enter to open the selected file’s diff, scroll it with up/down or PageUp/PageDown, and press Esc to return to the file list. As of v2.1.198, the open viewer also refreshes automatically when the repository’s git state changes outside the session, such as a branch switch or commit in another terminal
`/doctor`| **[Skill](</docs/en/skills#bundled-skills>).** Run a setup checkup that diagnoses issues and can fix them. Checks installation health, including duplicate or leftover installs, `PATH` problems, and unparseable settings files. Finds unused skills, MCP servers, and plugins versus their context cost, flags slow [hooks](</docs/en/hooks>), and checks for a newer version on your release channel. Deduplicates local `CLAUDE.md` files against checked-in ones, trims checked-in [`CLAUDE.md`](</docs/en/memory>) files by cutting content Claude could derive from the codebase, and migrates the always-loaded guidance that remains into [skills](</docs/en/skills>) and nested `CLAUDE.md` files that load on demand. The trim cuts sections such as directory layouts, dependency lists, and architecture overviews, and keeps pitfalls, rationale, and conventions that differ from tool defaults. Also offers to make [auto mode](</docs/en/permissions#permission-modes>) your default and to [pre-approve](</docs/en/permissions>) frequently denied read-only commands. Reports findings first and asks for confirmation before changing anything. From the terminal, `claude doctor` prints read-only installation diagnostics without starting a session. Alias: `/checkup`. The `CLAUDE.md` trim check requires Claude Code v2.1.206 or later. Before v2.1.206, the version check compared Homebrew installs against the `autoUpdatesChannel` setting rather than the [installed cask’s channel](</docs/en/setup#configure-release-channel>). Before v2.1.205, `/doctor` opened a read-only diagnostics screen and pressing `f` sent the report to Claude
`/effort [level|auto]`| Set the model [effort level](</docs/en/model-config#adjust-effort-level>). Accepts `low`, `medium`, `high`, `xhigh`, `max`, or [`ultracode`](</docs/en/workflows#let-claude-decide-with-ultracode>); available levels depend on the model, and `max` and `ultracode` are session-only. `auto` resets to the model default. Without an argument, opens an interactive slider. Takes effect immediately without waiting for the current response to finish. Also available in non-interactive mode (`-p`) with a level argument, where it applies to the current session only; requires Claude Code v2.1.205 or later. While the [model-default effort hold](</docs/en/model-config#adjust-effort-level>) is in force, a non-interactive `/effort` reports `Not applied`, so pass `--effort` at launch instead
@@ -92,7 +92,7 @@
`/reload-plugins [--force]`| Reload all active [plugins](</docs/en/plugins>) to apply pending changes without restarting. Reports counts for each reloaded component and flags any load errors. When the reload would change which MCP tools are loaded and invalidate the prompt cache, the command warns and skips unless you pass `--force`
`/reload-skills`| Re-scan [skill](</docs/en/skills>) and command directories so skills added or changed on disk during the session become available without restarting. Reports how many skills are available and how many were added or removed. Added in v2.1.152
`/remote-control`| Make this session available for [Remote Control](</docs/en/remote-control>) from claude.ai. Running it while signed out prints that Remote Control requires a claude.ai subscription and tells you how to sign in; before v2.1.206 it reported `Unknown command: /remote-control`. Alias: `/rc`
-`/remote-env`| Choose the default environment for [cloud agents](</docs/en/claude-code-on-the-web#configure-your-environment>)
+`/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
`/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>)
@@ -102,7 +102,7 @@
`/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`
`/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 pending changes on the current branch for security vulnerabilities. Reviews the git diff and identifies risks like injection, auth issues, and data exposure
+`/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
--- a/costs.md
+++ b/costs.md
@@ -315,8 +315,8 @@
A session that has been open for hours can use far more of your plan limits than your activity suggests, usually for one of these reasons:
- * **Long context** : Claude Code sends your full conversation with every message, so a one-line question in a session that has been open all day uses tokens for the whole conversation, not just the one line. See Manage context proactively for ways to keep your context small
- * **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. The lifetime is an hour on a subscription and drops to five minutes once you’re drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>); on an API key or cloud provider, it’s five minutes by default
+ * **Long context** : Claude Code sends your full conversation with every request, and each time Claude uses tools it sends another request carrying that batch of tool results. With [prompt caching](</docs/en/prompt-caching>), Claude Code re-reads that history at the [cached token rate](<https://platform.claude.com/docs/en/about-claude/pricing>), so a one-line question in a session that has been open all day still draws usage for the whole conversation. See Manage context proactively for ways to keep your context small
+ * **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. The lifetime is an hour on a subscription and drops to five minutes once you’re drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>); on an API key or cloud provider, it’s five minutes by default. On Pro and Max plans, when you resume a large session after a long break, Claude Code [offers to resume from a summary](</docs/en/sessions#resume-from-a-summary>) so later requests don’t carry the full history
* **Scheduled tasks** : a [scheduled task](</docs/en/scheduled-tasks>) fires on its interval even while the session is idle, sending your full context each time
* **Agent teammates** : each active teammate keeps consuming tokens until it exits
* **Compaction** : `/compact` reads the conversation it summarizes, so [compacting a large context](</docs/en/prompt-caching#compacting-the-conversation>) is itself a large request. When you want a fresh start instead of continuity, `/clear` costs nothing
--- a/data-usage.md
+++ b/data-usage.md
@@ -93,7 +93,7 @@
Cloud execution: Data flow and dependencies
-When using [Claude Code on the web](</docs/en/claude-code-on-the-web>), sessions run in Anthropic-managed virtual machines instead of locally. In cloud environments:
+When using [Claude Code on the web](</docs/en/claude-code-on-the-web>), sessions run in Anthropic-managed virtual machines instead of locally. In cloud sessions:
* **Code and data storage:** Your repository is cloned to an isolated VM. Code and session data are subject to the retention and usage policies for your account type (see Data retention section above)
* **Credentials:** GitHub authentication is handled through a secure proxy; your GitHub credentials never enter the sandbox
@@ -108,7 +108,7 @@
Telemetry services
-Claude Code sends two kinds of operational telemetry: usage metrics and error reports. You can turn each off individually with the environment variables below, or disable all non-essential traffic at once by setting `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. **Metrics** : latency, reliability, and usage patterns, sent to Anthropic and to third-party logging infrastructure over TLS. Metrics never include your code, prompts, or file paths. Set `DISABLE_TELEMETRY=1` to opt out. **Error reports** : error messages and stack traces from Claude Code’s own internals, sent to a third-party error tracking service over TLS. Claude Code redacts known patterns of secrets, file paths, email addresses, and other personal information before anything leaves your machine. Set `DISABLE_ERROR_REPORTING=1` to opt out. Error reporting is on only when all of these apply:
+Claude Code sends two kinds of operational telemetry: usage metrics and error reports. You can turn each off individually with the environment variables below, or disable all non-essential traffic at once by setting `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Setting `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) depends on; `DISABLE_ERROR_REPORTING` doesn’t. **Metrics** : latency, reliability, and usage patterns, sent to Anthropic and to third-party logging infrastructure over TLS. Metrics never include your code, prompts, or file paths. Set `DISABLE_TELEMETRY=1` to opt out. **Error reports** : error messages and stack traces from Claude Code’s own internals, sent to a third-party error tracking service over TLS. Claude Code redacts known patterns of secrets, file paths, email addresses, and other personal information before anything leaves your machine. Set `DISABLE_ERROR_REPORTING=1` to opt out. Error reporting is on only when all of these apply:
* you sign in with a Claude Pro or Max subscription
* you’re running Claude Code v2.1.198 or later
--- a/desktop.md
+++ b/desktop.md
@@ -87,7 +87,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 the cloud environment is already sandboxed. 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 because cloud sessions already run in a sandboxed VM. Enterprise admins can restrict which permission modes are available. See enterprise configuration for details.
###
@@ -365,7 +365,7 @@
Click **\+ New session** in the sidebar, or press **Cmd+N** on macOS or **Ctrl+N** on Windows, to work on multiple tasks in parallel. Press **Ctrl+Tab** and **Ctrl+Shift+Tab** to cycle through sessions in the sidebar. For Git repositories, each session gets its own isolated copy of your project using [Git worktrees](</docs/en/worktrees>), so changes in one session don’t affect other sessions until you commit them. To view two sessions at once, hold **Cmd** on macOS or **Ctrl** on Windows and click a session in the sidebar. The session opens in a second pane alongside the one you already have open. While the split is active, clicking another sidebar session replaces whichever pane has focus. Press **Cmd+\** on macOS or **Ctrl+\** on Windows to close the focused pane and return to a single session. Worktrees are stored in `<project-root>/.claude/worktrees/` by default. You can change this to a custom directory in Settings → Claude Code under “Worktree location”. You can also set a branch prefix that gets prepended to every worktree branch name, which is useful for keeping Claude-created branches organized. To remove a worktree when you’re done, hover over the session in the sidebar and click the archive icon. To have sessions archive themselves when their pull request merges or closes, turn on **Auto-archive after PR merge or close** in Settings → Claude Code. Auto-archive only applies to local sessions that have finished running. To include gitignored files like `.env` in new worktrees, create a [`.worktreeinclude` file](</docs/en/worktrees#copy-gitignored-files-into-worktrees>) in your project root.
-Session isolation requires [Git](<https://git-scm.com/downloads>). Most Macs include Git by default. Run `git --version` in Terminal to check. 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.
+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. 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.
@@ -442,7 +442,7 @@
Install plugins
-[Plugins](</docs/en/plugins>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. For local and SSH sessions, click the **+** button next to the prompt box and select **Plugins** to see your installed plugins and their skills. To add a plugin, select **Add plugin** from the submenu to open the plugin browser, which shows available plugins from your configured [marketplaces](</docs/en/plugin-marketplaces>) including the official Anthropic marketplace. Select **Manage plugins** to enable, disable, or uninstall plugins. Plugins can be scoped to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI. The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions; to use a plugin in a cloud session, declare it in the repository’s `.claude/settings.json` under [`enabledPlugins`](</docs/en/settings#enabledplugins>) so it [installs at session start](</docs/en/claude-code-on-the-web#what%E2%80%99s-available-in-cloud-sessions>). Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins>).
+[Plugins](</docs/en/plugins>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. For local and SSH sessions, click the **+** button next to the prompt box and select **Plugins** to see your installed plugins and their skills. To add a plugin, select **Add plugin** from the submenu to open the plugin browser, which shows available plugins from your configured [marketplaces](</docs/en/plugin-marketplaces>) including the official Anthropic marketplace. Select **Manage plugins** to enable, disable, or uninstall plugins. Plugins can be scoped to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI. The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions; to use a plugin in a cloud session, declare it in the repository’s `.claude/settings.json` under [`enabledPlugins`](</docs/en/settings#enabledplugins>) so it [installs at session start](</docs/en/cloud-environments#what-carries-over-from-your-setup>). Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins>).
###
@@ -477,7 +477,14 @@
{
"version": "0.0.1",
"autoVerify": false,
- "configurations": [...]
+ "configurations": [
+ {
+ "name": "my-app",
+ "runtimeExecutable": "npm",
+ "runtimeArgs": ["run", "dev"],
+ "port": 3000
+ }
+ ]
}
When disabled, preview tools are still available and you can ask Claude to verify at any time. Auto-verify makes it automatic after every edit.
@@ -646,7 +653,7 @@
Cloud sessions
-Cloud sessions continue in the background even if you close the app. Usage counts toward your [subscription plan limits](</docs/en/costs>) with no separate compute charges. You can create custom cloud environments with different network access levels and environment variables. Select the environment dropdown when starting a cloud session and choose **Add environment**. See [the cloud environment](</docs/en/claude-code-on-the-web#the-cloud-environment>) for details on configuring network access and environment variables.
+Cloud sessions continue in the background even if you close the app. Usage counts toward your [subscription plan limits](</docs/en/costs>) with no separate compute charges. You can create custom cloud environments with different network access levels and environment variables. Select the environment dropdown when starting a cloud session and choose **Add cloud environment**. See [Configure cloud environments](</docs/en/cloud-environments>) for details on configuring network access and environment variables.
###
@@ -834,7 +841,7 @@
Coming from the CLI?
-If you already use the Claude Code CLI, Desktop runs the same underlying engine with a graphical interface. You can run both simultaneously on the same machine, even on the same project. Each maintains separate session history, but they share configuration and project memory via CLAUDE.md files. To move a CLI session into Desktop, run `/desktop` in the terminal. Claude saves your session and opens it in the desktop app, then exits the CLI. This command is available on macOS and Windows when you are signed in with a Claude subscription. It is not available with API key authentication or on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry.
+If you already use the Claude Code CLI, Desktop runs the same underlying engine with a graphical interface. You can run both simultaneously on the same machine, even on the same project. Each maintains separate session history, but they share configuration and project memory via CLAUDE.md files. To move a CLI session into Desktop, run `/desktop` in the terminal. Claude saves your session and opens it in the desktop app, then exits the CLI. This command is available on macOS and x64 Windows when you are signed in with a Claude subscription. It is not available with API key authentication or on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry.
When to use Desktop vs CLI: use Desktop when you want to manage parallel sessions in one window, arrange panes side by side, or review changes visually. Use the CLI when you need scripting, automation, or prefer a terminal workflow.
@@ -873,7 +880,15 @@
* **[Settings](</docs/en/settings>)** in `~/.claude.json` and `~/.claude/settings.json` are shared. Permission rules, allowed tools, and other settings in `settings.json` apply to Desktop sessions.
* **Models** : the same [models](</docs/en/model-config#available-models>) are available in both. In Desktop, select the model from the dropdown next to the send button. You can change the model mid-session from the same dropdown.
-**MCP servers from the Claude Desktop chat app** : the Desktop app loads MCP servers from `claude_desktop_config.json` into Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. A server defined in `claude_desktop_config.json` is available in both the Desktop chat surface and the Code tab.The standalone CLI does not read `claude_desktop_config.json`. On macOS and WSL, run `claude mcp add-from-claude-desktop` to copy those servers into `~/.claude.json`. See [Import MCP servers from Claude Desktop](</docs/en/mcp#import-mcp-servers-from-claude-desktop>) for the import flow and scope options.
+####
+
+
+
+MCP servers from the Claude Desktop chat app
+
+The Desktop app loads MCP servers from `claude_desktop_config.json` into local Code tab sessions, alongside servers from `~/.claude.json` and `.mcp.json`. A server you define in `claude_desktop_config.json` is available in both the Desktop chat surface and local Code tab sessions. If you define the same server name in `claude_desktop_config.json` and in `~/.claude.json` or `.mcp.json`, the Code tab in local sessions connects once and uses the `claude_desktop_config.json` definition. The app also re-delivers stdio servers from `~/.claude.json` to the embedded CLI in local sessions. When the top level of `~/.claude.json` (user scope) and `.mcp.json` define the same stdio server name, the Code tab uses the `~/.claude.json` definition, departing from the CLI [scope hierarchy](</docs/en/mcp#scope-hierarchy-and-precedence>).
+
+The standalone CLI does not read `claude_desktop_config.json`. On macOS and WSL, run `claude mcp add-from-claude-desktop` to copy those servers into `~/.claude.json`. See [Import MCP servers from Claude Desktop](</docs/en/mcp#import-mcp-servers-from-claude-desktop>) for the import flow and scope options.
###
--- a/desktop-linux.md
+++ b/desktop-linux.md
@@ -25,15 +25,19 @@
Add Anthropic's apt repository
-This step downloads the signing key with `curl`, which fresh Debian and Ubuntu installations may not include. If the download command fails with `sudo: curl: command not found`, install curl first:
+This step downloads the signing key with `curl` and verifies it with `gpg`, which fresh Debian and Ubuntu installations may not include. If either command reports `command not found`, install both first:
- sudo apt install curl
+ sudo apt install curl gnupg
Download Anthropic’s signing key:
sudo curl -fsSLo /usr/share/keyrings/claude-desktop-archive-keyring.asc https://downloads.claude.ai/claude-desktop/key.asc
-Register the repository:
+If this download fails, `apt update` later fails with `NO_PUBKEY BAA929FF1A7ECACE`. Confirm the key downloaded and belongs to Anthropic before continuing:
+
+ gpg --show-keys /usr/share/keyrings/claude-desktop-archive-keyring.asc
+
+The fingerprint gpg prints should be `31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE`. If gpg reports that the file can’t be opened or contains no valid OpenPGP data, the download failed or returned the wrong content: confirm your network can reach `downloads.claude.ai`, then rerun the download command.Register the repository:
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/claude-desktop-archive-keyring.asc] https://downloads.claude.ai/claude-desktop/apt/stable stable main" | sudo tee /etc/apt/sources.list.d/claude-desktop.list
@@ -48,14 +52,6 @@
Launch and sign in
Launch **Claude** from your application launcher, or run `claude-desktop` from a terminal, and sign in with your Anthropic account.The Linux app signs in the same way as on macOS and Windows: with a claude.ai subscription, or through your organization’s SSO. Desktop doesn’t accept a Claude Console API key directly; use the [CLI](</docs/en/quickstart>) for API-key authentication. For enterprise deployments that route Desktop to Google Cloud’s Agent Platform or an LLM gateway, see [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>) and [network configuration](</docs/en/network-config>).
-
-Verify the signing key
-
-You can confirm the downloaded signing key belongs to Anthropic:
-
- gpg --show-keys /usr/share/keyrings/claude-desktop-archive-keyring.asc
-
-The fingerprint should be `31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`.
###
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -31,7 +31,7 @@
}
}
-Replace the `image` line with your project’s base image or remove it if your existing file uses a Dockerfile.
+Replace the `image` line with your project’s base image or remove it if your existing file uses a Dockerfile.The Claude Code feature installs Node.js itself when the base image doesn’t provide it. If that install fails and the build stops with `Failed to install Node.js and npm`, add `"ghcr.io/devcontainers/features/node:1": {}` to the `features` block above the Claude Code feature and rebuild.
2
@@ -60,15 +60,18 @@
Persist authentication and settings across rebuilds
-By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under [`~/.claude`](</docs/en/claude-directory>). Mount a named volume at that path to keep this state across rebuilds. The following example mounts a volume at the home directory of the `node` user:
+By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
devcontainer.json
"mounts": [
"source=claude-code-config,target=/home/node/.claude,type=volume"
- ]
+ ],
+ "containerEnv": {
+ "CLAUDE_CONFIG_DIR": "/home/node/.claude"
+ }
-Replace `/home/node` with the home directory of your container’s `remoteUser`. If you mount the volume somewhere other than `~/.claude`, set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the mount path so Claude Code reads and writes there. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists across stopping and starting a codespace, but is still cleared when you rebuild the container, so the volume mount above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>); Codespaces makes secrets available as environment variables inside the container automatically.
+Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically.
##
@@ -92,7 +95,7 @@
"DISABLE_AUTOUPDATER": "1"
}
-The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) depends on, so sessions in the container can’t use Remote Control. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
--- a/discover-plugins.md
+++ b/discover-plugins.md
@@ -28,7 +28,7 @@
Official Anthropic marketplace
-The official Anthropic marketplace (`claude-plugins-official`) is automatically available when you start Claude Code. Run `/plugin` and go to the **Discover** tab to browse what’s available, or view the catalog at [claude.com/plugins](<https://claude.com/plugins>). To install a plugin from the official marketplace, use `/plugin install <name>@claude-plugins-official`. For example, to install the GitHub integration:
+Claude Code adds the official Anthropic marketplace (`claude-plugins-official`) automatically when you start it. If Claude Code can’t add it, for example because your network blocks the download, add it yourself with `/plugin marketplace add anthropics/claude-plugins-official`. To browse what’s available, run `/plugin` and go to the **Discover** tab, or view the catalog at [claude.com/plugins](<https://claude.com/plugins>). To install a plugin from the official marketplace, use `/plugin install <name>@claude-plugins-official`. For example, to install the GitHub integration:
/plugin install github@claude-plugins-official
@@ -72,10 +72,10 @@
Once a code intelligence plugin is installed and its language server binary is available, Claude gains two capabilities:
- * **Automatic diagnostics** : after every file edit Claude makes, the language server analyzes the changes and reports errors and warnings back automatically. Claude sees type errors, missing imports, and syntax issues without needing to run a compiler or linter. If Claude introduces an error, it notices and fixes the issue in the same turn. This requires no configuration beyond installing the plugin. You can see diagnostics inline by pressing **Ctrl+O** when the “diagnostics found” indicator appears.
+ * **Automatic diagnostics** : after every file edit Claude makes, the language server reports errors and warnings back, so Claude sees type errors, missing imports, and syntax issues without running a compiler or linter. If Claude introduces an error, it notices and fixes it in the same turn.
* **Code navigation** : Claude can use the language server to jump to definitions, find references, get type info on hover, list symbols, find implementations, and trace call hierarchies. These operations give Claude more precise navigation than grep-based search, though availability may vary by language and environment.
-If you run into issues, see Code intelligence troubleshooting.
+You don’t need to configure diagnostics beyond installing the plugin. To read them yourself, press **Ctrl+O** when Claude Code shows an indicator such as **Found 3 new diagnostic issues in 2 files**. If you run into issues, see Code intelligence troubleshooting.
###
@@ -181,7 +181,7 @@
* 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)
-Choose an installation scope:
+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:
* **User scope** : install for yourself across all projects
* **Project scope** : install for all collaborators on this repository
@@ -280,7 +280,7 @@
Install plugins
-Once you’ve added marketplaces, you can install plugins directly:
+Once you’ve added marketplaces, you can install a plugin by name:
/plugin install plugin-name@marketplace-name
@@ -311,7 +311,12 @@
* 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. List installed plugins without opening the menu:
+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:
+
+ * 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.
+
+List installed plugins without opening the menu:
/plugin list
@@ -342,7 +347,7 @@
/reload-plugins
-Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. In that case `/reload-plugins` shows a warning and does not apply the reload; pass `--force` to apply anyway. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details.
+Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. The skills count covers only each plugin’s `commands/` directory, not its `skills/` directory, so the summary can report `0 skills` even when the plugin’s skills reloaded. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. In that case `/reload-plugins` shows a warning and does not apply the reload; pass `--force` to apply anyway. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details.
##
Show diff (201 lines)
--- a/env-vars.md
+++ b/env-vars.md
@@ -78,7 +78,7 @@
---|---
`~/.claude/settings.json`| You, in every project
`.claude/settings.json`| Everyone working in the project, checked into source control
-`.claude/settings.local.json`| You, in this project only (add it to your gitignore if you create it by hand)
+`.claude/settings.local.json`| You, in this project only, gitignored when Claude Code saves a setting to it; add it to your gitignore if you create it by hand
Managed settings| Everyone in your organization, deployed by an admin
See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable.
@@ -89,7 +89,7 @@
Precedence
-Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files.
+Some behaviors have both an environment variable and a dedicated settings key. If you set both, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. Claude Code uses the settings key only when the environment variable is unset. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files.
##
@@ -98,6 +98,17 @@
Variables
Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable’s row notes it takes plain digits only. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1.
+
+For variables that turn a behavior on or off, set `1` or `true` to turn it on and `0` or `false` to turn it off, in any casing.Some variables read only whether you set them at all, so any non-empty value including `0` turns the behavior on, and you turn the behavior off by unsetting the variable or setting it to an empty value. These variables work that way:
+
+ * `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`
+ * `DISABLE_TELEMETRY`
+ * `DISABLE_ERROR_REPORTING`
+ * `CLAUDE_CODE_TMUX_TRUECOLOR`
+ * `FALLBACK_FOR_ALL_PRIMARY_MODELS`
+ * `IS_DEMO`
+
+One other variable has its own rule: `FORCE_HYPERLINK` reads a number, so only `0` turns it off. Each variable’s row also states its own rule.
Variable| Purpose
---|---
@@ -115,23 +126,23 @@
`ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>)
`ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set
`ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set
-`ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_FABLE_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>)
-`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>)
-`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_OPUS_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>)
-`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_SONNET_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>)
-`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
-`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the custom model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_FABLE_MODEL`| Model ID that the `fable` alias resolves to, and the ID Claude Code recognizes as Fable 5 for [automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on third-party providers. See [Model configuration](</docs/en/model-config#environment-variables>)
+`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| Display description for the pinned Fable model in the `/model` picker. Defaults to `Custom Fable model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| Display name for the pinned Fable model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Fable model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_HAIKU_MODEL`| Model ID that the `haiku` alias resolves to, also used for [background functionality](</docs/en/costs#background-token-usage>). See [Model configuration](</docs/en/model-config#environment-variables>)
+`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| Display description for the pinned Haiku model in the `/model` picker. Defaults to `Custom Haiku model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| Display name for the pinned Haiku model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Haiku model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_OPUS_MODEL`| Model ID that the `opus` alias resolves to, and that `opusplan` uses while Plan Mode is active. See [Model configuration](</docs/en/model-config#environment-variables>)
+`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, defaults to `Custom Opus model`, or `Custom Opus model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Opus model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_SONNET_MODEL`| Model ID that the `sonnet` alias resolves to, and that `opusplan` uses when Plan Mode is not active. See [Model configuration](</docs/en/model-config#environment-variables>)
+`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, defaults to `Custom Sonnet model`, or `Custom Sonnet model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
+`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Sonnet model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>)
`ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>))
`ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later
`ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>))
@@ -166,7 +177,7 @@
`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail
`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>))
`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting
-`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Caching on a direct connection to the Anthropic API is unaffected either way
+`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your [LLM gateway](</docs/en/llm-gateway>) caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly
`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window
`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting
`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later
@@ -191,19 +202,19 @@
`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later
`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later
`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later
-`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` doesn’t override it
+`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting
`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files
`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session
`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when `ENABLE_TOOL_SEARCH` is set
`CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later
`CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>)
`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>)
-`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes
+`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings#available-settings>) setting
`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set
`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry
`CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior
`CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later
-`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`
`CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution
`CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later
`CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run
@@ -243,7 +254,7 @@
`CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running
`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later
`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>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers
+`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_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
@@ -278,9 +289,9 @@
`CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>)
`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>)
`CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution
-`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment
-`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>)
-`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt
+`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session
+`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>)
+`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable, because setting it to `0` still triggers the resume in non-interactive mode
`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later
`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default
`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later
@@ -303,7 +314,7 @@
`CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions
`CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway)
`CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve
-`CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>). As of v2.1.196, setting it to `inherit` is the same as leaving it unset; earlier versions treated `inherit` as an override that forced every subagent onto the main conversation’s model
+`CLAUDE_CODE_SUBAGENT_MODEL`| The model Claude Code uses for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and agents in a [workflow](</docs/en/workflows>). Accepts an alias such as `haiku` or a full model name, and takes precedence over the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. See [Model configuration](</docs/en/model-config#environment-variables>). Setting it to `inherit` is the same as leaving it unset; before v2.1.196, `inherit` was an override that forced every subagent onto the main conversation’s model
`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured
`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait
`CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete
@@ -314,7 +325,7 @@
`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>)
`CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later
`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override
-`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings
+`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings
`CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
`CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>)
`CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>)
@@ -334,14 +345,14 @@
`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1`
`DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it
`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both
-`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs
+`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting
`DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command
`DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages
`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command
-`DISABLE_ERROR_REPORTING`| Set to `1` to opt out of error reporting
+`DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on
`DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits
`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted
-`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set
+`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set
`DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations
`DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry)
`DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>)
@@ -352,24 +363,24 @@
`DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models
`DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models
`DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models
-`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable
+`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable
`DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update
`DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command
-`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs
+`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs
`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead
`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate
`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead
-`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront
-`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to make all models, not only Opus, stop retrying with a repeated-overload error when no fallback model is configured. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model
+`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure, where the server-side rejection still forces upfront loading; requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront
+`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model
`FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER`
-`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them
+`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. Claude Code parses this value as a number, not a boolean, so word spellings such as `false`, `no`, or `off` enable hyperlinks rather than disabling them
`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H`
`HTTP_PROXY`| Specify HTTP proxy server for network connections
`HTTPS_PROXY`| Specify HTTPS proxy server for network connections
-`IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session
+`IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session
`MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000)
`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5
-`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking on the Anthropic API except on Fable 5, which cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead, and models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) may still think. For nonzero values on adaptive reasoning models, the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`
+`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set
`MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret`
`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built
`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt
Show diff (158 lines)
--- a/errors.md
+++ b/errors.md
@@ -80,6 +80,7 @@
`Error: Workspace not trusted` when starting Remote Control| Command-line errors
`Could not import <server>: <reason>`| Command-line errors
`Error: MCP tool <name> (passed via --permission-prompt-tool) not found`| Command-line errors
+`Shell command failed for pattern "!`git ... origin/HEAD...`"`| Command-line errors
`Input must be provided either through stdin or as a prompt argument when using --print`| Command-line errors
`Diff is too large for ultrareview` / `PR #<N> is too large for ultrareview`| Command-line errors
`Failed to resume the conversation`| Command-line errors
@@ -108,13 +109,33 @@
Automatic retries
-Claude Code retries transient failures before showing you an error. Server errors, overloaded responses, request timeouts, temporary 429 throttles, and dropped connections are all retried up to 10 times with exponential backoff. As of v2.1.198, this covers connections that drop in the middle of a response before any visible output has streamed: Claude Code re-issues the request with the same backoff and the turn continues instead of stopping with a connection error. As of v2.1.199, temporary 429 throttles that don’t carry your plan’s quota headers are also retried when you’re signed in with a claude.ai subscription; earlier versions retried them only for API key and Enterprise sign-ins. Some failure classes aren’t retried, because a retry can’t succeed:
-
- * As of v2.1.199, a TLS certificate validation failure, such as a TLS-inspecting proxy, a missing `NODE_EXTRA_CA_CERTS` bundle, or an expired certificate, fails on the first attempt so the fix appears immediately instead of after the full retry budget. See SSL certificate errors. Transient TLS conditions such as a handshake timeout still retry.
- * As of v2.1.199, a server error that arrives after Claude has already streamed visible output keeps the partial response and appends an incomplete-response notice instead of retrying, since re-running the request could execute the same tools twice. Earlier versions discarded the partial output and reported the turn as an error.
- * An Amazon Bedrock streaming response with an unexpected content-type fails on the first attempt, because the gateway or proxy rewriting the response would rewrite the retry the same way. Requires Claude Code v2.1.208 or later.
-
-While retrying, the spinner shows a `Retrying in Ns · attempt x/y` countdown after an error label. The label names the specific reason from the first attempt for failures you can act on right away: the network is down, a TLS handshake failed, or you hit a rate limit. For other errors it reads `API error` at first. As of v2.1.198 it switches to the specific reason from the third attempt, or on the final attempt when `CLAUDE_CODE_MAX_RETRIES` allows fewer than three; earlier versions switch only on the final attempt. As of v2.1.198, the usual spinner tip is suppressed during retries. Once the error reason is revealed, if the failure is a 529 overload the line below the countdown also names where to check service status: `status.claude.com` on the Anthropic API, or the provider or gateway host named in the message on other configurations. If no data arrives on the response stream for 20 seconds while a request is still pending, the spinner shows `Waiting for API response · will retry in … · check your network` before any retry has started. The request has not failed yet: the countdown runs to the point where Claude Code aborts the stalled connection and retries, so the banner clears on its own once data resumes or the retry succeeds. As of v2.1.185 the threshold is 20 seconds; earlier versions show the banner after 10 seconds with different wording. If it reappears on every attempt, treat it as a network issue. While Claude is consulting the [advisor](</docs/en/advisor>), the banner appears after 90 seconds without data instead of 20, because a long advisor review can send nothing for well over 20 seconds. Before v2.1.214, the 20-second threshold applied during advisor calls too, so the banner appeared during advisor reviews even when nothing was wrong. When you see one of the errors on this page, those retries have already been exhausted, unless it belongs to a class that isn’t retried, such as a certificate-validation failure. You can tune the behavior with these environment variables:
+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 any part of Claude’s response has completed: 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.
+ * 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 partway through a response, once Claude has completed a block of text or a tool call in that response: Claude Code could execute the same tool calls twice if it re-ran the request, so it keeps the completed output and ends the turn with an incomplete-response notice. 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.
+ * 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.
+
+###
+
+
+
+What you see while Claude Code retries or waits
+
+While retrying, the spinner shows a `Retrying in Ns · attempt x/y` countdown after an error label. The label names the specific reason from the first attempt for failures you can act on right away: the network is down, a TLS handshake failed, or you hit a rate limit. For other errors it reads `API error` at first. As of v2.1.198 it switches to the specific reason from the third attempt, or on the final attempt when `CLAUDE_CODE_MAX_RETRIES` allows fewer than three; earlier versions switch only on the final attempt. As of v2.1.198, the usual spinner tip is suppressed during retries. Once the error reason is revealed, if the failure is a 529 overload the line below the countdown also names where to check service status: `status.claude.com` on the Anthropic API, or the provider or gateway host named in the message on other configurations. If no data arrives on the response stream for 20 seconds while a request is still pending, the spinner shows `Waiting for API response · will retry in … · check your network` before any retry has started. The request has not failed yet: the countdown runs to the point where Claude Code aborts the stalled connection, after which the turn either retries or ends with an error such as The response above may be incomplete. The banner clears on its own once data resumes or a retry succeeds; if it reappears on every attempt, treat it as a network issue. As of v2.1.185 the threshold is 20 seconds; earlier versions show the banner after 10 seconds with different wording. While Claude is consulting the [advisor](</docs/en/advisor>), the banner appears after 90 seconds without data instead of 20, because a long advisor review can send nothing for well over 20 seconds. Before v2.1.214, the 20-second threshold applied during advisor calls too, so the banner appeared during advisor reviews even when nothing was wrong.
+
+###
+
+
+
+Tune retry behavior
+
+You can tune retry behavior with these environment variables:
Variable| Default| Effect
---|---|---
@@ -128,7 +149,7 @@
Server errors
-Most of these errors come from the inference provider’s infrastructure: Anthropic’s on the Anthropic API, and that provider’s on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or a custom gateway. Auto mode cannot determine the safety of an action and Agent terminated early due to an API error also cover causes on your side, such as an Amazon Bedrock account that can’t invoke the classifier model or a subagent that hit a usage limit.
+Most of these errors come from the inference provider: Anthropic’s service on the Anthropic API, and the service behind that provider’s endpoint on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or a custom gateway. Auto mode cannot determine the safety of an action and Agent terminated early due to an API error also cover causes on your side, such as an Amazon Bedrock account that can’t invoke the classifier model or a subagent that hit a usage limit.
###
@@ -185,7 +206,7 @@
The response above may be incomplete
-A streaming response failed after Claude had already produced visible output. Re-sending the request could run the same tool calls twice, so Claude Code keeps what already streamed and appends this notice instead of discarding the turn. Which variant you see names the cause:
+A streaming request failed after Claude had started producing a response. 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.
@@ -195,11 +216,13 @@
* `Connection closed mid-response`: the connection dropped.
* `Response stalled mid-stream`: the stream stopped sending data.
-**What to do:**
-
- * Read the response that streamed. Nothing has been lost, but the final sentences or tool calls may be missing.
- * Reply with `continue` to have Claude pick up where it stopped
- * If the same error appears before any visible output, Claude Code retries the request instead of finalizing it. See Automatic retries.
+Claude Code never shows this notice for a failure that happens before Claude starts producing a response: at that point it either retries the failure or ends the turn with a different error. See Automatic retries. **What to do:**
+
+ * In an interactive session, read the response that remains on screen: Claude Code keeps every block Claude completed before the error, but discards an interrupted final block when the turn ends, so the final sentences or tool calls may be missing. Reply with `continue` to have Claude pick up from its last completed block.
+ * In [non-interactive mode](</docs/en/headless>) (`-p`):
+ * With the default text output, Claude Code prints the last completed block of text it still holds from earlier in the turn, followed by this message. When it holds none, Claude Code prints this message alone, for example because Claude completed only tool calls before the error, or because Claude Code compacted the conversation mid-turn and cleared that text. Before v2.1.219, Claude Code printed only this message in `-p` text output and dropped the response it had already produced.
+ * With `--output-format json` or `stream-json`, Claude Code reports this message in the `result` field.
+ * To continue the turn, resume the session and send `continue` as described in [Continue conversations](</docs/en/headless#continue-conversations>).
###
@@ -414,7 +437,7 @@
* Upgrade to v2.1.174 or later if this appears in a background or cloud session and your credentials are already configured
* Confirm `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, or your cloud provider credentials are set in the environment that launches the worker, not only in your interactive shell
- * For the Agent SDK, see [authentication setup](</docs/en/agent-sdk/overview#get-started>)
+ * For the Agent SDK, see [authentication setup in the quickstart](</docs/en/agent-sdk/quickstart#setup>)
* Run `/status` in an interactive session in the same environment to confirm which credential source resolves
###
@@ -697,7 +720,7 @@
Socket is closed
-The connection carrying a streaming response was closed while the response was still arriving, and the failure surfaced with the text `Socket is closed`. This happens almost exclusively on Windows behind a corporate proxy, when the proxy drops an established tunnel mid-response. Claude Code treats this as a dropped connection and retries it automatically, so the turn continues. Before v2.1.214, the retry didn’t cover this failure, and the turn stopped with an error containing `Socket is closed`. **What to do:**
+`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. When nothing in the interrupted response had completed yet, Claude Code treats this as a dropped connection and retries it automatically, so the turn continues. Once Claude has completed a block of text or a tool call in the response, Claude Code keeps that output and ends the turn with an incomplete-response notice instead. 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:**
* If you see this error, update to v2.1.214 or later with `claude update`, then send your message again
* If turns keep failing behind the same proxy after updating, work through Unable to connect to API and check the proxy setup in [Network configuration](</docs/en/network-config>)
@@ -749,13 +772,13 @@
HTTP 403
x-deny-reason: host_not_allowed
-You may also see a TLS certificate that doesn’t match the destination’s real certificate. The cloud environment routes outbound traffic through a proxy that enforces the network policy, so a mismatched certificate means the proxy terminated the connection, not the destination. This is not a client-side network problem. Cloud sessions and [routines](</docs/en/routines>) run inside a sandboxed environment whose outbound traffic is filtered to the environment’s allowlist. The **Default** environment uses **Trusted** access, which permits the [default allowlist](</docs/en/claude-code-on-the-web#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains but blocks everything else. **What to do:**
+You may also see a TLS certificate that doesn’t match the destination’s real certificate. Cloud sessions route outbound traffic through a proxy that enforces the network policy, so a mismatched certificate means the proxy terminated the connection, not the destination. This is not a client-side network problem. Cloud sessions and [routines](</docs/en/routines>) run inside a sandboxed VM whose outbound traffic through the session’s network is filtered to the [cloud environment’s](</docs/en/cloud-environments>) allowlist; [GitHub operations](</docs/en/cloud-environments#github-proxy>) and MCP connector traffic use separate channels, which is why they can keep working while other hosts are blocked. The **Default** environment uses **Trusted** access, which permits the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains and blocks other domains on that path. **What to do:**
* Open the routine for editing, or start a cloud session. Select the cloud icon showing your environment’s name, such as **Default** , to open the selector. Hover over your environment and click the settings icon.
- * In the **Update cloud environment** dialog, change **Network access** from **Trusted** to **Custom** , then add the blocked domain to **Allowed domains**. Enter one domain per line. Check **Also include default list of common package managers** to keep the [default allowlist](</docs/en/claude-code-on-the-web#default-allowed-domains>) alongside your custom domains. Select **Full** instead if you want unrestricted access.
+ * In the **Update cloud environment** dialog, change **Network access** from **Trusted** to **Custom** , then add the blocked domain to **Allowed domains**. Enter one domain per line. Check **Also include default list of common package managers** to keep the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) alongside your custom domains. Select **Full** instead if you want unrestricted access.
* Click **Save changes**. The next run uses the updated allowlist.
-See [Network access](</docs/en/claude-code-on-the-web#network-access>) for access levels and the default allowlist. Local CLI sessions are not affected by this policy.
+See [Network access](</docs/en/cloud-environments#network-access>) for access levels and the default allowlist. Local CLI sessions are not affected by this policy.
###
@@ -1129,7 +1152,7 @@
Command-line errors
-These errors come from the `claude` command line and its subcommands. Claude Code prints them before running your prompt or sending any API request.
+These errors come from the `claude` command line, its subcommands, and commands such as `/security-review` that gather context by running shell commands before their prompt runs.
###
@@ -1225,6 +1248,25 @@
* Check that the server starts and stays connected: run `claude mcp list` in the same directory and confirm the server is listed as connected
* Confirm the tool name matches the `mcp__<server>__<tool>` name the server exposes
* If the server needs longer than 30 seconds to start, raise [`MCP_TIMEOUT`](</docs/en/env-vars>)
+
+###
+
+
+
+/security-review fails without origin/HEAD
+
+[`/security-review`](</docs/en/commands#all-commands>) builds its review context by diffing your branch against `origin/HEAD`, the local ref that records which branch is the default on your `origin` remote. When that ref doesn’t exist, the git commands that gather the diff fail and the review stops before it starts.
+
+ Error: Shell command failed for pattern "!`git diff --name-only origin/HEAD...`": [stderr]
+ fatal: ambiguous argument 'origin/HEAD...': unknown revision or path not in the working tree.
+ Use '--' to separate paths from revisions, like this:
+ 'git <command> [<revision>...] -- [<file>...]'
+
+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.
+ * 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.
###
--- a/feature-availability.md
+++ b/feature-availability.md
@@ -13,7 +13,7 @@
* **Amazon Bedrock** : you use Claude models from the Amazon Bedrock model catalog and set `CLAUDE_CODE_USE_BEDROCK`. The [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) (`CLAUDE_CODE_USE_MANTLE`) is covered by this column
* **Claude Platform on AWS** : you bought Claude through AWS Marketplace but call the Anthropic API, and set `CLAUDE_CODE_USE_ANTHROPIC_AWS`
* **Google Cloud’s Agent Platform** : Google-operated; you set `CLAUDE_CODE_USE_VERTEX`
- * **Microsoft Foundry** : Anthropic-operated on Azure; you set `CLAUDE_CODE_USE_FOUNDRY`
+ * **Microsoft Foundry** : Anthropic-operated; you set `CLAUDE_CODE_USE_FOUNDRY`
###
@@ -32,7 +32,7 @@
Three of these have provider-specific differences:
- * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method, and [tool search](</docs/en/mcp#configure-tool-search>) is off by default on Google Cloud’s Agent Platform and when `ANTHROPIC_BASE_URL` points to a non-first-party host
+ * **MCP servers** : [connectors from claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>) load only when your claude.ai subscription is the active authentication method. [Tool search](</docs/en/mcp#configure-tool-search>) is off by default on Google Cloud’s Agent Platform and when `ANTHROPIC_BASE_URL` points to a non-first-party host, and isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>)
* **Subagents** : the built-in [Explore subagent](</docs/en/sub-agents#built-in-subagents>) caps its inherited model at Opus on the Claude API, and inherits the main conversation’s model directly on any other provider, including Claude Platform on AWS
* **[Commands](</docs/en/commands#all-commands>)** : `/design-sync` and `/radio` are unavailable on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and `/voice` requires a claude.ai account
@@ -65,7 +65,7 @@
These features work in the local CLI but depend on a server-side capability that not every provider exposes. Feature| Claude subscription| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform| Microsoft Foundry
---|---|---|---|---|---|---
-[Web search](</docs/en/tools-reference#websearch-tool-behavior>)| ✓| ✓| ✗| ✓| See note 1| ✓
+[Web search](</docs/en/tools-reference#websearch-tool-behavior>)| ✓| ✓| ✗| ✓| See note 1| ✓ ([deployments hosted on Anthropic](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>))
[Fast mode](</docs/en/fast-mode>)| ✓| ✓| ✗| ✗| ✗| ✗
[Auto mode](</docs/en/auto-mode-config>)| ✓| ✓| See note 2| ✓| See note 2| See note 2
[Advisor](</docs/en/advisor>)| ✓| ✓| ✗| ✗| ✗| ✗
@@ -138,6 +138,7 @@
**Not available:** all features that require a Claude subscription, plus [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), [GitHub Actions](</docs/en/github-actions>) and [GitLab CI/CD](</docs/en/gitlab-ci-cd>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/radio` commands](</docs/en/commands#all-commands>).**Partial support:**
* [Desktop](</docs/en/desktop>): only via [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>)
+ * [Web search](</docs/en/tools-reference#websearch-tool-behavior>): [deployments hosted on Anthropic](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) only
* [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7 or later, and Fable 5 only
* [`/loop`](</docs/en/scheduled-tasks>): explicit intervals only
* [Zero Data Retention](</docs/en/zero-data-retention>): subject to your Azure agreement
--- a/file-checkpointing.md
+++ b/file-checkpointing.md
@@ -4,7 +4,7 @@
* **Explore alternatives** by restoring to a checkpoint and trying a different approach
* **Recover from errors** when the agent makes incorrect modifications
-Only changes made through the Write, Edit, and NotebookEdit tools are tracked. Changes made through Bash commands (like `echo > file.txt` or `sed -i`) are not captured by the checkpoint system.
+Only changes made through the Write, Edit, and NotebookEdit tools are tracked. Changes made through Bash commands (like `echo > file.txt` or `sed -i`) are not captured by the checkpoint system, and neither are edits a [subagent](</docs/en/agent-sdk/subagents>) applies, except a [skill with `context: fork`](</docs/en/skills#run-skills-in-a-subagent>) that runs in the foreground.
##
@@ -28,7 +28,7 @@
* Files modified during the session
* The original content of modified files
-When you rewind to a checkpoint, created files are deleted and modified files are restored to their content at that point.
+When you rewind to a checkpoint, Claude Code deletes the files it created and restores the files it modified to their content at that point. Claude Code skips a tracked path that is a symlink, hard link, or other non-regular file. It also skips a tracked file whose parent directory no longer resolves to its checkpoint-time location, or whose backup it can’t read safely. [`RewindFilesResult`](</docs/en/agent-sdk/typescript#rewindfilesresult>) counts every skipped path in its `skippedLinks` field. Skipping requires Claude Code v2.1.216 or later; before v2.1.216, a rewind wrote and deleted through links at tracked paths.
##
@@ -177,7 +177,7 @@
Capture checkpoint UUID and session ID
-With the `replay-user-messages` option set (shown above), each user message in the response stream has a UUID that serves as a checkpoint.For most use cases, capture the first user message UUID (`message.uuid`); rewinding to it restores all files to their original state. To store multiple checkpoints and rewind to intermediate states, see Multiple restore points.Capturing the session ID (`message.session_id`) is optional; you only need it if you want to rewind later, after the stream completes. If you’re calling `rewindFiles()` immediately while still processing messages (as the example in Checkpoint before risky operations does), you can skip capturing the session ID.
+With the `replay-user-messages` option set (shown above), each user message in the response stream has a UUID that serves as a checkpoint.For most use cases, capture the first user message UUID (`message.uuid`); rewinding to it restores the tracked files to their original state. To store multiple checkpoints and rewind to intermediate states, see Multiple restore points.Capturing the session ID (`message.session_id`) is optional; you only need it if you want to rewind later, after the stream completes. If you’re calling `rewindFiles()` immediately while still processing messages (as the example in Checkpoint before risky operations does), you can skip capturing the session ID.
Python
@@ -695,6 +695,7 @@
Limitation| Description
---|---
Write/Edit/NotebookEdit tools only| Changes made through Bash commands are not tracked
+Subagent edits| Edits a [subagent](</docs/en/agent-sdk/subagents>) applies aren’t tracked or restored, except a skill with `context: fork` running in the foreground; use git to revert untracked edits
Same session| Checkpoints are tied to the session that created them
File content only| Creating, moving, or deleting directories is not undone by rewinding
Local files| Remote or network files are not tracked
--- a/github-enterprise-server.md
+++ b/github-enterprise-server.md
@@ -186,7 +186,7 @@
Allowlist GHES marketplaces in managed settings
-If your organization uses [managed settings](</docs/en/settings>) to restrict which marketplaces developers can add, use the `hostPattern` source type to allow all marketplaces from your GHES instance without enumerating each repository:
+If your organization uses [managed settings](</docs/en/settings>) to restrict which marketplaces developers can add, use the `hostPattern` source type to allow all marketplaces from your GHES instance without enumerating each repository. See [settings files](</docs/en/settings#settings-files>) for file locations on each platform. Add the JSON to your `managed-settings.json` file or equivalent MDM policy:
{
"strictKnownMarketplaces": [
--- a/glossary.md
+++ b/glossary.md
@@ -404,7 +404,7 @@
Surface
-Any place you access Claude Code: the CLI, VS Code, JetBrains, Desktop, or claude.ai. All surfaces share the same engine. Sessions on your machine read your local CLAUDE.md, settings, and skills; [cloud sessions](</docs/en/claude-code-on-the-web#what%E2%80%99s-available-in-cloud-sessions>) start from a fresh clone of your repository and don’t read `~/.claude/` on your machine. Slack and the Chrome extension are integrations that connect to a surface rather than surfaces themselves. Learn more: [Platforms and integrations](</docs/en/platforms>)
+Any place you access Claude Code: the CLI, VS Code, JetBrains, Desktop, or claude.ai. All surfaces share the same engine. Sessions on your machine read your local CLAUDE.md, settings, and skills; [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>) start from a fresh clone of your repository and don’t read `~/.claude/` on your machine. Slack and the Chrome extension are integrations that connect to a surface rather than surfaces themselves. Learn more: [Platforms and integrations](</docs/en/platforms>)
##
--- a/goal.md
+++ b/goal.md
@@ -119,7 +119,16 @@
How evaluation works
-`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku. The model returns a yes-or-no decision and a short reason. A “no” tells Claude to keep working and includes the reason as guidance for the next turn. A “yes” clears the goal and records an achieved entry in the transcript. The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
+`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, the condition and the conversation so far are sent to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason.
+
+ * **No** : Claude keeps working and takes the reason as guidance for the next turn.
+ * **Yes** : Claude Code clears the goal and records an achieved entry in the transcript.
+
+To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>).
+
+Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it.
+
+The evaluator runs on whichever provider your session is configured for. It does not call tools, so it can only judge what Claude has already surfaced in the conversation.
Evaluation tokens are billed on the small fast model configured for your provider and are typically negligible compared to main-turn spend.
--- a/headless.md
+++ b/headless.md
@@ -135,10 +135,26 @@
claude -p "Explain recursion" --output-format stream-json --verbose --include-partial-messages
-The last line of the stream is a `result` message with the final response text, cost, and session metadata. If your consumer reads the stream slowly, Claude Code waits for the queued output to drain before exiting, scaling the wait with how much is still queued, capped at 30 seconds. Before v2.1.214 the exit wait was capped at about two seconds, which could cut off the end of a large response, and before v2.1.208 piping a large response could truncate the final line and omit the `result` message. Messages from [subagents](</docs/en/sub-agents>) appear in the stream as `assistant` and `user` messages whose `parent_tool_use_id` field is the ID of the tool call that spawned the subagent. Messages from the main conversation carry `null` in that field. By default, Claude Code emits only subagent `tool_use` and `tool_result` blocks. Pass [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) or set [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) to also emit subagent text and thinking blocks, so you can reconstruct each subagent’s transcript. This requires Claude Code v2.1.211 or later. The following example uses [jq](<https://jqlang.org/>) to filter for text deltas and display just the streaming text. The `-r` flag outputs raw strings (no quotes) and `-j` joins without newlines so tokens stream continuously:
+The last line of the stream is a `result` message with the final response text, cost, and session metadata. If your consumer reads the stream slowly, Claude Code waits for the queued output to drain before exiting, scaling the wait with how much is still queued, capped at 30 seconds. Before v2.1.214 the exit wait was capped at about two seconds, which could cut off the end of a large response. The following example uses [jq](<https://jqlang.org/>) to filter for text deltas and display just the streaming text. The `-r` flag outputs raw strings (no quotes) and `-j` joins without newlines so tokens stream continuously:
claude -p "Write a poem" --output-format stream-json --verbose --include-partial-messages | \
jq -rj 'select(.type == "stream_event" and .event.delta.type? == "text_delta") | .event.delta.text'
+
+For programmatic streaming with callbacks and message objects, see [Stream responses in real-time](</docs/en/agent-sdk/streaming-output>) in the Agent SDK documentation.
+
+####
+
+
+
+Follow subagent messages
+
+Messages from [subagents](</docs/en/sub-agents>) appear in the stream as `assistant` and `user` messages whose `parent_tool_use_id` field is the ID of the tool call that spawned the subagent. Messages from the main conversation carry `null` in that field. By default, Claude Code emits only subagent `tool_use` and `tool_result` blocks. Pass [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) or set [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) to also emit subagent text and thinking blocks, so you can reconstruct each subagent’s transcript. This requires Claude Code v2.1.211 or later. When you enable either option, Claude Code forwards messages from [subagents at every nesting depth](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>): when a subagent spawns its own subagent, the nested subagent’s messages carry the ID of the Agent tool call that spawned it in `parent_tool_use_id`, so you can rebuild the full nesting tree by following those IDs. Before v2.1.219, messages from nested subagents didn’t appear in the stream.
+
+####
+
+
+
+Handle API retries
When an API request fails with a retryable error, Claude Code emits a `system/api_retry` event before retrying. You can use this to surface retry progress or implement custom backoff logic.
@@ -154,17 +170,46 @@
`uuid`| string| unique event identifier
`session_id`| string| session the event belongs to
+####
+
+
+
+Read session metadata
+
The `system/init` event reports session metadata including the model, tools, MCP servers, and loaded plugins. It is the first event in the stream unless startup events precede it:
* `plugin_install` events, when [`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`](</docs/en/env-vars>) is set.
* [`hook_started`, `hook_progress`, and `hook_response` events](</docs/en/agent-sdk/typescript#sdkhookstartedmessage>), while a configured [`SessionStart`](</docs/en/hooks#sessionstart>) or [`Setup`](</docs/en/hooks#setup>) hook runs. These stream as the hook produces them. Claude Code v2.1.169 through v2.1.203 delivered them in one batch after the hook completed, still ahead of `system/init`; v2.1.204 restored live delivery.
-The event also carries an optional `capabilities` array of strings naming the protocol behaviors this Claude Code version implements, such as `interrupt_receipt_v1`. Check it to feature-detect instead of comparing version strings, and ignore values you don’t recognize. The field requires Claude Code v2.1.205 or later and is absent from earlier versions. See [`SDKSystemMessage`](</docs/en/agent-sdk/typescript#sdksystemmessage>) for the capability list. Use the plugin fields to fail CI when a plugin did not load:
+The event also carries an optional `capabilities` array of strings naming the protocol behaviors this Claude Code version implements, such as `interrupt_receipt_v1` or `interrupt_cancel_queued_v1`. Check it to feature-detect instead of comparing version strings, and ignore values you don’t recognize. The field requires Claude Code v2.1.205 or later and is absent from earlier versions. See [`SDKSystemMessage`](</docs/en/agent-sdk/typescript#sdksystemmessage>) for the capability list.
+
+####
+
+
+
+Fail CI when a plugin or MCP server doesn’t load
+
+Use the plugin fields in the `system/init` event to catch a plugin that didn’t load:
Field| Type| Description
---|---|---
`plugins`| array| plugins that loaded successfully, each with `name` and `path`
`plugin_errors`| array| plugin load-time errors, each with `plugin`, `type`, and `message`. Includes unsatisfied dependency versions and `--plugin-dir` load failures such as a missing path or invalid archive. Affected plugins are demoted and absent from `plugins`. The key is omitted when there are no errors
+
+Use the MCP server fields the same way. Claude Code validates each [`--mcp-config`](</docs/en/cli-reference#cli-flags>) entry at startup and skips entries that fail validation, for example a `url` entry with no `type`; the run continues and exits cleanly, so check these fields to catch a server that never loaded:
+
+Field| Type| Description
+---|---|---
+`mcp_servers`| array| MCP servers in the session, each with `name` and `status`
+`mcp_server_errors`| array| `--mcp-config` entries skipped by config validation, each with `name`, `type`, and `message`. `type` is a skip category such as `unknown_type`, `url_missing_type`, `invalid_config`, or `reserved_name`; treat values you don’t recognize as a generic skip. Affected servers are absent from `mcp_servers`. The key is omitted when there are no errors, so a CI gate can fail on a non-empty array. Requires Claude Code v2.1.219 or later
+
+When you run the command by hand in a terminal, Claude Code also prints a startup warning to stderr, such as `Warning: 1 MCP server skipped due to invalid config:`, followed by the reason for each skipped entry. When you redirect stderr, or when a program such as a CI runner or an SDK host captures it, Claude Code prints no warning and reports the skipped entries only in the `mcp_server_errors` field. The warning requires Claude Code v2.1.219 or later.
+
+####
+
+
+
+Track plugin installs
When [`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`](</docs/en/env-vars>) is set, Claude Code emits `system/plugin_install` events while marketplace plugins install before the first turn. Use these to surface install progress in your own UI.
@@ -178,8 +223,6 @@
`uuid`| string| unique event identifier
`session_id`| string| session the event belongs to
-For programmatic streaming with callbacks and message objects, see [Stream responses in real-time](</docs/en/agent-sdk/streaming-output>) in the Agent SDK documentation.
-
###
Show diff (103 lines)
--- a/hooks.md
+++ b/hooks.md
@@ -23,7 +23,7 @@
`UserPromptSubmit`| When you submit a prompt, before Claude processes it
`UserPromptExpansion`| When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion
`PreToolUse`| Before a tool call executes. Can block it
-`PermissionRequest`| When a permission dialog appears
+`PermissionRequest`| When a tool call needs a permission decision
`PermissionDenied`| When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call
`PostToolUse`| After a tool call succeeds
`PostToolUseFailure`| After a tool call fails
@@ -75,7 +75,7 @@
}
}
-The script reads the JSON input from stdin, extracts the command, and returns a `permissionDecision` of `"deny"` if it contains `rm -rf`:
+The script reads the JSON input from stdin, extracts the command, and returns a `permissionDecision` of `"deny"` if it contains `rm -rf`. Save it to `.claude/hooks/block-rm.sh` in your project:
#!/bin/bash
# .claude/hooks/block-rm.sh
@@ -93,7 +93,7 @@
exit 0 # no decision; normal permission flow applies
fi
-This script and the Bash examples on this page that parse JSON input use `jq`, so install `jq` and make sure it is on your `PATH` before trying them. Now suppose Claude Code decides to run `Bash "rm -rf /tmp/build"`. Here’s what happens:
+On macOS and Linux, make the script executable with `chmod +x .claude/hooks/block-rm.sh` so Claude Code can run it. On Windows, write the hook in PowerShell instead and register it with `"command": "powershell.exe"`, as shown in the MessageDisplay example. This script and the Bash examples on this page that parse JSON input use `jq`, so install `jq` and make sure it is on your `PATH` before trying them. Now suppose Claude Code decides to run `Bash "rm -rf /tmp/build"`. Here’s what happens:
1
@@ -167,7 +167,7 @@
---|---|---
`~/.claude/settings.json`| All your projects| No, local to your machine
`.claude/settings.json`| Single project| Yes, can be committed to the repo
-`.claude/settings.local.json`| Single project| No, gitignored when Claude Code creates it
+`.claude/settings.local.json`| Single project| No, gitignored when Claude Code saves a setting to it
Managed policy settings| Organization-wide| Yes, admin-controlled
[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
@@ -306,7 +306,7 @@
---|---|---
`type`| yes| `"command"`, `"http"`, `"mcp_tool"`, `"prompt"`, or `"agent"`
`if`| no| Permission rule syntax to filter when this hook runs, such as `"Bash(git *)"` or `"Edit(*.ts)"`. The hook command only runs if the tool call matches the pattern. See the Bash matching table below for how Bash patterns evaluate against subcommands, `$()`, and backticks. Only evaluated on tool events: `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest`, and `PermissionDenied`. On other events, a hook with `if` set never runs. Uses the same syntax as [permission rules](</docs/en/permissions>)
-`timeout`| no| Seconds before canceling. Defaults: 600 for `command`, `http`, and `mcp_tool`; 30 for `prompt`; 60 for `agent`. `UserPromptSubmit` lowers the `command`, `http`, and `mcp_tool` default to 30, and `MessageDisplay` lowers it to 10
+`timeout`| no| Seconds before canceling. Defaults: 600 for `command`, `http`, and `mcp_tool`; 30 for `prompt`; 60 for `agent`. `UserPromptSubmit` lowers the `command`, `http`, and `mcp_tool` default to 30, and `MessageDisplay` lowers it to 10. `SessionEnd` hooks share a 1.5-second budget; if your settings set a longer per-hook `timeout`, Claude Code raises the budget to match, up to 60 seconds
`statusMessage`| no| Custom spinner message displayed while the hook runs
`once`| no| If `true`, runs once per session then is removed. Only honored for hooks declared in skill frontmatter; ignored in settings files and agent frontmatter
@@ -536,12 +536,12 @@
Type `/hooks` in Claude Code to open a read-only browser for your configured hooks. The menu shows every hook event with a count of configured hooks, lets you drill into matchers, and shows the full details of each hook handler. Use it to verify configuration, check which settings file a hook came from, or inspect a hook’s command, prompt, or URL. The menu displays all five hook types: `command`, `prompt`, `agent`, `http`, and `mcp_tool`. Each hook is labeled with a `[type]` prefix and a source indicating where it was defined:
- * `User`: from `~/.claude/settings.json`
- * `Project`: from `.claude/settings.json`
- * `Local`: from `.claude/settings.local.json`
- * `Plugin`: from a plugin’s `hooks/hooks.json`
- * `Session`: registered in memory for the current session
- * `Built-in`: registered internally by Claude Code
+ * `User Settings`: from `~/.claude/settings.json`
+ * `Project Settings`: from `.claude/settings.json`
+ * `Local Settings`: from `.claude/settings.local.json`
+ * `Plugin Hooks`: from a plugin’s `hooks/hooks.json`
+ * `Session Hooks`: registered in memory for the current session
+ * `Built-in Hooks`: registered internally by Claude Code
Selecting a hook opens a detail view showing its event, matcher, type, source file, and the full command, prompt, or URL. The menu is read-only: to add, modify, or remove hooks, edit the settings JSON directly or ask Claude to make the change.
@@ -617,7 +617,8 @@
#!/bin/bash
# Reads JSON input from stdin, checks the command
- command=$(jq -r '.tool_input.command' < /dev/stdin)
+ input=$(cat)
+ command=$(jq -r '.tool_input.command' <<<"$input")
if [[ "$command" == rm* ]]; then
echo "Blocked: rm commands are not allowed" >&2
@@ -982,7 +983,7 @@
`init`| `claude --init-only` or `claude -p --init`
`maintenance`| `claude -p --maintenance`
-`--init-only` runs Setup hooks and `SessionStart` hooks with the `startup` matcher, then exits without starting a conversation. `--init` and `--maintenance` fire Setup hooks only when combined with `-p`; in an interactive session those two flags don’t currently fire Setup hooks. On success, `--init-only` prints nothing to the terminal. To confirm the hooks ran, start with `claude --debug-file <path> --init-only`, replacing `<path>` with a log file location, and check the log for the Setup and SessionStart hook entries. Because Setup doesn’t fire on every launch, a plugin that needs a dependency installed can’t rely on Setup alone. The practical pattern is to check for the dependency on first use and install on miss, for example a hook or skill that tests for `${CLAUDE_PLUGIN_DATA}/node_modules` and runs `npm install` if absent. See the [persistent data directory](</docs/en/plugins-reference#persistent-data-directory>) for where to store installed dependencies.
+When you run `claude --init-only`, Claude Code runs Setup hooks and `SessionStart` hooks with the `startup` matcher, then exits without starting a conversation. `--init` and `--maintenance` fire Setup hooks only when you combine them with `-p`. In an interactive session, those two flags don’t currently fire Setup hooks. When you start or continue a conversation with `-p`, you also need to supply a prompt, as an argument or piped on stdin. You can skip the prompt when a `SessionStart` hook supplies `initialUserMessage` or when you resume a session with a deferred tool call. On success, `--init-only` prints nothing to the terminal. To confirm the hooks ran, start with `claude --debug-file <path> --init-only`, replacing `<path>` with a log file location, and check the log for the Setup and SessionStart hook entries. Because Setup doesn’t fire on every launch, a plugin that needs a dependency installed can’t rely on Setup alone. The practical pattern is to check for the dependency on first use and install on miss, for example a hook or skill that tests for `${CLAUDE_PLUGIN_DATA}/node_modules` and runs `npm install` if absent. See the [persistent data directory](</docs/en/plugins-reference#persistent-data-directory>) for where to store installed dependencies.
####
@@ -1515,7 +1516,7 @@
PermissionRequest
-Runs when the user is shown a permission dialog. Use PermissionRequest decision control to allow or deny on behalf of the user. Matches on tool name, same values as PreToolUse.
+Runs when Claude Code is about to ask you for permission. In sessions that can’t show a prompt, such as background subagents in [non-interactive mode](</docs/en/headless>), Claude Code still runs these hooks, and if no hook returns a decision, it denies the tool call. Use PermissionRequest decision control to allow or deny on behalf of the user. Matches on tool name, same values as PreToolUse.
####
@@ -1523,7 +1524,7 @@
PermissionRequest input
-PermissionRequest hooks receive `tool_name` and `tool_input` fields like PreToolUse hooks, but without `tool_use_id`. An optional `permission_suggestions` array contains the “always allow” options the user would normally see in the permission dialog. The difference from PreToolUse is when the hook fires: PermissionRequest hooks run when a permission dialog is about to be shown to the user, while PreToolUse hooks run before tool execution regardless of permission status. Neither event fires for [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>).
+PermissionRequest hooks receive `tool_name` and `tool_input` fields like PreToolUse hooks, but without `tool_use_id`. An optional `permission_suggestions` array contains the “always allow” options the user would normally see in the permission dialog. PreToolUse hooks run before every tool call, whether or not it needs permission. PermissionRequest hooks run only when Claude Code is about to ask you for permission, or when it would otherwise auto-deny a call that can’t prompt. Neither event fires for [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>).
{
"session_id": "abc123",
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -184,7 +184,7 @@
}
}
-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.
+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.
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/>).
@@ -249,6 +249,12 @@
}
}
+4
+
+Test the hook
+
+Ask Claude to add a comment to your `.env` file. Claude Code blocks the edit before it runs and passes the script’s `Blocked:` message to Claude as feedback.
+
###
@@ -299,7 +305,7 @@
}
}
-The matcher filters by configuration type: `user_settings`, `project_settings`, `local_settings`, `policy_settings`, or `skills`. To block a change from taking effect, exit with code 2 or return `{"decision": "block"}`. See the [ConfigChange reference](</docs/en/hooks#configchange>) for the full input schema.
+The matcher filters by configuration type: `user_settings`, `project_settings`, `local_settings`, `policy_settings`, or `skills`. To block a change from taking effect, exit with code 2 or return `{"decision": "block"}`. See the [ConfigChange reference](</docs/en/hooks#configchange>) for the full input schema. To confirm the hook records changes, edit a settings file in another editor while a session is running, then open `~/claude-config-audit.log`: the hook appends one JSON line per change with the timestamp, source, and file path.
###
@@ -360,7 +366,7 @@
Auto-approve specific permission prompts
-Skip the approval dialog for tool calls you always allow. This example auto-approves `ExitPlanMode`, the tool Claude calls when it finishes presenting a plan and asks to proceed, so you aren’t prompted every time a plan is ready. Unlike the exit-code examples above, auto-approval requires your hook to write a JSON decision to stdout. A `PermissionRequest` hook fires when Claude Code is about to show a permission dialog, and returning `"behavior": "allow"` answers it on your behalf. The matcher scopes the hook to `ExitPlanMode` only, so no other prompts are affected. Add this to `~/.claude/settings.json`:
+Skip the approval dialog for tool calls you always allow. This example auto-approves `ExitPlanMode`, the tool Claude calls when it finishes presenting a plan and asks to proceed, so you aren’t prompted every time a plan is ready. Unlike the exit-code examples above, auto-approval requires your hook to write a JSON decision to stdout. A `PermissionRequest` hook fires when Claude Code is about to ask you for permission, and returning `"behavior": "allow"` answers the request on your behalf. The matcher scopes the hook to `ExitPlanMode` only, so no other prompts are affected. Add this to `~/.claude/settings.json`:
{
"hooks": {
@@ -413,7 +419,7 @@
`UserPromptSubmit`| When you submit a prompt, before Claude processes it
`UserPromptExpansion`| When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion
`PreToolUse`| Before a tool call executes. Can block it
-`PermissionRequest`| When a permission dialog appears
+`PermissionRequest`| When a tool call needs a permission decision
`PermissionDenied`| When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call
`PostToolUse`| After a tool call succeeds
`PostToolUseFailure`| After a tool call fails
@@ -725,7 +731,7 @@
---|---|---
`~/.claude/settings.json`| All your projects| No, local to your machine
`.claude/settings.json`| Single project| Yes, can be committed to the repo
-`.claude/settings.local.json`| Single project| No, gitignored when Claude Code creates it
+`.claude/settings.local.json`| Single project| No, gitignored when Claude Code saves a setting to it
Managed policy settings| Organization-wide| Yes, admin-controlled
[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 skill or agent is active| Yes, defined in the component file
@@ -842,8 +848,11 @@
* `command`, `http`, `mcp_tool`: 10 minutes. `UserPromptSubmit` lowers these to 30 seconds, and `MessageDisplay` lowers them to 10 seconds.
* `prompt`: 30 seconds.
* `agent`: 60 seconds.
+ * [`SessionEnd`](</docs/en/hooks#sessionend>) hooks of any type share a 1.5-second budget. If your settings set a longer per-hook `timeout`, Claude Code raises the budget to match, up to 60 seconds.
* `PostToolUse` hooks can’t undo actions since the tool has already executed.
- * `PermissionRequest` hooks don’t fire in [non-interactive mode](</docs/en/headless>) with the `-p` flag. Use `PreToolUse` hooks for automated permission decisions.
+ * `PermissionRequest` hooks fire when Claude Code is about to ask you for permission.
+ * In [non-interactive mode](</docs/en/headless>) with the `-p` flag, that prompt only exists when the Agent SDK’s [`canUseTool` callback](</docs/en/agent-sdk/permissions>) supplies it. In plain `-p` runs or with `--permission-prompt-tool`, use `PreToolUse` hooks for automated permission decisions instead.
+ * Background subagents can’t show a prompt in non-interactive mode. Claude Code still runs the hooks for their tool calls, and if no hook returns a decision, it denies the call. In an interactive session, background subagent prompts surface in your main session and the hooks fire as usual.
* `Stop` hooks fire whenever Claude finishes responding, not only at task completion. They don’t fire on user interrupts. API errors fire [StopFailure](</docs/en/hooks#stopfailure>) instead.
* When multiple `PreToolUse` hooks return [`updatedInput`](</docs/en/hooks#pretooluse>) to rewrite a tool’s arguments, the last one to finish takes effect. Since hooks run in parallel, the order is non-deterministic. Avoid having more than one hook modify the same tool’s input.
@@ -866,7 +875,7 @@
* Run `/hooks` and confirm the hook appears under the correct event
* Check that the matcher pattern matches the tool name exactly. Matchers are case-sensitive
* Verify you’re triggering the right event type: `PreToolUse` fires before tool execution, `PostToolUse` fires after
- * If using `PermissionRequest` hooks in non-interactive mode with the `-p` flag, switch to `PreToolUse` instead
+ * In non-interactive mode with the `-p` flag, `PermissionRequest` hooks fire only when the Agent SDK’s `canUseTool` callback supplies the prompt, or for tool calls inside background subagents. In plain `-p` runs or with `--permission-prompt-tool`, use `PreToolUse` hooks instead
###
--- a/hosting.md
+++ b/hosting.md
@@ -48,7 +48,11 @@
Ephemeral sessions
-Create a container for each user task and destroy it when the task completes. Best for one-off tasks. The user may still interact with the AI while the task is completing, but once completed the container is destroyed. Example workloads include bug investigation and fix, invoice and receipt extraction, document translation, and media transformation. The container runs a one-shot entrypoint that calls the SDK and exits. The example below shows a minimal TypeScript version. Save it as `entrypoint.mts` or set `"type": "module"` in `package.json` so top-level `await` is available.
+Create a container for each user task and destroy it when the task completes. Best for one-off tasks. The user may still interact with the AI while the task is completing, but once completed the container is destroyed. Example workloads include bug investigation and fix, invoice and receipt extraction, document translation, and media transformation. The container runs a one-shot entrypoint that calls the SDK and exits. In TypeScript, save the file as `entrypoint.mts` or set `"type": "module"` in `package.json` so top-level `await` is available.
+
+TypeScript
+
+Python
import { query } from "@anthropic-ai/claude-agent-sdk";
@@ -56,6 +60,20 @@
for await (const message of query({ prompt, options: { maxTurns: 20 } })) {
console.log(message);
}
+
+ import asyncio
+ import os
+
+ from claude_agent_sdk import ClaudeAgentOptions, query
+
+ async def main():
+ async for message in query(
+ prompt=os.environ["TASK_PROMPT"],
+ options=ClaudeAgentOptions(max_turns=20),
+ ):
+ print(message)
+
+ asyncio.run(main())
###
@@ -227,7 +245,7 @@
Three auth concerns matter at hosting time:
- * **Anthropic API** : the subprocess reads `ANTHROPIC_API_KEY` from its environment. Supply it from your secret manager, or set `ANTHROPIC_BASE_URL` to route model calls through a proxy that injects the key outside the container. See [Credential management](</docs/en/agent-sdk/secure-deployment#credential-management>) for the proxy pattern and the [SDK overview](</docs/en/agent-sdk/overview#get-started>) for supported authentication methods.
+ * **Anthropic API** : the subprocess reads `ANTHROPIC_API_KEY` from its environment. Supply it from your secret manager, or set `ANTHROPIC_BASE_URL` to route model calls through a proxy that injects the key outside the container. See [Credential management](</docs/en/agent-sdk/secure-deployment#credential-management>) for the proxy pattern and [Setup in the SDK quickstart](</docs/en/agent-sdk/quickstart#setup>) for supported authentication methods.
* **Inbound** : put authentication at a gateway in front of the agent container. The agent should receive pre-authenticated requests and should not be the component that validates user tokens.
* **Outbound tools** : keep tool credentials out of the agent environment. Route outbound calls through a proxy that injects API keys after the request leaves the container. The agent makes the call; the proxy adds the credential.
--- a/interactive-mode.md
+++ b/interactive-mode.md
@@ -202,7 +202,7 @@
`,`| Repeat last f/F/t/T motion in reverse
`/`| Open reverse history search, same as `Ctrl+R`. As of v2.1.191, the empty search prompt shows a hint: press `Esc` then `i` then `/` to open the command menu instead
-In vim normal mode, if the cursor is at the beginning or end of input and can’t move further, `j`/`k` and the arrow keys navigate command history instead.
+In vim NORMAL mode, if the cursor is at the beginning or end of input and can’t move further, `j`/`k` and `↑`/`↓` navigate command history instead. `←` on an empty prompt opens [agent view](</docs/en/agent-view>) from NORMAL mode as well as INSERT; before v2.1.219, `←` on an empty prompt did nothing in NORMAL mode.
###
--- a/large-codebases.md
+++ b/large-codebases.md
@@ -134,7 +134,7 @@
Exclude irrelevant CLAUDE.md files
-When you start Claude from the repository root, each subdirectory’s CLAUDE.md loads as soon as Claude reads a file in that directory. The `claudeMdExcludes` setting skips specific files by path or glob pattern so they never load. Use this for directories you never work in, such as other teams’ packages, legacy code, or vendored subtrees. The exclusion list is static, not a per-task switch. To focus on one package today and another tomorrow, start Claude from that package’s directory instead of editing exclusions. If you only want these exclusions for yourself, put the setting in `.claude/settings.local.json`. Claude Code gitignores that file when it creates it; since you’re creating it by hand here, add it to your gitignore. Patterns use glob syntax matched against absolute file paths, so start relative-style patterns with `**/` to match anywhere in the tree. The example below excludes a package owned by another team:
+When you start Claude from the repository root, each subdirectory’s CLAUDE.md loads as soon as Claude reads a file in that directory. The `claudeMdExcludes` setting skips specific files by path or glob pattern so they never load. Use this for directories you never work in, such as other teams’ packages, legacy code, or vendored subtrees. The exclusion list is static, not a per-task switch. To focus on one package today and another tomorrow, start Claude from that package’s directory instead of editing exclusions. If you only want these exclusions for yourself, put the setting in `.claude/settings.local.json`. Claude Code adds that file to your global gitignore when it saves a setting there. Since you are creating it by hand here, add it to your gitignore yourself. Patterns use glob syntax matched against absolute file paths, so start relative-style patterns with `**/` to match anywhere in the tree. The example below excludes a package owned by another team:
.claude/settings.local.json
@@ -340,7 +340,7 @@
With skills spread across many directories, the list Claude chooses from can grow large. Claude picks a skill by reading every discovered skill’s name and description, and only the chosen skill’s full content loads into context. This section covers how to keep that list small and write descriptions that survive shortening. Which skills are in scope depends on where you start Claude:
* **From a subdirectory such as`packages/api/`**: skills from that directory, every parent up to the repository root, and the user and enterprise levels
- * **From the repository root** : skills from every subdirectory Claude touches during the session, which can accumulate into the hundreds
+ * **From the repository root** : root skills, plus skills from every subdirectory Claude touches during the session, which can accumulate into the hundreds
* **After adding a sibling with`--add-dir`**: that sibling’s skills load too. The `additionalDirectories` setting grants file access only and does not load skills
Names always load, but [descriptions are shortened when there are many](</docs/en/skills#skill-descriptions-are-cut-short>), which can strip the keywords Claude uses to decide whether a skill applies. Keep descriptions short and lead with words a request would contain, like “writing or modifying tests in `packages/api/`”. For skills that many directories share, such as PR conventions or a deploy checklist, place them in the repository root’s `.claude/skills/` so they load from any starting directory. When shared skills need their own version history or must work across repositories, package them as a [plugin](</docs/en/plugins>) instead. Plugin skills use a `plugin-name:skill-name` namespace, so they never collide with per-directory skills. A platform team can version and update them in one place. To find which skills go unused, enable the OpenTelemetry [logs exporter](</docs/en/monitoring-usage>) and set `OTEL_LOG_TOOL_DETAILS=1` so skill names are recorded verbatim instead of redacted. The [`skill_activated` event](</docs/en/monitoring-usage#skill-activated-event>) records every invocation in its `skill.name` attribute, and `invocation_trigger` records whether a command, Claude, or a nested skill invoked it, which tells you what to consolidate or retire.
--- a/llm-gateway-connect.md
+++ b/llm-gateway-connect.md
@@ -106,7 +106,7 @@
To make the configuration apply everywhere Claude Code runs, including [background agents](</docs/en/agent-view#how-background-sessions-are-hosted>), set the variables in the `env` block of a [settings file](</docs/en/settings>) instead of relying on your shell. Settings files have different scopes:
* `~/.claude/settings.json` applies to all your projects. On Windows the path is `%USERPROFILE%\.claude\settings.json`
- * `.claude/settings.local.json` applies to one project. Claude Code adds it to your gitignore when it creates the file; if you create it yourself, add it to your gitignore manually first so you don’t accidentally commit your credential
+ * `.claude/settings.local.json` applies to one project. Claude Code adds it to your global gitignore when it saves a setting there; if you create it by hand or have Claude write it, add it to your gitignore yourself first so you don’t accidentally commit your credential
Don’t put the credential in a project’s `.claude/settings.json`. That file is committed and shared with everyone who clones the repository.
@@ -317,7 +317,7 @@
Add gateway models to the model picker
-Model discovery queries the gateway for its model list at startup and adds those names to the `/model` picker alongside the built-in entries. Enable it if your gateway serves model names that aren’t in Claude Code’s built-in list and you want to select them from the picker. If the built-in models are what you use, you don’t need discovery; your administrator may also have already enabled it through managed settings. To enable it, set `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` in your shell or in the `env` block of `~/.claude/settings.json`. Discovery requires Claude Code v2.1.129 or later. Discovered models appear as additional `/model` entries labeled `From gateway`. To confirm discovery ran, start `claude --debug` and look for the `[gatewayDiscovery]` lines: a success logs how many models were cached, and a `404`, timeout, or redirect is recorded there too. For when discovery runs, what it filters, and the response format gateways serve, see the [model discovery reference](</docs/en/llm-gateway-protocol#model-discovery>).
+Model discovery queries the gateway for its model list at startup and adds those names to the `/model` picker alongside the built-in entries. Enable it if your gateway serves model names that aren’t in Claude Code’s built-in list and you want to select them from the picker. If the built-in models are what you use, you don’t need discovery; your administrator may also have already enabled it through managed settings. To enable it, set `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` in your shell or in the `env` block of `~/.claude/settings.json`. Discovery requires Claude Code v2.1.129 or later. Discovered models appear as additional `/model` entries labeled `From gateway`. To confirm discovery ran, start `claude --debug` and look for the `[gatewayDiscovery]` lines in the debug log at `~/.claude/debug/<session-id>.txt`: a success logs how many models were cached, and a `404`, timeout, or redirect is recorded there too. For when discovery runs, what it filters, and the response format gateways serve, see the [model discovery reference](</docs/en/llm-gateway-protocol#model-discovery>).
###
--- a/llm-gateway-protocol.md
+++ b/llm-gateway-protocol.md
@@ -108,7 +108,10 @@
* Keep the block in its own array entry: the endpoint treats a merged block that starts with the attribution header as attribution in its entirety and drops everything merged into it, including the rest of the system prompt.
* If your gateway must reshape system content, set [`CLAUDE_CODE_ATTRIBUTION_HEADER=0`](</docs/en/env-vars>) so Claude Code omits the block. Anthropic and the cloud providers’ Claude endpoints read the block for attribution, so omit it at the client rather than stripping or moving it in the gateway.
-Requests that reach the endpoint unmodified are unaffected. From Claude Code v2.1.181, the block is stable for the lifetime of a conversation when requests route through a custom base URL, so a gateway-side prompt cache keyed on the full request body works without disabling it. Before v2.1.181 the block included a per-request token; on those versions, set `CLAUDE_CODE_ATTRIBUTION_HEADER=0` if your gateway implements such a cache.
+Requests that reach the endpoint unmodified are unaffected. From Claude Code v2.1.181, the block is stable for the lifetime of a conversation when requests route through a custom base URL, so a gateway-side prompt cache keyed on the full request body works without disabling it, and any provider your gateway forwards to receives a stable prompt prefix. Before v2.1.181 the block included a per-request token that changed the start of the system prompt on every request. On those versions, set `CLAUDE_CODE_ATTRIBUTION_HEADER=0` when your gateway does either of these:
+
+ * Implements a prompt cache keyed on the request body.
+ * Forwards requests to a third-party provider such as Amazon Bedrock, Microsoft Foundry, or Google Cloud’s Agent Platform, in the Anthropic Messages format or the provider’s own, where the changing prefix reduces prompt-cache reuse on that provider.
##
@@ -191,7 +194,7 @@
Picker entries and caching
-The picker is the interactive model list that opens when a developer runs `/model` in Claude Code. Each discovered entry is labeled “From gateway” and uses `display_name` when provided. The [`availableModels` managed setting](</docs/en/settings#available-settings>) bounds what discovery can add. A discovered ID is skipped when it exactly matches a row already in the picker, or when both the discovered and existing IDs resolve to [Fable](</docs/en/model-config#work-with-fable-5>). As of Claude Code v2.1.197, a discovered explicit ID is also folded into a built-in entry when both resolve to the same model. Built-in rows are keyed on aliases such as `sonnet`, so a discovered explicit ID of the model the alias currently resolves to, such as `claude-sonnet-5`, collapses into the `sonnet` row, while an ID the alias doesn’t resolve to, such as `claude-sonnet-4-6`, still adds its own “From gateway” row alongside the built-in entry. Results are cached to `~/.claude/cache/gateway-models.json`, or `%USERPROFILE%\.claude\cache\gateway-models.json` on Windows, and refreshed on each startup. If the request fails or the gateway doesn’t implement `/v1/models`, the picker falls back to the cached list from the previous startup or to the built-in model list. If your gateway serves Claude models under aliases that don’t match the discovery filter, developers can add those aliases manually with the [model configuration](</docs/en/model-config>) variables.
+The picker is the interactive model list that opens when a developer runs `/model` in Claude Code. Each discovered entry is labeled “From gateway” and uses `display_name` when provided. The [`availableModels` managed setting](</docs/en/settings#available-settings>) bounds what discovery can add. A discovered ID is skipped when it exactly matches a row already in the picker, or when both the discovered and existing IDs resolve to [Fable](</docs/en/model-config#work-with-fable-5>). As of Claude Code v2.1.197, a discovered explicit ID is also folded into a built-in entry when both resolve to the same model. Built-in rows are keyed on aliases such as `sonnet`, so a discovered explicit ID of the model the alias currently resolves to, such as `claude-sonnet-5`, collapses into the `sonnet` row, while an ID the alias doesn’t resolve to, such as `claude-sonnet-4-6`, still adds its own “From gateway” row alongside the built-in entry. Results are cached to `~/.claude/cache/gateway-models.json`, or `%USERPROFILE%\.claude\cache\gateway-models.json` on Windows, and refreshed on each startup. If you set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>), the cache lives under that directory instead. If the request fails or the gateway doesn’t implement `/v1/models`, the picker falls back to the cached list from the previous startup or to the built-in model list. If your gateway serves Claude models under aliases that don’t match the discovery filter, developers can add those aliases manually with the [model configuration](</docs/en/model-config>) variables.
##
Show diff (144 lines)
--- a/mcp.md
+++ b/mcp.md
@@ -81,6 +81,8 @@
The SSE (Server-Sent Events) transport is deprecated. Use HTTP servers instead, where available.
+Some services still expose only an SSE endpoint. Use the same command as the HTTP transport, with `--transport sse`:
+
# Basic syntax
claude mcp add --transport sse <name> <url>
@@ -138,21 +140,21 @@
claude mcp list
# Get details for a specific server
- claude mcp get github
+ claude mcp get notion
# Remove a server
- claude mcp remove github
+ claude mcp remove notion
# (within Claude Code) Check server status
/mcp
-Project-scoped servers from `.mcp.json` that are awaiting your approval appear in `claude mcp list` and `claude mcp get <name>` as `⏸ Pending approval (run `claude` to approve)`. Run `claude` interactively to review and approve them. `claude mcp get <name>` shows rejected servers as `✘ Rejected (see disabledMcpjsonServers in settings)`. As of v2.1.196, `claude mcp list` and `claude mcp get` read `.mcp.json` approvals only from settings files that aren’t checked into the repository until you trust the workspace by running `claude` in it and accepting the workspace trust dialog. A cloned repository can’t approve its own servers: [`enableAllProjectMcpServers` or `enabledMcpjsonServers`](</docs/en/settings#available-settings>) committed to the project’s `.claude/settings.json` is ignored in an untrusted folder, and the server stays at `⏸ Pending approval` instead of being connected and health-checked. Approvals from these sources still apply in an untrusted folder:
+`claude mcp add` confirms a successful add by printing an `Added ...` line, which means the configuration was written. `claude mcp list` then shows a health status next to each server it lists, such as `✔ Connected`, `! Needs authentication`, or `✘ Failed to connect`. A failure status means Claude Code couldn’t connect to that server, not that the list command failed. Project-scoped servers from `.mcp.json` that are awaiting your approval appear in `claude mcp list` and `claude mcp get <name>` as `⏸ Pending approval (run `claude` to approve)`. Run `claude` interactively to review and approve them. `claude mcp get <name>` shows rejected servers as `✘ Rejected (see disabledMcpjsonServers in settings)`. WebSocket servers don’t appear in `claude mcp list` output. Use `claude mcp get <name>` or the `/mcp` panel to check them. As of v2.1.196, `claude mcp list` and `claude mcp get` read `.mcp.json` approvals only from settings files that aren’t checked into the repository until you trust the workspace by running `claude` in it and accepting the workspace trust dialog. A cloned repository can’t approve its own servers: [`enableAllProjectMcpServers` or `enabledMcpjsonServers`](</docs/en/settings#available-settings>) committed to the project’s `.claude/settings.json` is ignored in an untrusted folder, and the server stays at `⏸ Pending approval` instead of being connected and health-checked. Approvals from these sources still apply in an untrusted folder:
* your user `~/.claude/settings.json`
* managed settings
* settings passed with `--settings`
-Approvals in an untracked `.claude/settings.local.json` also apply, but only after you accept a trust dialog for that folder or one of its parent directories: Claude Code runs git to check whether the file is tracked, and it runs that check only in a trusted folder. In a folder you’ve never trusted, the file’s approvals wait for the trust dialog unless the folder is your own configuration home: your home directory, or a directory whose `.claude` you’ve set as [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). Before v2.1.207, an untracked `.claude/settings.local.json` approved servers in a folder you’d never trusted. A `disabledMcpjsonServers` entry in any settings file still rejects the server. The `/mcp` panel shows the tool count next to each connected server and flags servers that advertise the tools capability but expose no tools. A remote server whose configuration has an empty `url` shows as `not configured` in `/mcp`, in `claude mcp list`, and in the [`/plugin`](</docs/en/plugins>) manager, and Claude Code doesn’t attempt to connect to it. A plugin can include a placeholder entry like this for a connector you configure later, so Claude Code doesn’t report it as an error or a setup issue. The server’s detail view in `/mcp` reads `No URL configured for this server`; set the entry’s `url` to connect it. Before v2.1.208, Claude Code reported an empty `url` as a configuration issue with a prompt to reconnect. If your request needs tools from a server that is still connecting in the background, Claude waits for that server before continuing. With tool search enabled, which is the default, the wait happens inside the `ToolSearch` call. In configurations without tool search, such as Google Cloud’s Agent Platform, a custom `ANTHROPIC_BASE_URL`, or `ENABLE_TOOL_SEARCH=false`, Claude uses the `WaitForMcpServers` tool instead. Some server names are reserved for Claude Code’s built-in servers: `workspace`, `claude-in-chrome`, `computer-use`, `Claude Preview`, and `Claude Browser`. If your configuration defines a server with a reserved name, Claude Code skips it at load time and shows a warning asking you to rename it. `claude mcp add` rejects a reserved name with an error. `Claude Preview` and `Claude Browser` both name the built-in server that the [Claude Code desktop app’s preview pane](</docs/en/desktop#preview-your-app>) uses. Before v2.1.205, `Claude Browser` wasn’t reserved, so a user-configured server could register under that name.
+Approvals in an untracked `.claude/settings.local.json` also apply, but only after you accept a trust dialog for that folder or one of its parent directories: Claude Code runs git to check whether the file is tracked, and it runs that check only in a trusted folder. In a folder you’ve never trusted, the file’s approvals wait for the trust dialog unless the folder is your own configuration home: your home directory, or a directory whose `.claude` you’ve set as [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>). Before v2.1.207, an untracked `.claude/settings.local.json` approved servers in a folder you’d never trusted. A `disabledMcpjsonServers` entry in any settings file still rejects the server. The `/mcp` panel shows the tool count next to each connected server and flags servers that advertise the tools capability but expose no tools. A remote server whose configuration has an empty `url` shows as `not configured` in `/mcp`, in `claude mcp list`, and in the [`/plugin`](</docs/en/plugins>) manager, and Claude Code doesn’t attempt to connect to it. A plugin can include a placeholder entry like this for a connector you configure later, so Claude Code doesn’t report it as an error or a setup issue. The server’s detail view in `/mcp` reads `No URL configured for this server`; set the entry’s `url` to connect it. Before v2.1.208, Claude Code reported an empty `url` as a configuration issue with a prompt to reconnect. If your request needs tools from a server that is still connecting in the background, Claude waits for that server before continuing. With tool search enabled, which is the default, the wait happens inside the `ToolSearch` call. In configurations without tool search, such as Google Cloud’s Agent Platform, a custom `ANTHROPIC_BASE_URL`, or `ENABLE_TOOL_SEARCH=false`, Claude uses the `WaitForMcpServers` tool instead. A Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) starts on the tool-search path rather than with `WaitForMcpServers`, since Claude Code discovers the deployment’s server-side rejection only from the API; after Claude Code switches that deployment to upfront loading, tools from a server that finishes connecting become available on Claude’s next request. Some server names are reserved for Claude Code’s built-in servers: `workspace`, `claude-in-chrome`, `computer-use`, `Claude Preview`, and `Claude Browser`. If your configuration defines a server with a reserved name, Claude Code skips it at load time and shows a warning asking you to rename it. `claude mcp add` rejects a reserved name with an error. `Claude Preview` and `Claude Browser` both name the built-in server that the [Claude Code desktop app’s preview pane](</docs/en/desktop#preview-your-app>) uses. Before v2.1.205, `Claude Browser` wasn’t reserved, so a user-configured server could register under that name.
###
@@ -263,7 +265,7 @@
* **Automatic lifecycle** : servers connect and disconnect at these points:
* At session startup, Claude Code connects the servers for enabled plugins automatically
- * If you enable or disable a plugin during a session, run `/reload-plugins` to connect or disconnect its MCP servers
+ * If you enable or disable a plugin during a session, run `/reload-plugins` to connect or disconnect its MCP servers. When you reload, Claude Code keeps the live connections of plugin servers whose configuration is unchanged, and does the same when you [replace the session’s MCP server list](</docs/en/agent-sdk/typescript#mcpsetserversresult>) from the Agent SDK without naming them. Before v2.1.210, Claude Code disconnected plugin-provided MCP servers that the new SDK server list didn’t name
* In [web sessions](</docs/en/claude-code-on-the-web>), an MCP call to a plugin server that isn’t connected yet, such as right after an idle session wakes, starts the server on demand and waits for it to connect. Before v2.1.211, plugin servers in a web session reconnected only when the next message started a turn, so MCP calls after an idle session woke failed until then
* **Path placeholders** : `${CLAUDE_PLUGIN_ROOT}` resolves to the plugin’s installation directory, `${CLAUDE_PLUGIN_DATA}` to its [persistent state](</docs/en/plugins-reference#persistent-data-directory>) directory, and `${CLAUDE_PROJECT_DIR}` to the stable project root. Substitution applies to:
* `stdio` servers: `command`, `args`, `env`
@@ -342,16 +344,15 @@
Project-scoped servers enable team collaboration by storing configurations in a `.mcp.json` file at your project’s root directory. This file is designed to be checked into version control, ensuring all team members have access to the same MCP tools and services. When you add a project-scoped server, Claude Code automatically creates or updates this file with the appropriate configuration structure.
# Add a project-scoped server
- claude mcp add --transport http paypal --scope project https://mcp.paypal.com/mcp
+ claude mcp add --transport http shared-server --scope project https://example.com/mcp
The resulting `.mcp.json` file follows a standardized format:
{
"mcpServers": {
"shared-server": {
- "command": "/path/to/server",
- "args": [],
- "env": {}
+ "type": "http",
+ "url": "https://example.com/mcp"
}
}
}
@@ -383,7 +384,7 @@
4. [Plugin-provided servers](</docs/en/plugins>)
5. claude.ai connectors
-The three scopes match duplicates by name. Plugins and connectors match by endpoint, so one that points at the same URL or command as a server above is treated as a duplicate.
+The three scopes match duplicates by name. Plugins and connectors match by endpoint, so one that points at the same URL or command as a server above is treated as a duplicate. If you open a local session in the [Desktop app’s Code tab](</docs/en/desktop#mcp-servers-from-the-claude-desktop-chat-app>) with the same stdio server name at the top level of `~/.claude.json` (user scope) and in `.mcp.json`, the Code tab uses the `~/.claude.json` definition.
###
@@ -432,13 +433,15 @@
Example: Monitor errors with Sentry
+Sentry’s remote MCP server gives Claude access to the errors your applications report to Sentry. It authenticates through OAuth rather than an API key, so you don’t pass a credential when you add it. If you already added the `sentry` server in the [MCP quickstart](</docs/en/mcp-quickstart>), skip this command: running `claude mcp add` again with the same server name at the same scope fails with `MCP server sentry already exists in local config`.
+
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
Authenticate with your Sentry account:
/mcp
-Then debug production issues:
+Follow the sign-in steps in your browser. Once you’re signed in, the `sentry` server shows `connected` in the `/mcp` menu. Then debug production issues:
What are the most common errors in the last 24 hours?
@@ -471,10 +474,12 @@
Example: Query your PostgreSQL database
+[DBHub](<https://github.com/bytebase/dbhub>), the `@bytebase/dbhub` package, is an MCP server that connects Claude to a relational database through the connection string you pass in `--dsn`. Use a read-only database user in the connection string so the queries Claude runs can’t modify data:
+
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
--dsn "postgresql://readonly:pass@prod.db.com:5432/analytics"
-Then query your database naturally:
+To confirm the server starts, run `/mcp` and check that `db` shows `connected`. Then query your database naturally:
What's our total revenue this month?
@@ -494,7 +499,7 @@
Add the server that requires authentication
-For example:
+If you already added this server in the Sentry example or the [MCP quickstart](</docs/en/mcp-quickstart>), skip this step: running `claude mcp add` again with the same server name at the same scope fails with `MCP server sentry already exists in local config`. Otherwise, run:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
@@ -849,7 +854,7 @@
# Start Claude as a stdio MCP server
claude mcp serve
-You can use this in Claude Desktop by adding this configuration to claude_desktop_config.json:
+The command prints nothing when it starts. A stdio MCP server communicates over stdin and stdout, so a silent, blocked terminal means the server is running and waiting for a client to connect. You can use this in Claude Desktop by adding this configuration to claude_desktop_config.json:
{
"mcpServers": {
@@ -1028,6 +1033,8 @@
Tool search keeps MCP context usage low by deferring tool definitions until Claude needs them. Only tool names and server instructions load at session start, so adding more MCP servers has minimal impact on your context window. Claude Code doesn’t impose a fixed per-server tool cap; the practical limit is your context window budget.
+Tool search isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>), which reject it server-side: Claude Code detects the rejection and loads MCP tools upfront for that deployment instead. `ENABLE_TOOL_SEARCH` can’t override this, since the rejection comes from the deployment itself.
+
###
@@ -1060,8 +1067,8 @@
Value| Behavior
---|---
-(unset)| All MCP tools deferred and loaded on demand. Falls back to loading upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` is a non-first-party host
-`true`| All MCP tools deferred. Claude Code sends the beta header even on Google Cloud’s Agent Platform and through proxies. Requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that don’t support `tool_reference` blocks
+(unset)| All MCP tools deferred and loaded on demand. Falls back to loading upfront on Google Cloud’s Agent Platform, when `ANTHROPIC_BASE_URL` is a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure
+`true`| All MCP tools deferred, except on a Microsoft Foundry deployment hosted on Azure, where the server-side rejection still forces upfront loading. Claude Code sends the beta header even on Google Cloud’s Agent Platform and through proxies. Requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that don’t support `tool_reference` blocks
`auto`| Threshold mode: tools load upfront if they fit within 10% of the context window, deferred otherwise
`auto:N`| Threshold mode with a custom percentage, where `N` is 0-100. For example, `auto:5` for 5%
`false`| All MCP tools loaded upfront, no deferral
--- a/mobile.md
+++ b/mobile.md
@@ -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 create your first 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 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.
###
@@ -87,7 +87,8 @@
Related resources
* [Platforms and integrations](</docs/en/platforms>): compare every surface Claude Code runs on
- * [Claude Code on the web](</docs/en/claude-code-on-the-web>): how cloud sessions run, network access, and moving work to and from your terminal
+ * [Claude Code on the web](</docs/en/claude-code-on-the-web>): how cloud sessions run and how to move work to and from your terminal
+ * [Configure cloud environments](</docs/en/cloud-environments>): network access levels, environment variables, and setup scripts for cloud sessions
* [Remote Control](</docs/en/remote-control>): continue a local session from any device
* [Sessions from Dispatch](</docs/en/desktop#sessions-from-dispatch>): how Dispatch tasks become Code sessions in the Desktop app
* [Channels](</docs/en/channels>): ask Claude something from your phone via Telegram, Discord, or iMessage while the work runs on your machine
--- a/model-config.md
+++ b/model-config.md
@@ -547,7 +547,7 @@
`ANTHROPIC_DEFAULT_OPUS_MODEL`| The model to use for `opus`, or for `opusplan` when Plan Mode is active.
`ANTHROPIC_DEFAULT_SONNET_MODEL`| The model to use for `sonnet`, or for `opusplan` when Plan Mode is not active.
`ANTHROPIC_DEFAULT_HAIKU_MODEL`| The model to use for `haiku`, or [background functionality](</docs/en/costs#background-token-usage>)
-`CLAUDE_CODE_SUBAGENT_MODEL`| The model to use for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and the agents a [workflow](</docs/en/workflows>) runs. Accepts an alias such as `haiku` or a full model name, and overrides the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. Set to `inherit` to use normal model resolution instead
+`CLAUDE_CODE_SUBAGENT_MODEL`| The model Claude Code uses for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and agents in a [workflow](</docs/en/workflows>). Accepts an alias such as `haiku` or a full model name, and overrides the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. Set to `inherit` to use normal model resolution instead
Note: `ANTHROPIC_SMALL_FAST_MODEL` is deprecated in favor of `ANTHROPIC_DEFAULT_HAIKU_MODEL`.
@@ -592,7 +592,7 @@
Environment variable| Description
---|---
`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. Defaults to the model ID when not set
-`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. Defaults to `Custom Opus model` when not set
+`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, defaults to `Custom Opus model`, or `Custom Opus model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on
`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of capabilities the pinned Opus model supports
The same `_NAME`, `_DESCRIPTION`, and `_SUPPORTED_CAPABILITIES` suffixes are available for `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_DEFAULT_FABLE_MODEL`, and `ANTHROPIC_CUSTOM_MODEL_OPTION`. Claude Code enables features like effort levels and extended thinking by matching the model ID against known patterns. Provider-specific IDs such as Amazon Bedrock ARNs or custom deployment names often don’t match these patterns, leaving supported features disabled. Set `_SUPPORTED_CAPABILITIES` to tell Claude Code which features the model actually supports:
Show diff (210 lines)
--- a/modifying-system-prompts.md
+++ b/modifying-system-prompts.md
@@ -88,25 +88,30 @@
// Now Claude has access to your project guidelines from CLAUDE.md
+ import asyncio
+
from claude_agent_sdk import query, ClaudeAgentOptions
messages = []
- async for message in query(
- prompt="Add a new React component for user profiles",
- options=ClaudeAgentOptions(
- system_prompt={
- "type": "preset",
- "preset": "claude_code", # Use Claude Code's system prompt
- },
- setting_sources=["project"], # Loads CLAUDE.md from project
- ),
- ):
- messages.append(message)
+ async def main():
+ async for message in query(
+ prompt="Add a new React component for user profiles",
+ options=ClaudeAgentOptions(
+ system_prompt={
+ "type": "preset",
+ "preset": "claude_code", # Use Claude Code's system prompt
+ },
+ setting_sources=["project"], # Loads CLAUDE.md from project
+ ),
+ ):
+ messages.append(message)
+
+ asyncio.run(main())
# Now Claude has access to your project guidelines from CLAUDE.md
-CLAUDE.md is persistent across all sessions in a project, shared with your team through git, and discovered automatically without code changes. It is not loaded if you pass an empty `settingSources` array.
+When you run either example, the SDK streams messages as Claude works: a system init message, assistant messages, user messages carrying tool results, and a final result message with the session outcome. CLAUDE.md is persistent across all sessions in a project, shared with your team through git, and discovered automatically without code changes. It is not loaded if you pass an empty `settingSources` array.
###
@@ -188,23 +193,28 @@
}
}
+ import asyncio
+
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage
messages = []
- async for message in query(
- prompt="Help me write a Python function to calculate fibonacci numbers",
- options=ClaudeAgentOptions(
- system_prompt={
- "type": "preset",
- "preset": "claude_code",
- "append": "Always include detailed docstrings and type hints in Python code.",
- }
- ),
- ):
- messages.append(message)
- if isinstance(message, AssistantMessage):
- print(message.content)
+ async def main():
+ async for message in query(
+ prompt="Help me write a Python function to calculate fibonacci numbers",
+ options=ClaudeAgentOptions(
+ system_prompt={
+ "type": "preset",
+ "preset": "claude_code",
+ "append": "Always include detailed docstrings and type hints in Python code.",
+ }
+ ),
+ ):
+ messages.append(message)
+ if isinstance(message, AssistantMessage):
+ print(message.content)
+
+ asyncio.run(main())
####
@@ -238,20 +248,25 @@
// ...
}
+ import asyncio
+
from claude_agent_sdk import query, ClaudeAgentOptions
- async for message in query(
- prompt="Triage the open issues in this repo",
- options=ClaudeAgentOptions(
- system_prompt={
- "type": "preset",
- "preset": "claude_code",
- "append": "You operate Acme's internal triage workflow. Label issues by component and severity.",
- "exclude_dynamic_sections": True,
- },
- ),
- ):
- ...
+ async def main():
+ async for message in query(
+ prompt="Triage the open issues in this repo",
+ options=ClaudeAgentOptions(
+ system_prompt={
+ "type": "preset",
+ "preset": "claude_code",
+ "append": "You operate Acme's internal triage workflow. Label issues by component and severity.",
+ "exclude_dynamic_sections": True,
+ },
+ ),
+ ):
+ ...
+
+ asyncio.run(main())
**Tradeoffs:** the working directory, the git-repo flag, the platform, the active shell, the OS version, and auto-memory paths still reach Claude, but as part of the first user message rather than the system prompt. Instructions in the user message carry marginally less weight than the same text in the system prompt, so Claude may rely on them less strongly when reasoning about the current directory or auto-memory paths. Enable this option when cross-session cache reuse matters more than maximally authoritative environment context. For the equivalent flag in non-interactive CLI mode, see [`--exclude-dynamic-system-prompt-sections`](</docs/en/cli-reference>).
@@ -291,6 +306,8 @@
}
}
+ import asyncio
+
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage
custom_prompt = """You are a Python coding specialist.
@@ -303,13 +320,18 @@
messages = []
- async for message in query(
- prompt="Create a data processing pipeline",
- options=ClaudeAgentOptions(system_prompt=custom_prompt),
- ):
- messages.append(message)
- if isinstance(message, AssistantMessage):
- print(message.content)
+ async def main():
+ async for message in query(
+ prompt="Create a data processing pipeline",
+ options=ClaudeAgentOptions(system_prompt=custom_prompt),
+ ):
+ messages.append(message)
+ if isinstance(message, AssistantMessage):
+ print(message.content)
+
+ asyncio.run(main())
+
+In Python, load a large custom prompt from a file with `system_prompt={"type": "file", "path": "..."}` instead of passing it as a string. The Python SDK passes a string prompt as one command-line argument to the CLI subprocess, so a prompt that exceeds the OS argument-length limit fails at process spawn before any API request is sent. On Linux the error is `Argument list too long`. See [`SystemPromptFile`](</docs/en/agent-sdk/python#systempromptfile>) for the platform thresholds and the Windows behavior.
##
@@ -438,28 +460,33 @@
messages.push(message);
}
+ import asyncio
+
from claude_agent_sdk import query, ClaudeAgentOptions
# Assuming "Code Reviewer" output style is active (via /config or settings)
# Add session-specific focus areas
messages = []
- async for message in query(
- prompt="Review this authentication module",
- options=ClaudeAgentOptions(
- system_prompt={
- "type": "preset",
- "preset": "claude_code",
- "append": """
- For this review, prioritize:
- - OAuth 2.0 compliance
- - Token storage security
- - Session management
- """,
- }
- ),
- ):
- messages.append(message)
+ async def main():
+ async for message in query(
+ prompt="Review this authentication module",
+ options=ClaudeAgentOptions(
+ system_prompt={
+ "type": "preset",
+ "preset": "claude_code",
+ "append": """
+ For this review, prioritize:
+ - OAuth 2.0 compliance
+ - Token storage security
+ - Session management
+ """,
+ }
+ ),
+ ):
+ messages.append(message)
+
+ asyncio.run(main())
##
--- a/monitoring-usage.md
+++ b/monitoring-usage.md
@@ -60,14 +60,16 @@
-Managed endpoints govern signal-specific endpoints
-
-A generic `OTEL_EXPORTER_OTLP_ENDPOINT` set in managed settings governs every signal’s endpoint. If a lower-precedence source, such as user settings or a shell export, sets a signal-specific endpoint like `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`, Claude Code removes that variable at startup and logs a warning, visible with `claude --debug`. Users can’t point one signal’s OTLP traffic at a different endpoint, so you don’t need to set the signal-specific endpoint variables in managed settings to prevent it. This applies only on machines where an administrator deploys managed settings with telemetry configured, and it changes where telemetry is delivered, not what Claude Code collects. A managed `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_EXPORTER_OTLP_CLIENT_KEY`, or `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` variable also governs the endpoint variables, since those credentials would otherwise accompany telemetry to a collector the managed settings didn’t choose. Two cases keep the normal per-key precedence:
-
- * Signal-specific variables set in the managed settings file itself still apply, so you can route one signal to a different collector by setting them there, as the SIEM example does.
- * The exporter selectors (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, and the beta `OTEL_TRACES_EXPORTER`) and the protocol variables follow per-key precedence, so a lower-precedence source can still change how a signal is exported. To make those authoritative too, set the signal-specific keys in managed settings directly.
-
-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.
+How managed settings lock the OTLP destination
+
+When you set an `OTEL_EXPORTER_OTLP_*` variable in managed settings, Claude Code removes conflicting developer-set variables at startup and logs a warning you can see with `claude --debug`. What it removes depends on which variable you set:
+
+ * **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.
+
+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.
##
@@ -81,14 +83,14 @@
Common configuration variables
-These variables configure exporters, endpoints, and export behavior for all deployments. A signal-specific variable overrides its generic counterpart, except that a generic endpoint or credential variable set in managed settings governs all signals’ endpoints and can’t be overridden from lower-precedence sources.
+These variables configure exporters, endpoints, and export behavior for all deployments. A per-signal variable overrides its generic counterpart. On machines with managed settings, see How managed settings lock the OTLP destination for what Claude Code removes.
Environment Variable| Description| Example Values
---|---|---
`CLAUDE_CODE_ENABLE_TELEMETRY`| Enables telemetry collection (required)| `1`
`OTEL_METRICS_EXPORTER`| Metrics exporter types, comma-separated. Use `none` to disable| `console`, `otlp`, `prometheus`, `none`
`OTEL_LOGS_EXPORTER`| Logs/events exporter types, comma-separated. Use `none` to disable| `console`, `otlp`, `none`
-`OTEL_EXPORTER_OTLP_PROTOCOL`| Protocol for OTLP exporter, applies to all signals| `grpc`, `http/json`, `http/protobuf`
+`OTEL_EXPORTER_OTLP_PROTOCOL`| Protocol for OTLP exporter, applies to all signals. Claude Code has no default protocol, so set this or the signal-specific protocol variable for each `otlp` exporter you enable| `grpc`, `http/json`, `http/protobuf`
`OTEL_EXPORTER_OTLP_ENDPOINT`| OTLP collector endpoint for all signals| `http://localhost:4317`
`OTEL_EXPORTER_OTLP_METRICS_PROTOCOL`| Protocol for metrics, overrides general setting| `grpc`, `http/json`, `http/protobuf`
`OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`| OTLP metrics endpoint, overrides general setting| `http://localhost:4318/v1/metrics`
@@ -121,7 +123,7 @@
`http/protobuf`, `http/json`| `CLAUDE_CODE_CLIENT_CERT`, `CLAUDE_CODE_CLIENT_KEY`, and optionally `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`. See [Network configuration](</docs/en/network-config#mtls-authentication>)| `NODE_EXTRA_CA_CERTS`
`grpc`| `OTEL_EXPORTER_OTLP_CLIENT_KEY` and `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`, or the per-signal variants such as `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` to use a different certificate per signal| `OTEL_EXPORTER_OTLP_CERTIFICATE`
-For `grpc`, the OpenTelemetry SDK reads the standard OTLP variables directly, so existing configurations that set the per-signal metrics variables continue to work.
+For `grpc`, the OpenTelemetry SDK reads the standard OTLP variables directly, so existing configurations that set the per-signal metrics variables continue to work. On machines with managed settings, Claude Code may remove developer-set per-signal credentials and endpoints at startup.
###
@@ -147,7 +149,7 @@
Traces (beta)
-Distributed tracing exports spans that link each user prompt to the API requests and tool executions it triggers, so you can view a full request as a single trace in your tracing backend. Tracing is off by default. To enable it, set both `CLAUDE_CODE_ENABLE_TELEMETRY=1` and `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1`, then set `OTEL_TRACES_EXPORTER` to choose where spans are sent. Traces reuse the common OTLP configuration for endpoint, protocol, headers, and mTLS. A generic endpoint or credential variable set in managed settings governs the traces endpoint too, so the `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` override in the table below applies only when managed settings don’t set one.
+Distributed tracing exports spans that link each user prompt to the API requests and tool executions it triggers, so you can view a full request as a single trace in your tracing backend. Tracing is off by default. To enable it, set both `CLAUDE_CODE_ENABLE_TELEMETRY=1` and `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1`, then set `OTEL_TRACES_EXPORTER` to choose where spans are sent. Traces reuse the common OTLP configuration for endpoint, protocol, headers, and mTLS. On machines with managed settings, Claude Code may remove developer-set `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` variables at startup.
Environment Variable| Description| Example Values
---|---|---
@@ -367,7 +369,7 @@
Example configurations
-Set these environment variables before running `claude`. Each scenario below shows a complete configuration, and each variable is described under Common configuration variables. For console debugging with a 1-second export interval:
+Set these environment variables before running `claude`. Each scenario below shows a complete configuration, and each variable is described under Common configuration variables. To confirm a configuration took effect, check your backend for the `claude_code.session.count` metric after starting a session; the Quick start covers logs-only verification and what to check when nothing arrives. For console debugging with a 1-second export interval:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
@@ -1265,6 +1267,8 @@
}
}
+To confirm events arrive, submit a prompt in a session running under this configuration and check your SIEM for the `claude_code.user_prompt` event. If nothing arrives, run `claude --debug` and check the debug log for OTel export errors.
+
##
--- a/network-config.md
+++ b/network-config.md
@@ -1,4 +1,4 @@
-Claude Code supports various enterprise network and security configurations through environment variables. This includes routing traffic through corporate proxy servers, trusting custom Certificate Authorities (CA), and authenticating with mutual Transport Layer Security (mTLS) certificates for enhanced security.
+Claude Code supports various enterprise network and security configurations through environment variables. This includes routing traffic through corporate proxy servers, trusting custom Certificate Authorities (CA), and authenticating with mutual Transport Layer Security (mTLS) certificates for enhanced security. Set these environment variables before you launch Claude Code. Variables exported in your shell are read once at startup, so a running session doesn’t pick up later changes to your shell environment.
All environment variables shown on this page can also be configured in [`settings.json`](</docs/en/settings>).
@@ -28,6 +28,8 @@
export NO_PROXY="localhost,192.168.1.1,example.com,.example.com"
# Bypass proxy for all requests
export NO_PROXY="*"
+
+Lowercase variants also work, and Claude Code uses the first one that’s set in the order `https_proxy`, `HTTPS_PROXY`, `http_proxy`, `HTTP_PROXY`.
Claude Code does not support SOCKS proxies.
@@ -103,6 +105,28 @@
+Verify your configuration
+
+You usually find out about a wrong proxy address or a bad certificate path from a [connection or certificate error](</docs/en/errors#network-and-connection-errors>) on a later request, since Claude Code doesn’t validate most of these settings when it reads them. The one setting it checks at startup is the proxy URL: when it can’t parse the value, such as one missing the `http://` scheme, Claude Code stops launch with an error naming the variable to fix. To confirm your configuration loaded before you send a request, start Claude Code with debug logging:
+
+ claude --debug
+
+Debug output goes to `~/.claude/debug/<session-id>.txt` rather than the terminal, or to a path you set with `--debug-file <path>`. In the log, look for the lines that confirm each file loaded:
+
+ CA certs: Appended extra certificates from NODE_EXTRA_CA_CERTS (/etc/ssl/certs/corp-ca.pem)
+ mTLS: Loaded client certificate from CLAUDE_CODE_CLIENT_CERT
+ mTLS: Loaded client key from CLAUDE_CODE_CLIENT_KEY
+
+If Claude Code can’t read one of these files, the log shows a `Failed to read` or `Failed to load` line with the reason instead. You can also run `/status` in an interactive session and check these rows:
+
+ * **Proxy** : shows the active proxy URL, and marks a value it can’t parse as invalid and ignored.
+ * **mTLS client cert** and **mTLS client key** : appear only when the files loaded, so a missing row means the load failed and the debug log has the reason.
+ * **Additional CA cert(s)** : shows the `NODE_EXTRA_CA_CERTS` path without checking that the file loaded, so confirm this one in the debug log.
+
+##
+
+
+
Apply network settings to background agents
[Background agents](</docs/en/agent-view>) don’t run inside the terminal that dispatched them. A per-user supervisor process starts on demand, outlives your shell, and hosts every `claude agents`, `--bg`, and `/background` session. See [How background sessions are hosted](</docs/en/agent-view#how-background-sessions-are-hosted>). This changes how the configuration on this page reaches those sessions.
--- a/observability.md
+++ b/observability.md
@@ -91,7 +91,7 @@
console.log(message);
}
-Because the child process inherits your application’s environment by default, you can achieve the same result by exporting these variables in a Dockerfile, Kubernetes manifest, or shell profile and omitting `options.env` entirely.
+Because the child process inherits your application’s environment by default, you can achieve the same result by exporting these variables in a Dockerfile, Kubernetes manifest, or shell profile and omitting `options.env` entirely. To confirm that export is working, check your collector’s logs for incoming spans, metrics, and log events after the task completes. The CLI fails silently on export errors by default: if the endpoint is unreachable or rejects the data, the agent still runs normally and the CLI drops the telemetry without surfacing an error in your application. To surface exporter errors, set [`CLAUDE_CODE_OTEL_DIAG_STDERR=1`](</docs/en/env-vars>) alongside the exporter variables and read the diagnostics through the SDK’s `stderr` callback (Python) or `stderr` option (TypeScript). Requires Claude Code v2.1.179 or later.
The `console` exporter writes telemetry to standard output, which the SDK uses as its message channel. Do not set `console` as an exporter value when running through the SDK. To inspect telemetry locally, point `OTEL_EXPORTER_OTLP_ENDPOINT` at a local collector or an all-in-one Jaeger container instead.
@@ -160,7 +160,7 @@
options = ClaudeAgentOptions(
env={
- # ... exporter configuration ...
+ # ... exporter configuration from the Enable telemetry export example ...
"OTEL_SERVICE_NAME": "support-triage-agent",
"OTEL_RESOURCE_ATTRIBUTES": "service.version=1.4.0,deployment.environment=production",
},
@@ -169,7 +169,7 @@
const options = {
env: {
...process.env,
- // ... exporter configuration ...
+ // ... exporter configuration from the Enable telemetry export example ...
OTEL_SERVICE_NAME: "support-triage-agent",
OTEL_RESOURCE_ATTRIBUTES:
"service.version=1.4.0,deployment.environment=production",
@@ -192,7 +192,8 @@
options = ClaudeAgentOptions(
env={
- # ... exporter configuration ...
+ # ... exporter configuration from the Enable telemetry export example ...
+ # request is the incoming request object from your web framework.
"OTEL_RESOURCE_ATTRIBUTES": f"enduser.id={quote(request.user_id)},tenant.id={quote(request.tenant_id)}",
},
)
@@ -200,7 +201,8 @@
const options = {
env: {
...process.env,
- // ... exporter configuration ...
+ // ... exporter configuration from the Enable telemetry export example ...
+ // request is the incoming request object from your web framework.
OTEL_RESOURCE_ATTRIBUTES: `enduser.id=${encodeURIComponent(request.userId)},tenant.id=${encodeURIComponent(request.tenantId)}`,
},
};
--- a/overview.md
+++ b/overview.md
@@ -57,7 +57,7 @@
cd your-project
claude
-You’ll be prompted to log in on first use. That’s it! [Continue with the Quickstart →](</docs/en/quickstart>)
+You’ll be prompted to log in on first use. If you’ve set the `ANTHROPIC_API_KEY` environment variable, Claude Code skips the login prompt and asks you to approve the key instead. That’s it! [Continue with the Quickstart →](</docs/en/quickstart>)
See [advanced setup](</docs/en/setup>) for installation options, manual updates, or uninstallation instructions. Visit [installation troubleshooting](</docs/en/troubleshoot-install>) if you hit issues.
@@ -148,7 +148,7 @@
* Step away from your desk and keep working from your phone or any browser with [Remote Control](</docs/en/remote-control>)
* Message [Dispatch](</docs/en/desktop#sessions-from-dispatch>) a task from your phone and open the Desktop session it creates
* Kick off a long-running task on the [web](</docs/en/claude-code-on-the-web>) or the [Claude mobile app](</docs/en/mobile>), then pull it into your terminal with `claude --teleport`. Teleport requires a claude.ai subscription.
- * Run `/desktop` to continue your current terminal session in the [Desktop app](</docs/en/desktop>), where you can review diffs visually. Available on macOS and x64 Windows.
+ * Run `/desktop` to continue your current terminal session in the [Desktop app](</docs/en/desktop>), where you can review diffs visually. The `/desktop` handoff requires a claude.ai subscription. Available on macOS and x64 Windows.
* Route tasks from team chat: mention `@Claude` in [Slack](</docs/en/slack>) with a bug report and get a pull request back
##
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -92,7 +92,7 @@
Use the mode dropdown next to the prompt box on [claude.ai/code](<https://claude.ai/code>) or in the mobile app. Permission prompts appear in claude.ai for approval. Which modes appear depends on where the session runs:
- * **Cloud sessions** on [Claude Code on the web](</docs/en/claude-code-on-the-web>): Accept edits, Plan, and Auto. Accept edits corresponds to `default` mode: the cloud environment pre-approves file edits regardless of mode, so the dropdown shows Accept edits instead of Manual. Cloud sessions still honor `defaultMode: "acceptEdits"` from settings. Auto mode appears only when your organization allows it and the selected model supports it. Bypass permissions isn’t available.
+ * **Cloud sessions** on [Claude Code on the web](</docs/en/claude-code-on-the-web>): Accept edits, Plan, and Auto. Accept edits corresponds to `default` mode: cloud sessions pre-approve file edits regardless of mode, so the dropdown shows Accept edits instead of Manual. Cloud sessions still honor `defaultMode: "acceptEdits"` from settings. Auto mode appears only when your organization allows it and the selected model supports it. Bypass permissions isn’t available.
* **[Remote Control](</docs/en/remote-control>) sessions** on your local machine: Manual, Accept edits, and Plan. You can’t select Auto or Bypass permissions from the app. The dropdown shows the mode the local session is in, including a mode set from the terminal, and updates when the mode changes in the app or in the terminal. The one exception is Bypass permissions: the session never reports that mode to claude.ai, so switching into it from the terminal doesn’t change what the dropdown shows. Before v2.1.202, sessions connected with `/remote-control` or `claude --remote-control` didn’t report their mode at all, so claude.ai and the mobile app could show a mode the session wasn’t in. The mismatch affected only the label: Claude Code generated permission prompts from the session’s actual mode, and they still appeared in the app for approval.
For Remote Control, the host must be signed in with your claude.ai account; API keys are not supported. You can also set the starting mode when launching the host:
@@ -163,7 +163,7 @@
Auto mode is available only when your account meets all of these requirements:
* **Plan** : All plans.
- * **Owner** : on Team and Enterprise, an Owner must enable it in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>) before users can turn it on. Administrators can also turn auto mode off by setting `permissions.disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). For the desktop app’s Code tab, `disableAutoMode` is the organization-level control, and the admin settings toggle doesn’t apply.
+ * **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.
--- a/plugin-marketplaces.md
+++ b/plugin-marketplaces.md
@@ -276,6 +276,14 @@
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.
The git-based source types below are `github`, `url`, and `git-subdir`. When both `ref` and `sha` are set on any of them, the `sha` is the effective pin. Claude Code fetches and checks out the pinned commit directly. On most git hosts, including GitHub, GitLab, and Bitbucket, this means installation succeeds even if the branch or tag named by `ref` has since been deleted upstream, as long as the commit is still reachable from the repository. Some servers, such as AWS CodeCommit, don’t support fetching commits by SHA. On those servers the `ref` must still exist and the pinned commit must be reachable from it.
+
+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.
+ * 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.
###
@@ -568,7 +576,23 @@
Private repositories
-Claude Code supports installing plugins from private repositories. For manual installation and updates, Claude Code uses your existing git credential helpers, so HTTPS access via `gh auth login`, macOS Keychain, or `git-credential-store` works the same as in your terminal. SSH access works as long as the host is already in your `known_hosts` file and the key is loaded in `ssh-agent`, since Claude Code suppresses interactive SSH prompts for the host fingerprint and key passphrase. GitHub `owner/repo` shorthand sources clone over SSH by default; set [`CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1`](</docs/en/env-vars#variables>) to clone them over HTTPS instead. Background auto-updates work differently. By default, the background refresh disables git credential helpers for its `git pull`, so the pull can’t authenticate to private repositories over HTTPS even when a helper is configured. SSH remotes aren’t affected: a key loaded in `ssh-agent` authenticates background pulls the same way as manual operations. When the background pull fails, Claude Code falls back to re-cloning the marketplace from scratch. The re-clone does use your stored git credentials, but it can time out on large repositories, so private-marketplace auto-updates may fail intermittently. Two settings make private marketplaces behave predictably:
+Claude Code supports installing plugins from private repositories. If you distribute your marketplace through [Organization settings > Plugins](<https://claude.ai/admin-settings/plugins>) instead, your git credentials aren’t involved: organization sync reads the marketplace repository through the Claude GitHub App or your organization’s GitHub Enterprise App, and a plugin source it can’t authenticate to must be public. The note under Plugin sources has the full rules.
+
+####
+
+
+
+Commands you run
+
+When you run `/plugin marketplace add`, `/plugin install`, `/plugin update`, or `/plugin marketplace update`, Claude Code uses your existing git credential helpers, so HTTPS access via `gh auth login`, macOS Keychain, or `git-credential-store` works the same as in your terminal. SSH access works as long as the host is already in your `known_hosts` file and the key is loaded in `ssh-agent`, since Claude Code suppresses interactive SSH prompts for the host fingerprint and key passphrase. GitHub `owner/repo` shorthand sources clone over SSH by default; set [`CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1`](</docs/en/env-vars#variables>) to clone them over HTTPS instead.
+
+####
+
+
+
+Background auto-updates
+
+By default, the background refresh disables git credential helpers for its `git pull`, so the pull can’t authenticate to private repositories over HTTPS even when a helper is configured. SSH remotes aren’t affected: a key loaded in `ssh-agent` authenticates background pulls the same way as the commands you run. When the background pull fails, Claude Code falls back to re-cloning the marketplace from scratch. The re-clone does use your stored git credentials, but it can time out on large repositories, so private-marketplace auto-updates may fail intermittently. Two settings make private marketplaces behave predictably:
* Set `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1` to keep the existing clone when the background pull fails, instead of deleting and re-cloning. Your plugins keep working from the last synced state, and manual updates with `/plugin marketplace update` still pull with your credentials.
* Configure a git credential helper, for example with `gh auth setup-git` for GitHub, so the re-clone fallback can authenticate without prompting.
@@ -671,7 +695,7 @@
Value| Behavior
---|---
Undefined (default)| No restrictions. Users can add any marketplace
-Empty array `[]`| Complete lockdown. Users can’t add any new marketplaces
+Empty array `[]`| Complete lockdown. Blocks every marketplace source, including the official Anthropic marketplace
List of sources| Users can only add marketplaces that match the allowlist exactly
####
@@ -680,13 +704,24 @@
Common configurations
-Disable all marketplace additions:
+Disable all marketplace additions, including the official Anthropic marketplace:
{
"strictKnownMarketplaces": []
}
-Allow specific marketplaces only:
+Allow only the official Anthropic marketplace. Matching is exact, so this entry doesn’t cover `ref` or `path` variants of the same repository:
+
+ {
+ "strictKnownMarketplaces": [
+ {
+ "source": "github",
+ "repo": "anthropics/claude-plugins-official"
+ }
+ ]
+ }
+
+With this entry, the official marketplace registers itself automatically the first time you start Claude Code interactively, so you don’t need to pair it with `extraKnownMarketplaces`. In a non-interactive environment that runs before that first interactive launch, add it explicitly with `claude plugin marketplace add anthropics/claude-plugins-official` or include it in `extraKnownMarketplaces`. Allow specific marketplaces only:
{
"strictKnownMarketplaces": [
@@ -740,7 +775,7 @@
Restrictions are checked before any network or filesystem operation. The check runs on marketplace add and on plugin install, update, refresh, and auto-update. If a marketplace was added before the policy was configured and its source no longer matches the allowlist, Claude Code refuses to install or update plugins from it. The same enforcement applies to `blockedMarketplaces`. The allowlist uses exact matching for most source types. For a marketplace to be allowed, all specified fields must match exactly:
- * For GitHub sources: `repo` is required, and `ref` or `path` must also match if specified in the allowlist
+ * For GitHub sources: `repo` is required, and `ref` and `path` must each match exactly or be absent from both the marketplace source and the allowlist entry
* For URL sources: the full URL must match exactly
* For `hostPattern` sources: the marketplace host is matched against the regex pattern
* For `pathPattern` sources: the marketplace’s filesystem path is matched against the regex pattern
@@ -1024,7 +1059,7 @@
* Verify the marketplace URL is accessible
* Check that `.claude-plugin/marketplace.json` exists at the specified path
- * Ensure JSON syntax is valid using `claude plugin validate` or `/plugin validate`. To check skill, agent, and command frontmatter, run the command against each plugin directory
+ * Ensure JSON syntax is valid using `claude plugin validate .` or `/plugin validate .` from the marketplace directory. To check skill, agent, and command frontmatter, run the command against each plugin directory
* For private repositories, confirm you have access permissions
###
--- a/plugin-relevance.md
+++ b/plugin-relevance.md
@@ -92,7 +92,7 @@
}
}
-Unknown fields under `relevance` and `relevance.signals` are ignored at load time so older Claude Code clients continue to load your marketplace. Run `claude plugin validate` 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. Run `claude plugin validate` against your marketplace directory, for example `claude plugin validate ./my-marketplace`, to surface them as warnings.
##
--- a/plugins.md
+++ b/plugins.md
@@ -125,7 +125,7 @@
/my-first-plugin:hello
-You’ll see Claude respond with a greeting. Run `/help` to see your skill listed under the plugin namespace.
+You’ll see Claude respond with a greeting. Run `/help` and open the **Custom commands** tab to see your skill listed under the plugin namespace.
**Why namespacing?** Plugin skills are always namespaced (like `/my-first-plugin:hello`) to prevent conflicts when multiple plugins have skills with the same name.To change the namespace prefix, update the `name` field in `plugin.json`.
@@ -145,7 +145,7 @@
Greet the user named "$ARGUMENTS" warmly and ask how you can help them today. Make the greeting personal and encouraging.
-Run `/reload-plugins` to pick up the changes, then try the skill with your name:
+Run `/reload-plugins` to pick up the changes. The skills count in the summary covers only `commands/` directories, so it can report `0 skills` even though the skill you just edited reloaded. Then try the skill with your name:
/my-first-plugin:hello Alex
@@ -257,7 +257,7 @@
}
}
-Users installing your plugin must have the language server binary installed on their machine. For complete LSP configuration options, see [LSP servers](</docs/en/plugins-reference#lsp-servers>).
+Users installing your plugin must have the language server binary installed on their machine. To confirm the server starts, launch Claude Code with the plugin enabled and check the `/plugin` Errors tab: a language server that fails to start appears there, for example with `Executable not found in $PATH` when the binary isn’t installed. An entry with an invalid configuration is skipped instead; run `claude --debug` to see why. For complete LSP configuration options, see [LSP servers](</docs/en/plugins-reference#lsp-servers>).
###
@@ -321,13 +321,13 @@
* Try your skills with `/plugin-name:skill-name`
* Check that agents appear in `/context` under Custom Agents, or @-mention one by its scoped name
- * Verify hooks work as expected
+ * Trigger the event each hook matches, such as asking Claude to edit a file for a `PostToolUse` hook, and confirm its effect. Claude Code records which hooks matched, their exit codes, and their output in the [debug log](</docs/en/hooks#debug-hooks>)
You can load multiple plugins at once by specifying the flag multiple times:
claude --plugin-dir ./plugin-one --plugin-dir ./plugin-two
-To test a plugin that is already packaged as a `.zip` archive and hosted at a URL, such as a CI build artifact, use `--plugin-url` instead. Claude Code fetches the archive at startup and loads it for that session only. If the fetch fails or the archive is invalid, Claude Code reports a plugin load error and starts without it. The same [trust considerations](</docs/en/discover-plugins#security>) apply as for any plugin source: only point this flag at archives you control or trust. To load multiple plugins, repeat the flag for each URL:
+To test a plugin that is already packaged as a `.zip` archive and hosted at a URL, such as a CI build artifact, use `--plugin-url` instead. Claude Code fetches the archive at startup and loads it for that session only. If Claude Code can’t fetch the archive, or the archive is invalid, it starts without the plugin and records a plugin load error that you can review in the `/plugin` manager’s **Errors** tab. The same [trust considerations](</docs/en/discover-plugins#security>) apply as for any plugin source: only point this flag at archives you control or trust. To load multiple plugins, repeat the flag for each URL:
claude --plugin-url https://example.com/my-plugin.zip --plugin-url https://example.com/other.zip
@@ -378,7 +378,7 @@
* **claude.ai** : [claude.ai/admin-settings/directory/submissions/plugins/new](<https://claude.ai/admin-settings/directory/submissions/plugins/new>)
* **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` locally before you submit. The review pipeline runs the same check on every submission, along with automated safety screening. 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>).
+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>).
@@ -418,16 +418,15 @@
Copy your existing files
-Copy your existing configurations to the plugin directory:
-
- # Copy commands
+Copy each configuration directory you have to the plugin root. You might not have all three: if a directory doesn’t exist, `cp` prints `No such file or directory` and copies nothing, so skip that command or ignore the error.
+
cp -r .claude/commands my-plugin/
- # Copy agents (if any)
cp -r .claude/agents my-plugin/
- # Copy skills (if any)
cp -r .claude/skills my-plugin/
+
+Your plugin now contains copies of the directories you had under `.claude/`. Run `ls my-plugin` to confirm: you should see each directory you copied.
3
@@ -460,7 +459,7 @@
claude --plugin-dir ./my-plugin
-Test each component: run your commands, check that agents appear in `/context`, and verify hooks trigger correctly.
+Test each component: run your commands, check that agents appear in `/context`, and trigger the event each hook matches to confirm its effect. Claude Code records which hooks matched and how they exited in the [debug log](</docs/en/hooks#debug-hooks>).
###
--- a/plugins-reference.md
+++ b/plugins-reference.md
@@ -93,7 +93,7 @@
`UserPromptSubmit`| When you submit a prompt, before Claude processes it
`UserPromptExpansion`| When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion
`PreToolUse`| Before a tool call executes. Can block it
-`PermissionRequest`| When a permission dialog appears
+`PermissionRequest`| When a tool call needs a permission decision
`PermissionDenied`| When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call
`PostToolUse`| After a tool call succeeds
`PostToolUseFailure`| After a tool call fails
@@ -159,6 +159,7 @@
* 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
###
@@ -310,7 +311,7 @@
---|---|---
`user`| `~/.claude/settings.json`| Personal plugins available across all projects (default)
`project`| `.claude/settings.json`| Team plugins shared via version control
-`local`| `.claude/settings.local.json`| Project-specific plugins, gitignored
+`local`| `.claude/settings.local.json`| Project-specific plugins, gitignored when Claude Code saves a setting to it
`managed`| [Managed settings](</docs/en/settings#settings-files>)| Managed plugins (read-only, update only)
Plugins use the same scope system as other Claude Code configurations. For installation instructions and scope flags, see [Install plugins](</docs/en/discover-plugins#install-plugins>). For a complete explanation of scopes, see [Configuration scopes](</docs/en/settings#configuration-scopes>).
@@ -350,7 +351,7 @@
Personal-scope plugins have none of these restrictions.
-Project-scope `@skills-dir` plugins load only from the `.claude/skills/` of the directory where you start Claude Code. They do not [walk up to the repository root](</docs/en/skills#automatic-discovery-from-parent-and-nested-directories>) the way plain skills and commands do, so launching from a subdirectory misses a plugin that lives at the repo root. Launch from the repository root, or run `/reload-plugins` after changing directories.
+Project-scope `@skills-dir` plugins load only from the `.claude/skills/` of the directory where you start Claude Code. They don’t [walk up to the repository root](</docs/en/skills#discovery-from-parent-and-nested-directories>) the way plain skills and commands do, so launching from a subdirectory misses a plugin that lives at the repo root. Launch from the repository root, or run `/reload-plugins` after changing directories.
###
@@ -903,7 +904,7 @@
# Install to project scope (shared with team)
claude plugin install formatter@my-marketplace --scope project
- # Install to local scope (gitignored)
+ # Install to local scope (not shared with team)
claude plugin install formatter@my-marketplace --scope local
###
@@ -1153,7 +1154,7 @@
Issue| Cause| Solution
---|---|---
-Plugin not loading| Invalid `plugin.json`| Run `claude plugin validate` or `/plugin validate` to check `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors
+Plugin not loading| Invalid `plugin.json`| Run `claude plugin validate ./my-plugin` or `/plugin validate ./my-plugin`, where `./my-plugin` is your plugin directory, to check `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors
Skills not appearing| Wrong directory structure| Ensure `skills/` or `commands/` is at the plugin root, not inside `.claude-plugin/`
Hooks not firing| Script not executable| Run `chmod +x script.sh`
MCP server fails| Missing `${CLAUDE_PLUGIN_ROOT}`| Use variable for all plugin paths
--- a/prompt-caching.md
+++ b/prompt-caching.md
@@ -1,4 +1,4 @@
-Prompt caching makes Claude Code faster and more cost-efficient. Without caching, the API would reprocess your full history on every turn. With caching, it reuses what it already processed and only does new work for what changed. Claude Code handles prompt caching for you, unless you disable it. It is still useful to know how prompt caching works, because some actions invalidate the cache and make the next response slower and more expensive while it rebuilds. This page covers which actions those are, why some settings wait for a restart to apply, and how to check cache performance when usage looks high.
+Prompt caching makes Claude Code faster and more cost-efficient. Without caching, the API would reprocess your full history on every turn. With caching, it reuses what it already processed, bills the re-read at the [cached token rate](<https://platform.claude.com/docs/en/about-claude/pricing>), and fully processes only what changed. Claude Code handles prompt caching for you, unless you disable it. It is still useful to know how prompt caching works, because some actions invalidate the cache and make the next response slower and more expensive while it rebuilds. This page covers which actions those are, why some settings wait for a restart to apply, and how to check cache performance when usage looks high.
##
@@ -86,7 +86,7 @@
Tool definitions sit in the system prompt layer, so the cache invalidates when the set of tool definitions in the request changes between turns. Toggling the [advisor tool](</docs/en/advisor>) is an exception: its definition sits after the cache breakpoint, so enabling or disabling `/advisor` keeps the cached prefix intact. Whether an [MCP server](</docs/en/mcp>) change does this depends on whether its tools are deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>) or loaded into the prefix:
* **Deferred tools** , the default on supported models: a server connecting, disconnecting, or changing its tool list only appends new content and doesn’t disturb anything already cached.
- * **Tools loaded into the prefix** : any change to them invalidates the cache. This happens when [tool search is unavailable or disabled](</docs/en/mcp#configure-tool-search>), such as on Google Cloud’s Agent Platform or with a custom `ANTHROPIC_BASE_URL` gateway. It also happens for a server or tool marked [`alwaysLoad`](</docs/en/mcp#exempt-a-server-from-deferral>), and for definitions kept upfront by [threshold-based loading](</docs/en/mcp#configure-tool-search>).
+ * **Tools loaded into the prefix** : any change to them invalidates the cache. This happens when [tool search is unavailable or disabled](</docs/en/mcp#configure-tool-search>), such as on Google Cloud’s Agent Platform, with a custom `ANTHROPIC_BASE_URL` gateway, or on a Microsoft Foundry [deployment hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>) once Claude Code detects that the deployment rejects tool search. It also happens for a server or tool marked [`alwaysLoad`](</docs/en/mcp#exempt-a-server-from-deferral>), and for definitions kept upfront by [threshold-based loading](</docs/en/mcp#configure-tool-search>).
When tools load into the prefix, the most common cause of an invalidation is a server connecting or disconnecting mid-session, which can happen without any action on your part: a stdio server’s process exits, an HTTP session expires, or a server [reconnects automatically after a transient failure](</docs/en/mcp#automatic-reconnection>). A connected server can also push a [dynamic tool update](</docs/en/mcp#dynamic-tool-updates>) that changes its tool list. Editing your MCP config does not by itself change the cache. The new config takes effect only after a restart, which is when the server connects or disconnects.
@@ -112,7 +112,7 @@
Compacting the conversation
-[Compaction](</docs/en/context-window#what-survives-compaction>) replaces your message history with a summary. By design, this invalidates the conversation layer, since the next request has a new, shorter history that doesn’t share a prefix with the old one. Claude Code reuses the system prompt layer and reloads project context from disk, which cache-hits only if CLAUDE.md and memory are unchanged since the session started. To produce the summary, Claude Code sends a one-off request with the same system prompt, tools, and history as your conversation, plus a summarization instruction appended as a final user message. Because it shares your prefix, that request reads the existing cache rather than reprocessing the full history. Most of compaction’s time goes to generating the summary, not to a cache miss. The turn that follows rebuilds the conversation cache only for the much shorter summary, so the post-compaction turn is not the slow part.
+[Compaction](</docs/en/context-window#what-survives-compaction>) replaces your message history with a summary. By design, this invalidates the conversation layer, since the next request has a new, shorter history that doesn’t share a prefix with the old one. Claude Code reuses the system prompt layer and reloads project context from disk, which cache-hits only if CLAUDE.md and memory are unchanged since the session started. To produce the summary, Claude Code sends a separate request with the same system prompt, tools, and history as your conversation, plus a summarization instruction appended as a final user message. While the cache is warm, that request reads your prefix from the cache, so a mid-session `/compact` costs a fraction of what the context size suggests and spends most of its time generating the summary. After a break longer than the cache lifetime, there is no cache left to read, so the summarization request reprocesses the full history as uncached input. This is why `/compact` costs the most when you [resume an old session](</docs/en/sessions#resume-from-a-summary>). In both the warm and cold cases, the turn after compaction rebuilds the conversation cache for only the much shorter summary, so that turn is not the slow part.
Compaction works in your favor when the context you discard is content you no longer need. To choose when its overhead happens, run `/compact` at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task. If you’ve gone down a path you want to abandon entirely, `/rewind` to an earlier turn instead. Rewinding truncates back to a prefix that is already cached, rather than building a new one as compaction does.
@@ -205,7 +205,7 @@
Cache lifetime
-Cached prefixes expire after a period of inactivity. Each request that hits the cache resets the timer, so the cache stays warm as long as you keep working. After a long enough gap, the next request recomputes the full input and re-establishes the cache, which is why the first turn back after stepping away can be noticeably slower. The time to live (TTL) controls how long a gap the cache survives. The API offers two: a five-minute TTL, and a [one-hour TTL](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#1-hour-cache-duration>) that keeps the cache warm through longer breaks but [bills cache writes at a higher rate](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing>). Claude Code picks the TTL for you based on how you authenticate, and you can override it with environment variables.
+Cached prefixes expire after a period of inactivity. Each request that hits the cache resets the timer, so the cache stays warm as long as you keep working. After a long enough gap, the next request recomputes the full input and re-establishes the cache, which is why the first turn back after stepping away can be noticeably slower. On a Pro or Max plan, when you resume a large session after a long break, Claude Code [offers to resume from a summary](</docs/en/sessions#resume-from-a-summary>) so later requests don’t carry the full history. The time to live (TTL) controls how long a gap the cache survives. The API offers two: a five-minute TTL, and a [one-hour TTL](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#1-hour-cache-duration>) that keeps the cache warm through longer breaks but [bills cache writes at a higher rate](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing>). Claude Code picks the TTL for you based on how you authenticate, and you can override it with environment variables.
###
@@ -213,7 +213,7 @@
On a Claude subscription
-On a Claude subscription, Claude Code requests the one-hour TTL automatically. Usage is included in your plan rather than billed per token, so the longer TTL costs you nothing extra and only affects how long your cache stays warm. If you’ve gone over your plan’s usage limit and Claude Code is drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>), you are billed for that usage, so Claude Code automatically drops the TTL to five minutes.
+On a Claude subscription, Claude Code requests the one-hour TTL automatically, so the cache survives breaks of up to an hour. If you’ve gone over your plan’s usage limit and Claude Code is drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>), you are billed for that usage. Cache writes cost more at the one-hour TTL than at the five-minute TTL, so Claude Code automatically drops to the shorter one.
###
Show diff (134 lines)
--- a/python.md
+++ b/python.md
@@ -10,7 +10,7 @@
source .venv/bin/activate
pip install claude-agent-sdk
-For uv, Windows PowerShell, and API key setup, see [Get started in the Agent SDK overview](</docs/en/agent-sdk/overview#get-started>).
+For uv, Windows PowerShell, and API key setup, see [Setup in the Agent SDK quickstart](</docs/en/agent-sdk/quickstart#setup>).
##
@@ -733,8 +733,9 @@
# Drain the interrupted task's messages (including its ResultMessage)
async for message in client.receive_response():
if isinstance(message, ResultMessage):
- print(f"Interrupted task finished with subtype={message.subtype!r}")
- # subtype is "error_during_execution" for interrupted tasks
+ print(f"Interrupted task: terminal_reason={message.terminal_reason!r}")
+ # terminal_reason is "aborted_streaming" or "aborted_tools"
+ # for interrupted turns
# Send a new command
await client.query("Just say hello instead")
@@ -746,7 +747,7 @@
asyncio.run(interruptible_task())
-**Buffer behavior after interrupt:** `interrupt()` sends a stop signal but does not clear the message buffer. Messages already produced by the interrupted task, including its `ResultMessage` (with `subtype="error_during_execution"`), remain in the stream. You must drain them with `receive_response()` before reading the response to a new query. If you send a new query immediately after `interrupt()` and call `receive_response()` only once, you’ll receive the interrupted task’s messages, not the new query’s response.
+**Buffer behavior after interrupt:** `interrupt()` sends a stop signal but does not clear the message buffer. Messages already produced by the interrupted task, including its `ResultMessage`, remain in the stream. You must drain them with `receive_response()` before reading the response to a new query. If you send a new query immediately after `interrupt()` and call `receive_response()` only once, you’ll receive the interrupted task’s messages, not the new query’s response.
####
@@ -997,7 +998,7 @@
* `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents.
* `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window, so worst-case wall time is roughly `API_TIMEOUT_MS × (CLAUDE_CODE_MAX_RETRIES + 1)` plus backoff. For unattended runs that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG=1`: it retries capacity errors indefinitely, and as of Claude Code v2.1.199 raises the default for other transient errors to `300` and removes the cap on this variable.
* `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents launched with `run_in_background`. Default `600000`. Resets on each stream event; on stall it aborts the subagent, marks the task failed, and surfaces the error to the parent with any partial result. Does not apply to synchronous subagents.
- * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. The aborted request goes through the normal retry path.
+ * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, Claude Code retries the request at most once, and only before Claude has started a block of text or a tool call in the response; once Claude has completed a block of text or a tool call, Claude Code keeps the completed output, appends an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>) instead of retrying, and still runs any completed tool call.
###
@@ -1070,7 +1071,7 @@
---|---|---
`"user"`| Global user settings| `~/.claude/settings.json`
`"project"`| Shared project settings (version controlled)| `.claude/settings.json`
-`"local"`| Local project settings (not version controlled)| `.claude/settings.local.json`
+`"local"`| Local project settings, gitignored when Claude Code saves a setting to it| `.claude/settings.local.json`
####
@@ -1484,7 +1485,7 @@
`enabled`| `type`, `budget_tokens`, `display`| Enable thinking with a specific token budget
`disabled`| `type`| Disable thinking
-The optional `display` field controls whether thinking text is returned `"summarized"` or `"omitted"`. On Claude Opus 4.7 and later, the API default is `"omitted"`, so set `"summarized"` to receive thinking content in `ThinkingBlock` outputs. Because these are `TypedDict` classes, they’re plain dicts at runtime. Either construct them as dict literals or call the class like a constructor; both produce a `dict`. Access fields with `config["budget_tokens"]`, not `config.budget_tokens`:
+The optional `display` field controls whether thinking text is returned `"summarized"` or `"omitted"`. On Claude Opus 4.7 and later, the API default is `"omitted"`, so set `"summarized"` to receive thinking content in `ThinkingBlock` outputs. Claude Code doesn’t send `display` to Amazon Bedrock or Google Cloud’s Agent Platform, so on those providers Opus 4.7 and later return empty `ThinkingBlock` outputs even when you set `display` to `"summarized"`. Because these are `TypedDict` classes, they’re plain dicts at runtime. Either construct them as dict literals or call the class like a constructor; both produce a `dict`. Access fields with `config["budget_tokens"]`, not `config.budget_tokens`:
from claude_agent_sdk import ClaudeAgentOptions, ThinkingConfigEnabled
@@ -1525,7 +1526,7 @@
Use with the `betas` field in `ClaudeAgentOptions` to enable beta features.
-The `context-1m-2025-08-07` beta is retired as of April 30, 2026. Passing this header with Claude Sonnet 4.5 or Sonnet 4 has no effect, and requests that exceed the standard 200k-token context window return an error. To use a 1M-token context window, migrate to [Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.6, Claude Opus 4.7, or Claude Opus 4.8](<https://platform.claude.com/docs/en/about-claude/models/overview>), which include 1M context at standard pricing with no beta header required.
+The `context-1m-2025-08-07` beta is retired as of April 30, 2026. Passing this header with Claude Sonnet 4.5 or Sonnet 4 has no effect, and requests that exceed the standard 200k-token context window return an error. To use a 1M-token context window, migrate to [Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.6, Claude Opus 4.7, or Claude Opus 4.8](<https://platform.claude.com/docs/en/about-claude/models/overview>), which include 1M context at standard pricing with no beta header required.
###
@@ -1759,9 +1760,10 @@
"rate_limit",
"invalid_request",
"server_error",
- "max_output_tokens",
"unknown",
]
+
+The underlying CLI process can emit error types this Literal doesn’t list, such as `max_output_tokens`. The SDK passes the value through unmodified, so treat strings outside this list the way you treat `unknown`. The TypeScript [`SDKAssistantMessageError`](</docs/en/agent-sdk/typescript#sdkassistantmessage>) type lists the full set of values the CLI can emit.
###
@@ -1811,7 +1813,7 @@
* `api_error_status`: the HTTP status code of the terminating API error. `None` when the turn ended without one. Populated only on `subtype="success"`.
* `result`: text of the final assistant message on `subtype="success"`, or `None` on the `error_*` subtypes. When `subtype="success"` and `is_error=True`, this holds the API error string if one is available but can be empty, so check `api_error_status` and the preceding `AssistantMessage` content for detail.
* `errors`: loop-level error strings such as the max-turns message. Populated only on the `error_*` subtypes.
- * `terminal_reason`: why the query loop terminated, such as `"completed"`, `"max_turns"`, or `"aborted_streaming"`. A value of `"aborted_streaming"` or `"aborted_tools"` means the turn was cancelled by an interrupt. `None` when the CLI didn’t report a terminal reason, such as with an older CLI version. See [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) for the full list of values.
+ * `terminal_reason`: why the query loop ended, such as `"completed"`, `"max_turns"`, `"api_error"`, `"aborted_streaming"`, or `"aborted_tools"`. A value of `"aborted_streaming"` or `"aborted_tools"` means the turn was aborted before completing. Common causes are `interrupt()` and a permission callback returning `PermissionResultDeny` with `interrupt=True`. `None` on CLI versions that predate the field, on results that bypassed the query loop such as local slash commands, or on synthesized error results emitted when the session fails fatally. Mirrors the TypeScript SDK’s [`SDKResultMessage.terminal_reason`](</docs/en/agent-sdk/typescript#sdkresultmessage>), which lists the full set of values.
The `usage` dict contains the following keys when present:
@@ -2097,6 +2099,8 @@
class ClaudeSDKError(Exception):
"""Base error for Claude SDK."""
+When a single-shot `query()` ends with an error result, for example a turn-limit error, the SDK raises a plain `Exception` after yielding the final result message, not a `ClaudeSDKError` subclass.
+
###
@@ -2240,7 +2244,8 @@
default_factory=list
) # List of callbacks to execute
timeout: float | None = (
- None # Timeout in seconds. When omitted, the per-event default applies
+ None # Timeout in seconds. When omitted, the per-event default applies:
+ # 600 for most events, 30 for UserPromptSubmit
)
###
@@ -3577,6 +3582,9 @@
print(f"Process failed with exit code: {e.exit_code}")
except CLIJSONDecodeError as e:
print(f"Failed to parse response: {e}")
+ # A single-shot query() raises a plain Exception after yielding an error result
+ except Exception as e:
+ print(f"Query ended with an error result: {e}")
asyncio.run(main())
@@ -3720,11 +3728,12 @@
import asyncio
- from claude_agent_sdk import query, ClaudeAgentOptions, SandboxSettings
-
- sandbox_settings: SandboxSettings = {
+ from claude_agent_sdk import query, ClaudeAgentOptions
+
+ sandbox_settings = {
"enabled": True,
"autoAllowBashIfSandboxed": True,
+ "failIfUnavailable": True,
"network": {"allowLocalBinding": True},
}
--- a/quickstart.md
+++ b/quickstart.md
@@ -71,7 +71,7 @@
claude
-For Claude subscription or Console accounts, follow the prompts to complete authentication in your browser. To switch accounts later or re-authenticate, type `/login` inside the running session:
+For Claude subscription or Console accounts, follow the prompts to complete authentication in your browser. If you’ve set the `ANTHROPIC_API_KEY` environment variable, Claude Code skips the login prompt and asks you to approve the key instead. To switch accounts later or re-authenticate, type `/login` inside the running session:
/login
--- a/remote-control.md
+++ b/remote-control.md
@@ -20,6 +20,7 @@
* **Subscription** : available on Pro, Max, Team, and Enterprise plans. API keys are not supported. On Team and Enterprise, an Owner must first enable the Remote Control toggle in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>).
* **Authentication** : run `claude` and use `/login` to sign in through claude.ai if you haven’t already. Without an eligible login, `claude remote-control` exits with an error, while `claude --remote-control` still starts an interactive session and shows a Remote Control failure notification shortly after launch.
* **API endpoint** : not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. As of v2.1.196, Remote Control is also disabled when [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at a host other than `api.anthropic.com`, such as an [LLM gateway](</docs/en/llm-gateway>) or proxy. Unset the variable to use Remote Control.
+ * **Feature-flag evaluation** : [`DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, and `DISABLE_GROWTHBOOK`](</docs/en/env-vars>) each disable the feature-flag evaluation that Remote Control availability depends on. Unset the variable wherever it’s set, in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings#available-settings>), to use Remote Control.
* **Workspace trust** : run `claude` in your project directory at least once to accept the workspace trust dialog. The startup trust dialog never saves trust for your home directory, so start Remote Control from a project directory.
##
@@ -60,6 +61,8 @@
`--verbose`| Show detailed connection and session logs.
`--sandbox` / `--no-sandbox`| Enable or disable [sandboxing](</docs/en/sandboxing>) for filesystem and network isolation. Off by default.
+Claude Code checks Remote Control eligibility before printing help, so `claude remote-control --help` returns an error instead of this flag list when you aren’t signed in with an eligible account.
+
To start a normal interactive Claude Code session with Remote Control enabled, use the `--remote-control` flag (or `--rc`):
claude --remote-control
@@ -134,7 +137,7 @@
Enable Remote Control for all sessions
-Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`, unless auto-connect is turned on. To enable it automatically for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions** to `true`. Set it to `false` to never auto-connect, or leave it unset to follow your organization’s default. In the Desktop app, you can also toggle this from **Settings → Claude Code → Enable remote control by default**. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), the same toggle appears as **Enable Remote Control for all sessions** in the command menu’s Settings section; requires Claude Code v2.1.203 or later. With this setting on, each interactive Claude Code process registers one remote session. If you run multiple instances, each one gets its own environment and session. To run multiple concurrent sessions from a single process, use server mode instead.
+Remote Control only activates when you explicitly run `claude remote-control`, `claude --remote-control`, or `/remote-control`, unless auto-connect is turned on. To enable it automatically for every interactive session, run `/config` inside Claude Code and set **Enable Remote Control for all sessions** to `true`. Set it to `false` to never auto-connect, or to `default` to clear your choice. When the setting is cleared, Remote Control follows your organization’s admin default if one is set, and otherwise Claude Code’s current default. In the Desktop app, you can also toggle this from **Settings → Claude Code → Enable remote control by default**. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), the same toggle appears as **Enable Remote Control for all sessions** in the command menu’s Settings section; requires Claude Code v2.1.203 or later. With this setting on, each interactive Claude Code process registers one remote session. If you run multiple instances, each one gets its own remote session. To run multiple concurrent sessions from a single process, use server mode instead.
##
@@ -262,7 +265,7 @@
Limitations
* **One remote session per interactive process** : outside of server mode, each Claude Code instance supports one remote session at a time. Use server mode to run multiple concurrent sessions from a single process.
- * **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session ends.
+ * **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session ends. To keep a session running on a remote machine after you disconnect from SSH, start it inside `tmux` or `screen`.
* **Extended network outage** : if your machine is awake but unable to reach the network for more than roughly 10 minutes, the session times out and the process exits. Run `claude remote-control` again to start a new session.
* **Ultraplan disconnects Remote Control** : starting an [ultraplan](</docs/en/ultraplan>) session disconnects any active Remote Control session because both features occupy the claude.ai/code interface and only one can be connected at a time.
* **Some commands are local-only** : commands that only run in the terminal interface, such as `/plugin` or `/resume`, work only from the local CLI, whether or not you pass an argument. The following work from mobile and web:
@@ -308,7 +311,7 @@
”Remote Control is not yet enabled for your account”
-The Remote Control rollout has not reached your account, or your cached entitlements are out of date. If you recently changed plans, run `claude auth logout` then `claude auth login` to refresh them. Run `claude doctor` to see which individual eligibility check failed. Environment-variable conflicts, unreachable checks, and organization policy each produce their own message, so this error means the rollout gate itself.
+The Remote Control rollout has not reached your account, or your cached entitlements are out of date. If you recently changed plans, run `claude auth logout` then `claude auth login` to refresh them. Run `claude doctor` to see which individual eligibility check failed. Environment-variable conflicts, unreachable checks, and organization policy each produce their own message, so this error means the rollout gate itself. Before v2.1.154, a variable that disables feature-flag evaluation, such as `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, also produced this message; the “Remote Control requires feature-flag evaluation” entry below covers that configuration.
###
@@ -317,6 +320,14 @@
”Couldn’t verify Remote Control eligibility”
Claude Code could not reach the feature-flag service to check whether Remote Control is enabled for your account, typically because you are offline or a proxy is blocking the request. Retry once you have network access, or run `claude doctor` for details. The related message “Couldn’t verify your organization’s Remote Control policy” has the same cause and the same fix. Both messages were added in v2.1.178.
+
+###
+
+
+
+”Remote Control requires feature-flag evaluation”
+
+One of these variables is set: [`DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, or `DISABLE_GROWTHBOOK`](</docs/en/env-vars>). Each of them disables the feature-flag evaluation that Remote Control availability depends on, and the full message names the variable Claude Code found. Unset that variable wherever it’s set, in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings#available-settings>). On versions before 2.1.154, the same configuration produces “Remote Control is not yet enabled for your account” instead.
###
@@ -401,7 +412,7 @@
Related resources
- * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions in Anthropic-managed cloud environments instead of on your machine
+ * [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>)
* [Ultraplan](</docs/en/ultraplan>): launch a cloud planning session from your terminal and review the plan in your browser
* [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
--- a/routines.md
+++ b/routines.md
@@ -22,7 +22,7 @@
Create a routine
-Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app, click **Routines** in the sidebar, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select and their branch-push setting, the [environment’s](</docs/en/claude-code-on-the-web#the-cloud-environment>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services.
+Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app, click **Routines** in the sidebar, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select and their branch-push setting, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services.
###
@@ -52,13 +52,13 @@
Select an environment
-Pick a [cloud environment](</docs/en/claude-code-on-the-web#the-cloud-environment>) for the routine. Environments control what the cloud session has access to:
+Pick a [cloud environment](</docs/en/cloud-environments>) for the routine. Environments control what the cloud session has access to:
* **Network access** : set the level of internet access available during each run
- * **Environment variables** : provide API keys, tokens, or other secrets Claude can use
- * **Setup script** : install dependencies and tools the routine needs. The result is [cached](</docs/en/claude-code-on-the-web#environment-caching>), so the script doesn’t re-run on every session
-
-A **Default** environment is provided with **Trusted** network access, which allows the [default set](</docs/en/claude-code-on-the-web#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains, but blocks everything else. If your routine needs to reach your own services or a domain outside that list, edit the environment’s [network access](</docs/en/claude-code-on-the-web#network-access>) before running. To use a separate environment, [create one](</docs/en/claude-code-on-the-web#configure-your-environment>) first.
+ * **Environment variables** : provide values Claude can use during each run. They’re [visible to anyone who uses the environment](</docs/en/cloud-environments#what-carries-over-from-your-setup>), so add credentials with that in mind
+ * **Setup script** : install dependencies and tools the routine needs. The result is [cached](</docs/en/cloud-environments#environment-caching>), so the script doesn’t re-run on every session
+
+A **Default** environment is provided with **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains through the session’s network. Connectors you add to the routine reach their services through Anthropic’s servers, so they don’t need allowlist changes. If your routine needs to reach your own services directly, or a domain outside that list, edit the environment’s [network access](</docs/en/cloud-environments#network-access>) before running. To use a separate environment, [create one](</docs/en/cloud-environments#configure-your-environment>) first.
5
@@ -338,7 +338,7 @@
Environments and network access
-Each routine runs in a [cloud environment](</docs/en/claude-code-on-the-web#the-cloud-environment>) that controls network access, environment variables, and setup scripts. The routine inherits the environment’s network policy on every run. The **Default** environment uses **Trusted** network access: the [default allowlist](</docs/en/claude-code-on-the-web#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains is reachable, but arbitrary domains are not. Outbound requests to other hosts fail with `403` and `x-deny-reason: host_not_allowed`. MCP connector traffic is routed through Anthropic’s servers, so the connectors you add to the routine work without adding their hosts to **Allowed domains**. Remove any connectors you don’t need under Connectors. To allow additional domains:
+Each routine uses a [cloud environment](</docs/en/cloud-environments>) that controls network access, environment variables, and setup scripts. The routine inherits the environment’s network policy on every run. The **Default** environment uses **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) through the session’s network. Requests on that path to hosts outside the allowlist fail with `403` and `x-deny-reason: host_not_allowed`. MCP connector traffic is routed through Anthropic’s servers rather than that path, so the connectors you add to the routine work without adding their hosts to **Allowed domains**. Remove any connectors you don’t need under Connectors. To allow additional domains:
1
@@ -362,7 +362,7 @@
Change the network access level
-In the **Update cloud environment** dialog, change **Network access** to **Custom** and enter your domains in **Allowed domains**. Check **Also include default list of common package managers** to keep the [default allowlist](</docs/en/claude-code-on-the-web#default-allowed-domains>) alongside your custom domains. Select **Full** instead for unrestricted access.
+In the **Update cloud environment** dialog, change **Network access** to **Custom** and enter your domains in **Allowed domains**. Check **Also include default list of common package managers** to keep the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) alongside your custom domains. Select **Full** instead for unrestricted access.
5
@@ -370,7 +370,7 @@
Click **Save changes**. The new policy applies from the next run.
-See [Network access](</docs/en/claude-code-on-the-web#network-access>) for details on access levels and the default allowlist.
+See [Network access](</docs/en/cloud-environments#network-access>) for details on access levels and the default allowlist.
##
@@ -424,6 +424,6 @@
* [`/loop` and in-session scheduling](</docs/en/scheduled-tasks>): schedule local tasks within an open CLI session
* [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>): local scheduled tasks that run on your machine with access to local files
- * [Cloud environment](</docs/en/claude-code-on-the-web#the-cloud-environment>): configure the runtime environment for cloud sessions
+ * [Cloud environments](</docs/en/cloud-environments>): configure network access, environment variables, and setup scripts for cloud sessions
* [MCP connectors](</docs/en/mcp>): connect external services like Slack, Linear, and Google Drive
* [GitHub Actions](</docs/en/github-actions>): run Claude in your CI pipeline on repository events
--- a/sandbox-environments.md
+++ b/sandbox-environments.md
@@ -17,7 +17,7 @@
Dev container| Full development environment| Yes| Medium
Custom container| Full development environment| Yes| Medium to high
Virtual machine| Full operating system| No| High
-Claude Code on the web| Full operating system, hosted by Anthropic| No| None; requires a Claude subscription and GitHub
+Claude Code on the web| Full operating system, hosted by Anthropic| No| None; requires a Claude subscription, and GitHub when you launch from the web interface
The [sandboxed Bash tool](</docs/en/sandboxing>) is built into Claude Code and restricts only Bash commands. Built-in file tools, MCP servers, and hooks still run directly on your host. Every other approach in the table puts the whole Claude Code process inside the isolation boundary, so file tools, MCP servers, and hooks are restricted too.
@@ -36,7 +36,7 @@
Reduce permission prompts during everyday work on your own machine| The [sandboxed Bash tool](</docs/en/sandboxing>), enabled with `/sandbox`
Let Claude work unattended with `--dangerously-skip-permissions` or auto mode| The preconfigured [dev container](</docs/en/devcontainer>), any container or VM, or the sandbox runtime
Isolate MCP servers and hooks as well as Bash, without Docker| The sandbox runtime
-Work on an untrusted repository| A dedicated virtual machine, or [Claude Code on the web](</docs/en/claude-code-on-the-web>) if you have a Claude subscription and a connected GitHub account
+Work on an untrusted repository| A dedicated virtual machine, or [Claude Code on the web](</docs/en/claude-code-on-the-web>) if you have a Claude subscription; GitHub is only required when you launch from the web interface
Standardize a sandboxed environment across a team| The preconfigured [dev container](</docs/en/devcontainer>), copied into your repository
Use Claude Code from a device with no local setup| [Claude Code on the web](</docs/en/claude-code-on-the-web>), which requires a Claude subscription and a connected GitHub account
Require isolation for every developer in your organization| Enforce isolation across an organization
@@ -107,7 +107,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 and a connected GitHub account, and sessions clone your repository from GitHub. 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. 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
@@ -38,7 +38,7 @@
Ask Claude to run a command, such as a build or a test suite. By default, commands inside the sandbox can write only to the working directory and the session temp directory. The first time a command needs a new network domain, Claude Code prompts for approval.Commands that cannot run sandboxed fall back to the regular permission flow. To widen or narrow these boundaries, see Configure sandboxing.
-Selecting a mode in the panel writes to your project’s local settings at `.claude/settings.local.json`, which apply to the current project and are not checked into git. To enable the sandbox across all of your projects, set [`sandbox.enabled`](</docs/en/settings#sandbox-settings>) to `true` in your user settings at `~/.claude/settings.json`. To enforce sandboxing for every developer in an organization, use managed settings.
+Selecting a mode in the panel writes to your project’s local settings at `.claude/settings.local.json`, which apply to the current project. Claude Code adds that file to your global gitignore when it saves a setting there. To enable the sandbox across all of your projects, set [`sandbox.enabled`](</docs/en/settings#sandbox-settings>) to `true` in your user settings at `~/.claude/settings.json`. To enforce sandboxing for every developer in an organization, use managed settings.
By default, if the sandbox cannot start because dependencies are missing or the platform is unsupported, Claude Code shows a warning and runs commands without sandboxing. To make this a hard failure instead, set [`sandbox.failIfUnavailable`](</docs/en/settings#sandbox-settings>) to `true`. This is intended for managed deployments that require sandboxing as a security gate.
--- a/security.md
+++ b/security.md
@@ -130,10 +130,10 @@
* **Network access controls** : Network access is limited by default and can be configured to be disabled or allow only specific domains
* **Credential protection** : Authentication is handled through a secure proxy that uses a scoped credential inside the sandbox, which is then translated to your actual GitHub authentication token
* **Branch restrictions** : Git push operations are restricted to the current working branch
- * **Audit logging** : All operations in cloud environments are logged for compliance and audit purposes
- * **Automatic cleanup** : Cloud environments are automatically terminated after session completion
+ * **Audit logging** : All operations in cloud sessions are logged for compliance and audit purposes
+ * **Automatic cleanup** : Session VMs are reclaimed after a period of inactivity
-For more details on cloud execution, see [Claude Code on the web](</docs/en/claude-code-on-the-web>). [Remote Control](</docs/en/remote-control>) sessions work differently: the web interface connects to a Claude Code process running on your local machine. All code execution and file access stays local, and session traffic travels through the Anthropic API over TLS; while connected, the session transcript is stored on Anthropic servers to sync the conversation across devices, as described in [Connection and security](</docs/en/remote-control#connection-and-security>). No cloud VMs or sandboxing are involved. The connection uses multiple short-lived, narrowly scoped credentials, each limited to a specific purpose and expiring independently, to limit the blast radius of any single compromised credential.
+For more details on cloud execution, see [Claude Code on the web](</docs/en/claude-code-on-the-web>); to configure network access for cloud sessions, see [Configure cloud environments](</docs/en/cloud-environments#network-access>). [Remote Control](</docs/en/remote-control>) sessions work differently: the web interface connects to a Claude Code process running on your local machine. All code execution and file access stays local, and session traffic travels through the Anthropic API over TLS; while connected, the session transcript is stored on Anthropic servers to sync the conversation across devices, as described in [Connection and security](</docs/en/remote-control#connection-and-security>). No cloud VMs or sandboxing are involved. The connection uses multiple short-lived, narrowly scoped credentials, each limited to a specific purpose and expiring independently, to limit the blast radius of any single compromised credential.
##
@@ -184,6 +184,7 @@
Related resources
* [Security guidance plugin](</docs/en/security-guidance>): have Claude review and fix vulnerabilities in its own code changes during the session
+ * [`/security-review`](</docs/en/commands#all-commands>): run an on-demand security pass over the changes on your current branch
* [Sandbox environments](</docs/en/sandbox-environments>): compare isolation approaches and choose one for your threat model
* [Sandboxing](</docs/en/sandboxing>): filesystem and network isolation for Bash commands
* [Permissions](</docs/en/permissions>): configure permissions and access controls
--- a/security-guidance.md
+++ b/security-guidance.md
@@ -1,4 +1,4 @@
-The security guidance plugin makes Claude review its own code changes for common vulnerabilities while it works and fix what it finds in the same session. The plugin catches issues such as injection, unsafe deserialization, and unsafe DOM APIs before the code reaches a pull request, reducing how much security review falls to human reviewers downstream. Once installed, the plugin runs automatically. There is nothing to invoke and no separate command to remember. The plugin is the in-session companion to [Code Review](</docs/en/code-review>), which runs on pull requests. This plugin reduces what reaches the PR. Code Review catches what does. For how the plugin layers with on-demand review and CI scanning, see How this fits with other security tools.
+The security guidance plugin makes Claude review its own code changes for common vulnerabilities while it works and fix what it finds in the same session. The plugin catches issues such as injection, unsafe deserialization, and unsafe DOM APIs before the code reaches a pull request, reducing how much security review falls to human reviewers downstream. Once installed, the plugin runs automatically. There is nothing to invoke and no separate command to remember. The plugin is the in-session companion to [Code Review](</docs/en/code-review>), which runs on pull requests. This plugin reduces what reaches the PR. Code Review catches what does. For how the plugin layers with on-demand review and CI scanning, or to scan code you already have rather than changes Claude is writing, see How this fits with other security tools.
##
@@ -178,7 +178,7 @@
---|---|---
User| `~/.claude/claude-security-guidance.md`| Applies to every project on your machine
Project| `.claude/claude-security-guidance.md`| Checked in with the repository
-Project local| `.claude/claude-security-guidance.local.md`| Gitignored, for personal overrides
+Project local| `.claude/claude-security-guidance.local.md`| For personal overrides; add it to your `.gitignore`
The plugin loads all locations that exist and concatenates them, with a combined cap of 8 KB for the guidance file. Administrators can distribute organization-wide rules by pushing the user-scope file to `~/.claude/` through device management. The same paths apply to `security-patterns.yaml`.
@@ -250,7 +250,7 @@
On pull request| [Code Review](</docs/en/code-review>), Team and Enterprise plans| Multi-agent correctness and security review with full codebase context
In CI| Your existing static analysis and dependency scanners| Language-specific rules, supply-chain checks, and policy enforcement the plugin does not attempt
-Each later stage catches what earlier ones miss. The plugin’s value is reducing the volume that reaches them, not eliminating the need for them.
+Each later stage catches what earlier ones miss. The plugin’s value is reducing the volume that reaches them, not eliminating the need for them. To find security issues in code you already have, rather than in changes Claude is writing, ask Claude in a session to review a specific file or directory for vulnerabilities, or use the [Claude Security plugin](</docs/en/claude-security>) for a deeper multi-agent scan of the whole repository; [`/security-review`](</docs/en/commands#all-commands>) covers only the changes on your current branch. Either way, the review reads the source code in your checkout, not a running site or deployed service.
##
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -213,13 +213,29 @@
Certain settings that could pose security risks require explicit user approval before Claude Code applies them:
* **Shell command settings** : settings that execute shell commands
- * **Custom environment variables** : variables not in the known safe allowlist
+ * **Custom environment variables** : delivered `env` variables that require the user’s approval, such as proxy and base-URL variables; see Environment variables and the approval dialog
* **Hook configurations** : any hook definition
* **Managed CLAUDE.md content** : a `claudeMd` value delivered through managed settings
When these settings are present, users see a security dialog explaining what is being configured. Users must approve to proceed. If a user rejects the settings, Claude Code exits. If an interactive session can’t show the dialog, Claude Code doesn’t apply the delivered settings and keeps the last-approved settings; the dialog appears in the next session that can show it. Requires Claude Code v2.1.211 or later.
A non-interactive run, such as `claude -p` or an Agent SDK session, can’t show the dialog. When the delivered settings would require approval, Claude Code applies them for that run only: it doesn’t record them as approved or write them to the local cache, and the next interactive session shows the dialog. Until a user approves in an interactive session, each non-interactive run fetches the settings again at startup. Before v2.1.207, a non-interactive run saved the settings as approved, so later interactive sessions never showed the dialog for them.
+
+####
+
+
+
+Environment variables and the approval dialog
+
+Claude Code applies some delivered `env` variables without showing the user the approval dialog, including:
+
+ * Feature and command toggles
+ * Model selection and behavior settings, such as `ANTHROPIC_MODEL`, `DISABLE_PROMPT_CACHING`, and `CLAUDE_CODE_EFFORT_LEVEL`
+ * Context window and compaction settings, such as `DISABLE_AUTO_COMPACT`
+ * Terminal UI and accessibility options
+ * Numeric limits, budgets, and timeouts
+
+Other delivered variables can require the user’s approval before they take effect; a non-empty proxy, base-URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` value always does. When a delivered variable needs approval, the dialog names it, so the user sees exactly what the policy is asking to set. Before v2.1.218, Claude Code applied fewer variables without asking the user, so settings such as `DISABLE_AUTO_COMPACT` triggered the dialog at any non-empty value. Claude Code decides whether four privacy toggles need approval by the delivered value rather than by the variable name: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_ERROR_REPORTING`, `DISABLE_TELEMETRY`, and `DO_NOT_TRACK`. A truthy value such as `1` or `true` only turns tracking, reporting, or other nonessential traffic off, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.218, all of them except `DO_NOT_TRACK` applied without approval at any value, and `DO_NOT_TRACK` triggered the dialog at any non-empty value.
##
--- a/session-storage.md
+++ b/session-storage.md
@@ -230,16 +230,22 @@
Validate your adapter
-Both SDKs ship a conformance suite that asserts the behavioral contract `append`, `load`, and the optional methods must satisfy. Tests for optional methods skip automatically when those methods are not implemented. In TypeScript, copy [`shared/conformance.ts`](<https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/examples/session-stores/shared/conformance.ts>) from the example directory into your test suite. In Python, the suite ships in the package:
+Both SDKs ship a conformance suite that asserts the behavioral contract `append`, `load`, and the optional methods must satisfy. Tests for optional methods skip automatically when those methods are not implemented. In TypeScript, copy [`shared/conformance.ts`](<https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/examples/session-stores/shared/conformance.ts>) from the example directory into your test suite. In Python, the suite ships in the package. To run it with pytest, which isn’t an SDK dependency, install pytest first:
+
+ pip install pytest
+
+Then pass your adapter to the suite in a test file as a zero-argument factory, which `run_session_store_conformance` calls once per contract to build a fresh store:
Python
import pytest
from claude_agent_sdk.testing import run_session_store_conformance
- @pytest.mark.asyncio
+ @pytest.mark.anyio
async def test_my_store_conformance():
- await run_session_store_conformance(MyRedisStore) # Your adapter class
+ await run_session_store_conformance(MyRedisStore)
+
+Passing the `MyRedisStore` class itself, as this example does, works when the constructor takes no arguments. For an adapter that takes a pre-configured client, pass a lambda that constructs the store instead. Because the contracts reuse the same session keys, each store the factory returns must start with empty storage, so have the lambda provision isolated backing storage per call, such as a fresh in-memory fake, a unique key prefix, or a new test database.
##
--- a/sessions.md
+++ b/sessions.md
@@ -34,6 +34,20 @@
* Scheduled tasks: [tasks that haven’t expired](</docs/en/scheduled-tasks#limitations>) are restored. Background Bash and monitor tasks aren’t.
Not every configuration flag from the original launch is restored. If the session depended on `--mcp-config`, `--settings`, `--plugin-dir`, `--fallback-model`, or directories added with `--add-dir`, pass them again when you resume; directories added mid-session with `/add-dir` aren’t restored either, though the session picker still uses them to locate the session. The standard settings files, such as `settings.json` and `settings.local.json`, are re-read at launch, so configuration that lives in them doesn’t need to be passed again.
+
+###
+
+
+
+Resume from a summary
+
+On a Pro or Max plan, when you resume a session that has been inactive for more than about an hour and is over 100,000 tokens, Claude Code restores the conversation and then opens a dialog before you send your first message. The session’s [prompt cache](</docs/en/prompt-caching#cache-lifetime>) has expired by then, so the next request processes the full history once no matter which of the dialog’s options you pick. The dialog offers three ways to continue the session. They differ in how much of the conversation each one carries forward into later requests, which is a tradeoff between keeping every detail and sending fewer tokens per request:
+
+ * **Resume from summary** : runs [`/compact`](</docs/en/context-window#what-survives-compaction>) immediately. Claude Code sends one summarization request over the full history, then replaces the history with the summary, your most recent exchanges, and up to five recently read files. Later requests carry the summary instead of the full history.
+ * **Resume full session as-is** : loads the conversation unchanged. After you send your first message, Claude Code reprocesses and re-caches the full history, then re-reads it from the cache on later requests while the cache stays warm.
+ * **Don’t ask me again** : resumes the full session and stops showing the dialog on all future resumes.
+
+Resuming as-is keeps every detail of the conversation available, at a per-request cost that scales with the conversation’s size. Resuming from the summary costs less on each later request because it carries the summary instead of the full history, but whatever the summary leaves out is no longer in Claude’s context. See [why usage climbs in a long session](</docs/en/costs#why-usage-climbs-in-a-long-session>) for where that per-request cost comes from.
###
Show diff (102 lines)
--- a/settings.md
+++ b/settings.md
@@ -19,7 +19,7 @@
**Managed**| Server-managed settings, plist / registry, or system-level `managed-settings.json`| All organization members for server-managed delivery; all users on the machine for plist, HKLM registry, and file delivery; the current user for HKCU registry delivery| Yes (deployed by IT)
**User**| `~/.claude/` directory| You, across all projects| No
**Project**| `.claude/` in repository| All collaborators on this repository| Yes (committed to git)
-**Local**| `.claude/settings.local.json` at the repository root| You, in this repository only| No (gitignored when Claude Code creates it)
+**Local**| `.claude/settings.local.json` at the repository root| You, in this repository only| No (gitignored when Claude Code saves a setting to it)
###
@@ -98,7 +98,7 @@
* **User settings** are defined in `~/.claude/settings.json` and apply to all projects.
* **Project settings** are saved in your project directory:
* `.claude/settings.json` for settings that are checked into source control and shared with your team
- * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. When Claude Code creates `.claude/settings.local.json`, it configures git to ignore the file. If you create the file yourself, add it to your gitignore manually. Claude Code reads and writes this file at the root of the git repository, resolved through [worktrees](</docs/en/worktrees>) to the main checkout, so one file covers sessions started in any subdirectory or worktree of the repository. The file stays in the directory you start Claude Code from in three cases: outside a git repository, when the repository root is your home directory, and in [Agent SDK](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>) sessions.
+ * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. When Claude Code saves a setting to this file in a repository that doesn’t already ignore it, Claude Code adds `**/.claude/settings.local.json` to your global git excludes file. That excludes file is `core.excludesFile` from your global git config when it’s set to an absolute or `~`-prefixed path, otherwise `$XDG_CONFIG_HOME/git/ignore`, or `~/.config/git/ignore`. If you create the file by hand or have Claude write it with the Write tool, add it to your gitignore yourself. Claude Code reads and writes this file at the root of the git repository, resolved through [worktrees](</docs/en/worktrees>) to the main checkout, so one file covers sessions started in any subdirectory or worktree of the repository. The file stays in the directory you start Claude Code from in three cases: outside a git repository, when the repository root is your home directory, and in [Agent SDK](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>) sessions.
Before v2.1.211, the file always lived in the starting directory. Claude Code still reads a `.claude/settings.local.json` that an earlier version left there. When both files set the same key, the repository root’s value wins, except that permission rules from both files stay in effect.
@@ -149,7 +149,8 @@
},
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
- "OTEL_METRICS_EXPORTER": "otlp"
+ "OTEL_METRICS_EXPORTER": "otlp",
+ "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf"
},
"companyAnnouncements": [
"Welcome to Acme Corp! Review our code guidelines at docs.acme.com",
@@ -298,7 +299,8 @@
`prefersReducedMotion`| Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility| `true`
`processWrapper`| Corporate launcher command placed in front of the [background processes Claude Code starts](</docs/en/corporate-launcher#what-the-launcher-covers>). Honored from managed settings, a `--settings` file, and user settings only; the [`CLAUDE_CODE_PROCESS_WRAPPER`](</docs/en/env-vars>) environment variable takes precedence when both are set. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the launcher contract. Requires Claude Code v2.1.210 or later| `"/opt/corp/launcher --profile claude"`
`prUrlTemplate`| URL template for the PR badge shown in the footer and in tool-result summaries. Substitutes `{host}`, `{owner}`, `{repo}`, `{number}`, and `{url}` from the `gh`-reported PR URL. Use to point PR links at an internal code-review tool instead of `github.com`. Does not affect `#123` autolinks in Claude’s prose| `"https://reviews.example.com/{owner}/{repo}/pull/{number}"`
-`remoteControlAtStartup`| Connect [Remote Control](</docs/en/remote-control>) automatically when each interactive session starts, instead of waiting for `/remote-control`. Set to `true` to always auto-connect, `false` to never auto-connect, or leave unset to follow your organization’s default. Appears in `/config` as **Enable Remote Control for all sessions**. See [Enable Remote Control for all sessions](</docs/en/remote-control#enable-remote-control-for-all-sessions>)| `false`
+`remote.defaultEnvironmentId`| Default [cloud environment](</docs/en/cloud-environments>) for cloud sessions you create from the CLI, such as with `claude --cloud` or [ultraplan](</docs/en/ultraplan>). Written to user settings when you pick an environment with [`/remote-env`](</docs/en/cloud-environments#select-an-environment-from-the-cli>). Follows the standard settings precedence, so a value in a repo’s project settings overrides the user-level pick| `"env_0123abcd"`
+`remoteControlAtStartup`| Connect [Remote Control](</docs/en/remote-control>) automatically when each interactive session starts, instead of waiting for `/remote-control`. Set to `true` to always auto-connect, `false` to never auto-connect, or leave unset to follow your organization’s admin default if one is set, and otherwise Claude Code’s current default. Appears in `/config` as **Enable Remote Control for all sessions**. See [Enable Remote Control for all sessions](</docs/en/remote-control#enable-remote-control-for-all-sessions>)| `false`
`requiredMaximumVersion`| Managed settings only. Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup and instructs the user to install an approved version through the organization’s approved method; `claude install <version>` may also work. Background auto-updates and `claude update` skip versions above the ceiling, so an in-range installation stays in range. `claude update`, `claude install`, and `claude doctor` keep working above the ceiling so users can recover. Versions that predate this setting ignore it| `"2.1.150"`
`requiredMinimumVersion`| Managed settings only. Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup and instructs the user to update through the organization’s approved method. `claude update`, `claude install`, and `claude doctor` keep working below the floor so users can recover. Differs from `minimumVersion`, which prevents downgrades but never blocks startup. Versions that predate this setting ignore it| `"2.1.150"`
`respectGitignore`| **Default** : `true`. Control whether the `@` file picker respects `.gitignore` patterns. When `true`, files matching `.gitignore` patterns are excluded from suggestions| `false`
@@ -317,6 +319,7 @@
`statusLine`| Configure a custom status line to display context. The object’s optional `padding`, `refreshInterval`, and `hideVimModeIndicator` fields control spacing, periodic re-runs, and whether the built-in vim mode indicator below the prompt is hidden. See [`statusLine` documentation](</docs/en/statusline#manually-configure-a-status-line>)| `{"type": "command", "command": "~/.claude/statusline.sh"}`
`strictKnownMarketplaces`| (Managed settings only) Allowlist of plugin marketplace sources. Undefined = no restrictions, empty array = lockdown. Enforced on marketplace add and on plugin install, update, refresh, and auto-update, so a marketplace added before the policy was set cannot be used to fetch plugins. See [Managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| `[{ "source": "github", "repo": "acme-corp/plugins" }]`
`strictPluginOnlyCustomization`| (Managed settings only) Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. `true` locks all four surfaces; an array locks only the named ones. See `strictPluginOnlyCustomization`| `["skills", "hooks"]`
+`switchModelsOnFlag`| **Default** : `true`. When a [safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), switch to the fallback model automatically and continue the session. Set to `false` to pause instead and choose between switching and editing the prompt. See [Ask before switching](</docs/en/model-config#ask-before-switching>). Appears in `/config` as **Switch models when a message is flagged**. Requires Claude Code v2.1.160 or later| `false`
`syntaxHighlightingDisabled`| Disable syntax highlighting in diffs, code blocks, and file previews| `true`
`teammateMode`| **Default** : `in-process`. How [agent team](</docs/en/agent-teams>) teammates display: `in-process`, `auto` (split panes when running inside tmux, or inside iTerm2 with `it2` on your `PATH`; in-process otherwise), `tmux` (split panes using tmux or iTerm2, detected from your terminal), or `iterm2` (iTerm2 native split panes via the `it2` CLI, added in v2.1.186). The default changed from `auto` in v2.1.179. `--teammate-mode` overrides this for one session. See [choose a display mode](</docs/en/agent-teams#choose-a-display-mode>)| `"auto"`
`terminalProgressBarEnabled`| **Default** : `true`. Show the terminal progress bar in supported terminals: ConEmu, Ghostty 1.2.0+, and iTerm2 3.6.6+. Appears in `/config` as **Terminal progress bar**| `false`
@@ -501,7 +504,7 @@
---|---
`commit`| Attribution for git commits, including any trailers. Empty string hides commit attribution
`pr`| Attribution for pull request descriptions. Empty string hides pull request attribution
-`sessionUrl`| Whether to append the claude.ai session link as a `Claude-Session` trailer on commits and a link in pull request descriptions when running from a web or Remote Control session. Defaults to `true`. Set to `false` to omit the link
+`sessionUrl`| Whether to append the claude.ai session link as a `Claude-Session` trailer on commits and a link in pull request descriptions when running from a cloud or Remote Control session. Defaults to `true`. Set to `false` to omit the link
**Default commit attribution:**
@@ -785,7 +788,7 @@
* **User settings** (`~/.claude/settings.json`): Personal plugin preferences
* **Project settings** (`.claude/settings.json`): Project-specific plugins shared with team
- * **Local settings** (`.claude/settings.local.json`): Per-machine overrides, gitignored when Claude Code creates it
+ * **Local settings** (`.claude/settings.local.json`): Per-machine overrides, gitignored when Claude Code saves a setting to it
* **Managed settings** (`managed-settings.json`): Organization-wide policy overrides that block installation at all scopes and hide the plugin from the marketplace
Project settings take precedence over user settings, so setting a plugin to `false` in `~/.claude/settings.json` does not disable a plugin that the project’s `.claude/settings.json` enables. To opt out of a project-enabled plugin on your machine, set it to `false` in `.claude/settings.local.json` instead.Plugins force-enabled by managed settings cannot be disabled this way, since managed settings override local settings.Enabling a plugin from an external source such as a GitHub repository or npm package in a project’s `.claude/settings.json` doesn’t install it for other people. As of Claude Code v2.1.195, every path that loads plugins asks each user to [install and trust the plugin](</docs/en/discover-plugins#configure-team-marketplaces>) before it runs.
@@ -904,7 +907,7 @@
**Allowlist behavior** :
* `undefined` (default): no restrictions, so users can add any marketplace
- * Empty array `[]`: complete lockdown, so users can’t add any new marketplaces
+ * Empty array `[]`: complete lockdown that blocks every marketplace source, including the official Anthropic marketplace, so users can’t add any new marketplaces
* List of sources: users can only add marketplaces that match exactly
**All supported source types** : The allowlist supports multiple marketplace source types. Most sources use exact matching, while `hostPattern` and `pathPattern` use regex matching against the marketplace host and filesystem path respectively.
@@ -996,13 +999,24 @@
]
}
-Example: disable all marketplace additions:
+Example: disable all marketplace additions, including the official Anthropic marketplace:
{
"strictKnownMarketplaces": []
}
-Example: allow all marketplaces from an internal git server:
+Example: allow only the official Anthropic marketplace. Matching is exact, so this entry doesn’t cover `ref` or `path` variants of the same repository:
+
+ {
+ "strictKnownMarketplaces": [
+ {
+ "source": "github",
+ "repo": "anthropics/claude-plugins-official"
+ }
+ ]
+ }
+
+With this entry, the official marketplace registers itself automatically the first time you start Claude Code interactively, so you don’t need to pair it with `extraKnownMarketplaces`. In a non-interactive environment that runs before that first interactive launch, add it explicitly with `claude plugin marketplace add anthropics/claude-plugins-official` or include it in `extraKnownMarketplaces`. Example: allow all marketplaces from an internal git server:
{
"strictKnownMarketplaces": [
--- a/setup.md
+++ b/setup.md
@@ -284,6 +284,8 @@
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 2.1.89 && del install.cmd
+To confirm which version installed, run `claude --version`: the command prints the exact version you passed, such as `2.1.89 (Claude Code)`.
+
###
@@ -298,15 +300,22 @@
* apk
-For Debian and Ubuntu. The install commands below download the signing key with `curl`, which fresh Debian and Ubuntu installations may not include. If the download fails with `sudo: curl: command not found`, install curl first:
-
- sudo apt install curl
-
-The following commands configure the `stable` channel:
+For Debian and Ubuntu. The install commands below download the signing key with `curl` and verify it with `gpg`, which fresh Debian and Ubuntu installations may not include. If either command reports `command not found`, install both first:
+
+ sudo apt install curl gnupg
+
+Download the signing key:
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
-o /etc/apt/keyrings/claude-code.asc
+
+If this download fails, `apt update` later fails with `NO_PUBKEY BAA929FF1A7ECACE`. Confirm the key downloaded and belongs to Anthropic before continuing:
+
+ gpg --show-keys /etc/apt/keyrings/claude-code.asc
+
+The fingerprint gpg prints should be `31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE`. If gpg reports that the file can’t be opened or contains no valid OpenPGP data, the download failed or returned the wrong content: confirm your network can reach `downloads.claude.ai`, then rerun the download command.Register the repository on the `stable` channel and install:
+
echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \
| sudo tee /etc/apt/sources.list.d/claude-code.list
sudo apt update
@@ -317,7 +326,7 @@
echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/latest latest main" \
| sudo tee /etc/apt/sources.list.d/claude-code.list
-Verify the GPG key fingerprint before trusting it: `gpg --show-keys /etc/apt/keyrings/claude-code.asc` should report `31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`.To upgrade later, run `sudo apt update && sudo apt upgrade claude-code`.
+To upgrade later, run `sudo apt update && sudo apt upgrade claude-code`.
For Fedora and RHEL. The following commands configure the `stable` channel:
--- a/skills.md
+++ b/skills.md
@@ -30,7 +30,7 @@
`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks
`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project
-All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes.
+All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes. `/verify` can also record its own recipe. When it has to build and drive your app without a recorded recipe, it writes what worked to `.claude/skills/verify/SKILL.md` at the repo root, or in the touched package directory in a monorepo, so later runs and other agents follow the same steps. At the repo root, the recorded skill replaces the bundled `/verify`. This requires Claude Code v2.1.200 or later. Claude edits the recorded file only when it steered a run wrong, such as a command that failed or a missing step, so you can commit the file without per-session diffs. Before v2.1.205, the bundled skill told Claude to fold in anything a run learned, which caused frequent merge conflicts.
##
@@ -127,9 +127,9 @@
-Automatic discovery from parent and nested directories
-
-Project skills load from `.claude/skills/` in your starting directory and in every parent directory up to the repository root, so starting Claude in a subdirectory still picks up skills defined at the root. When you work with files in subdirectories below your starting directory, Claude Code also discovers skills from nested `.claude/skills/` directories on demand. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
+Discovery from parent and nested directories
+
+Project skills load from `.claude/skills/` in the directory where you start Claude Code and in every parent directory up to the repository root. Starting Claude in a subdirectory still picks up skills defined at the root. To load skills from a directory outside that path at startup, pass it with [`--add-dir`](</docs/en/cli-reference>). Claude Code reads `.claude/skills/` inside each added directory alongside the project skills. Skills in nested `.claude/skills/` directories below your starting directory aren’t loaded at startup. They load the first time Claude reads or edits a file inside that subdirectory, and stay available for the rest of the session. For example, after Claude edits a file under `packages/frontend/`, skills in `packages/frontend/.claude/skills/` become available. Until then, those skills don’t appear in autocomplete and can’t be invoked by name. Each skill is a directory with `SKILL.md` as the entrypoint:
my-skill/
├── SKILL.md # Main instructions (required)
@@ -159,10 +159,10 @@
Skills in Cowork and cloud sessions
-[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/claude-code-on-the-web#the-cloud-environment>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
+[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
* For Cowork and cloud sessions, enable the skill for your claude.ai account.
- * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/claude-code-on-the-web#what%E2%80%99s-available-in-cloud-sessions>); plugins enabled only in your user settings don’t transfer.
+ * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/cloud-environments#what-carries-over-from-your-setup>); plugins enabled only in your user settings don’t transfer.
[Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) are different: they run locally on your machine and load skills from the same locations as any other local session.
--- a/slack.md
+++ b/slack.md
@@ -1,4 +1,7 @@
-Claude Code in Slack is being replaced by [Claude Tag](<https://claude.com/product/tag>) for Team and Enterprise workspaces. Claude Tag runs @Claude as your organization’s shared identity with admin-configured access, under the same Slack app, so there is nothing to reinstall and existing setups continue to work during the transition. To switch a workspace, see [Migrate from the earlier Claude in Slack](<https://claude.com/docs/claude-tag/admins/migrate-from-earlier>).
+This page documents the earlier Claude Code in Slack, which runs each session under an individual user’s account.
+
+ * **Team and Enterprise plans:** Anthropic is retiring this version in favor of [Claude Tag](<https://claude.com/docs/claude-tag/overview>), which runs @Claude as your organization’s shared identity with admin-configured access. Your existing Slack app and @Claude handle stay, and your Anthropic account team can tell you the cutover date. Set up Claude Tag for a new workspace; to move one that already uses this version, see [Migrate from the earlier Claude in Slack](<https://claude.com/docs/claude-tag/admins/migrate-from-earlier>).
+ * **Pro and Max plans:** Claude Tag isn’t available on individual plans, so this page remains the setup path.
Claude Code in Slack brings the power of Claude Code directly into your Slack workspace. When you mention `@Claude` with a coding task, Claude automatically detects the intent and creates a Claude Code session on the web, allowing you to delegate development work without leaving your team conversations. This integration is built on the existing Claude for Slack app but adds intelligent routing to Claude Code on the web for coding-related requests. Each session runs under your own Claude account, using your connected repositories and your plan limits.
@@ -261,6 +264,19 @@
+Sessions from a Claude Tag channel fail to start
+
+This entry applies to workspaces using [Claude Tag](<https://claude.com/docs/claude-tag/overview>), where Claude works in channels as your organization’s shared identity, not as any member’s account. If you created the channel’s cloud environment at [claude.ai/code](<https://claude.ai/code>), it belongs to your personal account, and Claude can’t start channel sessions in a personal environment. Claude Code fails the session immediately, and retrying doesn’t help. If you’re an Owner or admin, recreate the environment as an [organization-shared environment](</docs/en/cloud-environments#organization-shared-environments>) from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). You can apply it in two ways:
+
+ * Set it as the organization default at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>).
+ * [Set it on the 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.
+
+If you’re not an Owner or admin, send this entry to one.
+
+###
+
+
+
Repository not showing
1. Connect the repository in Claude Code on the web at [claude.ai/code](<https://claude.ai/code>)
--- a/slash-commands.md
+++ b/slash-commands.md
@@ -402,6 +402,8 @@
asyncio.run(main())
+If the prompt passes fewer arguments than the placeholders reference, unmatched indexed placeholders such as `$1` stay in the command text verbatim. For the full substitution behavior, including named arguments, see [available string substitutions](</docs/en/skills#available-string-substitutions>).
+
####
--- a/structured-outputs.md
+++ b/structured-outputs.md
@@ -411,11 +411,9 @@
}
}
} catch (error) {
- // A single-shot query() throws after yielding an error result.
- // If the failure was an error result, the subtype branches above
- // have already run; connection or process failures yield no result
- // message. Handle the failure here - retry with a simpler prompt,
- // fall back to unstructured, etc.
+ // A single-shot query() throws after yielding an error result. If the
+ // failure was an error result, the error subtype branches above have
+ // already run; connection or process failures yield no result message.
console.log(`Session ended with an error: ${error}`);
}
@@ -448,11 +446,9 @@
else:
print("Run ended without a structured output")
except Exception as error:
- # A single-shot query() raises after yielding an error result.
- # If the failure was an error result, the subtype branches above
- # have already run; connection or process failures yield no
- # result message. Handle the failure here - retry with a simpler
- # prompt, fall back to unstructured, etc.
+ # A single-shot query() raises after yielding an error result. If the
+ # failure was an error result, the error subtype branches above have
+ # already run; connection or process failures yield no result message.
print(f"Session ended with an error: {error}")
asyncio.run(main())
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -220,7 +220,7 @@
Field| Required| Description
---|---|---
-`name`| Yes| Unique identifier using lowercase letters and hyphens. [Hooks](</docs/en/hooks#subagentstart>) receive this value as `agent_type`. The filename doesn’t have to match
+`name`| Yes| Unique identifier using lowercase letters and hyphens. [Hooks](</docs/en/hooks#subagentstart>) receive this value as `agent_type`. The filename doesn’t have to match. Names can’t contain `:`, which is reserved for [plugin-scoped identifiers](</docs/en/plugins>) such as `my-plugin:reviewer`. Claude Code doesn’t load a file whose name contains one and logs an error to the debug log. Before v2.1.218, such names were accepted
`description`| Yes| When Claude should delegate to this subagent
`tools`| No| Tools the subagent can use. Inherits every tool available to subagents if omitted. If no entry in the list resolves to a tool, the subagent usually [fails to launch](</docs/en/errors#agent-would-be-spawned-with-zero-tools>) with an error naming the entries. To preload Skills into context, use the `skills` field rather than listing `Skill` here
`disallowedTools`| No| Tools to deny, removed from inherited or specified list
@@ -493,7 +493,11 @@
exit 0
-See [Hook input](</docs/en/hooks#pretooluse-input>) for the complete input schema and [exit codes](</docs/en/hooks#exit-code-output>) for how exit codes affect behavior. On Windows, write hook scripts in PowerShell and add `shell: powershell` to the hook entry as shown in [running hooks in PowerShell](</docs/en/hooks#windows-powershell-tool>).
+On macOS and Linux, make the script executable, or the hook fails instead of blocking anything:
+
+ chmod +x ./scripts/validate-readonly-query.sh
+
+To test the rule, ask the subagent to run an `UPDATE` statement: the script exits with code 2, Claude Code blocks the command, and the subagent sees the `Blocked: Only SELECT queries are allowed` message. See [Hook input](</docs/en/hooks#pretooluse-input>) for the complete input schema and [exit codes](</docs/en/hooks#exit-code-output>) for how exit codes affect behavior. On Windows, write hook scripts in PowerShell and add `shell: powershell` to the hook entry as shown in [running hooks in PowerShell](</docs/en/hooks#windows-powershell-tool>).
####
@@ -538,7 +542,7 @@
Frontmatter hooks fire when the agent is spawned as a subagent through the Agent tool or an @-mention, and when the agent runs as the main session via `--agent` or the `agent` setting. In the main-session case they run alongside any hooks defined in [`settings.json`](</docs/en/hooks>).
-All [hook events](</docs/en/hooks#hook-events>) are supported. The most common events for subagents are:
+To let a project-level subagent’s frontmatter hooks run, accept the [workspace trust dialog](</docs/en/permissions#project-allow-rules-and-workspace-trust>) for the folder that contains the agent file. Hooks from user-level subagents in `~/.claude/agents/` and from definitions you pass with `--agents` run without this step. If you added a folder with `--add-dir` from outside your trusted workspace’s repository, trust that folder separately: its `.claude/agents/` hooks don’t inherit the workspace’s grant. Until you trust the folder, the subagent still runs, but Claude Code skips its frontmatter hooks and logs an error to the debug log explaining how to trust the folder. The grant is the same workspace trust approval that covers project settings and project-level hooks. Before v2.1.218, frontmatter hooks could run from folders you hadn’t trusted, including in non-interactive sessions. All [hook events](</docs/en/hooks#hook-events>) are supported. The most common events for subagents are:
Event| Matcher input| When it fires
---|---|---
@@ -1125,7 +1129,7 @@
chmod +x ./scripts/validate-readonly-query.sh
-On Windows, write the validation script in PowerShell and add `shell: powershell` to the hook entry. See [running hooks in PowerShell](</docs/en/hooks#windows-powershell-tool>). The hook receives JSON via stdin with the Bash command in `tool_input.command`. Exit code 2 blocks the operation and feeds the error message back to Claude. See [Hooks](</docs/en/hooks#exit-code-output>) for details on exit codes and [Hook input](</docs/en/hooks#pretooluse-input>) for the complete input schema.
+On Windows, write the validation script in PowerShell and add `shell: powershell` to the hook entry. See [running hooks in PowerShell](</docs/en/hooks#windows-powershell-tool>). The hook receives JSON via stdin with the Bash command in `tool_input.command`. Exit code 2 blocks the operation and feeds the error message back to Claude. See [Hooks](</docs/en/hooks#exit-code-output>) for details on exit codes and [Hook input](</docs/en/hooks#pretooluse-input>) for the complete input schema. The system prompt tells the subagent to refuse write requests, so the hook is a backstop: if the subagent attempts a write anyway, Claude Code blocks the command and the subagent sees the `Blocked: Write operations not allowed. Use SELECT queries only.` message.
##
--- a/tool-search.md
+++ b/tool-search.md
@@ -13,7 +13,7 @@
When tool search is active, tool definitions are withheld from the context window. The agent receives a summary of available tools and searches for relevant ones when the task requires a capability not already loaded. Up to five of the most relevant tools are loaded into context by default, where they stay available for subsequent turns. If the conversation is long enough that the SDK compacts earlier messages to free space, previously discovered tools may be removed, and the agent searches again as needed. Tool search adds one extra round-trip the first time Claude discovers a tool (the search step), but for large tool sets this is offset by smaller context on every turn. With fewer than ~10 tools, loading everything upfront is typically faster. For details on the underlying API mechanism, see [Tool search in the API](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool>).
-Tool search is supported on Claude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4.5, and later models; see [model compatibility in the API docs](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool#model-compatibility>) for the current list. On Google Cloud’s Agent Platform, the minimum supported models are Claude Sonnet 4.5 and Claude Opus 4.5.
+Tool search is supported on Claude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4.5, and later models; see [model compatibility in the API docs](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool#model-compatibility>) for the current list. On Google Cloud’s Agent Platform, the minimum supported models are Claude Sonnet 4.5 and Claude Opus 4.5.Tool search also isn’t supported on Microsoft Foundry [deployments hosted on Azure](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>), which reject it server-side: the SDK detects the rejection and loads tool definitions upfront for that deployment instead. `ENABLE_TOOL_SEARCH` can’t override this, since the rejection comes from the deployment itself.
##
@@ -25,8 +25,8 @@
Value| Behavior
---|---
-(unset)| Tool search is on. Tool definitions are deferred and discovered on demand. Falls back to loading upfront on Google Cloud’s Agent Platform or a non-first-party `ANTHROPIC_BASE_URL`.
-`true`| Tool search is always on. The SDK sends the beta header even on Google Cloud’s Agent Platform and through proxies. Requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference` blocks.
+(unset)| Tool search is on. Tool definitions are deferred and discovered on demand. Falls back to loading upfront on Google Cloud’s Agent Platform, a non-first-party `ANTHROPIC_BASE_URL`, or a Microsoft Foundry deployment hosted on Azure.
+`true`| Tool search is always on, except on a Microsoft Foundry deployment hosted on Azure, where the server-side rejection still forces upfront loading. The SDK sends the beta header even on Google Cloud’s Agent Platform and through proxies. Requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference` blocks.
`auto`| Checks the combined token count of all tool definitions against the model’s context window. If they exceed 10%, tool search activates. If they’re under 10%, all tools are loaded into context normally.
`auto:N`| Same as `auto` with a custom percentage. `auto:5` activates when tool definitions exceed 5% of the context window. Lower values activate sooner.
`false`| Tool search is off. All tool definitions are loaded into context on every turn.
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -24,7 +24,7 @@
`Monitor`| Runs a command in the background and feeds each output line back to Claude, so it can react to log entries, file changes, or polled status mid-conversation. Can also open a WebSocket and treat each incoming message as an event. See Monitor tool| Yes
`NotebookEdit`| Modifies Jupyter notebook cells. See NotebookEdit tool behavior| Yes
`PowerShell`| Executes PowerShell commands natively. See PowerShell tool for availability| Yes
-`PushNotification`| Sends a desktop notification, and a phone push when [Remote Control](</docs/en/remote-control>) is connected, so a long-running task or [scheduled task](</docs/en/scheduled-tasks>) can reach you when you step away. Push delivery runs through Anthropic-hosted infrastructure, which is not accessible from Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No
+`PushNotification`| Sends a desktop notification, and a phone push when [Remote Control](</docs/en/remote-control>) is connected, so a long-running task or [scheduled task](</docs/en/scheduled-tasks>) can reach you when you step away. Push delivery runs through Anthropic-hosted infrastructure, which is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No
`Read`| Reads the contents of files. See Read tool behavior| No
`ReadMcpResourceTool`| Reads a specific MCP resource by URI| No
`RemoteTrigger`| Creates, updates, runs, and lists [Routines](</docs/en/routines>) on claude.ai. Backs the `/schedule` command. Routines live on claude.ai and require a Pro, Max, Team, or Enterprise plan, so this tool is not accessible from Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No
@@ -403,7 +403,7 @@
WebSearch runs a query against Anthropic’s [web search](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool>) backend and returns result titles and URLs. It doesn’t fetch the result pages. To read a page Claude finds in search results, it follows up with WebFetch. The tool may issue up to eight backend searches per call, refining the search internally before returning results. Claude can scope results with `allowed_domains` to include only certain hosts, or `blocked_domains` to exclude them. The two lists can’t be combined in a single call. When the search request hits an overloaded API, Claude Code retries it with backoff; a call that still fails returns an error result. Before v2.1.212, the API error text could reach Claude as if it were search results. WebSearch permission rules take no specifier. A bare `WebSearch` entry in `allow` or `deny` is the only form. The search backend is not configurable. To search with a different provider, add an [MCP server](</docs/en/mcp>) that exposes a search tool.
-WebSearch is available on the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Microsoft Foundry. On Google Cloud’s Agent Platform it works with Claude 4 and later models, including Opus, Sonnet, and Haiku. Amazon Bedrock doesn’t expose the server-side web search tool.
+WebSearch is available on the Claude API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Microsoft Foundry it requires a [deployment hosted on Anthropic](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>): deployments hosted on Azure don’t support server-side tools, so the WebSearch call fails. On Google Cloud’s Agent Platform it works with Claude 4 and later models, including Opus, Sonnet, and Haiku. Amazon Bedrock doesn’t expose the server-side web search tool.
###
--- a/troubleshoot-install.md
+++ b/troubleshoot-install.md
@@ -268,6 +268,7 @@
winget install Anthropic.ClaudeCode
+Then run `claude --version` to confirm: the command prints a version number such as `2.1.211 (Claude Code)`. If the shell reports `claude` isn’t found, open a new terminal window and retry: the session you installed from keeps its old `PATH`.
2. **Retry after a few minutes** : the issue is often temporary. Wait and try the original command again.
###
@@ -311,6 +312,8 @@
winget install Anthropic.ClaudeCode
+Then run `claude --version` to confirm: the command prints a version number such as `2.1.211 (Claude Code)`. If the shell reports `claude` isn’t found, open a new terminal window and retry: the session you installed from keeps its old `PATH`.
+
###
@@ -385,6 +388,8 @@
winget install Anthropic.ClaudeCode
+Then run `claude --version` to confirm: the command prints a version number such as `2.1.211 (Claude Code)`. If the shell reports `claude` isn’t found, open a new terminal window and retry: the session you installed from keeps its old `PATH`.
+
###
@@ -451,10 +456,10 @@
Install killed on low-memory Linux servers
-A `Killed` message during install usually means the Linux out-of-memory (OOM) killer terminated the `claude install` step because the system ran out of free memory. This is common on small VPS and cloud instances. The install script reports the cause and exits with code 137:
+A `Killed` message during install usually means the Linux out-of-memory (OOM) killer terminated the `claude install` step because the system ran out of free memory. This is common on small VPS and cloud instances. The install script reports the cause and exits with code 137. In this example, the line number and process ID vary by release and run:
Setting up Claude Code...
- bash: line 142: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"}
+ bash: line 183: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"}
Installation was killed before it could finish (exit code 137). This usually means the system ran out of memory.
Claude Code needs roughly 512MB of free memory to install. Free up memory, then run this script again.
Show diff (1932 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -460,7 +460,7 @@
Example
-The example below resolves settings for a project directory and prints the source that controls the cleanup period.
+The example below resolves settings for a project directory and prints the source that controls the cleanup period. On a machine where no settings file sets `cleanupPeriodDays`, both printed lines show `undefined` for the value, which is the expected output rather than an error.
import { resolveSettings } from "@anthropic-ai/claude-agent-sdk";
@@ -510,7 +510,7 @@
`extraArgs`| `Record<string, string | null>`| `{}`| Additional arguments
`fallbackModel`| `string`| `undefined`| Model to use if primary fails
`forkSession`| `boolean`| `false`| When resuming with `resume`, fork to a new session ID instead of continuing the original session
-`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. By default only `tool_use` and `tool_result` blocks from subagents are emitted
+`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. By default only `tool_use` and `tool_result` blocks from subagents are emitted. Messages from subagents at every nesting depth are forwarded on Claude Code v2.1.219 and later; before v2.1.219, only messages from depth-1 subagents appeared
`hooks`| `Partial<Record<``HookEvent``, ``HookCallbackMatcher``[]>>`| `{}`| Hook callbacks for events
`includeHookEvents`| `boolean`| `false`| Include hook lifecycle events for every hook event in the message stream as `SDKHookStartedMessage`, `SDKHookProgressMessage`, and `SDKHookResponseMessage`. Lifecycle events for `SessionStart` and `Setup` hooks are always included and don’t need this option
`includePartialMessages`| `boolean`| `false`| Include partial message events
@@ -559,6 +559,8 @@
The CLI subprocess reads several environment variables that control API timeouts and stall detection. Pass them through the `env` option:
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
const result = query({
prompt: "Analyze this code",
options: {
@@ -574,7 +576,7 @@
* `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents.
* `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window, so worst-case wall time is roughly `API_TIMEOUT_MS × (CLAUDE_CODE_MAX_RETRIES + 1)` plus backoff. For unattended runs that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG=1`: it retries capacity errors indefinitely, and as of Claude Code v2.1.199 raises the default for other transient errors to `300` and removes the cap on this variable.
* `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents launched with `run_in_background`. Default `600000`. Resets on each stream event; on stall it aborts the subagent, marks the task failed, and surfaces the error to the parent with any partial result. Does not apply to synchronous subagents.
- * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. The aborted request goes through the normal retry path.
+ * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, Claude Code retries the request at most once, and only before Claude has started a block of text or a tool call in the response; once Claude has completed a block of text or a tool call, Claude Code keeps the completed output, appends an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>) instead of retrying, and still runs any completed tool call.
###
@@ -600,6 +602,7 @@
supportedModels(): Promise<ModelInfo[]>;
supportedAgents(): Promise<AgentInfo[]>;
mcpServerStatus(): Promise<McpServerStatus[]>;
+ getContextUsage(): Promise<SDKControlGetContextUsageResponse>;
accountInfo(): Promise<AccountInfo>;
reconnectMcpServer(serverName: string): Promise<void>;
toggleMcpServer(serverName: string, enabled: boolean): Promise<void>;
@@ -620,15 +623,16 @@
`interrupt()`| Interrupts the query. Only available in streaming input mode. When the CLI advertises the `interrupt_receipt_v1` capability in `SDKSystemMessage.capabilities`, resolves with an `SDKControlInterruptResponse` listing the queued messages that survive the interrupt. Resolves `undefined` on CLIs before v2.1.205
`rewindFiles(userMessageId, options?)`| Restores files to their state at the specified user message. Pass `{ dryRun: true }` to preview changes. Requires `enableFileCheckpointing: true`. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>)
`setPermissionMode()`| Changes the permission mode (only available in streaming input mode)
-`setModel()`| Changes the model (only available in streaming input mode)
+`setModel()`| Changes the model (only available in streaming input mode). Passing `undefined` or the string `"default"` resets to the session default model
`setMaxThinkingTokens()`| _Deprecated:_ Use the `thinking` option instead. Changes the maximum thinking tokens. Passing `null` resets thinking to the session default: a mid-session override is cleared, and thinking stays off for sessions that have it disabled
`applyFlagSettings(settings)`| Merges settings into the session’s flag settings layer at runtime (only available in streaming input mode). See `applyFlagSettings()`
`initializationResult()`| Returns the full initialization result including supported commands, models, account info, and output style configuration
`reinitialize()`| Re-sends the `initialize` control request to the running CLI and returns a fresh result instead of the cached first-connect result. Use it after a transport gap, such as reattaching to a session after a disconnect, so pending permission requests reach your `canUseTool` callback again. Make the callback idempotent per request ID, because a request whose response was lost is dispatched again. Requires Claude Code v2.1.195 or later
-`supportedCommands()`| Returns available slash commands
+`supportedCommands()`| Returns available slash commands. From Agent SDK v0.3.216 the list reflects mid-session command changes; see `SDKCommandsChangedMessage`
`supportedModels()`| Returns available models with display info
`supportedAgents()`| Returns available subagents as `AgentInfo``[]`
`mcpServerStatus()`| Returns status of connected MCP servers
+`getContextUsage()`| Returns an `SDKControlGetContextUsageResponse` breaking down the session’s context window usage by category, skill, and tool. The same data `/context` shows in an interactive session
`accountInfo()`| Returns account information
`reconnectMcpServer(serverName)`| Reconnect an MCP server by name
`toggleMcpServer(serverName, enabled)`| Enable or disable an MCP server by name
@@ -650,6 +654,8 @@
* **No effect mid-session** : the system prompt options. These are resolved once at startup, so the running session keeps the original value even though the call succeeds. To change them, start a new session.
`effortLevel` accepts an [effort level](</docs/en/model-config#adjust-effort-level>) name. It also accepts `"ultracode"`, which runs the session at `xhigh` effort and turns on [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>). The `Settings` type declares `effortLevel` without that value, so pass the equivalent `{ ultracode: true }` in TypeScript. The `ultracode` value requires Claude Code v2.1.203 or later and is accepted only by `applyFlagSettings()`, not by the `effortLevel` key in a settings file. The values are written to the flag-settings layer, the same layer the inline `settings` option of `query()` populates at startup. Flag settings sit near the top of the [settings precedence order](</docs/en/settings#settings-precedence>): they override user, project, and local settings, and only managed policy settings can override them. This is the same tier the on-page precedence section calls programmatic options. Successive calls shallow-merge top-level keys. A second call with `{ permissions: {...} }` replaces the entire `permissions` object from the prior call rather than deep-merging into it. To clear a key from the flag layer and fall back to lower-precedence sources, pass `null` for that key. Passing `undefined` has no effect because JSON serialization drops it. Only available in streaming input mode, the same constraint as `setModel()` and `setPermissionMode()`. The example below switches the active model mid-session, then clears the override so the model falls back to whatever the user or project settings specify.
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
const q = query({ prompt: messageStream });
@@ -703,9 +709,10 @@
models: ModelInfo[];
account: AccountInfo;
fast_mode_state?: "off" | "cooldown" | "on";
- };
-
-When a client sends `initialize` to a session that is already running, the control-response wrapper also carries an optional `pending_permission_requests` array. The field is on the response wrapper itself, not in the `SDKControlInitializeResponse` payload above. Each entry is a complete `control_request` message with the same `{ type: "control_request", request_id, request }` shape the session streams for permission requests while running. These are requests that were issued before the client connected and are still awaiting a reply. The SDK reads the array for you and dispatches each entry to your `canUseTool` callback, the same redelivery that `reinitialize()` triggers after a transport gap. Handle repeated request IDs idempotently, because an entry can repeat a request the callback already received before the connection dropped.
+ fast_mode_disabled_reason?: FastModeDisabledReason;
+ };
+
+The response always reports `fast_mode_state`, and when something blocks [fast mode](</docs/en/fast-mode>), `fast_mode_disabled_reason` carries the reason code alongside it, so you can explain the blocked state instead of re-deriving availability. Both behaviors require Claude Code v2.1.219 or later. Before v2.1.219, the response omitted `fast_mode_state` when fast mode wasn’t available and never carried a reason. For the reason codes and their meanings, see `fast_mode_disabled_reason` on the result message. When a client sends `initialize` to a session that is already running, the control-response wrapper also carries an optional `pending_permission_requests` array. The field is on the response wrapper itself, not in the `SDKControlInitializeResponse` payload above. Each entry is a complete `control_request` message with the same `{ type: "control_request", request_id, request }` shape the session streams for permission requests while running. These are requests that were issued before the client connected and are still awaiting a reply. The SDK reads the array for you and dispatches each entry to your `canUseTool` callback, the same redelivery that `reinitialize()` triggers after a transport gap. Handle repeated request IDs idempotently, because an entry can repeat a request the callback already received before the connection dropped.
###
@@ -717,6 +724,7 @@
type SDKControlInterruptResponse = {
still_queued: string[];
+ cancelled?: string[];
};
`still_queued` lists the UUIDs of user messages that survive the interrupt: messages still in the queue, plus any batch already dequeued for the next turn but not yet reachable by the abort. Each one runs as its own turn after the interrupt unless you cancel it first. Use the receipt to decide whether to resend anything; resending a message that is already listed produces a duplicate turn. Interpret the list with these caveats:
@@ -725,7 +733,116 @@
* Only main-thread messages are listed. Messages addressed to a subagent are out of scope.
* The list can include UUIDs your client never sent, such as [scheduled task](</docs/en/scheduled-tasks>) triggers. Ignore UUIDs you don’t recognize instead of treating them as an error.
-The receipt is a snapshot taken at the moment the interrupt is processed, and on a clean interrupt it arrives before the interrupted turn’s `SDKResultMessage`. Read the receipt rather than inspecting the queue after that result: the loop starts the next queued turn immediately, so the queue you inspect after the result has already changed.
+A client that drives the CLI’s control protocol directly, rather than through `interrupt()`, can set `cancel_queued: true` on the `interrupt` control request. Claude Code v2.1.219 and later advertises support with the `interrupt_cancel_queued_v1` capability in `SDKSystemMessage.capabilities`; older CLIs ignore the field and leave queued messages to run as usual. Such an interrupt also cancels every message that would otherwise be listed under `still_queued`: the receipt lists them under `cancelled` instead, `still_queued` is empty, and none of them run. The `cancelled` list carries the same caveats as `still_queued`. The `interrupt()` method never sends `cancel_queued`, so receipts it resolves with don’t carry `cancelled`. The receipt is a snapshot taken at the moment the interrupt is processed, and on a clean interrupt it arrives before the interrupted turn’s `SDKResultMessage`. Read the receipt rather than inspecting the queue after that result: the loop starts the next queued turn immediately, so the queue you inspect after the result has already changed.
+
+###
+
+
+
+`SDKControlGetContextUsageResponse`
+
+Return type of `getContextUsage()`. This is the same payload the `/context` command renders in an interactive session, so alongside the token counts it carries display fields such as `color`, `gridRows`, and `percentage` that `/context` uses to draw its usage grid.
+
+ type SDKControlGetContextUsageResponse = {
+ categories: {
+ name: string;
+ tokens: number;
+ color: string;
+ isDeferred?: boolean;
+ }[];
+ totalTokens: number;
+ maxTokens: number;
+ rawMaxTokens: number;
+ percentage: number;
+ gridRows: {
+ color: string;
+ isFilled: boolean;
+ categoryName: string;
+ tokens: number;
+ percentage: number;
+ squareFullness: number;
+ }[][];
+ model: string;
+ memoryFiles: {
+ path: string;
+ type: string;
+ tokens: number;
+ }[];
+ mcpTools: {
+ name: string;
+ serverName: string;
+ tokens: number;
+ isLoaded?: boolean;
+ }[];
+ deferredBuiltinTools?: {
+ name: string;
+ tokens: number;
+ isLoaded: boolean;
+ }[];
+ systemTools?: {
+ name: string;
+ tokens: number;
+ }[];
+ systemPromptSections?: {
+ name: string;
+ tokens: number;
+ }[];
+ agents: {
+ agentType: string;
+ source: string;
+ tokens: number;
+ }[];
+ slashCommands?: {
+ totalCommands: number;
+ includedCommands: number;
+ tokens: number;
+ };
+ skills?: {
+ totalSkills: number;
+ includedSkills: number;
+ tokens: number;
+ skillFrontmatter: {
+ name: string;
+ source: string;
+ tokens: number;
+ }[];
+ };
+ autoCompactThreshold?: number;
+ isAutoCompactEnabled: boolean;
+ messageBreakdown?: {
+ toolCallTokens: number;
+ toolResultTokens: number;
+ attachmentTokens: number;
+ assistantMessageTokens: number;
+ userMessageTokens: number;
+ redirectedContextTokens: number;
+ unattributedTokens: number;
+ toolCallsByType: {
+ name: string;
+ callTokens: number;
+ resultTokens: number;
+ }[];
+ attachmentsByType: {
+ name: string;
+ tokens: number;
+ }[];
+ };
+ apiUsage: {
+ input_tokens: number;
+ output_tokens: number;
+ cache_creation_input_tokens: number;
+ cache_read_input_tokens: number;
+ } | null;
+ };
+
+Read token attribution from the collection fields:
+
+ * `categories` holds the per-category totals.
+ * `mcpTools` and `agents` attribute tokens to individual MCP tools and subagents.
+ * `memoryFiles` lists each loaded memory file with its cost.
+ * `skills.skillFrontmatter` attributes the skill listing’s tokens to each included skill. The per-skill counts measure each skill’s listing entry as Claude Code actually sends it, which can be shorter than the skill’s full frontmatter. Compare `skills.totalSkills` with `skills.includedSkills` to see whether every discovered skill made it into the listing.
+
+`totalTokens` is the session’s current context usage, and `maxTokens` is the window that usage is measured against. That window is the model’s context window, or the lower auto-compaction window when one applies. Claude Code leaves the optional `deferredBuiltinTools`, `systemTools`, and `systemPromptSections` diagnostics unset, so expect them to be absent even though the type declares them.
###
@@ -795,7 +912,7 @@
---|---|---
`'user'`| Global user settings| `~/.claude/settings.json`
`'project'`| Shared project settings (version controlled)| `.claude/settings.json`
-`'local'`| Local project settings (not version controlled)| `.claude/settings.local.json`
+`'local'`| Local project settings, gitignored when Claude Code saves a setting to it| `.claude/settings.local.json`
####
@@ -812,6 +929,8 @@
Why use settingSources
**Disable filesystem settings:**
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
// Do not load user, project, or local settings from disk
const result = query({
@@ -820,6 +939,8 @@
});
**Load all filesystem settings explicitly:**
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
const result = query({
prompt: "Analyze this code",
@@ -829,6 +950,8 @@
});
**Load only specific setting sources:**
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
// Load only project settings, ignore user and local
const result = query({
@@ -840,16 +963,21 @@
**Testing and CI environments:**
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
// Ensure consistent behavior in CI by excluding local settings
const result = query({
prompt: "Run tests",
options: {
settingSources: ["project"], // Only team-shared settings
- permissionMode: "bypassPermissions"
+ permissionMode: "bypassPermissions",
+ allowDangerouslySkipPermissions: true
}
});
**SDK-only applications:**
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
// Define everything programmatically.
// Pass [] to opt out of filesystem setting sources.
@@ -868,6 +996,8 @@
});
**Loading CLAUDE.md project instructions:**
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
// Load project settings to include CLAUDE.md files
const result = query({
@@ -1155,10 +1285,11 @@
message: BetaMessage; // From Anthropic SDK
parent_tool_use_id: string | null;
error?: SDKAssistantMessageError;
+ aborted?: true;
timestamp?: string;
};
-The `message` field is a [`BetaMessage`](<https://platform.claude.com/docs/en/api/messages/create>) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'oauth_org_not_allowed'`, `'billing_error'`, `'rate_limit'`, `'overloaded'`, `'invalid_request'`, `'model_not_found'`, `'server_error'`, `'max_output_tokens'`, or `'unknown'`. `'model_not_found'` means the selected model doesn’t exist or isn’t available to your account or deployment. `'overloaded'` means the API returned a 529 because the server is at capacity, as opposed to `'rate_limit'`, which is a 429 against your quota. `timestamp` is the ISO 8601 time when the message’s content finished generating on the process that produced it. The value comes from that machine’s clock, so use it for display only and don’t order messages by it. One API turn can produce several assistant messages that share a `message.id`, each with its own `timestamp`. When the field is absent, fall back to the time you received the message.
+The `message` field is a [`BetaMessage`](<https://platform.claude.com/docs/en/api/messages/create>) from the Anthropic SDK. It includes fields like `id`, `content`, `model`, `stop_reason`, and `usage`. `SDKAssistantMessageError` is one of: `'authentication_failed'`, `'oauth_org_not_allowed'`, `'billing_error'`, `'rate_limit'`, `'overloaded'`, `'invalid_request'`, `'model_not_found'`, `'server_error'`, `'max_output_tokens'`, or `'unknown'`. `'model_not_found'` means the selected model doesn’t exist or isn’t available to your account or deployment. `'overloaded'` means the API returned a 529 because the server is at capacity, as opposed to `'rate_limit'`, which is a 429 against your quota. `aborted` is `true` when an interrupt or abort truncated the assistant message before the stream completed: the message has no `stop_reason` and the content may end mid-word. The field is absent on normally completed messages. It requires Agent SDK v0.3.214 or later. `timestamp` is the ISO 8601 time when the message’s content finished generating on the process that produced it. The value comes from that machine’s clock, so use it for display only and don’t order messages by it. One API turn can produce several assistant messages that share a `message.id`, each with its own `timestamp`. When the field is absent, fall back to the time you received the message.
###
@@ -1227,6 +1358,8 @@
stop_reason: string | null;
ttft_ms?: number;
ttft_stream_ms?: number;
+ user_message_uuid?: string;
+ request_sent_wall_ms?: number;
total_cost_usd: number;
usage: NonNullableUsage;
modelUsage: { [modelName: string]: ModelUsage };
@@ -1235,6 +1368,7 @@
deferred_tool_use?: { id: string; name: string; input: Record<string, unknown> };
terminal_reason?: TerminalReason;
fast_mode_state?: FastModeState;
+ fast_mode_disabled_reason?: FastModeDisabledReason;
origin?: SDKMessageOrigin;
}
| {
@@ -1258,6 +1392,7 @@
errors: string[];
terminal_reason?: TerminalReason;
fast_mode_state?: FastModeState;
+ fast_mode_disabled_reason?: FastModeDisabledReason;
origin?: SDKMessageOrigin;
};
@@ -1266,10 +1401,28 @@
* `api_error_status`: the HTTP status code of the API error that terminated the conversation. Absent or `null` when the turn ended without an API error.
* `ttft_ms`: time to first token in milliseconds, measured when the first complete assistant message arrives. Present on the success arm only.
* `ttft_stream_ms`: time in milliseconds until the first `message_start` stream event, when the response stream opens. Lower than `ttft_ms`; the gap between the two is time spent streaming the first message. Present on the success arm only.
+ * `user_message_uuid`: the `uuid` of the `SDKUserMessage` that started this turn, echoed back so you can match the result to the message you sent. Requires Claude Code v2.1.216 or later. Present on the success arm only, together with `request_sent_wall_ms`; absent on API-error results, subagent calls, and synthetic turns such as scheduled ones.
+ * `request_sent_wall_ms`: epoch milliseconds at which Claude Code dispatched the API request, for joins against server-side timestamps. Present only together with `user_message_uuid`.
* `terminal_reason`: why the loop ended. One of `"completed"`, `"max_turns"`, `"tool_deferred"`, `"aborted_streaming"`, `"aborted_tools"`, `"hook_stopped"`, `"stop_hook_prevented"`, `"background_requested"`, `"blocking_limit"`, `"rapid_refill_breaker"`, `"prompt_too_long"`, `"image_error"`, `"model_error"`, `"api_error"`, `"malformed_tool_use_exhausted"`, `"budget_exhausted"`, `"structured_output_retry_exhausted"`, `"tool_deferred_unavailable"`, or `"turn_setup_failed"`.
* `fast_mode_state`: one of `"on"`, `"off"`, or `"cooldown"`.
-
-The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When a background task finishes and the SDK injects a synthetic follow-up turn, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Check this field to distinguish results that answer your prompt from results emitted for background-task follow-ups, so you can route or suppress the latter. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip.
+ * `fast_mode_disabled_reason`: why [fast mode](</docs/en/fast-mode>) isn’t available right now. Absent when nothing blocks fast mode, though a request may still run at standard speed. During the cooldown after a fast mode rate limit, Claude Code reports `fast_mode_state: "cooldown"` with no reason code and re-enables fast mode when the cooldown expires. Requires Claude Code v2.1.219 or later.
+
+Use the reason code to explain why fast mode is off in your own UI instead of re-deriving availability. Each code names the check that blocked fast mode:
+
+Reason code| Meaning
+---|---
+`free`| The account doesn’t have the paid subscription or usage credits fast mode requires
+`preference`| The organization has disabled fast mode
+`extra_usage_disabled`| Usage credits are turned off for the account
+`network_error`| The [availability check](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) couldn’t reach `api.anthropic.com`
+`unknown`| Claude Code couldn’t determine availability
+`not_first_party`| The session uses a provider other than the Anthropic API
+`disabled_by_env`| [`CLAUDE_CODE_DISABLE_FAST_MODE`](</docs/en/env-vars>) is set
+`model_not_allowed`| The fast mode Opus model isn’t in the organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist
+`sdk_opt_in_required`| The session hasn’t opted in to fast mode: pass `fastMode: true` in the `settings` option or through `applyFlagSettings()`
+`pending`| The availability check hasn’t completed yet
+
+The same pair of fields appears on `SDKSystemMessage` and on the `SDKControlInitializeResponse`, so you can read the fast mode state before the first turn. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When a background task finishes and the SDK injects a synthetic follow-up turn, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Check this field to distinguish results that answer your prompt from results emitted for background-task follow-ups, so you can route or suppress the latter. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip.
###
@@ -1300,14 +1453,17 @@
output_style: string;
skills: string[];
plugins: { name: string; path: string }[];
+ fast_mode_state?: FastModeState;
+ fast_mode_disabled_reason?: FastModeDisabledReason;
capabilities?: string[];
};
-The `capabilities` array names the protocol behaviors this CLI implements, so you can feature-detect instead of comparing `claude_code_version` strings. It is an open set: ignore values you don’t recognize, and check for the specific capability whose behavior you rely on. The field requires Claude Code v2.1.205 or later and is absent on earlier CLIs.
+`fast_mode_state` reports the session’s [fast mode](</docs/en/fast-mode>) state. When something blocks fast mode, `fast_mode_disabled_reason` names the check that blocked it; the field requires Claude Code v2.1.219 or later. For the reason codes and their meanings, see `fast_mode_disabled_reason` on the result message. The `capabilities` array names the protocol behaviors this CLI implements, so you can feature-detect instead of comparing `claude_code_version` strings. It is an open set: ignore values you don’t recognize, and check for the specific capability whose behavior you rely on. The field requires Claude Code v2.1.205 or later and is absent on earlier CLIs.
Capability| Meaning
---|---
`interrupt_receipt_v1`| `interrupt()` resolves with an `SDKControlInterruptResponse` receipt naming the queued messages that survive the interrupt
+`interrupt_cancel_queued_v1`| The `interrupt` control request honors `cancel_queued: true`, cancelling the queued messages that would otherwise survive the interrupt and listing them on the receipt’s `cancelled` field. See `SDKControlInterruptResponse`. Requires Claude Code v2.1.219 or later
###
@@ -1457,8 +1613,10 @@
kind: "peer";
from: string;
name?: string;
+ fromSession?: string;
senderTaskId?: string;
body?: string;
+ verifiedPeerPid?: number;
}
| { kind: "task-notification" }
| { kind: "coordinator" }
@@ -1468,10 +1626,25 @@
---|---
`human`| Direct input from the end user. If your application forwards what the user typed as a user message, set its `origin` to `{ kind: "human" }` explicitly: Claude Code treats a user message with no `origin` as unattributed, and checks that require a human-typed prompt, such as the [`ultracode` workflow keyword](</docs/en/workflows#ask-for-a-workflow-in-your-prompt>), don’t accept it. Before v2.1.210, Claude Code treated an absent `origin` on a user message as human input.
`channel`| Message arriving on a [channel](</docs/en/channels>). `server` is the source MCP server name.
-`peer`| Message from another agent. For an in-process [teammate](</docs/en/agent-teams>) sending to `main` via `SendMessage`, `from` is the teammate’s name and `senderTaskId` is its task ID. For a cross-session peer such as another local Claude Code process, `from` is the sender address and `senderTaskId` is absent. `name` and `body` require Claude Code v2.1.205 or later. `name` is the sender’s display name, normalized by Claude Code: it strips Unicode control, format, surrogate, and line or paragraph separator code points, then trims the result and caps it at 64 code points with an ellipsis. `body` is the decoded message body with the peer envelope stripped, byte-exact with what the model sees. For a teammate message `body` is always present; for a cross-session peer it is present only when the turn is exactly one peer envelope formed by Claude Code. Render `name` and `body` instead of re-parsing the message text.
+`peer`| Message from another agent: an in-process [teammate](</docs/en/agent-teams>) or a cross-session peer such as another local Claude Code process. See Peer origin fields for the per-field semantics and the trust model.
`task-notification`| Synthetic turn injected after a background task finished. See `SDKTaskNotificationMessage`.
`coordinator`| Message from a team coordinator in an [agent team](</docs/en/agent-teams>).
`auto-continuation`| Synthetic turn injected when the session continues without fresh user input, such as a command result that triggers a follow-up prompt.
+
+###
+
+
+
+Peer origin fields
+
+A `peer` origin identifies which agent sent the message: an in-process [teammate](</docs/en/agent-teams>) sending to `main` with `SendMessage`, or a cross-session peer such as another local Claude Code process. The two kinds of sender fill the fields differently:
+
+ * `from`: the teammate’s name, or the sender address for a cross-session peer. The value is sender-authored; `verifiedPeerPid` is the verified identity.
+ * `senderTaskId`: the teammate’s task ID. Absent for a cross-session peer.
+ * `name`: the sender’s display name, normalized by Claude Code: it strips Unicode control, format, surrogate, and line or paragraph separator code points, then trims the result and caps it at 64 code points with an ellipsis. Requires Claude Code v2.1.205 or later.
+ * `body`: the decoded message body with the peer envelope stripped, byte-exact with what the model sees. Always present for a teammate message; for a cross-session peer, present only when the turn is exactly one peer envelope formed by Claude Code. Render `name` and `body` instead of re-parsing the message text. Requires Claude Code v2.1.205 or later.
+ * `fromSession`: the sender’s host-openable session ID, set by the sender’s host so your UI can link back to the sending session. Like `from`, it is sender-asserted: use it as a navigation target only, and don’t treat it as proof of the sender’s identity. Requires Claude Code v2.1.216 or later.
+ * `verifiedPeerPid`: the process ID of the process that connected to this session’s cross-session messaging socket, verified by the kernel and read from the connection itself, never from the payload. Use it, not `from`, to identify the sender: `from` is forgeable by any same-user process. The field is absent when Claude Code can’t verify it, such as on Windows or non-socket ingress, so an absent value means the sender is unverified. For relayed traffic it identifies the relay rather than the message’s author, and process IDs are recyclable, so treat it as provenance rather than an authentication token. Requires Claude Code v2.1.216 or later.
##
@@ -1500,16 +1673,26 @@
| "SessionStart"
| "SessionEnd"
| "Stop"
+ | "StopFailure"
| "SubagentStart"
| "SubagentStop"
| "PreCompact"
+ | "PostCompact"
| "PermissionRequest"
+ | "PermissionDenied"
| "Setup"
| "TeammateIdle"
+ | "TaskCreated"
| "TaskCompleted"
+ | "Elicitation"
+ | "ElicitationResult"
| "ConfigChange"
+ | "DirectoryAdded"
| "WorktreeCreate"
| "WorktreeRemove"
+ | "InstructionsLoaded"
+ | "CwdChanged"
+ | "FileChanged"
| "MessageDisplay";
###
@@ -1553,21 +1736,32 @@
| PostToolUseHookInput
| PostToolUseFailureHookInput
| PostToolBatchHookInput
+ | PermissionDeniedHookInput
| NotificationHookInput
| UserPromptSubmitHookInput
+ | UserPromptExpansionHookInput
| SessionStartHookInput
| SessionEndHookInput
| StopHookInput
+ | StopFailureHookInput
| SubagentStartHookInput
| SubagentStopHookInput
| PreCompactHookInput
+ | PostCompactHookInput
| PermissionRequestHookInput
| SetupHookInput
| TeammateIdleHookInput
+ | TaskCreatedHookInput
| TaskCompletedHookInput
+ | ElicitationHookInput
+ | ElicitationResultHookInput
| ConfigChangeHookInput
+ | InstructionsLoadedHookInput
+ | DirectoryAddedHookInput
| WorktreeCreateHookInput
| WorktreeRemoveHookInput
+ | CwdChangedHookInput
+ | FileChangedHookInput
| MessageDisplayHookInput;
###
@@ -1659,6 +1853,20 @@
+`PermissionDeniedHookInput`
+
+ type PermissionDeniedHookInput = BaseHookInput & {
+ hook_event_name: "PermissionDenied";
+ tool_name: string;
+ tool_input: unknown;
+ tool_use_id: string;
+ reason: string;
+ };
+
+####
+
+
+
`NotificationHookInput`
type NotificationHookInput = BaseHookInput & {
@@ -1677,6 +1885,22 @@
type UserPromptSubmitHookInput = BaseHookInput & {
hook_event_name: "UserPromptSubmit";
prompt: string;
+ session_title?: string;
+ };
+
+####
+
+
+
+`UserPromptExpansionHookInput`
+
+ type UserPromptExpansionHookInput = BaseHookInput & {
+ hook_event_name: "UserPromptExpansion";
+ expansion_type: "slash_command" | "mcp_prompt";
+ command_name: string;
+ command_args: string;
+ command_source?: string;
+ prompt: string;
};
####
@@ -1687,9 +1911,10 @@
type SessionStartHookInput = BaseHookInput & {
hook_event_name: "SessionStart";
- source: "startup" | "resume" | "clear" | "compact";
+ source: "startup" | "resume" | "clear" | "compact" | "fork";
agent_type?: string;
model?: string;
+ session_title?: string;
};
####
@@ -1715,6 +1940,19 @@
last_assistant_message?: string;
background_tasks?: BackgroundTaskSummary[];
session_crons?: SessionCronSummary[];
+ };
+
+####
+
+
+
+`StopFailureHookInput`
+
+ type StopFailureHookInput = BaseHookInput & {
+ hook_event_name: "StopFailure";
+ error: SDKAssistantMessageError;
+ error_details?: string;
+ last_assistant_message?: string;
};
####
@@ -1781,6 +2019,18 @@
+`PostCompactHookInput`
+
+ type PostCompactHookInput = BaseHookInput & {
+ hook_event_name: "PostCompact";
+ trigger: "manual" | "auto";
+ compact_summary: string;
+ };
+
+####
+
+
+
`PermissionRequestHookInput`
type PermissionRequestHookInput = BaseHookInput & {
@@ -1812,6 +2062,22 @@
teammate_name: string;
/** @deprecated since v2.1.178. Carries the session-derived team name; will be removed. */
team_name: string;
+ };
+
+####
+
+
+
+`TaskCreatedHookInput`
+
+ type TaskCreatedHookInput = BaseHookInput & {
+ hook_event_name: "TaskCreated";
+ task_id: string;
+ task_subject: string;
+ task_description?: string;
+ teammate_name?: string;
+ /** @deprecated since v2.1.178. Carries the session-derived team name; will be removed. */
+ team_name?: string;
};
####
@@ -1828,6 +2094,37 @@
teammate_name?: string;
/** @deprecated since v2.1.178. Carries the session-derived team name; will be removed. */
team_name?: string;
+ };
+
+####
+
+
+
+`ElicitationHookInput`
+
+ type ElicitationHookInput = BaseHookInput & {
+ hook_event_name: "Elicitation";
+ mcp_server_name: string;
+ message: string;
+ mode?: "form" | "url";
+ url?: string;
+ elicitation_id?: string;
+ requested_schema?: Record<string, unknown>;
+ };
+
+####
+
+
+
+`ElicitationResultHookInput`
+
+ type ElicitationResultHookInput = BaseHookInput & {
+ hook_event_name: "ElicitationResult";
+ mcp_server_name: string;
+ elicitation_id?: string;
+ mode?: "form" | "url";
+ action: "accept" | "decline" | "cancel";
+ content?: Record<string, unknown>;
};
####
@@ -1851,6 +2148,41 @@
+`InstructionsLoadedHookInput`
+
+ type InstructionsLoadedHookInput = BaseHookInput & {
+ hook_event_name: "InstructionsLoaded";
+ file_path: string;
+ memory_type: "User" | "Project" | "Local" | "Managed";
+ load_reason:
+ | "session_start"
+ | "nested_traversal"
+ | "path_glob_match"
+ | "include"
+ | "compact";
+ globs?: string[];
+ trigger_file_path?: string;
+ parent_file_path?: string;
+ };
+
+####
+
+
+
+`DirectoryAddedHookInput`
+
+ type DirectoryAddedHookInput = BaseHookInput & {
+ hook_event_name: "DirectoryAdded";
+ directory: string;
+ source: "slash_command" | "register_repo_root";
+ };
+
+`directory` is the absolute path of the directory that was added. `source` is `"slash_command"` when `/add-dir` added it and `"register_repo_root"` when the SDK control request did.
+
+####
+
+
+
`WorktreeCreateHookInput`
type WorktreeCreateHookInput = BaseHookInput & {
@@ -1867,6 +2199,30 @@
type WorktreeRemoveHookInput = BaseHookInput & {
hook_event_name: "WorktreeRemove";
worktree_path: string;
+ };
+
+####
+
+
+
+`CwdChangedHookInput`
+
+ type CwdChangedHookInput = BaseHookInput & {
+ hook_event_name: "CwdChanged";
+ old_cwd: string;
+ new_cwd: string;
+ };
+
+####
+
+
+
+`FileChangedHookInput`
+
+ type FileChangedHookInput = BaseHookInput & {
+ hook_event_name: "FileChanged";
+ file_path: string;
+ event: "change" | "add" | "unlink";
};
####
@@ -1917,6 +2273,13 @@
stopReason?: string;
decision?: "approve" | "block";
systemMessage?: string;
+ /**
+ * A terminal escape sequence (e.g. OSC 9 / OSC 777 desktop-notification)
+ * for Claude Code to emit on your behalf. Only notification/title OSCs
+ * (0, 1, 2, 9, 99, 777) and BEL are permitted; a value containing
+ * anything else is ignored as a whole.
+ */
+ terminalSequence?: string;
reason?: string;
hookSpecificOutput?:
| {
@@ -1929,10 +2292,26 @@
| {
hookEventName: "UserPromptSubmit";
additionalContext?: string;
+ sessionTitle?: string;
+ /** When decision is "block", omit the original prompt from the block message. */
+ suppressOriginalPrompt?: boolean;
+ }
+ | {
+ hookEventName: "UserPromptExpansion";
+ additionalContext?: string;
}
| {
hookEventName: "SessionStart";
additionalContext?: string;
+ initialUserMessage?: string;
+ sessionTitle?: string;
+ watchPaths?: string[];
+ /**
+ * Re-scan skill and command directories after SessionStart hooks
+ * complete, so skills installed by the hook are available in the
+ * same session.
+ */
+ reloadSkills?: boolean;
}
| {
hookEventName: "Setup";
@@ -1958,6 +2337,18 @@
additionalContext?: string;
}
| {
+ hookEventName: "Stop";
+ additionalContext?: string;
+ }
+ | {
+ hookEventName: "SubagentStop";
+ additionalContext?: string;
+ }
+ | {
+ hookEventName: "PermissionDenied";
+ retry?: boolean;
+ }
+ | {
hookEventName: "Notification";
additionalContext?: string;
}
@@ -1974,6 +2365,33 @@
message?: string;
interrupt?: boolean;
};
+ }
+ | {
+ hookEventName: "Elicitation";
+ action?: "accept" | "decline" | "cancel";
+ content?: Record<string, unknown>;
+ }
+ | {
+ hookEventName: "ElicitationResult";
+ action?: "accept" | "decline" | "cancel";
+ content?: Record<string, unknown>;
+ }
+ | {
+ hookEventName: "CwdChanged";
+ watchPaths?: string[];
+ }
+ | {
+ hookEventName: "FileChanged";
+ watchPaths?: string[];
+ }
+ | {
+ hookEventName: "WorktreeCreate";
+ worktreePath: string;
+ }
+ | {
+ hookEventName: "MessageDisplay";
+ /** Text displayed in place of the delta. Omit (or return the delta unchanged) to display the original. */
+ displayContent?: string;
};
};
@@ -1991,15 +2409,20 @@
`ToolInputSchemas`
-Union of all tool input types, exported from `@anthropic-ai/claude-agent-sdk`.
+Union of tool input types exported from `@anthropic-ai/claude-agent-sdk`; members include:
type ToolInputSchemas =
| AgentInput
+ | ArtifactInput
| AskUserQuestionInput
| BashInput
- | TaskOutputInput
+ | CronCreateInput
+ | CronDeleteInput
+ | CronListInput
+ | EnterPlanModeInput
| EnterWorktreeInput
| ExitPlanModeInput
+ | ExitWorktreeInput
| FileEditInput
| FileReadInput
| FileWriteInput
@@ -2009,17 +2432,23 @@
| McpInput
| MonitorInput
| NotebookEditInput
+ | ProjectsInput
+ | PushNotificationInput
+ | ReadMcpResourceDirInput
| ReadMcpResourceInput
- | SubscribeMcpResourceInput
- | SubscribePollingInput
+ | RefreshMcpToolsInput
+ | RemoteTriggerInput
+ | REPLInput
+ | ReportFindingsInput
+ | ScheduleWakeupInput
+ | ShowOnboardingRolePickerInput
| TaskCreateInput
| TaskGetInput
| TaskListInput
+ | TaskOutputInput
| TaskStopInput
| TaskUpdateInput
| TodoWriteInput
- | UnsubscribeMcpResourceInput
- | UnsubscribePollingInput
| WebFetchInput
| WebSearchInput
| WorkflowInput;
@@ -2030,7 +2459,7 @@
Agent
-**Tool name:** `Agent` (previously `Task`, which is still accepted as an alias)
+**Tool name:** `Agent`. The previous name `Task` is still accepted as an alias, and the `tools` array in the `SDKSystemMessage` init message currently lists this tool as `Task` for backward compatibility.
The `mode` field is deprecated and ignored on Claude Code v2.1.212 or later: subagents [inherit the parent session’s permission mode](</docs/en/agent-sdk/permissions#available-modes>), and a subagent definition’s `permissionMode` can override it, except when the parent uses `bypassPermissions`, `acceptEdits`, or `auto`.
@@ -2041,7 +2470,8 @@
model?: "sonnet" | "opus" | "haiku" | "fable";
run_in_background?: boolean;
name?: string;
- mode?: "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan";
+ team_name?: string; // Deprecated; ignored
+ mode?: "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan"; // Deprecated; ignored. Subagents inherit the parent session's permission mode; agent-definition frontmatter may override it
isolation?: "worktree" | "remote";
};
@@ -2062,6 +2492,9 @@
options: Array<{ label: string; description: string; preview?: string }>;
multiSelect: boolean;
}>;
+ answers?: Record<string, string>;
+ annotations?: Record<string, { preview?: string; notes?: string }>;
+ metadata?: { source?: string };
};
Asks the user clarifying questions during execution. See [Handle approvals and user input](</docs/en/agent-sdk/user-input#handle-clarifying-questions>) for usage details.
@@ -2099,11 +2532,11 @@
protocols?: string[];
};
description: string;
- timeout_ms?: number;
- persistent?: boolean;
- };
-
-Runs a background source and delivers each event to Claude so it can react without polling: `command` runs a script and emits one event per stdout line, and `ws` opens a WebSocket and emits one event per text frame. Provide exactly one of `command` or `ws`. The `ws` source requires Claude Code v2.1.195 or later. Set `persistent: true` for session-length watches such as log tails. When Monitor runs a command, it follows the same permission rules as Bash; a WebSocket watch prompts for approval separately. See the [Monitor tool reference](</docs/en/tools-reference#monitor-tool>) for behavior and provider availability.
+ timeout_ms: number;
+ persistent: boolean;
+ };
+
+Runs a background source and delivers each event to Claude so it can react without polling: `command` runs a script and emits one event per stdout line, and `ws` opens a WebSocket and emits one event per text frame. Provide exactly one of `command` or `ws`. The `ws` source requires Claude Code v2.1.195 or later. Set `persistent: true` for session-length watches such as log tails. When Monitor runs a command, it follows the same permission rules as Bash; a WebSocket watch prompts for approval separately. See the [Monitor tool reference](</docs/en/tools-reference#monitor-tool>) for behavior and provider availability. The exported type marks `timeout_ms` and `persistent` as required because the schema fills in their defaults, 300000 and `false`; a call that omits them validates.
###
@@ -2112,6 +2545,8 @@
TaskOutput
**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.
type TaskOutputInput = {
task_id: string;
@@ -2200,6 +2635,7 @@
type?: string;
output_mode?: "content" | "files_with_matches" | "count";
"-i"?: boolean;
+ "-o"?: boolean; // print only the matched parts of each line; requires output_mode: "content"
"-n"?: boolean;
"-B"?: number;
"-A"?: number;
@@ -2288,8 +2724,10 @@
script?: string;
name?: string;
scriptPath?: string;
- args?: unknown;
+ args?: unknown; // any JSON value; the published typings render this as an object map
resumeFromRunId?: string;
+ title?: string; // ignored; the script's meta block sets the title
+ description?: string; // ignored; the script's meta block sets the description
};
Runs a [dynamic workflow](</docs/en/workflows>): a script that orchestrates many subagents in the background and returns one consolidated result. The `Workflow` tool is available in Agent SDK v0.3.149 and later. At least one of `script`, `name`, or `scriptPath` is required.
@@ -2300,7 +2738,11 @@
`name`| `string`| Name of a built-in workflow or one saved in `.claude/workflows/`. Resolved to a script
`scriptPath`| `string`| Path to a workflow script file on disk. Takes precedence over `script` and `name`. Every invocation persists its script and returns the path in the result, so you can edit that file and re-invoke with the same `scriptPath` to iterate
`args`| `unknown`| Input value exposed to the script as the global `args`, for parameterized named workflows such as a research question or a list of file paths. Pass arrays and objects as actual JSON values, not as a JSON-encoded string
-`resumeFromRunId`| `string`| Run ID of a prior `Workflow` invocation to resume. Completed `agent()` calls with unchanged inputs return cached results; only changed or new calls run live. Same session only
+`resumeFromRunId`| `string`| Run ID of a prior `Workflow` invocation to resume. Completed `agent()` calls with unchanged inputs usually return cached results; the rest run live. [Resume after a pause](</docs/en/workflows#resume-after-a-pause>) covers which completed calls re-run. Same session only
+`title`| `string`| Ignored; the script’s `meta` block sets the title
+`description`| `string`| Ignored; the script’s `meta` block sets the description
+
+The schema accepts any JSON value for `args`; the exported type marks it `unknown`, but the published typings render the field as an object map.
###
@@ -2401,6 +2843,7 @@
tool: "Bash";
prompt: string;
}>;
+ [k: string]: unknown;
};
Exits plan mode. The `allowedPrompts` field is deprecated and ignored; Claude Code still accepts it so existing callers and transcripts validate. Before v2.1.205, it requested prompt-based Bash permissions for implementing the plan.
@@ -2449,6 +2892,282 @@
Creates and enters a temporary git worktree for isolated work. Pass `path` to switch into an existing worktree instead of creating a new one. On first entry the target must be a registered worktree of the current repository or, in a multi-repo workspace, of a repository nested inside it; from within a worktree session it must be under `.claude/worktrees/` of the session’s repository. `name` and `path` are mutually exclusive.
+###
+
+
+
+ExitWorktree
+
+**Tool name:** `ExitWorktree`
+
+ type ExitWorktreeInput = {
+ action: "keep" | "remove";
+ discard_changes?: boolean;
+ };
+
+Exits the current git worktree and returns to the original working directory. The `keep` action leaves the worktree and branch on disk, while `remove` deletes both. `discard_changes` must be `true` when removing a worktree that has uncommitted files or unmerged commits.
+
+###
+
+
+
+EnterPlanMode
+
+**Tool name:** `EnterPlanMode`
+
+ type EnterPlanModeInput = {};
+
+Enters plan mode, where Claude researches and presents a plan before making changes.
+
+###
+
+
+
+CronCreate
+
+**Tool name:** `CronCreate`
+
+ type CronCreateInput = {
+ cron: string;
+ prompt: string;
+ recurring?: boolean;
+ durable?: boolean;
+ };
+
+Schedules a prompt to run on a 5-field cron schedule in local time. Set `recurring` to `false` to fire once at the next match. Jobs are session-scoped by default: starting a fresh conversation clears them, and resuming with `--resume` or `--continue` restores jobs that haven’t expired. See [Scheduled tasks](</docs/en/scheduled-tasks>). Setting `durable` to `true` requests persistence to `.claude/scheduled_tasks.json` so the job survives restarts. Durable scheduling isn’t available in every session: when it isn’t, Claude Code accepts `durable: true` but creates the job session-only. Read the output’s `durable` field to see whether the job persisted.
+
+###
+
+
+
+CronDelete
+
+**Tool name:** `CronDelete`
+
+ type CronDeleteInput = {
+ id: string;
+ };
+
+Deletes a scheduled cron job by the ID returned from `CronCreate`.
+
+###
+
+
+
+CronList
+
+**Tool name:** `CronList`
+
+ type CronListInput = {};
+
+Lists the scheduled cron jobs: durable jobs from `.claude/scheduled_tasks.json` and session-only jobs from the current session.
+
+###
+
+
+
+ScheduleWakeup
+
+**Tool name:** `ScheduleWakeup`
+
+ type ScheduleWakeupInput = {
+ delaySeconds?: number;
+ reason?: string;
+ prompt?: string;
+ stop?: boolean;
+ };
+
+Schedules a one-shot wake-up that fires the given prompt after a delay. This tool backs the self-paced `/loop` command. The runtime clamps `delaySeconds` to between 60 and 3600 seconds. The `delaySeconds`, `reason`, and `prompt` fields are required unless `stop` is true. Setting `stop: true` cancels the pending wakeup and ends the self-paced `/loop`. The `stop` field requires Claude Code v2.1.202 or later. See the [ScheduleWakeup row in the tools reference](</docs/en/tools-reference>) for provider availability; it isn’t available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.
+
+###
+
+
+
+RemoteTrigger
+
+**Tool name:** `RemoteTrigger`
+
+ type RemoteTriggerInput = {
+ action: "list" | "get" | "create" | "update" | "run";
+ trigger_id?: string;
+ body?: {
+ [k: string]: unknown;
+ };
+ };
+
+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.
+
+###
+
+
+
+PushNotification
+
+**Tool name:** `PushNotification`
+
+ type PushNotificationInput = {
+ message: string;
+ status: "proactive";
+ };
+
+Sends a proactive push notification to the user. Keep `message` under 200 characters because mobile operating systems truncate longer text. See the [PushNotification row in the tools reference](</docs/en/tools-reference>) for provider availability; push delivery runs through Anthropic-hosted infrastructure that isn’t accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry.
+
+###
+
+
+
+REPL
+
+**Tool name:** `REPL`
+
+ type REPLInput = {
+ code: string;
+ description?: string;
+ timeout?: number;
+ };
+
+Executes JavaScript code in a persistent REPL. State persists across calls and top-level await is supported. `timeout` is in milliseconds, with a default of 30000 and a maximum of 600000. The types are exported, but the tool is off in SDK sessions unless you set `CLAUDE_CODE_REPL=1` in the `env` option. It also requires the Bun-based `claude` executable that the native installer provides.
+
+###
+
+
+
+ReportFindings
+
+**Tool name:** `ReportFindings`
+
+ type ReportFindingsInput = {
+ level?: "low" | "medium" | "high" | "xhigh" | "max";
+ findings: Array<{
+ file: string;
+ line?: number;
+ summary: string;
+ failure_scenario: string;
+ short_summary?: string;
+ category?: string;
+ verdict?: "CONFIRMED" | "PLAUSIBLE";
+ outcome?: "fixed" | "skipped" | "no_change_needed";
+ }>;
+ };
+
+Reports code-review findings as a structured list so Claude Code can render them instead of printing them as text. `level` is the effort level the review ran at. Findings are ordered most-severe first, with at most 32 per call, and the array is empty when none survived. Requires Claude Code v2.1.196 or later. Each finding carries these fields:
+
+ * `file`: repo-relative path the finding is in. The optional `line` is the 1-indexed line it anchors to.
+ * `summary`: one-sentence statement of the defect. `failure_scenario` describes the concrete inputs and state that lead to the wrong output or crash.
+ * `short_summary`: optional compressed label of at most 60 characters for compact display. Requires Claude Code v2.1.212 or later.
+ * `category`: optional short kebab-case slug of the finding type, such as `correctness` or `test-coverage`. Requires Claude Code v2.1.199 or later.
+ * `verdict`: set when a verify pass ran; absent on inline-only reviews.
+ * `outcome`: set only when re-reporting after applying fixes.
+
+###
+
+
+
+Artifact
+
+**Tool name:** `Artifact`
+
+ type ArtifactInput = {
+ action?: "publish" | "list";
+ file_path?: string;
+ favicon?: string;
+ limit?: number;
+ scope?: "mine" | "shared" | "all";
+ title?: string;
+ description?: string;
+ label?: string;
+ url?: string;
+ force?: boolean;
+ };
+
+Publishes a local `.html` or `.md` file as a hosted artifact page, or lists the user’s published artifacts. Omit `action` or pass `"publish"` to publish `file_path`, which is required for the publish action along with `favicon`, one or two emoji for the browser tab. `title` names the published page in the browser tab and gallery when the HTML file has no `<title>` tag. `url` targets an existing artifact to update in place instead of minting a new one, and `force` is a last-resort overwrite that discards another session’s published version; on a 409 conflict the normal fix is to re-read, merge, and publish again rather than pass `force`. Pass `"list"` to enumerate the user’s published artifacts; only `limit` and `scope` may accompany it. `scope` defaults to `"mine"`, which lists artifacts the user owns; `"shared"` lists artifacts other people shared with the user, and `"all"` lists both. The types are exported, but the tool is off by default in Agent SDK sessions. Publishing also requires every condition in the [artifacts availability table](</docs/en/artifacts#availability>), which sessions authenticated with an API key don’t meet.
+
+###
+
+
+
+Projects
+
+**Tool name:** `Projects`
+
+ type ProjectsInput = {
+ method:
+ | "project_info"
+ | "project_read"
+ | "project_search"
+ | "project_write"
+ | "project_delete";
+ path?: string;
+ content?: string;
+ local_path?: string;
+ present_to_user?: boolean;
+ query?: string;
+ n?: number;
+ };
+
+Reads and writes the claude.ai Project attached to the session. Dispatches on `method`:
+
+ * `project_info`: returns project metadata and the doc list.
+ * `project_read`: reads one doc by `path`.
+ * `project_search`: queries the project’s knowledge base with `query`. `n` caps the hits and defaults to 5.
+ * `project_write`: creates or replaces a doc at `path` from exactly one of `content`, which carries inline text, or `local_path`, which names a file inside the working directory. `present_to_user: true` marks the written doc as the deliverable the user needs to see.
+ * `project_delete`: deletes a doc by `path`.
+
+###
+
+
+
+ReadMcpResourceDir
+
+**Tool name:** `ReadMcpResourceDirTool`
+
+ type ReadMcpResourceDirInput = {
+ server: string;
+ uri: string;
+ };
+
+Lists the direct children of a directory resource on an MCP server. Only usable against a server that has declared support for directory listing; the listing isn’t recursive. Directory listing isn’t enabled in every session: when it’s off, the call returns an empty `resources` list and the `error` field reports that directory listing isn’t enabled.
+
+###
+
+
+
+RefreshMcpTools
+
+**Tool name:** `RefreshMcpTools`
+
+ type RefreshMcpToolsInput = {
+ server?: string; // refresh only this server; omit to refresh all connected servers
+ };
+
+Re-queries the tool list of connected MCP servers and applies any changes. The types are exported, but Claude Code registers the tool only when you set `CLAUDE_CODE_ENABLE_REFRESH_MCP_TOOLS=1` in the `env` option, and only in sessions with at least one MCP server. Requires Claude Code v2.1.211 or later.
+
+###
+
+
+
+ShowOnboardingRolePicker
+
+**Tool name:** `ShowOnboardingRolePicker`
+
+ type ShowOnboardingRolePickerInput = {};
+
+Renders a clickable role-picker chip row during Cowork onboarding so the user can pick their role and get a matching plugin installed. Takes no arguments; the role list is defined by the client. The call blocks until the user responds.
+
+###
+
+
+
+McpInput
+
+**Tool name:** dynamic MCP tool names of the form `mcp__<server>__<tool>`
+
+ type McpInput = {
+ [k: string]: unknown;
+ };
+
+MCP tool arguments are an open object: each server defines its own parameters, so the type places no constraints on field names or values. Consult the server’s own tool schema for the fields a specific tool accepts.
+
##
@@ -2463,23 +3182,39 @@
`ToolOutputSchemas`
-Union of all tool output types.
+Union of tool output types exported from `@anthropic-ai/claude-agent-sdk`; members include:
type ToolOutputSchemas =
| AgentOutput
+ | ArtifactOutput
| AskUserQuestionOutput
| BashOutput
+ | CronCreateOutput
+ | CronDeleteOutput
+ | CronListOutput
+ | EnterPlanModeOutput
| EnterWorktreeOutput
| ExitPlanModeOutput
+ | ExitWorktreeOutput
| FileEditOutput
| FileReadOutput
| FileWriteOutput
| GlobOutput
| GrepOutput
| ListMcpResourcesOutput
+ | McpOutput
| MonitorOutput
| NotebookEditOutput
+ | ProjectsOutput
+ | PushNotificationOutput
+ | ReadMcpResourceDirOutput
| ReadMcpResourceOutput
+ | RefreshMcpToolsOutput
+ | RemoteTriggerOutput
+ | REPLOutput
+ | ReportFindingsOutput
+ | ScheduleWakeupOutput
+ | ShowOnboardingRolePickerOutput
| TaskCreateOutput
| TaskGetOutput
| TaskListOutput
@@ -2496,7 +3231,7 @@
Agent
-**Tool name:** `Agent` (previously `Task`, which is still accepted as an alias)
+**Tool name:** `Agent`. The previous name `Task` is still accepted as an alias, and the `tools` array in the `SDKSystemMessage` init message currently lists this tool as `Task` for backward compatibility.
type AgentOutput =
| {
@@ -2561,7 +3296,7 @@
outputFile: string;
};
-Returns the result from the subagent. Discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. The `resolvedModel` field on the `completed` and `async_launched` variants names the model the subagent actually ran on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On `async_launched`, it names the model in use when the task moved to the background. `modelsUsed` lists the models the subagent used, in order. The field is present only when a mid-run swap happened, and a model appears again when the run swapped back to it. On `async_launched`, the list covers the models used before backgrounding. Both `modelsUsed` and the backgrounding behavior of `resolvedModel` require Claude Code v2.1.212 or later. On the `completed` variant, `worktreePath` is set when the subagent ran in an isolated git worktree, and `worktreeBranch` names that worktree’s branch when Claude Code created it. `usage.service_tier` carries the service tier string the API reported for the subagent’s requests. Before v2.1.207, the published type was narrower. It omitted `worktreePath`, `worktreeBranch`, `citations`, `toolStats.frameCount`, and the `inference_geo`, `speed`, and `iterations` usage fields, and it typed `service_tier` as `"standard" | "priority" | "batch"`. Fields the type marks optional can be absent on results recorded by earlier versions.
+Returns the result from the subagent. Discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. On the `completed` variant, `resolvedModel` names the model the subagent started on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On `async_launched`, it names the model in use when the task moved to the background. `modelsUsed` lists the models the subagent used, in order. The field is present only when a mid-run swap happened, and a model appears again when the run swapped back to it. On `async_launched`, the list covers the models used before backgrounding. Both `modelsUsed` and the backgrounding behavior of `resolvedModel` require Claude Code v2.1.212 or later. On the `completed` variant, `worktreePath` is set when the subagent ran in an isolated git worktree, and `worktreeBranch` names that worktree’s branch when Claude Code created it. `usage.service_tier` carries the service tier string the API reported for the subagent’s requests. Before v2.1.207, the published type was narrower. It omitted `worktreePath`, `worktreeBranch`, `citations`, `toolStats.frameCount`, and the `inference_geo`, `speed`, and `iterations` usage fields, and it typed `service_tier` as `"standard" | "priority" | "batch"`. Fields the type marks optional can be absent on results recorded by earlier versions.
###
@@ -2580,6 +3315,8 @@
}>;
answers: Record<string, string>;
response?: string;
+ annotations?: Record<string, { preview?: string; notes?: string }>;
+ afkTimeoutMs?: number;
};
Returns the questions asked and the user’s answers. `response` is set when the user typed a freeform reply instead of answering the structured questions; when present, Claude receives “The user responded: …” instead of the per-question answer list.
@@ -2604,9 +3341,22 @@
backgroundCwdHint?: string;
dangerouslyDisableSandbox?: boolean;
returnCodeInterpretation?: string;
+ noOutputExpected?: boolean;
structuredContent?: unknown[];
persistedOutputPath?: string;
persistedOutputSize?: number;
+ staleReadFileStateHint?: string;
+ ghRateLimitHint?: string;
+ gitOperation?: {
+ commit?: { sha: string; kind: "committed" | "amended" | "cherry-picked" };
+ push?: { branch: string };
+ branch?: { ref: string; action: "merged" | "rebased" };
+ pr?: {
+ number: number;
+ url?: string;
+ action: "created" | "edited" | "merged" | "commented" | "closed" | "ready" | "draft" | "auto-merge-enabled" | "auto-merge-disabled";
+ };
+ };
};
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.
@@ -2639,7 +3389,7 @@
filePath: string;
oldString: string;
newString: string;
- originalFile: string;
+ originalFile: string | null;
structuredPatch: Array<{
oldStart: number;
oldLines: number;
@@ -2656,6 +3406,7 @@
deletions: number;
changes: number;
patch: string;
+ repository?: string | null;
};
};
@@ -2678,6 +3429,8 @@
numLines: number;
startLine: number;
totalLines: number;
+ /** True when a whole-file read was auto-paginated because it exceeded the token cap (the content is a partial first page). */
+ truncatedByTokenCap?: boolean;
};
}
| {
@@ -2717,6 +3470,14 @@
count: number;
outputDir: string;
};
+ }
+ | {
+ type: "file_unchanged";
+ file: {
+ filePath: string;
+ };
+ /** Set when the dedup matched a startup-seeded entry (CLAUDE.md / nested memory) rather than a prior Read tool_result. */
+ source?: "seeded";
};
Returns file contents in a format appropriate to the file type. Discriminated on the `type` field.
@@ -2748,7 +3509,9 @@
deletions: number;
changes: number;
patch: string;
+ repository?: string | null;
};
+ userModified?: boolean;
};
Returns the write result with structured diff information.
@@ -2822,6 +3585,7 @@
type NotebookEditOutput = {
new_source: string;
+ old_source?: string;
cell_id?: string;
cell_type: "code" | "markdown";
language: string;
@@ -2849,6 +3613,10 @@
result: string;
durationMs: number;
url: string;
+ artifactRead?: {
+ slug: string;
+ ver?: string;
+ };
};
Returns the fetched content with HTTP status and metadata.
@@ -2871,6 +3639,7 @@
| string
>;
durationSeconds: number;
+ searchCount?: number;
};
Returns search results from the web.
@@ -2884,12 +3653,16 @@
**Tool name:** `Workflow`
type WorkflowOutput = {
- status: "async_launched";
+ status: "async_launched" | "remote_launched";
taskId: string;
+ taskType?: "local_workflow" | "remote_agent";
+ workflowName?: string;
runId?: string;
summary?: string;
transcriptDir?: string;
scriptPath?: string;
+ sessionUrl?: string; // set when the workflow launched as a remote session
+ warning?: string;
error?: string;
};
@@ -2897,13 +3670,17 @@
Field| Type| Description
---|---|---
-`status`| `"async_launched"`| The tool accepted the invocation. This is the only value the field takes
+`status`| `"async_launched" | "remote_launched"`| The tool accepted the invocation. `"async_launched"` for in-process runs, `"remote_launched"` for runs dispatched to a remote session instead of running in-process
`taskId`| `string`| Background task identifier for the run
-`runId`| `string`| Workflow run identifier to pass as `resumeFromRunId` on a later invocation
+`taskType`| `"local_workflow" | "remote_agent"`| Task type of the registered background task, matching the `status` arm
+`workflowName`| `string`| The `meta.name` from the workflow script
+`runId`| `string`| Workflow run identifier to pass as `resumeFromRunId` on a later invocation. Absent for `remote_launched` runs, where the cloud session URL is the resume handle
`summary`| `string`| One-line description of what the workflow does
`transcriptDir`| `string`| Directory where subagent transcripts are written during execution
`scriptPath`| `string`| Path to the persisted workflow script for this run. Edit it and pass back as `scriptPath` to rerun without resending the script
-`error`| `string`| Set when the script fails its syntax check. When present, the run did not start despite the `async_launched` status
+`sessionUrl`| `string`| Cloud session URL, set when `status` is `"remote_launched"`
+`warning`| `string`| Non-blocking heads-up, such as local git state diverging from the pushed branch a cloud session will clone
+`error`| `string`| Set when the script fails its syntax check. When present, the run did not start despite the launched status
###
@@ -3022,6 +3799,7 @@
isAgent: boolean;
filePath?: string;
hasTaskTool?: boolean;
+ planWasEdited?: boolean;
awaitingLeaderApproval?: boolean;
requestId?: string;
};
@@ -3059,7 +3837,9 @@
uri: string;
mimeType?: string;
text?: string;
+ blobSavedTo?: string;
}>;
+ error?: string;
};
Returns the contents of the requested MCP resource.
@@ -3079,6 +3859,372 @@
};
Returns information about the git worktree.
+
+###
+
+
+
+ExitWorktree
+
+**Tool name:** `ExitWorktree`
+
+ type ExitWorktreeOutput = {
+ action: "keep" | "remove";
+ originalCwd: string;
+ worktreePath: string;
+ worktreeBranch?: string;
+ tmuxSessionName?: string;
+ discardedFiles?: number;
+ discardedCommits?: number;
+ message: string;
+ };
+
+Returns the action taken and details about the worktree that was exited.
+
+###
+
+
+
+EnterPlanMode
+
+**Tool name:** `EnterPlanMode`
+
+ type EnterPlanModeOutput = {
+ message: string;
+ };
+
+Returns a confirmation that plan mode was entered.
+
+###
+
+
+
+CronCreate
+
+**Tool name:** `CronCreate`
+
+ type CronCreateOutput = {
+ id: string;
+ humanSchedule: string;
+ recurring: boolean;
+ durable?: boolean; // true when persisted to .claude/scheduled_tasks.json; false when session-only
+ };
+
+Returns the job ID and a human-readable description of the schedule.
+
+###
+
+
+
+CronDelete
+
+**Tool name:** `CronDelete`
+
+ type CronDeleteOutput = {
+ id: string;
+ };
+
+Returns the ID of the deleted job.
+
+###
+
+
+
+CronList
+
+**Tool name:** `CronList`
+
+ type CronListOutput = {
+ jobs: {
+ id: string;
+ cron: string;
+ humanSchedule: string;
+ prompt: string;
+ recurring?: boolean;
+ durable?: boolean;
+ }[];
+ };
+
+Returns the scheduled cron jobs: durable jobs from `.claude/scheduled_tasks.json` and session-only jobs from the current session. A session-only job carries `durable: false`; jobs read from disk omit the field.
+
+###
+
+
+
+ScheduleWakeup
+
+**Tool name:** `ScheduleWakeup`
+
+ type ScheduleWakeupOutput = {
+ scheduledFor: number;
+ clampedDelaySeconds: number;
+ wasClamped: boolean;
+ stopped?: boolean;
+ cancelledWakeups?: number;
+ };
+
+Returns when the wake-up will fire as an epoch millisecond timestamp, the delay actually used, and whether the requested delay was clamped. The `stopped` field is `true` when the call ended the loop with `stop: true`. It requires Claude Code v2.1.202 or later. The `cancelledWakeups` field counts how many pending wakeups a `stop: true` call cancelled. A value of 0 means nothing was pending, and a recurring `/loop` cron isn’t cancelled by `stop: true`. It requires Claude Code v2.1.206 or later.
+
+###
+
+
+
+RemoteTrigger
+
+**Tool name:** `RemoteTrigger`
+
+ type RemoteTriggerOutput = {
+ status: number;
+ json: string;
+ summary?: string;
+ };
+
+Returns the API response status and body for the trigger operation.
+
+###
+
+
+
+PushNotification
+
+**Tool name:** `PushNotification`
+
+ type PushNotificationOutput = {
+ message: string;
+ pushSent?: boolean;
+ localSent?: boolean;
+ disabledReason?: "config_off" | "user_present" | "no_transport";
+ sentAt?: string;
+ };
+
+Returns delivery details, including whether a push or local notification was sent and why delivery was skipped.
+
+###
+
+
+
+REPL
+
+**Tool name:** `REPL`
+
+ type REPLOutput = {
+ code: string;
+ result: {
+ [k: string]: unknown;
+ };
+ stdout: string;
+ stderr: string;
+ error?: string;
+ registeredTools?: string[];
+ images?: {
+ base64: string;
+ mediaType: string;
+ }[];
+ documents?: {
+ base64: string;
+ }[];
+ };
+
+Returns the execution result, captured console output, and any images or documents surfaced by inner `Read` calls.
+
+###
+
+
+
+ReportFindings
+
+**Tool name:** `ReportFindings`
+
+ type ReportFindingsOutput = {
+ count: number;
+ level?: "low" | "medium" | "high" | "xhigh" | "max";
+ findings: Array<{
+ file: string;
+ line?: number;
+ summary: string;
+ failure_scenario: string;
+ short_summary?: string;
+ category?: string;
+ verdict?: "CONFIRMED" | "PLAUSIBLE";
+ outcome?: "fixed" | "skipped" | "no_change_needed";
+ }>;
+ };
+
+Returns the number of findings reported, the effort level the review ran at, and the findings echoed back for the result body. Requires Claude Code v2.1.196 or later. The echoed `short_summary` field requires Claude Code v2.1.212 or later.
+
+###
+
+
+
+Artifact
+
+**Tool name:** `Artifact`
+
+ type ArtifactOutput =
+ | {
+ url: string;
+ path: string;
+ title?: string;
+ version?: string;
+ capabilities?: unknown;
+ stored?: {
+ contract: string;
+ capabilities?: Record<string, unknown>;
+ };
+ warnings?: string[];
+ contract?: string;
+ updated?: boolean;
+ liveSubscription?: string;
+ }
+ | {
+ artifacts: Array<{
+ title: string;
+ url: string;
+ updatedAt?: string;
+ rel?: "mine" | "shared";
+ }>;
+ truncated?: boolean;
+ scope?: "shared" | "all";
+ };
+
+Returns the published page’s `url` and the local `path` that was published for the publish action, with `updated` set to true when the publish redeployed an existing artifact, and `warnings` carrying any publish-time advisories. The list action returns the `artifacts` rows instead, with `truncated` set when more artifacts exist than the requested limit. On listings whose scope isn’t `"mine"`, each row carries `rel` marking whether the user owns the artifact or it was shared with them, and the output’s `scope` records which non-default scope produced the listing; both are absent on default listings.
+
+###
+
+
+
+Projects
+
+**Tool name:** `Projects`
+
+ type ProjectsOutput =
+ | {
+ method: "project_info";
+ notice?: string;
+ name: string;
+ description: string;
+ instructions: string;
+ docs: Array<{ path: string; created_at: string | null }>;
+ files?: Array<{
+ path: string;
+ file_kind: string;
+ created_at: string | null;
+ }>;
+ sync_sources?: Array<{
+ type: string | null;
+ config: Record<string, unknown>;
+ }>;
+ knowledge: {
+ knowledge_size: number;
+ max_knowledge_size: number;
+ };
+ }
+ | {
+ method: "project_read";
+ notice?: string;
+ path: string;
+ file_kind?: string;
+ content?: string;
+ local_file?: string;
+ created_at: string | null;
+ }
+ | {
+ method: "project_search";
+ notice?: string;
+ rag: boolean;
+ hits?: Array<{ name?: string; doc_uuid?: string; text?: string }>;
+ docs?: string[];
+ }
+ | {
+ method: "project_write";
+ notice?: string;
+ path: string;
+ doc_uuid: string;
+ replaced: boolean;
+ present_to_user?: boolean;
+ local_path?: string;
+ }
+ | {
+ method: "project_delete";
+ notice?: string;
+ path: string;
+ deleted: boolean;
+ };
+
+Discriminated on the `method` field, mirroring the input. `project_read` returns small text docs inline in `content` and writes larger docs to a `local_file` path instead; `project_search` returns RAG `hits` with `rag: true` when the project’s index is available and falls back to a `docs` path list otherwise.
+
+###
+
+
+
+ReadMcpResourceDir
+
+**Tool name:** `ReadMcpResourceDirTool`
+
+ type ReadMcpResourceDirOutput = {
+ resources: Array<{
+ uri: string;
+ name: string;
+ mimeType?: string;
+ }>;
+ error?: string;
+ };
+
+Returns the direct children of the directory resource. Subdirectories appear with mimeType `"inode/directory"`; `error` carries a human-readable message when the server couldn’t list the directory.
+
+###
+
+
+
+RefreshMcpTools
+
+**Tool name:** `RefreshMcpTools`
+
+ type RefreshMcpToolsOutput = Array<{
+ server: string;
+ status: "refreshed" | "error" | "not_connected";
+ toolCount?: number; // tools now available from this server
+ added?: string[]; // tool names this refresh added
+ removed?: string[]; // tool names this refresh removed
+ error?: string; // why the refresh failed or the server was unavailable
+ }>;
+
+Returns one entry per server: `refreshed` means the re-queried tool list was applied, `error` means the re-query failed and the previous tool set was kept, and `not_connected` means the server has no live connection to query.
+
+###
+
+
+
+ShowOnboardingRolePicker
+
+**Tool name:** `ShowOnboardingRolePicker`
+
+ type ShowOnboardingRolePickerOutput = {
+ role?: string;
+ dismissed?: boolean;
+ };
+
+Returns the user’s selection: `role` when they picked a role chip or typed one, and `dismissed: true` when they closed the picker. An empty object means the user approved the call without picking a role.
+
+###
+
+
+
+McpOutput
+
+**Tool name:** dynamic MCP tool names of the form `mcp__<server>__<tool>`
+
+ type McpOutput =
+ | string
+ | {
+ type: string;
+ [k: string]: unknown;
+ }[]
+ | {
+ [k: string]: unknown;
+ };
+
+MCP tool results are returned as a string or an array of content blocks, depending on the server. The trailing plain-object branch in the exported type is a schema-generation artifact: the SDK doesn’t return a bare object, because a server’s structured output is serialized to a JSON string before being returned. At runtime the value may also be `undefined`, although the exported type doesn’t model this.
##
@@ -3175,6 +4321,8 @@
type ApiKeySource = "user" | "project" | "org" | "temporary" | "oauth";
+At runtime, the `apiKeySource` field on the `SDKSystemMessage` init message can also be the string `"none"` when no API key is in use, for example when the session authenticates with an OAuth token. Handle values outside this union defensively.
+
###
@@ -3185,7 +4333,7 @@
type SdkBeta = "context-1m-2025-08-07";
-The `context-1m-2025-08-07` beta is retired as of April 30, 2026. Passing this value with Claude Sonnet 4.5 or Sonnet 4 has no effect, and requests that exceed the standard 200k-token context window return an error. To use a 1M-token context window, migrate to [Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.6, Claude Opus 4.7, or Claude Opus 4.8](<https://platform.claude.com/docs/en/about-claude/models/overview>), which include 1M context at standard pricing with no beta header required.
+The `context-1m-2025-08-07` beta is retired as of April 30, 2026. Passing this value with Claude Sonnet 4.5 or Sonnet 4 has no effect, and requests that exceed the standard 200k-token context window return an error. To use a 1M-token context window, migrate to [Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.6, Claude Opus 4.7, or Claude Opus 4.8](<https://platform.claude.com/docs/en/about-claude/models/overview>), which include 1M context at standard pricing with no beta header required.
###
@@ -3333,7 +4481,11 @@
costUSD: number;
contextWindow: number;
maxOutputTokens: number;
- };
+ canonicalModel?: string;
+ provider?: string;
+ };
+
+The `canonicalModel` and `provider` fields require Claude Code v2.1.218 or later. `canonicalModel` is the canonical model ID that the pricing lookup uses; it can differ from the raw model string that keys the entry, for example when that string is a provider-specific ID or an alias. `provider` names the API backend that served the model, such as `firstParty`, `bedrock`, `vertex`, `foundry`, `anthropicAws`, `mantle`, or `gateway`.
###
@@ -3413,7 +4565,7 @@
| { type: "enabled"; budgetTokens?: number; display?: ThinkingDisplay } // Fixed thinking token budget
| { type: "disabled" }; // No extended thinking
-The optional `display` field controls whether thinking text is returned `"summarized"` or `"omitted"`. On Claude Opus 4.7 and later, the API default is `"omitted"`, so set `"summarized"` to receive thinking content in `thinking` blocks.
+The optional `display` field controls whether thinking text is returned `"summarized"` or `"omitted"`. On Claude Opus 4.7 and later, the API default is `"omitted"`, so set `"summarized"` to receive thinking content in `thinking` blocks. Claude Code doesn’t send `display` to Amazon Bedrock or Google Cloud’s Agent Platform, so on those providers Opus 4.7 and later return empty `thinking` blocks even when you set `display` to `"summarized"`.
###
@@ -3492,7 +4644,10 @@
filesChanged?: string[];
insertions?: number;
deletions?: number;
- };
+ skippedLinks?: number;
+ };
+
+`skippedLinks` counts the tracked paths the rewind refused to restore or delete for link safety: a symlink, hard link, or other non-regular file at the tracked path, a parent directory that no longer resolves to where it pointed when the checkpoint was taken, or a backup that couldn’t be read safely. The field requires Claude Code v2.1.216 or later. A preview call with `rewindFiles(userMessageId, { dryRun: true })` never sets it.
###
@@ -3536,6 +4691,8 @@
session_id: string;
};
+Claude Code prepends a notice to every task notification it sends to the model. The notice states that no human input has occurred, so the model doesn’t treat the notification as a user instruction or approval. To detect a task-notification turn, check `origin.kind === "task-notification"` on `SDKUserMessage` or `SDKResultMessage` rather than matching on the notice text. Before v2.1.205, Claude Code left the notice off notifications that arrived while the session was idle.
+
###
@@ -3629,9 +4786,25 @@
parent_tool_use_id: string | null;
elapsed_time_seconds: number;
task_id?: string;
+ heartbeat?: boolean;
+ subagent_type?: string;
+ subagent_retry?: {
+ agent_id: string;
+ attempt: number;
+ max_retries: number;
+ retry_delay_ms: number;
+ error_status: number | null;
+ error_category: string;
+ };
uuid: UUID;
session_id: string;
};
+
+While a tool call runs in the main conversation, Claude Code emits a `tool_progress` message every 30 seconds with `heartbeat: true`. Each heartbeat carries the tool name and elapsed seconds, so you can distinguish a long-running call from a stalled session. Claude Code doesn’t emit heartbeats for the Agent tool, whose subagents stream their own progress, or for tool calls inside a subagent. The `heartbeat` field requires Agent SDK v0.3.214 or later. On `tool_progress` messages for the Agent tool, `subagent_type` names the running subagent type, such as `general-purpose`. `subagent_retry` is present while that subagent waits out an API error backoff, such as a rate limit or overload, with one message per retry attempt. Both fields require Agent SDK v0.3.214 or later. To render a retry indicator from `subagent_retry`:
+
+ * Track the indicator by `parent_tool_use_id`, which is unique per subagent. `tool_use_id` is shared by parallel subagents from one assistant turn, so tracking by it would let one subagent’s update clear another’s indicator.
+ * Clear the indicator when a later `tool_progress` for the same `parent_tool_use_id` arrives without the field, or when the tool’s result message arrives. `attempt` can exceed `max_retries` under persistent retry, so don’t derive clearing from the counters.
+ * Treat `error_category` as a closed set of tokens for choosing your own message text, not as display text: `rate_limit`, `overloaded`, `authentication_failed`, `server_error`, or `unknown`.
###
@@ -3820,7 +4993,7 @@
`SDKCommandsChangedMessage`
-Emitted when the set of available commands changes mid-session, such as when skills are discovered as the agent enters a subdirectory. The `commands` array is the full updated list, so replace any cached command list with this payload. Calling `supportedCommands()` again is not equivalent: that method returns the snapshot captured at initialization and does not reflect mid-session changes.
+Emitted when the set of available commands changes mid-session, such as when Claude Code discovers skills as the agent enters a subdirectory. The `commands` array is the full updated list, so replace any cached command list with this payload. Calling `supportedCommands()` after this message returns the same updated list, because the method tracks the latest push; this requires Agent SDK v0.3.216 or later. In earlier SDK versions, `supportedCommands()` returns the snapshot captured at initialization and never reflects mid-session changes.
type SDKCommandsChangedMessage = {
type: "system";
@@ -3956,6 +5129,7 @@
type SandboxNetworkConfig = {
allowedDomains?: string[];
deniedDomains?: string[];
+ strictAllowlist?: boolean;
allowManagedDomainsOnly?: boolean;
allowLocalBinding?: boolean;
allowUnixSockets?: string[];
@@ -3968,6 +5142,7 @@
---|---|---|---
`allowedDomains`| `string[]`| `[]`| Domain names that sandboxed processes can access
`deniedDomains`| `string[]`| `[]`| Domain names that sandboxed processes cannot access. Takes precedence over `allowedDomains`
+`strictAllowlist`| `boolean`| `false`| Deny sandboxed commands access to hosts not in `allowedDomains` instead of prompting. Enforced for sandboxed commands only; in-process tools such as WebFetch aren’t gated by it. Only honored from user, managed, or CLI `--settings` settings; project settings are ignored. Requires Claude Code v2.1.219 or later
`allowManagedDomainsOnly`| `boolean`| `false`| Managed-settings only. When set in [managed settings](</docs/en/permissions#managed-settings>), only `allowedDomains` entries from managed settings are honored and entries from user, project, or local settings are ignored. Has no effect when set via SDK options
`allowLocalBinding`| `boolean`| `false`| Allow processes to bind to local ports (e.g., for dev servers)
`allowUnixSockets`| `string[]`| `[]`| Unix socket paths that processes can access (e.g., Docker socket)
--- a/typescript-v2-preview.md
+++ b/typescript-v2-preview.md
@@ -169,7 +169,7 @@
Cleanup
-Sessions can be closed manually or automatically using [`await using`](<https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management>), a TypeScript 5.2+ feature for automatic resource cleanup. If you’re using an older TypeScript version or encounter compatibility issues, use manual cleanup instead. **Automatic cleanup (TypeScript 5.2+):**
+Sessions can be closed manually or automatically using [`await using`](<https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management>), a TypeScript 5.2+ feature for automatic resource cleanup. If you’re using an older TypeScript version or encounter compatibility issues, use manual cleanup instead. The examples below show only the cleanup pattern and don’t send any messages, so running them produces no output. **Automatic cleanup (TypeScript 5.2+):**
import { unstable_v2_createSession } from "@anthropic-ai/claude-agent-sdk";
--- a/ultraplan.md
+++ b/ultraplan.md
@@ -6,7 +6,7 @@
* **Hands-off drafting** : the plan is generated remotely, so your terminal stays free for other work
* **Flexible execution** : approve the plan to run on the web and open a pull request, or send it back to your terminal
-Ultraplan requires a [Claude Code on the web](</docs/en/claude-code-on-the-web>) account and a GitHub repository. Because it runs on Anthropic’s cloud infrastructure, it is not available when using Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. The cloud session runs in your account’s default [cloud environment](</docs/en/claude-code-on-the-web#the-cloud-environment>). If you don’t have a cloud environment yet, ultraplan creates one automatically when it first launches.
+Ultraplan requires a [Claude Code on the web](</docs/en/claude-code-on-the-web>) account and a GitHub repository. Because it runs on Anthropic’s cloud infrastructure, it is not available when using Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. The cloud session runs in your default [cloud environment](</docs/en/cloud-environments>); use [`/remote-env`](</docs/en/cloud-environments#select-an-environment-from-the-cli>) in your terminal to change which environment that is. If you don’t have a cloud environment yet, ultraplan creates one automatically when it first launches.
##
--- a/user-input.md
+++ b/user-input.md
@@ -11,6 +11,8 @@
Python
TypeScript
+
+ from claude_agent_sdk import ClaudeAgentOptions
async def handle_tool_request(tool_name, input_data, context):
# Prompt user and return allow or deny
@@ -214,6 +216,8 @@
* **Reject** : block the tool and tell Claude why
* **Suggest alternative** : block but guide Claude toward what the user wants instead
* **Redirect entirely** : use [streaming input](</docs/en/agent-sdk/streaming-vs-single-mode>) to send Claude a completely new instruction
+
+The `ask_user` and `askUser` helpers in the following snippets stand in for your application’s own prompt UI.
* Approve
--- a/vs-code.md
+++ b/vs-code.md
@@ -100,8 +100,8 @@
Use @-mentions to give Claude context about specific files or folders. When you type `@` followed by a file or folder name, Claude reads that content and can answer questions about it or make changes to it. Claude Code supports fuzzy matching, so you can type partial names to find what you need:
- > Explain the logic in @auth (fuzzy matches auth.js, AuthService.ts, etc.)
- > What's in @src/components/ (include a trailing slash for folders)
+ Explain the logic in @auth (fuzzy matches auth.js, AuthService.ts, etc.)
+ What's in @src/components/ (include a trailing slash for folders)
For large PDFs, you can ask Claude to read specific pages instead of the whole file: a single page, a range like pages 1-10, or an open-ended range like page 3 onward. When you select text in the editor, Claude can see your highlighted code automatically. The prompt box footer shows how many lines are selected. Press `Option+K` (Mac) / `Alt+K` (Windows/Linux) to insert an @-mention with the file path and line numbers (e.g., `@app.ts#5-10`). Click the selection indicator to toggle whether Claude can see your highlighted text - the eye-slash icon means the selection is hidden from Claude. You can also hold `Shift` while dragging files into the prompt box to add them as attachments. Click the X on any attachment to remove it from context.
@@ -435,9 +435,9 @@
Claude can stage changes, write commit messages, and create pull requests based on your work:
- > commit my changes with a descriptive message
- > create a pr for this feature
- > summarize the changes I've made to the auth module
+ commit my changes with a descriptive message
+ create a pr for this feature
+ summarize the changes I've made to the auth module
When creating pull requests, Claude generates descriptions based on the actual code changes and can add context about testing or implementation decisions.
Show diff (120 lines)
--- a/web-quickstart.md
+++ b/web-quickstart.md
@@ -17,8 +17,8 @@
When you submit a task:
- 1. **Clone and prepare** : your repository is cloned to an Anthropic-managed VM, and your [setup script](</docs/en/claude-code-on-the-web#setup-scripts>) runs if configured.
- 2. **Configure network** : internet access is set based on your environment’s [access level](</docs/en/claude-code-on-the-web#access-levels>).
+ 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>).
3. **Work** : Claude analyzes code, makes changes, runs tests, and checks its work. You can watch and steer throughout, or step away and come back when it’s done.
4. **Push the branch** : when Claude reaches a stopping point, it pushes its branch to GitHub. You review the diff, leave inline comments, create a PR, or send another message to keep going.
@@ -48,7 +48,7 @@
-Connect GitHub and create an environment
+Connect GitHub
Setup is a one-time process. If you already use the GitHub CLI, you can do this from your terminal instead of the browser.
@@ -66,16 +66,9 @@
3
-Create your environment
-
-After connecting GitHub, you’ll be prompted to create a cloud environment. The environment controls what network access Claude has during sessions and what runs when a new session is created. See [Installed tools](</docs/en/claude-code-on-the-web#installed-tools>) for what’s available without any configuration.The form has these fields:
-
- * **Name** : a display label. Useful when you have multiple environments for different projects or access levels.
- * **Network access** : controls what the session can reach on the internet. The default, `Trusted`, allows connections to [common package registries](</docs/en/claude-code-on-the-web#default-allowed-domains>) like npm, PyPI, and RubyGems while blocking general internet access.
- * **Environment variables** : optional variables available in every session, in `.env` format. Don’t wrap values in quotes, since quotes are stored as part of the value. These are visible to anyone who can edit this environment.
- * **Setup script** : an optional Bash script that runs before Claude Code launches. Use it to install system tools the cloud VM doesn’t include, like `apt install -y gh`. The result is [cached](</docs/en/claude-code-on-the-web#environment-caching>), so the script doesn’t re-run on every session. See [Setup scripts](</docs/en/claude-code-on-the-web#setup-scripts>) for examples and debugging tips.
-
-For a first project, leave the defaults and click **Create environment**. You can [edit it later or create additional environments](</docs/en/claude-code-on-the-web#configure-your-environment>) for different projects.
+Confirm your Default environment
+
+When you finish connecting GitHub, onboarding creates a [cloud environment](</docs/en/cloud-environments>) named **Default** for you; if onboarding shows an environment form instead, keep its defaults to create the same **Default** environment. The environment controls what network access Claude has during sessions and what runs when a new session is created. **Default** uses [`Trusted` network access](</docs/en/cloud-environments#access-levels>): sessions reach [common package registries](</docs/en/cloud-environments#default-allowed-domains>) and other allowlisted domains, and nothing else through the session’s network. See [Installed tools](</docs/en/cloud-environments#installed-tools>) for what’s available without any configuration.For a first project, the **Default** environment works as is. To change its network access, add environment variables, or run a [setup script](</docs/en/cloud-environments#setup-scripts>) before sessions start, [edit it or create additional environments](</docs/en/cloud-environments#configure-your-environment>).
###
@@ -99,7 +92,7 @@
Sign in to Claude
-In the Claude Code CLI, run `/login` to sign in with your claude.ai account. Skip this step if you’re already signed in.
+In the Claude Code CLI, run `/login` to sign in with your claude.ai account. Skip this step if you’re already signed in with a claude.ai account. Authenticating with an API key doesn’t count. To check, run `/status` and confirm the **Login method** row shows a claude.ai account.
3
@@ -109,7 +102,7 @@
/web-setup
-This syncs your `gh` token to your Claude account. If you don’t have a cloud environment yet, `/web-setup` creates one with Trusted network access and no setup script. You can [edit the environment or add variables](</docs/en/claude-code-on-the-web#configure-your-environment>) afterward. Once `/web-setup` completes, you can start cloud sessions from your terminal with [`--cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>) or set up recurring tasks with [`/schedule`](</docs/en/routines>).
+This syncs your `gh` token to your Claude account. On success, Claude Code prints `Connected as <your-github-username>` and opens [claude.ai/code](<https://claude.ai/code>) in your browser. If you don’t have a cloud environment yet, `/web-setup` creates one with Trusted network access and no setup script. You can [edit the environment or add variables](</docs/en/cloud-environments#configure-your-environment>) afterward. Once `/web-setup` completes, you can start cloud sessions from your terminal with [`--cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-web>) or set up recurring tasks with [`/schedule`](</docs/en/routines>).
##
@@ -228,9 +221,17 @@
+`/web-setup` says “Not signed in to Claude”
+
+If `/web-setup` responds with “Not signed in to Claude. Run /login first.”, the CLI doesn’t have a valid claude.ai sign-in. This can also happen when a previous sign-in has expired. Run `/login`, sign in with your claude.ai account, then run `/web-setup` again.
+
+###
+
+
+
`/web-setup` shows “No commands match” or “Unknown command”
-`/web-setup` runs inside the Claude Code CLI, not your shell. Launch `claude` first, then type `/web-setup` at the prompt. If you typed it inside Claude Code and the command menu shows `No commands match "/web-setup"`, or submitting it returns `Unknown command: /web-setup`, the command is hidden because a requirement isn’t met. The cause is usually that you’re authenticated with an API key or third-party provider instead of a claude.ai subscription. Run `/login` to sign in with your claude.ai account. On Team and Enterprise plans, the command is also hidden when any of the following apply:
+`/web-setup` runs inside the Claude Code CLI, not your shell. Launch `claude` first, then type `/web-setup` at the prompt. If you typed it inside Claude Code and the command menu shows `No commands match "/web-setup"`, or submitting it returns `Unknown command: /web-setup`, the command is hidden because a requirement isn’t met. The cause is usually that you’re authenticated with an API key or third-party provider instead of a claude.ai subscription. Run `/login` to sign in with your claude.ai account. Team and Enterprise Owners can also [disable `/web-setup`](</docs/en/claude-code-on-the-web#github-authentication-options>) for their organization, which hides the command. In that case, use the browser flow above instead. On Team and Enterprise plans, the command is also hidden when any of the following apply:
* an administrator has disabled Claude Code on the web for your organization
* an administrator has disabled the [Quick web setup toggle](</docs/en/claude-code-on-the-web#github-authentication-options>)
@@ -242,7 +243,7 @@
”Could not create a cloud environment” or “No cloud environment available” when using `--cloud` or ultraplan
-Remote-session features create a default cloud environment automatically if you don’t have one. If you see “Could not create a cloud environment”, automatic creation failed. If you see “No cloud environment available”, your CLI predates automatic creation. In either case, run `/web-setup` in the Claude Code CLI to create one manually, or visit [claude.ai/code](<https://claude.ai/code>) and follow the **Create your environment** step above.
+Remote-session features create a default cloud environment automatically if you don’t have one. If you see “Could not create a cloud environment”, automatic creation failed. If you see “No cloud environment available”, your CLI predates automatic creation. In either case, run `/web-setup` in the Claude Code CLI, or add an environment from the [environment selector](</docs/en/cloud-environments#configure-your-environment>) at [claude.ai/code](<https://claude.ai/code>).
###
@@ -252,7 +253,7 @@
The setup script exited with a non-zero status, which blocks the session from starting. Common causes:
- * A package install failed because the registry isn’t in your [network access level](</docs/en/claude-code-on-the-web#access-levels>). `Trusted` covers most package managers; `None` blocks them all.
+ * A package install failed because the registry isn’t in your [network access level](</docs/en/cloud-environments#access-levels>). `Trusted` covers most package managers; `None` blocks them all.
* The script references a file or path that doesn’t exist in a fresh clone.
* A command that works locally needs a different invocation on Ubuntu.
@@ -264,10 +265,10 @@
New sessions hang or time out during setup
-If new sessions stall on the setup script step or fail with a generic container error before the script finishes, the script is likely exceeding the roughly five-minute time budget for building the [environment cache](</docs/en/claude-code-on-the-web#environment-caching>). Heavy steps such as pulling large Docker images, syncing full dependency trees, or downloading model weights often push the total over the limit, especially when they run one after another. To fix this, trim the script so it reliably finishes in under five minutes:
+If new sessions stall on the setup script step or fail with a generic container error before the script finishes, the script is likely exceeding the roughly five-minute time budget for building the [environment cache](</docs/en/cloud-environments#environment-caching>). Heavy steps such as pulling large Docker images, syncing full dependency trees, or downloading model weights often push the total over the limit, especially when they run one after another. To fix this, trim the script so it reliably finishes in under five minutes:
* Run independent installs in parallel with `&` and a final `wait` instead of running them serially.
- * Move the largest downloads out of the setup script and into a [SessionStart hook](</docs/en/claude-code-on-the-web#setup-scripts-vs-sessionstart-hooks>) that launches them in the background, so the session becomes usable while they finish.
+ * Move the largest downloads out of the setup script and into a [SessionStart hook](</docs/en/cloud-environments#setup-scripts-vs-sessionstart-hooks>) that launches them in the background, so the session becomes usable while they finish.
* Remove long retry sleeps from the setup script, since a stalled retry loop counts against the budget.
###
@@ -286,7 +287,8 @@
Now that you can submit and review tasks, these pages cover what comes next: starting cloud sessions from your terminal, scheduling recurring work, and giving Claude standing instructions.
- * [Use Claude Code on the web](</docs/en/claude-code-on-the-web>): the full reference, including teleporting sessions to your terminal, setup scripts, environment variables, and network config
+ * [Use Claude Code on the web](</docs/en/claude-code-on-the-web>): the full reference, including teleporting sessions to your terminal, session sharing, and auto-fixing pull requests
+ * [Configure cloud environments](</docs/en/cloud-environments>): network access levels, environment variables, and setup scripts for cloud sessions
* [Routines](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events
* [CLAUDE.md](</docs/en/memory>): give Claude persistent instructions and context that load at the start of every session
* Install the Claude mobile app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>) to monitor sessions from your phone. From the Claude Code CLI, `/mobile` shows a QR code.
--- a/workflows.md
+++ b/workflows.md
@@ -216,7 +216,7 @@
A saved workflow can accept input through the `args` parameter. The script reads it as a global named `args`. Use this to supply a research question, a list of target paths, or a configuration object at invocation time instead of editing the script for each run. The following prompt runs a saved workflow with a list of issue numbers:
- > Run /triage-issues on issues 1024, 1025, and 1030
+ Run /triage-issues on issues 1024, 1025, and 1030
Claude passes the list as structured data, so the script can call array and object methods on `args` directly without parsing it first. If `args` is omitted, the global is `undefined` inside the script.
@@ -236,7 +236,7 @@
Fan out one agent per file, then collect and verify the findings.
- > use a workflow to audit every route handler under src/routes/ for missing authentication checks, and adversarially verify each finding before reporting it
+ use a workflow to audit every route handler under src/routes/ for missing authentication checks, and adversarially verify each finding before reporting it
###
@@ -246,7 +246,7 @@
Run a checker, fix what failed, and repeat until it passes or stops making progress.
- > use a workflow to run npx tsc --noEmit and keep fixing the reported errors until the type check passes or two rounds in a row make no progress
+ use a workflow to run npx tsc --noEmit and keep fixing the reported errors until the type check passes or two rounds in a row make no progress
###
@@ -256,7 +256,7 @@
Discover the files to migrate, transform each one in an isolated copy so edits don’t conflict, and verify each result.
- > use a workflow to migrate every component under src/components/ from styled-components to Tailwind, working on each file in its own isolated copy
+ use a workflow to migrate every component under src/components/ from styled-components to Tailwind, working on each file in its own isolated copy
###
@@ -266,7 +266,7 @@
Run a reviewer per file, then hand all the findings to one agent that ranks and deduplicates them.
- > use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary
+ use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary
###
@@ -276,7 +276,7 @@
Fan out readers across changelogs, issues, and docs, then synthesize. The bundled `/deep-research` workflow does this; you can also describe a narrower version.
- > use a workflow to research how our three competitors handle rate limiting: read their public docs and recent changelog entries in parallel, then compare the approaches
+ use a workflow to research how our three competitors handle rate limiting: read their public docs and recent changelog entries in parallel, then compare the approaches
###
@@ -286,7 +286,7 @@
Keep searching in rounds and stop when new rounds turn up nothing new.
- > use a workflow to find flaky tests in this repo: run the suite repeatedly, record which tests fail intermittently, and stop once two rounds in a row find nothing new
+ use a workflow to find flaky tests in this repo: run the suite repeatedly, record which tests fail intermittently, and stop once two rounds in a row find nothing new
###
@@ -350,7 +350,12 @@
Resume after a pause
-If you stop a run, you can resume it: agents that already completed return their cached results, and the rest run live. An agent that was still running when you stopped isn’t saved and starts over on resume, so a workflow that fans work out across many small agents preserves more progress than one long agent. Resume a paused run from `/workflows` by selecting it and pressing `p`, or ask Claude to relaunch the workflow with the same script. Resume works within the same Claude Code session. If you exit Claude Code while a workflow is running, the next session starts the workflow fresh.
+If you stop a run, you can resume it. Agents that already completed usually return their cached results, and the rest run live. Two rules decide which results survive:
+
+ * An agent that was still running when you stopped isn’t saved, so it starts over on resume.
+ * Replay follows the order agents started. Cached results stop at the first agent that didn’t finish, and every agent that started after that one runs again, even if it completed.
+
+The second rule is what makes stopping mid fan-out expensive. Say a script starts four agents, A, B, C, and D, in that order, and you stop the run while B is still going. On resume, A returns from cache. B runs again because it never finished. C and D run again too, because they started after B, even though both completed before you stopped. A workflow that fans work out across many small agents therefore preserves more progress than one long agent. Resume a paused run from `/workflows` by selecting it and pressing `p`, or ask Claude to relaunch the workflow with the same script. Resume works within the same Claude Code session. If you exit Claude Code while a workflow is running, the next session starts the workflow fresh.
###
@@ -358,7 +363,7 @@
Cost
-A workflow spawns many agents, so a single run can use meaningfully more tokens than working through the same task in conversation. Runs count toward your plan’s usage and rate limits like any other session. To gauge the spend before committing to a large task, run the workflow on a small slice first: one directory instead of the whole repo, or a narrow question instead of a broad one. The `/workflows` view shows each agent’s token usage as the run progresses, and you can stop the run there at any time without losing completed work. The runtime’s agent caps limit how many agents a single run can spawn, which bounds the cost of a runaway script. To keep runs to fewer agents, choose the `small` size guideline. Claude Code also flags a run that grows unusually large. When a workflow schedules more than 25 agents, or its projected token total passes 1.5 million, its progress line in the task panel below the input box shows a `Large workflow` warning. The warning points you to `/workflows`, where you can stop the run. Requires Claude Code v2.1.203 or later. The warning is advisory: it doesn’t pause or limit the run. Two settings change when you see it:
+A workflow spawns many agents, so a single run can use meaningfully more tokens than working through the same task in conversation. Runs count toward your plan’s usage and rate limits like any other session. To gauge the spend before committing to a large task, run the workflow on a small slice first: one directory instead of the whole repo, or a narrow question instead of a broad one. The `/workflows` view shows each agent’s token usage as the run progresses, and you can stop the run there at any time, usually without losing completed work. Resume after a pause covers what a stopped run keeps. The runtime’s agent caps limit how many agents a single run can spawn, which bounds the cost of a runaway script. To keep runs to fewer agents, choose the `small` size guideline. Claude Code also flags a run that grows unusually large. When a workflow schedules more than 25 agents, or its projected token total passes 1.5 million, its progress line in the task panel below the input box shows a `Large workflow` warning. The warning points you to `/workflows`, where you can stop the run. Requires Claude Code v2.1.203 or later. The warning is advisory: it doesn’t pause or limit the run. Two settings change when you see it:
* If you choose a size guideline yourself, its agent count replaces the 25-agent threshold. The built-in default guideline leaves the threshold at 25.
* Sessions with ultracode on don’t show the warning, because turning ultracode on already opts you in to large runs.
--- a/worktrees.md
+++ b/worktrees.md
@@ -185,9 +185,9 @@
git worktree add ../project-feature-a -b feature-a
-Create a worktree from an existing branch:
-
- git worktree add ../project-bugfix bugfix-123
+Create a worktree from an existing branch, replacing `fix-issue-456` with a branch that already exists in your repository:
+
+ git worktree add ../project-bugfix fix-issue-456
Start Claude in the worktree: