Changes on
92 changes detected
--- a/2026-w18.md
+++ b/2026-w18.md
@@ -40,7 +40,7 @@
https://github.com/your-org/your-repo/pull/1234
-To skip the picker, pass the PR number on the command line instead:
+To open the picker already filtered to the PR, pass the PR number on the command line:
claude --from-pr 1234
--- a/2026-w21.md
+++ b/2026-w21.md
@@ -4,19 +4,21 @@
Auto mode is now available on the Pro plan and supports Sonnet 4.6 alongside Opus. It replaces permission prompts with background safety checks: routine actions run without interrupting you, and destructive or suspicious ones are blocked and surfaced.
-Update Claude Code, then cycle modes with Shift+Tab; auto mode appears once your account meets the requirements:
+Update Claude Code, then cycle modes with Shift+Tab; auto mode appears in the cycle once your account meets the requirements:
terminal
claude update
-[Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)
+The command prints `Successfully updated` with the new version number, or `Claude Code is up to date` if no update is needed. Once auto mode is active, the prompt footer shows `auto mode on`.
+
+[Auto mode requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)
Other wins
[`/usage`](</docs/en/costs#track-your-costs>) now shows a per-category breakdown of what’s driving your plan limits, attributing recent usage to skills, subagents, plugins, and individual MCP servers
-”Extra usage” is renamed to “usage credits” across the CLI, and `/extra-usage` is now `/usage-credits`. The old name still works.
+”Extra usage” is renamed to “usage credits” across the CLI, and `/extra-usage` is now `/usage-credits`. The old name still works. The command requires signing in with your claude.ai subscription through `/login` and isn’t available with API key authentication.
New [`/code-review`](</docs/en/code-review>) command reports correctness bugs at a chosen effort level such as `/code-review high`, and `—comment` posts findings as inline GitHub PR comments. `/simplify` remains as a separate cleanup-only review.
--- a/accessibility.md
+++ b/accessibility.md
@@ -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.
+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. Cycling [permission modes](</docs/en/permission-modes>) with `Shift+Tab` announces the mode you land on, such as `[plan mode on]` or `[accept edits on]`. Claude Code prints the announcement once and doesn’t repeat it on later redraws. Requires Claude Code v2.1.210 or later.
###
@@ -116,7 +116,7 @@
Some behaviors aren’t adapted for screen reader mode:
* Screen reader mode doesn’t turn on automatically when a screen reader is running.
- * Mode changes, such as entering [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>), aren’t announced yet.
+ * Claude Code doesn’t announce a permission mode change made in any way other than cycling with `Shift+Tab`, such as entering [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) from a command.
* Attaching to a [background session](</docs/en/agent-view>) with `claude attach` or from agent view enters the terminal’s alternate screen, which has no native scrollback. This is the [same behavior as other attached sessions](</docs/en/fullscreen>). To get back out, press Left Arrow on an empty prompt, or Ctrl+Z if a dialog has focus.
* Claude Code announces costs in the summary it prints at exit, not per turn.
* Screen reader mode doesn’t change [non-interactive mode](</docs/en/headless>) with the `-p` flag. Non-interactive mode already writes plain text and remains an alternative for scripting.
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -81,6 +81,7 @@
[Hook restrictions](</docs/en/settings#hook-configuration>)| Only managed hooks load; restrict HTTP hook URLs| `allowManagedHooksOnly`, `allowedHttpHookUrls`
[Login enforcement](</docs/en/settings#available-settings>)| Restrict interactive login to a specific method or Anthropic organization. When set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren’t affected| `forceLoginMethod`, `forceLoginOrgUUID`
[Disable agent view](</docs/en/agent-view#how-background-sessions-are-hosted>)| Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor| `disableAgentView`
+[Configure the corporate launcher](</docs/en/corporate-launcher>)| Prefix the [background-agent supervisor](</docs/en/agent-view#how-background-sessions-are-hosted>), its workers, and the [other covered background processes](</docs/en/corporate-launcher#what-the-launcher-covers>) with a required corporate launcher instead of turning agent view off| `processWrapper`
[Model restrictions](</docs/en/model-config#restrict-model-selection>)| `availableModels` filters which models appear in the picker. Adding `enforceAvailableModels` also constrains the auto-selected default model. See [surface coverage](</docs/en/model-config#surface-coverage>) for how this setting reaches the CLI, web, and IDE| `availableModels`, `enforceAvailableModels`
[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`
--- a/advisor.md
+++ b/advisor.md
@@ -22,9 +22,9 @@
* **`advisorModel` setting**: configure a persistent default in your [settings file](</docs/en/settings>)
* **`--advisor` flag**: set the advisor for a single session at launch
-If any of these sets an advisor model, the advisor is enabled for sessions whose main model supports it. To stop using it, see Turn the advisor off.
+If any of these sets an advisor model, the advisor is enabled for sessions whose main model supports it, and an `Advisor Tool (experimental) is on and may use more tokens · /advisor` notification appears after the session starts. To stop using it, see Turn the advisor off.
-To use Fable 5 as the advisor, you need Claude Code v2.1.170 or later and [Fable 5 access](</docs/en/model-config#work-with-fable-5>) for your organization.
+Claude Code doesn’t offer Fable 5 as the advisor. For organizations with [Fable 5 access](</docs/en/model-config#work-with-fable-5>), the `/advisor` picker lists it as a dimmed, unselectable row labeled `Fable 5 (temporarily unavailable)`, and Claude Code rejects `/advisor fable` and `--advisor fable`. Fable 5 as the main model isn’t affected.A remotely configured rollout controls when Fable 5 returns as an advisor option.
###
@@ -36,7 +36,7 @@
/advisor opus
-Your selection is saved to `advisorModel` in your user settings and persists across sessions. If your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes the saved advisor model, the advisor is not invoked until you pick an allowed model with `/advisor`. If your current main model does not support the advisor, the selection is still saved and activates when you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>).
+The command confirms with `Advisor set to` followed by the advisor model name. Your selection is saved to `advisorModel` in your user settings and persists across sessions. If your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes the saved advisor model, the advisor is not invoked until you pick an allowed model with `/advisor`. If your current main model does not support the advisor, the selection is still saved and activates when you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>).
###
@@ -60,7 +60,7 @@
claude --advisor opus
-The flag takes precedence over the `advisorModel` setting for that session. It exits with an error if the session’s main model does not support the advisor, or if the requested advisor model is excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist.
+The flag takes precedence over the `advisorModel` setting for that session, and isn’t listed in `claude --help`. It exits with an error if the session’s main model does not support the advisor, or if the requested advisor model is excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist.
##
@@ -68,7 +68,7 @@
Choose an advisor model
-The advisor must be at least as capable as the main model. The accepted advisors for each main model are:
+The advisor must be at least as capable as the main model. Fable 5 satisfies the capability check but isn’t offered as the advisor, so the Fable entries in the following table apply once the rollout returns it as an option. The accepted advisors for each main model are:
Main model| Accepted advisors| Notes
---|---|---
@@ -77,9 +77,9 @@
Sonnet 5| Fable, Opus, Sonnet 5| A Sonnet 4.6 advisor is rejected
Opus 4.6| Fable, Opus, Sonnet 5| Sonnet 5 and Opus 4.6 are ranked as equally capable, so an Opus 4.6 main accepts a Sonnet 5 advisor
Opus 4.7 or later| Fable, Opus 4.7, Opus 4.8| Opus 4.7 and Opus 4.8 are ranked as equally capable, so either accepts the other 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 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`, `sonnet`, or `fable`. These aliases resolve to the latest version of each model. You can also pass a full model ID such as `claude-opus-4-8`. 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 the latest version of each model. You can also pass a full model ID such as `claude-opus-4-8`. 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.
@@ -90,7 +90,7 @@
Common model pairings
-Any accepted pairing works. These combinations balance cost against capability in different ways:
+Any accepted pairing works. Pairings that use Fable 5 as the advisor apply once Fable 5 returns as an advisor option. These combinations balance cost against capability in different ways:
Pairing| When to use
---|---
@@ -142,7 +142,7 @@
The advisor tool requires all of the following:
* **Anthropic API only** : the advisor is a server-executed tool. It is not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry. Through an [LLM gateway](</docs/en/llm-gateway>) configured with `ANTHROPIC_BASE_URL`, availability depends on whether the gateway forwards the request intact to the Anthropic API.
- * **Supported main model** : Opus 4.6 or later, Sonnet 4.6 or later, or Haiku 4.5. Fable 5 also qualifies on Claude Code v2.1.170 or later.
+ * **Supported main model** : Opus 4.6 or later, Sonnet 4.6 or later, or Haiku 4.5. Fable 5 also qualifies on Claude Code v2.1.170 or later, but a Fable 5 main accepts only a Fable advisor and Fable isn’t offered as the advisor, so a Fable 5 session runs without one until the rollout returns it as an option.
##
--- a/agent-loop.md
+++ b/agent-loop.md
@@ -50,7 +50,7 @@
* **`StreamEvent`:** only emitted when partial messages are enabled. Contains raw API streaming events (text deltas, tool input chunks). See [Stream responses](</docs/en/agent-sdk/streaming-output>).
* **`ResultMessage`:** marks the end of the agent loop. Contains the final text result, token usage, cost, and session ID. Check the `subtype` field to determine whether the task succeeded or hit a limit. A small number of trailing system events, such as `prompt_suggestion`, can arrive after it, so iterate the stream to completion rather than breaking on the result. See Handle the result.
-These five types cover the full agent loop lifecycle in both SDKs. The TypeScript SDK also yields additional observability events (hook events, tool progress, rate limits, task notifications) that provide extra detail but are not required to drive the loop. See the [Python message types reference](</docs/en/agent-sdk/python#message-types>) and [TypeScript message types reference](</docs/en/agent-sdk/typescript#message-types>) for the complete lists.
+These five types cover the full agent loop lifecycle. Both SDKs also yield observability events such as rate-limit status and task notifications that are not required to drive the loop. See the [Python message types reference](</docs/en/agent-sdk/python#message-types>) and [TypeScript message types reference](</docs/en/agent-sdk/typescript#message-types>) for the complete lists.
###
@@ -247,7 +247,7 @@
The context window
-The context window is the total amount of information available to Claude during a session. It does not reset between turns within a session. Everything accumulates: the system prompt, tool definitions, conversation history, tool inputs, and tool outputs. Content that stays the same across turns (system prompt, tool definitions, CLAUDE.md) is automatically [prompt cached](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>), which reduces cost and latency for repeated prefixes.
+The context window is the total amount of information available to Claude during a session. It does not reset between turns within a session. Everything accumulates: the system prompt, tool definitions, conversation history, tool inputs, and tool outputs. Content that stays the same across turns (system prompt, tool definitions, CLAUDE.md) is automatically [prompt cached](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>), which reduces cost and latency for repeated prefixes. For how a custom system prompt or `append` text affects cache reuse across sessions, see [Modifying system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>).
###
@@ -314,7 +314,7 @@
Sessions and continuity
-Each interaction with the SDK creates or continues a session. Capture the session ID from `ResultMessage.session_id` (available in both SDKs) to resume later. The TypeScript SDK also exposes it as a direct field on the init `SystemMessage`; in Python it’s nested in `SystemMessage.data`. When you resume, the full context from previous turns is restored: files that were read, analysis that was performed, and actions that were taken. You can also fork a session to branch into a different approach without modifying the original. See [Session management](</docs/en/agent-sdk/sessions>) for the full guide on resume, continue, and fork patterns.
+Each interaction with the SDK creates or continues a session. Capture the session ID from `ResultMessage.session_id` (available in both SDKs) to resume later. The TypeScript SDK also exposes it as a direct field on the init `SystemMessage`; in Python it’s nested in `SystemMessage.data`. When you resume, the full context from previous turns is restored: files that were read, analysis that was performed, and actions that were taken. You can also fork a session to branch into a different approach without modifying the original. See [Session management](</docs/en/agent-sdk/sessions>) for the full guide on resume, continue, and fork patterns. To resume sessions across stateless containers or serverless hosts, pass a [`session_store` / `sessionStore` adapter](</docs/en/agent-sdk/session-storage>) so transcripts are mirrored to your own backend and any host can resume them. The Claude Code subprocess still writes to local disk first; point `CLAUDE_CONFIG_DIR` at a temp directory in `options.env` if the local copy needs to be ephemeral.
In Python, `ClaudeSDKClient` handles session IDs automatically across multiple calls. See the [Python SDK reference](</docs/en/agent-sdk/python#choosing-between-query-and-claudesdkclient>) for details.
@@ -475,5 +475,6 @@
* **Building an interactive UI?** Enable [streaming](</docs/en/agent-sdk/streaming-output>) to show live text and tool calls as the loop runs.
* **Need tighter control over what the agent can do?** Lock down tool access with [permissions](</docs/en/agent-sdk/permissions>), and use [hooks](</docs/en/agent-sdk/hooks>) to audit, block, or transform tool calls before they execute.
* **Running long or expensive tasks?** Offload isolated work to [subagents](</docs/en/agent-sdk/subagents>) to keep your main context lean.
+ * **Deploying as a service?** See [Hosting the Agent SDK](</docs/en/agent-sdk/hosting>) for container and serverless guidance, and [Session storage](</docs/en/agent-sdk/session-storage>) to persist sessions to your own backend.
For the broader conceptual picture of the agentic loop (not SDK-specific), see [How Claude Code works](</docs/en/how-claude-code-works>). For a practical guide to designing loops in Claude Code, from turn-based to goal-based and proactive loops, see [Loop engineering: getting started with loops](<https://claude.com/blog/getting-started-with-loops>) on the blog.
--- a/agent-teams.md
+++ b/agent-teams.md
@@ -1,4 +1,4 @@
-Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior.
+Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior.
Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead.
@@ -65,7 +65,7 @@
their codebase. Spawn three teammates to explore this from different angles:
one on UX, one on technical architecture, one playing devil's advocate.
-From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel:
+From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. Claude may sometimes use [subagents](</docs/en/sub-agents>) instead of creating a team. Subagents appear in the same agent panel as teammates, so the panel alone doesn’t confirm a team formed. If Claude spawned subagents instead, ask again and explicitly request an agent team. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel:
* **Up and down arrows** : select a teammate
* **Enter** : open the selected teammate’s transcript and message it directly
@@ -104,7 +104,7 @@
claude --teammate-mode auto
-Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually:
+The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`. Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually:
* **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions.
* **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**.
@@ -226,7 +226,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 teammate’s name, agent ID, and agent type. 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 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.
###
Show diff (156 lines)
--- a/agent-view.md
+++ b/agent-view.md
@@ -50,9 +50,9 @@
Bring an existing session in
-This step needs a running session. If you followed the earlier steps you don’t have one open in this terminal, so open a regular `claude` session in another terminal and send it a message first. To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. The session keeps running and appears as a row alongside the ones you dispatched.
-
-You can use `claude agents` as your primary entry point instead of `claude`: dispatch every task from agent view, attach when you want the full conversation, and press `←` to return to the table. Inside a regular `claude` session, the prompt footer’s `←` hint counts the background agents that are waiting on you, such as `← 2 agents`, and returns to `← for agents` when none need input. Counts above 99 show as `99+`. The count refreshes about every ten seconds while the terminal is focused and immediately when focus returns. It briefly changes color when it moves and when an agent completes, unless the [`prefersReducedMotion` setting](</docs/en/settings#available-settings>) is on, and it is hidden in [screen reader mode](</docs/en/accessibility>). On [Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry](</docs/en/third-party-integrations>), the hint stays in its plain `← for agents` form without the count. Requires Claude Code v2.1.205 or later.
+This step needs a running session. If you followed the earlier steps you don’t have one open in this terminal, so open a regular `claude` session in another terminal and send it a message first.To move a session you already have open into agent view, run `/bg` inside it, or press `←` on an empty prompt to background it and open agent view in one step. In a fresh session with no messages yet, `/bg` asks you to send a message first, while `←` works right away. The session keeps running and appears as a row alongside the ones you dispatched.
+
+You can use `claude agents` as your primary entry point instead of `claude`: dispatch every task from agent view, attach when you want the full conversation, and press `←` to return to the table. Inside a regular `claude` session, the prompt footer’s `←` hint counts the background agents that are waiting on you, such as `← 2 agents`, and returns to `← for agents` when none need input. Counts above 99 show as `99+`. The count refreshes about every ten seconds while the terminal is focused and immediately when focus returns. It briefly changes color when it moves and when an agent completes, unless the [`prefersReducedMotion` setting](</docs/en/settings#available-settings>) is on, and it is hidden in [screen reader mode](</docs/en/accessibility>). Requires Claude Code v2.1.205 or later. The count appears on every provider, including [Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry](</docs/en/third-party-integrations>).
##
@@ -99,7 +99,7 @@
Idle| Dimmed| The session has nothing to do and is ready for your next prompt
Completed| Green| The task finished successfully
Failed| Red| The task ended with an error
-Stopped| Grey| The session was stopped with `Ctrl+X` or `claude stop`
+Stopped| Grey| The session was stopped with `Ctrl+X` or `claude stop`, or its process was ended from outside Claude Code
Separately, the icon’s shape shows whether the underlying process is running:
@@ -148,7 +148,7 @@
* A finished session: its result
* A working session: its full status sentence
-Any pull requests linked to the session are listed next. For a session that’s waiting on you, a line such as `waiting 3m` below them shows how long it has been waiting, and it’s the only time shown in the panel. The age at the right edge of the row is a different number: it counts from when the session started. Most of the time the peek panel is enough and you don’t need to open the full transcript. Before v2.1.207, every peek opened with the status sentence and a bare timestamp, and a blocked session’s question appeared below them prefixed with the same timestamp a second time. Type a reply in the peek panel and press `Enter` to send it to that session. When the session is asking a multiple-choice question, the peek panel shows the options and you can press a number key to pick one. For other blocked sessions, press `Tab` to fill the input with a suggested reply you can edit before sending. Prefix a reply with `!` to send a Bash command instead. A reply that can’t be delivered, because the background service is unreachable or the send fails, is saved and sent to the session as its next prompt when its process starts again, and the error message says the reply was saved. A reply prefixed with `!` isn’t saved, because the saved text would reach the session as a plain prompt rather than run as a Bash command. With [voice dictation](</docs/en/voice-dictation>) enabled, hold or tap your push-to-talk key while the reply input is focused to dictate a reply instead of typing it. The same works in the dispatch input at the bottom of agent view. Use `↑` and `↓` to peek at adjacent sessions without closing the panel, or `→` to attach.
+Any pull requests linked to the session are listed next. For a session that’s waiting on you, a line such as `waiting 3m` below them shows how long it has been waiting, and it’s the only time shown in the panel. The age at the right edge of the row is a different number: it counts from when the session started. Most of the time the peek panel is enough and you don’t need to open the full transcript. Before v2.1.207, every peek opened with the status sentence and a bare timestamp, and a blocked session’s question appeared below them prefixed with the same timestamp a second time. Type a reply in the peek panel and press `Enter` to send it to that session. When the session asks a question with predefined choices, the peek panel shows them as a numbered list and you can press a number key to pick one. A permission prompt shows as text describing what the session wants to run, without numbered options. Type a reply to answer it, or attach to answer with the standard prompt. For other blocked sessions, press `Tab` to fill the input with a suggested reply you can edit before sending. Prefix a reply with `!` to send a Bash command instead. A reply that can’t be delivered, because the background service is unreachable or the send fails, is saved and sent to the session as its next prompt when its process starts again, and the error message says the reply was saved. A reply prefixed with `!` isn’t saved, because the saved text would reach the session as a plain prompt rather than run as a Bash command. With [voice dictation](</docs/en/voice-dictation>) enabled, hold or tap your push-to-talk key while the reply input is focused to dictate a reply instead of typing it. The same works in the dispatch input at the bottom of agent view. Use `↑` and `↓` to peek at adjacent sessions without closing the panel, or `→` to attach.
###
@@ -156,7 +156,7 @@
Attach to a session
-Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. A background session refuses `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list, including its authentication actions, whether you’re attached or replying from the peek panel. The message directs you to a regular `claude` session, and `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` still work. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view. As of v2.1.198 this works the same way whether you opened the session from agent view or with `claude attach <id>` from your shell. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`. In a session running in the foreground, one you started in the terminal rather than attached to from agent view, pressing `←` on an empty prompt backgrounds it and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The same single press detaches an attached session. If a tool is running when you press `←`, Claude Code waits up to about ten seconds for it to finish before backgrounding, and the response continues in the background session. Press `←` again to background immediately instead of waiting. When in-flight work can’t carry over to the background session, the `Background this session?` dialog appears first, the same as with `/background`. The ten-second limit doesn’t apply while [subagents](</docs/en/sub-agents>) are running. Claude Code keeps waiting so their work carries over, and shows a `Still backgrounding after the current tool` notice while it waits; press `←` again to background without waiting, which restarts the subagents from the beginning. Before v2.1.203, the wait ended after ten seconds and the running subagents were restarted from the beginning without warning. The row is created even from a fresh session with no conversation history, so `→` returns to it. Before v2.1.203, agent view showed an onboarding hint below that row when it was the only one. You can turn this shortcut off with the `leftArrowOpensAgents` setting in `/config`.
+Press `Enter` or `→` on a selected row to attach. Agent view is replaced by the full interactive session. When you attach, Claude posts a short recap of what happened while you were away. While attached, the session behaves like any other Claude Code session: [commands](</docs/en/commands>), keyboard shortcuts, and features all work, with the exceptions below. A background session refuses `/install-github-app` and the [`/mcp`](</docs/en/mcp>) settings list, including its authentication actions, whether you’re attached or replying from the peek panel. The message directs you to a regular `claude` session, and `/mcp reconnect <server>`, `/mcp enable`, and `/mcp disable` still work. Attached sessions always render in [fullscreen mode](</docs/en/fullscreen>), regardless of your `tui` setting, because a background session has no terminal scrollback to append to. Scroll with `PgUp`, `PgDn`, or the mouse wheel, and press `Ctrl+O` for transcript mode. Your terminal’s native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application. Press `←` on an empty prompt, or run `/exit`, to detach and return to agent view. As of v2.1.198 this works the same way whether you opened the session from agent view or with `claude attach <id>` from your shell. `Ctrl+Z` also detaches but goes back to where you started instead: agent view if you attached from there, or your shell if you ran `claude attach`. Use `Ctrl+Z` when a dialog has focus and isn’t responding to `←`. `Ctrl+C` keeps its standard interrupt behavior while attached: it cancels a running response or `!` shell command rather than detaching. Pressing `Ctrl+C` twice on an empty prompt detaches, the same as in any session. Detaching never stops a background session: `←`, `Ctrl+Z`, `/exit`, and double `Ctrl+C` or double `Ctrl+D` all leave it running. To end a session from inside it, run `/stop`. In a session running in the foreground, one you started in the terminal rather than attached to from agent view, pressing `←` on an empty prompt backgrounds it and opens agent view with that row selected, so you can switch sessions without leaving the terminal. The same single press detaches an attached session. [Claude’s task list](</docs/en/interactive-mode#task-list>) moves to the background session with the conversation, so the checklist is intact when you return to that row. The row you pressed `←` from also keeps a bold, undimmed name after you move the selection with the arrow keys or the mouse, so you can tell which session you came from. If a tool is running when you press `←`, Claude Code waits up to about ten seconds for it to finish before backgrounding, and the response continues in the background session. Press `←` again to background immediately instead of waiting. When in-flight work can’t carry over to the background session, the `Background this session?` dialog appears first, the same as with `/background`. The ten-second limit doesn’t apply while [subagents](</docs/en/sub-agents>) are running. Claude Code keeps waiting so their work carries over, and shows a `Still backgrounding after the current tool` notice while it waits; press `←` again to background without waiting, which restarts the subagents from the beginning. Before v2.1.203, the wait ended after ten seconds and the running subagents were restarted from the beginning without warning. The row is created even from a fresh session with no conversation history, so `→` returns to it. Before v2.1.203, agent view showed an onboarding hint below that row when it was the only one. You can turn this shortcut off with the `leftArrowOpensAgents` setting in `/config`.
###
@@ -171,7 +171,7 @@
* Press `Ctrl+R` to rename a session
* Press `Enter` on a group header to collapse it
-To remove a session from the list, press `Ctrl+X` to stop it and `Ctrl+X` again within two seconds to delete it. Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Deleting removes the session from agent view. If Claude created a worktree for the session, deleting removes that worktree too, including any uncommitted changes in it, so commit work you want to keep first. A worktree you created yourself and started the session inside is left in place. The conversation transcript stays on your local machine and remains available through `claude --resume`. Deleting never removes a worktree with commits that aren’t pushed anywhere, or one that another running session claims or has locked. Claude Code keeps the worktree and the session, and the footer names the kept path and the reason. Push the commits, or close the other session, then delete again. Deleting also clears the session from the supervisor’s session list, whether you delete with `Ctrl+X` or with `claude rm` from the shell, so the removal persists across supervisor restarts. Before v2.1.206, removing a session while the supervisor was restarting or unreachable left it in that list, and the next supervisor restarted its process and showed the row again. Completed sessions that don’t fit on screen fold into a `… N more` row. Failures and sessions with an open pull request always stay visible. The `Completed` group fills the vertical space left after the live groups, and on a short terminal the header compacts to a single summary line so sessions that are working or need input stay visible.
+To remove a session from the list, press `Ctrl+X` to stop it and `Ctrl+X` again within two seconds to delete it. Pressing `Ctrl+X` on a group header deletes every session in that group after confirmation. Deleting removes the session from agent view. If Claude created a worktree for the session, deleting removes that worktree too, including any uncommitted changes in it, so commit work you want to keep first. A worktree you created yourself and started the session inside is left in place. The conversation transcript stays on your local machine and remains available through `claude --resume`. Deleting never removes a worktree with commits that aren’t pushed anywhere, or one that another running session claims or has locked. Claude Code keeps the worktree and the session, and the footer names the kept path and the reason. Push the commits, or close the other session, then delete again. When a delete is refused, the session’s row shows `not deleted` with the reason, and a worktree that couldn’t be removed is reported with the underlying git error. A worktree that git no longer recognizes, for example one removed from git’s records by `git worktree prune`, doesn’t block deletion: the session is deleted, the worktree directory is left untouched on disk, and the footer names its path. Before v2.1.211, a session whose worktree git no longer recognized could never be deleted: every attempt was refused without the underlying error, and the row reappeared with no notice. Deleting also clears the session from the supervisor’s session list, whether you delete with `Ctrl+X` or with `claude rm` from the shell, so the removal persists across supervisor restarts. Before v2.1.206, removing a session while the supervisor was restarting or unreachable left it in that list, and the next supervisor restarted its process and showed the row again. Completed sessions that don’t fit on screen fold into a `… N more` row. Failures and sessions with an open pull request always stay visible. The `Completed` group fills the vertical space left after the live groups, and on a short terminal the header compacts to a single summary line so sessions that are working or need input stay visible.
###
@@ -229,7 +229,7 @@
From agent view
-Type a prompt in the input at the bottom of agent view and press `Enter` to start a new background session. The session is named automatically from the prompt; rename it later with `Ctrl+R`. A name the session gets later also appears on its row, including the name Claude derives when you [accept a plan](</docs/en/permission-modes#review-and-approve-a-plan>) in that session. Before v2.1.207, a background session named by accepting a plan showed that name in `/status` but not on its agent-view row until you renamed it yourself. Paste an image into the prompt to include a screenshot or diagram with the task. Pasted text longer than 800 characters or more than two lines collapses to a `[Pasted text #N]` placeholder so the input stays on one line; the full text is sent when you dispatch. To review or edit the collapsed text before dispatching, paste the same text again and the placeholder expands back into the input. A `paste again to expand` reminder appears below the input for a few seconds after the paste on terminals at least 90 columns wide. Before v2.1.207, pasting the same text again added a second placeholder instead of expanding the first. Prefix or mention parts of the prompt to control how the session starts:
+Type a prompt in the input at the bottom of agent view and press `Enter` to start a new background session. The session is named automatically from the prompt; rename it later with `Ctrl+R`. The automatic name is a short label written by a [Haiku-class model](</docs/en/model-config>). When the model’s reply answers or refuses the prompt instead of labeling it, which a prompt that’s mostly a link can provoke, Claude Code discards the reply, keeps a name taken from the prompt text on the row, and retries the naming later. Before v2.1.211, Claude Code could save such a reply as the session’s name, so a row could show a refusal such as `i don't have access to…` as its title. A name the session gets later also appears on its row, including the name Claude derives when you [accept a plan](</docs/en/permission-modes#review-and-approve-a-plan>) in that session. Before v2.1.207, a background session named by accepting a plan showed that name in `/status` but not on its agent-view row until you renamed it yourself. Paste an image into the prompt to include a screenshot or diagram with the task. Pasted text longer than 800 characters or more than two lines collapses to a `[Pasted text #N]` placeholder so the input stays on one line; the full text is sent when you dispatch. To review or edit the collapsed text before dispatching, paste the same text again and the placeholder expands back into the input. A `paste again to expand` reminder appears below the input for a few seconds after the paste on terminals at least 90 columns wide. Before v2.1.207, pasting the same text again added a second placeholder instead of expanding the first. Prefix or mention parts of the prompt to control how the session starts:
Input| Effect
---|---
@@ -295,11 +295,11 @@
claude --bg "investigate the flaky SettingsChangeDetector test"
-The prompt is the positional argument, not a `-p` value. As of v2.1.198, combining `--bg` with `-p` or `--print` is rejected with an error before any session is created, because `--print` never starts the interactive session that `claude agents` attaches to. To run a specific subagent as the session’s main agent, combine `--bg` with `--agent`:
+The prompt is the positional argument, not a `-p` value. As of v2.1.198, combining `--bg` with `-p` or `--print` is rejected with an error before any session is created, because `--print` never starts the interactive session that `claude agents` attaches to. To run a specific [subagent](</docs/en/sub-agents>) you have defined, such as a `code-reviewer`, as the session’s main agent, combine `--bg` with `--agent`:
claude --agent code-reviewer --bg "address review comments on PR 1234"
-Pass `--name` to set the session’s display name in agent view instead of the auto-generated one:
+If the name doesn’t match any of your subagents, Claude Code prints a stderr warning, `warning: no agent named '<name>' — spawning with default template`, and runs the session with the default agent. Pass `--name` to set the session’s display name in agent view instead of the auto-generated one:
claude --bg --name "flaky-test-fix" "investigate the flaky SettingsChangeDetector test"
@@ -385,7 +385,7 @@
claude agents --permission-mode plan --model opus --effort high
-`--agent` sets the [subagent](</docs/en/sub-agents>) used when a dispatch prompt doesn’t name one, either with `@name` or as the first word. It defaults to the [`agent` setting](</docs/en/settings#available-settings>) if one is set, otherwise the built-in catch-all `claude` agent. Naming a subagent in the dispatch input overrides both. `claude agents` also accepts `--dangerously-skip-permissions` as shorthand for `--permission-mode bypassPermissions`, and `--allow-dangerously-skip-permissions` to make `bypassPermissions` available in each dispatched session’s `Shift+Tab` cycle without starting in that mode. Both match the [top-level CLI flags](</docs/en/cli-reference>). The active defaults appear in the footer below the dispatch input. Without these flags, the session uses the `defaultMode` from that directory’s settings or the `permissionMode` from the dispatched [subagent’s frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>), and the model shown in the agent view header. Using `bypassPermissions` with `claude --bg --permission-mode` is refused until you have accepted the bypass disclaimer by running `claude --dangerously-skip-permissions` once interactively, since that mode lets a session you aren’t watching act without approval. Passing `--dangerously-skip-permissions` or `--permission-mode bypassPermissions` to `claude agents` shows the same disclaimer when you haven’t accepted it before, and accepting applies `bypassPermissions` to the sessions you launch from the view. Passing `--allow-dangerously-skip-permissions` shows the same disclaimer too, and accepting makes `bypassPermissions` available in the `Shift+Tab` cycle of those sessions without starting them in it.
+`--effort` here accepts the same values as the [top-level `--effort` flag](</docs/en/cli-reference#cli-flags>), including `ultracode`. `--agent` sets the [subagent](</docs/en/sub-agents>) used when a dispatch prompt doesn’t name one, either with `@name` or as the first word. It defaults to the [`agent` setting](</docs/en/settings#available-settings>) if one is set, otherwise the built-in catch-all `claude` agent. Naming a subagent in the dispatch input overrides both. `claude agents` also accepts `--dangerously-skip-permissions` as shorthand for `--permission-mode bypassPermissions`, and `--allow-dangerously-skip-permissions` to make `bypassPermissions` available in each dispatched session’s `Shift+Tab` cycle without starting in that mode. Both match the [top-level CLI flags](</docs/en/cli-reference>). The active defaults appear in the footer below the dispatch input. Without these flags, the session uses the `defaultMode` from that directory’s settings or the `permissionMode` from the dispatched [subagent’s frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>), and the model shown in the agent view header. Using `bypassPermissions` with `claude --bg --permission-mode` is refused until you have accepted the bypass disclaimer by running `claude --dangerously-skip-permissions` once interactively, since that mode lets a session you aren’t watching act without approval. Passing `--dangerously-skip-permissions` or `--permission-mode bypassPermissions` to `claude agents` shows the same disclaimer when you haven’t accepted it before, and accepting applies `bypassPermissions` to the sessions you launch from the view. Passing `--allow-dangerously-skip-permissions` shows the same disclaimer too, and accepting makes `bypassPermissions` available in the `Shift+Tab` cycle of those sessions without starting them in it.
###
@@ -406,6 +406,8 @@
Repeat `--add-dir`, `--plugin-dir`, or `--mcp-config` once per value. The space-separated form, such as `--add-dir a b c`, isn’t supported with `claude agents`. The following example opens agent view with a settings override and one extra directory:
claude agents --settings ./ci-settings.json --add-dir ../shared-lib
+
+`--settings` accepts a file path or an inline JSON string. A file path must point to an existing file; Claude Code exits with a `Settings file not found` error if it doesn’t.
##
@@ -425,7 +427,7 @@
`claude stop <id>`| Stop a session. Also accepts `claude kill`
`claude respawn <id>`| Restart a session, running or stopped, with its conversation intact, e.g. to pick up an updated Claude Code binary
`claude respawn --all`| Restart every running session, e.g. to move all sessions onto an updated Claude Code binary at once
-`claude rm <id>`| Remove a session from the list. Removes a worktree Claude created for the session if it has no uncommitted changes and no commits that aren’t pushed anywhere; otherwise the session is kept too, and the command prints the worktree path and the reason so you can resolve it and run `claude rm` again. Leaves a worktree you created yourself in place. The conversation transcript stays on your local machine and remains available through `claude --resume`
+`claude rm <id>`| Remove a session from the list. Removes a worktree Claude created for the session if it has no uncommitted changes and no commits that aren’t pushed anywhere; otherwise the session is kept too, and the command prints the worktree path and the reason so you can resolve it and run `claude rm` again. A worktree git no longer recognizes doesn’t block removal: the session is removed and the directory is left on disk, with its path printed. Leaves a worktree you created yourself in place. The conversation transcript stays on your local machine and remains available through `claude --resume`
`claude daemon status`| Print the supervisor’s state, version, socket directory, and worker count
`claude daemon stop --any`| Stop the supervisor process and the background sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. The next `claude agents` or `claude --bg` starts a fresh supervisor
@@ -443,13 +445,19 @@
The supervisor process
-Background sessions are hosted by a per-user supervisor process, separate from your terminal and from agent view. The supervisor starts automatically the first time you background a session or open agent view, and you don’t manage it directly. When an update has replaced or removed the binary a running Claude Code process was launched from, that process starts the supervisor from another installed copy, such as the installed `claude` launcher or the newest version on disk. The supervisor keeps one pre-warmed worker process ready so a dispatch from agent view or `claude --bg` starts without the delay of a cold launch. When you dispatch, the supervisor assigns the pre-warmed worker to your session, applies that session’s directory, settings, and credentials to it, and then starts a replacement for the next dispatch. If no healthy pre-warmed worker is available, the supervisor launches a fresh process instead. The supervisor and its sessions authenticate with the same stored credentials as your interactive sessions and make no additional network connections beyond the model API. Provider selection variables such as `CLAUDE_CODE_USE_BEDROCK` and `ANTHROPIC_DEFAULT_*_MODEL` aliases are read from the shell that dispatched each session and are applied to its worker. The dispatching shell’s `PATH` is applied to the worker the same way, so shell commands the session runs find the same tools your terminal does. Before v2.1.203, a background session kept the `PATH` of the shell that first started the supervisor, so tools added to your `PATH` since then could be missing, most often on Windows. A background session doesn’t inherit gateway endpoint variables such as `ANTHROPIC_BASE_URL` or the equivalent Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry base URL variables from the shell that started the supervisor. Without a gateway exported in the shell you dispatch from, the session uses your stored credentials and any `env` values in the project directory’s [settings](</docs/en/settings>). To point every session in a project at an [LLM gateway](</docs/en/llm-gateway>), set `ANTHROPIC_BASE_URL` in that project’s `.claude/settings.json` `env` block. If you export a gateway `ANTHROPIC_BASE_URL` in the shell you dispatch from, it reaches that session’s worker. `ANTHROPIC_CUSTOM_HEADERS` and the credential exported alongside them are forwarded with it. This happens when the supervisor was started from an environment with the same gateway. The supervisor captures its environment from the first shell that opens agent view or dispatches a background session, so starting from the gateway shell gives it that environment. The forward also applies only to sessions dispatched into the directory you’re dispatching from, or backgrounded from your own session with `←` or `/background`: dispatching into a different directory with `@repo` or `--cwd` doesn’t carry the shell’s gateway, and that project’s `settings.json` `env` block supplies the endpoint instead. When the supervisor’s environment carries a different gateway or none, the worker keeps your stored credentials against the default endpoint instead of mixing one environment’s credential with another’s endpoint. Before v2.1.203, the dispatching shell’s `ANTHROPIC_BASE_URL` was dropped while the `ANTHROPIC_API_KEY` exported alongside it was kept, so the gateway’s key was sent to the default endpoint and every request failed with a 401. The forwarded endpoint applies only to that live process and is never written to disk. When the supervisor stops an idle session and later restarts it, the restarted process reads its endpoint from your settings again: with a gateway `ANTHROPIC_AUTH_TOKEN` it falls back to your stored credentials, and with a gateway-issued `ANTHROPIC_API_KEY` it can fail to authenticate until the gateway is set in settings. Each background session is its own Claude Code process, managed by the supervisor rather than tied to your terminal. A session that’s actively working, waiting for your input, or has a terminal attached keeps its process running. A running background shell command, subagent, dynamic workflow, or monitor counts as active work, so a long-running process such as a dev server keeps the session alive. Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. A session you have pinned with `Ctrl+T` is exempt and keeps its process running while idle. The transcript and state stay on disk either way, and the next time you attach, peek, or reply to a stopped session, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you need it. Background work the session itself started at the top level is handed off when its process is stopped, restarted, or updated, including on Windows. The next process started for that session picks the work back up:
+Background sessions are hosted by a per-user supervisor process, separate from your terminal and from agent view. The supervisor starts automatically the first time you background a session or open agent view, and you don’t manage it directly. When an update has replaced or removed the binary a running Claude Code process was launched from, that process starts the supervisor from another installed copy, such as the installed `claude` launcher or the newest version on disk. The supervisor keeps one pre-warmed worker process ready so a dispatch from agent view or `claude --bg` starts without the delay of a cold launch. When you dispatch, the supervisor assigns the pre-warmed worker to your session, applies that session’s directory, settings, and credentials to it, and then starts a replacement for the next dispatch. If no healthy pre-warmed worker is available, the supervisor launches a fresh process instead. The supervisor and its sessions authenticate with the same stored credentials as your interactive sessions and make no additional network connections beyond the model API. Provider selection variables such as `CLAUDE_CODE_USE_BEDROCK` and `ANTHROPIC_DEFAULT_*_MODEL` aliases are read from the shell that dispatched each session and are applied to its worker. The dispatching shell’s `PATH` is applied to the worker the same way, so shell commands the session runs find the same tools your terminal does. Before v2.1.203, a background session kept the `PATH` of the shell that first started the supervisor, so tools added to your `PATH` since then could be missing, most often on Windows. A background session doesn’t inherit gateway endpoint variables such as `ANTHROPIC_BASE_URL` or the equivalent Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry base URL variables from the shell that started the supervisor. Without a gateway exported in the shell you dispatch from, the session uses your stored credentials and any `env` values in the project directory’s [settings](</docs/en/settings>). To point every session in a project at an [LLM gateway](</docs/en/llm-gateway>), set `ANTHROPIC_BASE_URL` in that project’s `.claude/settings.json` `env` block. If you export a gateway `ANTHROPIC_BASE_URL` in the shell you dispatch from, it reaches that session’s worker. `ANTHROPIC_CUSTOM_HEADERS` and the credential exported alongside them are forwarded with it. This happens when the supervisor was started from an environment with the same gateway. The supervisor captures its environment from the first shell that opens agent view or dispatches a background session, so starting from the gateway shell gives it that environment. The forward also applies only to sessions dispatched into the directory you’re dispatching from, or backgrounded from your own session with `←` or `/background`: dispatching into a different directory with `@repo` or `--cwd` doesn’t carry the shell’s gateway, and that project’s `settings.json` `env` block supplies the endpoint instead. When the supervisor’s environment carries a different gateway or none, the worker keeps your stored credentials against the default endpoint instead of mixing one environment’s credential with another’s endpoint. Before v2.1.203, the dispatching shell’s `ANTHROPIC_BASE_URL` was dropped while the `ANTHROPIC_API_KEY` exported alongside it was kept, so the gateway’s key was sent to the default endpoint and every request failed with a 401. The forwarded endpoint applies only to that live process and is never written to disk. When the supervisor stops an idle session and you later wake it by attaching, peeking, or replying, your environment’s gateway is forwarded again under the same conditions as a fresh dispatch: the session runs in the directory you wake it from and the supervisor shares that gateway environment. Waking a session from a shell without the gateway restarts it against your settings and stored credentials instead. Before v2.1.211, a wake never carried the gateway: a session authenticated through a gateway `ANTHROPIC_AUTH_TOKEN` restarted onto your stored credentials, or reported `Not logged in` when there were none, and a gateway-issued `ANTHROPIC_API_KEY` could fail to authenticate until the gateway was set in settings. Each background session is its own Claude Code process, managed by the supervisor rather than tied to your terminal. A session that’s actively working, waiting for your input, or has a terminal attached keeps its process running. A running background shell command, subagent, dynamic workflow, or monitor counts as active work, so a long-running process such as a dev server keeps the session alive. Once a session finishes and sits unattached for about an hour, the supervisor stops its process to free resources. A session you have pinned with `Ctrl+T` is exempt and keeps its process running while idle. The transcript and state stay on disk either way, and the next time you attach, peek, or reply to a stopped session, the supervisor starts a fresh process from where it left off. When every session has finished and no terminal is connected, the supervisor itself exits and starts again the next time you need it. The supervisor also restarts a session whose process exits unexpectedly, with three safeguards so a restart never overrides a stop or acts on stale input:
+
+ * A session whose state on disk already shows it as done, failed, or stopped isn’t restarted, unless a reply you sent is still waiting to be delivered.
+ * Ending the process of a session you backgrounded with `←` or `/background` yourself, for example with `kill`, marks the session stopped instead of restarting it. A session dispatched with a task, from the agent view input or `claude --bg`, is still restarted so the dispatched work completes.
+ * A session the supervisor restarts is told it was restarted and that you haven’t sent a new message since, so it can re-verify time-sensitive context such as branch state before continuing. A restarted `←` or `/background` session also doesn’t resume an interrupted response older than about an hour; it waits for your next message instead.
+
+Before v2.1.211, the supervisor treated an externally ended process as a crash and restarted the session, and a restarted session could resume a stale interrupted response inherited from the conversation it was backgrounded from. Background work the session itself started at the top level is handed off when its process is stopped, restarted, or updated, including on Windows. The next process started for that session picks the work back up:
* A background shell command that finished in the meantime is reported as completed with its output
* A dynamic workflow resumes from where it left off
* A [background subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) resumes from its own transcript
-As of v2.1.198 the handoff covers all three. Before v2.1.198 it covered only shell commands and workflows, so a background subagent stopped with the process and was reported as failed on the next wake. Work whose state lives only inside the process itself stops with it instead of being handed off. That’s shell commands a subagent started, which the resumed subagent can start again, and running [monitors](</docs/en/tools-reference#monitor-tool>), whose event stream can’t be moved to another process. Deleting the session stops everything it handed off. To stop all of the session’s background work with the process instead of handing it off, set the [`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`](</docs/en/env-vars#variables>) environment variable to `1`. A restarted process finds the conversation of a session that moved into a worktree mid-task: when the transcript isn’t where the session started, Claude Code also looks under the repository’s registered worktrees. Before v2.1.207, reopening that session from agent view after its process had stopped could show an empty conversation with only its original prompt, with the transcript still intact on disk; opening the session again on v2.1.207 or later recovers it. If a restarted session comes back showing only its original prompt because Claude Code misread its transcript as empty, the conversation transcript is renamed with an `.orphaned-` suffix instead of deleted, so it stays on your machine. An empty row left over from pressing `←` that was never given a prompt is removed entirely after about five minutes so the list clears on its own. Sessions started with `claude --bg` and sessions waiting on a setup prompt such as a trust dialog aren’t removed this way. When the host runs low on memory, the supervisor stops idle non-pinned sessions first and stops idle pinned ones only if that freed nothing. The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](</docs/en/setup#auto-updates>) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them. An idle pinned session is also restarted in place onto the new version so it picks up the update without you reattaching. Once the new supervisor takes over, it also restarts the remaining idle sessions onto the new version, a few at a time in the background, after a short delay that lets terminals attached across the restart reconnect first. A session that is working, waiting on your input, or has a terminal attached isn’t interrupted; it moves to the new version the next time its process restarts. Before v2.1.206, the supervisor moved only a few idle sessions per minute onto a new version, so sessions could keep running the old one for a while after an update. These restarts only ever move a session onto a newer version. A supervisor running an older Claude Code version than the one a session’s process was started with leaves that process alone; the session keeps running the newer version until a newer supervisor takes over. Running `claude attach` while the supervisor is restarting a session, whether for an update, a stall, or a migration, waits for the replacement process instead of failing. A status line such as `Agent is updating to the new Claude Code…` names what it’s waiting for and counts the elapsed seconds, and the command connects as soon as the session is ready. After about 60 seconds it stops waiting and reports an error. Before v2.1.205, `claude attach` stopped retrying after a few seconds and printed an error while the session was still restarting.
+As of v2.1.198 the handoff covers all three. Before v2.1.198 it covered only shell commands and workflows, so a background subagent stopped with the process and was reported as failed on the next wake. Work whose state lives only inside the process itself stops with it instead of being handed off. That’s shell commands a subagent started, which the resumed subagent can start again, and running [monitors](</docs/en/tools-reference#monitor-tool>), whose event stream can’t be moved to another process. Deleting the session stops everything it handed off. To stop all of the session’s background work with the process instead of handing it off, set the [`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`](</docs/en/env-vars#variables>) environment variable to `1`. A restarted process finds the conversation of a session that moved into a worktree mid-task: when the transcript isn’t where the session started, Claude Code also looks under the repository’s registered worktrees. Before v2.1.207, reopening that session from agent view after its process had stopped could show an empty conversation with only its original prompt, with the transcript still intact on disk; opening the session again on v2.1.207 or later recovers it. If a restarted session comes back showing only its original prompt because Claude Code misread its transcript as empty, the conversation transcript is renamed with an `.orphaned-` suffix instead of deleted, so it stays on your machine. An empty row left over from pressing `←` that was never given a prompt is removed entirely after about five minutes so the list clears on its own. Sessions started with `claude --bg` and sessions waiting on a setup prompt such as a trust dialog aren’t removed this way. When the host runs low on memory, the supervisor stops idle non-pinned sessions first and stops idle pinned ones only if that freed nothing. The supervisor watches the installed Claude Code binary on disk and restarts into the new version after the regular [auto-updater](</docs/en/setup#auto-updates>) replaces it. This is a local file watch, not a network check. Background sessions are detached processes, so they keep running through the restart and the new supervisor reconnects to them. An idle pinned session is also restarted in place onto the new version so it picks up the update without you reattaching. Once the new supervisor takes over, it also restarts the remaining idle sessions onto the new version, a few at a time in the background, after a short delay that lets terminals attached across the restart reconnect first. A session that is working, waiting on your input, or has a terminal attached isn’t interrupted; it moves to the new version the next time its process restarts. Before v2.1.206, the supervisor moved only a few idle sessions per minute onto a new version, so sessions could keep running the old one for a while after an update. These restarts only ever move a session onto a newer version. A supervisor running an older Claude Code version than the one a session’s process was started with leaves that process alone; the session keeps running the newer version until a newer supervisor takes over. Running `claude attach` while the supervisor is restarting a session, whether for an update, a stall, or a migration, waits for the replacement process instead of failing. A status line such as `Agent is updating to the new Claude Code…` names what it’s waiting for and counts the elapsed seconds, and the command connects as soon as the session is ready. After about 60 seconds it stops waiting and reports an error. Before v2.1.205, `claude attach` stopped retrying after a few seconds and printed an error while the session was still restarting. `claude attach` also waits while the background service itself is starting or reconnecting, and a session that finished during that wait is reported as exited rather than as an error. A terminal resize you make during a slow attach is applied when the attach completes.
###
@@ -534,6 +542,14 @@
+Opening a session says it has no saved transcript
+
+Opening a stopped session that was backgrounded from another conversation and stopped before its first response finished shows `This session has no saved transcript` instead of starting the session. Until that first response finishes, the conversation still lives only in the session it was backgrounded from, so there’s nothing for the stopped row to resume. The original conversation is intact; resume it with `claude --resume` or keep working in it. To start the row’s session fresh anyway, run `claude respawn <id>`. Before v2.1.211, opening the row silently started a blank conversation under the same session id. See the [error reference](</docs/en/errors#this-session-has-no-saved-transcript>) for details.
+
+###
+
+
+
A session fails before starting with a `possibly low memory` note
As of v2.1.199, when a background session’s process exits before it finishes starting and the host is low on memory, the row’s status names the exit and adds `possibly low memory — free some up and retry`. Earlier versions showed only the bare exit reason for this failure. The note is a hypothesis, not a confirmed cause. Claude Code adds it only when the process exited silently, without writing an error and without being stopped by a signal, and the host reported low memory at that moment. When the process did write an error before exiting, the row shows that error instead. Free up memory on the machine, then attach, peek, or reply to the row and the supervisor starts a fresh process for the session. When memory stays low, the supervisor also stops idle sessions to free resources on its own.
@@ -592,7 +608,7 @@
`.claude/worktrees/` is filling up
-Deleting a session in agent view removes the worktree Claude created for it, and a worktree that can’t be removed safely keeps its session row so it isn’t orphaned. `claude rm` keeps a worktree that has uncommitted changes, and its session row, and prints the kept path. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. See [Clean up worktrees](</docs/en/worktrees#clean-up-worktrees>).
+Deleting a session in agent view removes the worktree Claude created for it, and a worktree that can’t be removed safely keeps its session row so it isn’t orphaned. A worktree directory that git no longer recognizes is left on disk when its session is deleted, so remove leftover directories you don’t need by hand. `claude rm` keeps a worktree that has uncommitted changes, and its session row, and prints the kept path. List leftover entries with `git worktree list` in the project directory and remove each with `git worktree remove <path>`. See [Clean up worktrees](</docs/en/worktrees#clean-up-worktrees>).
##
@@ -628,6 +644,8 @@
Version| Change
---|---
+v2.1.211| Waking a stopped session by attaching, peeking, or replying from the directory it runs in forwards your shell’s gateway `ANTHROPIC_BASE_URL` again, under the same conditions as a fresh dispatch, so a session authenticated through a gateway `ANTHROPIC_AUTH_TOKEN` resumes on the gateway instead of reporting `Not logged in`. Opening a stopped session that was backgrounded from another conversation before its first response finished is refused with `This session has no saved transcript` instead of silently starting a blank conversation under the same session id. Ending the process of a `←` or `/background` session from outside Claude Code marks it stopped instead of the supervisor restarting it, a stop already recorded on disk is honored unless a reply you sent is still waiting to be delivered, a session restarted after a crash is told it was restarted, and a restarted `←` or `/background` session doesn’t resume an interrupted response older than about an hour. A session-naming reply that answers or refuses the prompt instead of labeling it, such as for a prompt that’s mostly a link, is discarded and the row keeps a name taken from the prompt text. Deleting a session whose worktree git no longer recognizes succeeds, leaving the worktree directory on disk and naming its path, instead of every attempt being refused. A refused delete shows the reason on the session’s row, including the underlying git error when the worktree couldn’t be removed, instead of the row silently reappearing.
+v2.1.210| `claude attach` waits while the background service is starting or reconnecting instead of failing with a `job not found` or `still starting` error, reports a session that finished during the attach as exited, and applies a terminal resize made during a slow attach when the attach completes. The prompt footer’s `←` needs-input count appears on every provider, including third-party providers that previously showed the plain `← for agents` form. Backgrounding a session with `←` carries Claude’s task list to the background session instead of dropping it. The row you pressed `←` from keeps a bold, undimmed name after the selection moves. `claude agents --effort` accepts `ultracode` instead of silently dropping it.
v2.1.208| Attaching to a session whose process has stopped shows the last screenful of its transcript while the process starts, instead of only a `Session is starting` note. A reply that can’t be delivered because the background service is unreachable or the send fails is saved and sent as the session’s next prompt when its process starts again; before this release, a reply lost while the background service was unreachable was discarded. A process whose own binary was replaced by an update can still start the supervisor, from the installed `claude` launcher or the newest version on disk, instead of failing until Claude Code was restarted. A supervisor running an older version never restarts an idle session started by a newer version onto its own older binary. Deleting a session removes its worktree even after the session moved the worktree onto a different branch, and keeps the worktree together with the session row when the worktree has commits that aren’t pushed anywhere or another session claims it, instead of destroying the commits or orphaning the worktree. `/install-github-app` and the `/mcp` settings list and its authentication actions are refused in a background session with a message naming the alternative; in v2.1.208 only, the `/model` picker was refused the same way and a typed `/model <name>` switched that session only instead of also saving your default model.
v2.1.207| The peek panel opens with the sentence the row truncates, such as the exact question for a session that’s waiting on you, and shows how long a blocked session has been waiting as a single `waiting 3m` line instead of prefixing the same timestamp to the status sentence and the question. Pasting the same text again in the dispatch input expands the collapsed `[Pasted text #N]` placeholder instead of adding a second one. A background session named by accepting a plan shows that name on its row. A background session that moved into a worktree keeps its conversation when its process is restarted from agent view.
v2.1.206| Row summaries fill the row’s remaining width and truncate only at the terminal’s right edge instead of at 64 columns. After the supervisor restarts into a new Claude Code version, it restarts the remaining idle background sessions onto that version in the background instead of a few per minute. Deleting a session with `Ctrl+X` or `claude rm` also clears it from the supervisor’s session list, so the row no longer reappears after a supervisor restart.
--- a/amazon-bedrock.md
+++ b/amazon-bedrock.md
@@ -31,7 +31,7 @@
Start Claude Code and choose Amazon Bedrock
-Run `claude`. At the login prompt, select **3rd-party platform** , then **Amazon Bedrock**.
+Run `claude`. At the login prompt, select **3rd-party platform** , then **Amazon Bedrock**. If you’re already signed in and see the chat prompt instead, run `/setup-bedrock` to open the wizard. The command works when typed even though it isn’t listed in the command menu until Bedrock is configured.
3
@@ -209,10 +209,10 @@
export ANTHROPIC_MODEL='arn:aws:bedrock:us-east-2:your-account-id:application-inference-profile/your-model-id'
# Optional: Disable prompt caching if needed
- export DISABLE_PROMPT_CACHING=1
+ # export DISABLE_PROMPT_CACHING=1
# Optional: Request 1-hour prompt cache TTL instead of the 5-minute default
- export ENABLE_PROMPT_CACHING_1H=1
+ # export ENABLE_PROMPT_CACHING_1H=1
The 1-hour cache TTL is billed at a higher rate than the 5-minute default. See [cache lifetime](</docs/en/prompt-caching#cache-lifetime>).
@@ -243,7 +243,9 @@
Startup model checks
-When Claude Code starts with Amazon Bedrock configured, it verifies that the models it intends to use are accessible in your account. If you have pinned a model version that is older than the current Claude Code default, and your account can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. Pins that point to an application inference profile ARN are skipped, since those are managed by your administrator. If you have not pinned a model and the current default is unavailable in your account, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in your Amazon Bedrock account or pin a version to make the choice permanent.
+When Claude Code starts with Amazon Bedrock configured, it verifies that the models it intends to use are accessible in your account. If you have pinned a model version that is older than the current Claude Code default, and your account can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. Pins that point to an application inference profile ARN are skipped, since those are managed by your administrator. If you have not pinned a model and the current default is unavailable in your account, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in your Amazon Bedrock account or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize, such as an application inference profile ARN.
+
+Before v2.1.211, Claude Code checked the default model’s availability even when a session model was explicitly configured, and could show a fallback notice for a default the session didn’t use.
##
@@ -469,5 +471,5 @@
* [Amazon Bedrock pricing](<https://aws.amazon.com/bedrock/pricing/>)
* [Amazon Bedrock inference profiles](<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html>)
* [Amazon Bedrock token burndown and quotas](<https://docs.aws.amazon.com/bedrock/latest/userguide/quotas-token-burndown.html>)
- * [Claude Code on Amazon Bedrock: Quick Setup Guide](<https://community.aws/content/2tXkZKrZzlrlu0KfH8gST5Dkppq/claude-code-on-amazon-bedrock-quick-setup-guide>)
+ * [Claude Code on Amazon Bedrock: Quick Setup Guide](<https://builder.aws.com/content/2tXkZKrZzlrlu0KfH8gST5Dkppq/claude-code-on-amazon-bedrock-quick-setup-guide>)
* [Claude Code Monitoring Implementation (Amazon Bedrock)](<https://github.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/blob/main/assets/docs/MONITORING.md>)
--- a/artifacts.md
+++ b/artifacts.md
@@ -176,7 +176,7 @@
Improve the visual design
-As of Claude Code v2.1.183, Claude applies a built-in design skill when it builds an artifact, so pages get a deliberate palette, typography, and layout without extra prompting. That skill also looks for an existing design system in your project before choosing its own. To keep artifacts consistent with your product’s branding, record your design tokens where Claude can find them, such as the project’s [CLAUDE.md](</docs/en/memory>) or a theme file in your repository:
+Claude applies a built-in design skill when it builds an artifact, so pages get a deliberate palette, typography, and layout without extra prompting. Requires Claude Code v2.1.182 or later. That skill also looks for an existing design system in your project before choosing its own. Design tokens are the named color, typography, and spacing values your design system reuses. To keep artifacts consistent with your product’s branding, record them where Claude can find them, such as the project’s [CLAUDE.md](</docs/en/memory>) or a theme file in your repository:
## Design system
--- a/authentication.md
+++ b/authentication.md
@@ -14,7 +14,7 @@
* **Cloud providers** : if your organization uses [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>), set the required environment variables before running `claude`, or select **3rd-party platform** at the login prompt, which launches an interactive setup wizard for Bedrock and Vertex AI. No browser login is needed.
* **Cloud gateway** : if your organization runs a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>), sign in with corporate SSO through `/login`. The gateway-issued token is the session’s only credential.
-Admins can restrict interactive login with the [`forceLoginMethod` and `forceLoginOrgUUID`](</docs/en/settings#available-settings>) managed settings. When either is set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren’t affected. To log out and re-authenticate, type `/logout` at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run `claude` it walks you through login and setup again. If you’re having trouble logging in, see [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>).
+Admins can restrict which login methods and organizations are accepted; see Restrict login to your organization. To log out and re-authenticate, type `/logout` at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run `claude` it walks you through login and setup again. If you’re having trouble logging in, see [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>).
##
@@ -128,6 +128,14 @@
Install Claude Code
Users can [install Claude Code](</docs/en/setup#install-claude-code>).
+
+###
+
+
+
+Restrict login to your organization
+
+To require that developer sessions authenticate into a specific Anthropic organization, set [`forceLoginMethod` and `forceLoginOrgUUID`](</docs/en/settings#available-settings>) in [managed settings](</docs/en/settings#settings-files>). Set `forceLoginOrgUUID` to your organization ID, shown in [claude.ai admin settings](<https://claude.ai/admin-settings/organization>) for Claude for Teams or Enterprise organizations, or at [platform.claude.com/settings/organization](<https://platform.claude.com/settings/organization>) for Console organizations. With both keys set, Claude Code restricts login to the listed organization and exits at startup if the active credential belongs to a different one. Deploy the keys through your device management tooling. [Server-managed settings](</docs/en/server-managed-settings>) reach only accounts that are already authenticated into your organization, so they can’t redirect a developer’s first login. If your organization distributes server-managed settings as well, set the keys in both places: managed-settings sources [don’t merge](</docs/en/server-managed-settings#settings-precedence>), and cached server-managed settings replace the device-managed file entirely. The keys also block sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`, since organization membership can’t be verified for an environment credential. Cloud provider sessions such as Amazon Bedrock authenticate against your cloud provider and aren’t blocked; restrict those through your cloud IAM policies. See [`forceLoginOrgUUID`](</docs/en/settings#available-settings>) in the settings reference for the full behavior. Before v2.1.146, the pin applied only to the login flow and didn’t block API-key credentials.
##
@@ -157,7 +165,7 @@
Renew an expiring login
-When the login you created with `/login` is within five days of expiring, Claude Code shows a warning at startup: `Your login expires in 3 days · run /login to renew`. Requires Claude Code v2.1.203 or later. Run `/login` to renew. The warning is informational and never blocks a request: authentication keeps working until the login actually expires. The login lifetime itself is unchanged; the advance warning is what v2.1.203 adds. Once the stored login expires and can’t be refreshed, each request fails with [`Login expired · Please run /login`](</docs/en/errors#login-expired>) until you sign in again. Before v2.1.206, an expired login surfaced as a model error instead. The warning appears only when a claude.ai or Claude Console login is the active credential, and not when a cloud provider, `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` supplies the credential. Renewing early matters most for sessions that run unattended. A [background session in agent view](</docs/en/agent-view>) or a [Remote Control](</docs/en/remote-control>) session that outlives the login stops making progress once the credential expires and can’t recover until you sign in again.
+When the login you created with `/login` is within five days of expiring, Claude Code shows a warning at startup: `Your login expires in 3 days · run /login to renew`. Requires Claude Code v2.1.203 or later. Run `/login` to renew. The warning is informational and never blocks a request: authentication keeps working until the login actually expires. The login lifetime itself is unchanged; the advance warning is what v2.1.203 adds. Once the stored login expires and can’t be refreshed, each request fails with [`Login expired · Please run /login`](</docs/en/errors#login-expired>) until you sign in again. Before v2.1.206, an expired login surfaced as a model error instead. You can check for this state before a request fails: [`/status`](</docs/en/commands>) shows a `Login` row reading `Expired — log in again`, plus the organization and email it has saved for the expired login. The row appears only when the saved claude.ai or Claude Console login is the active credential. The row requires Claude Code v2.1.210 or later. The warning appears only when a claude.ai or Claude Console login is the active credential, and not when a cloud provider, `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` supplies the credential. Renewing early matters most for sessions that run unattended. A [background session in agent view](</docs/en/agent-view>) or a [Remote Control](</docs/en/remote-control>) session that outlives the login stops making progress once the credential expires and can’t recover until you sign in again.
###
--- 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, 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 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.
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:
@@ -18,7 +18,19 @@
Common boundaries
-Auto mode allows pushes to your working branch, routine pushes to the repository default branch, and pull request creation by default. The classifier blocks a push only when it carries risk, such as a force push or content that routes around a review you set up. If you want a human checkpoint before every push or pull request, add permission rules: the recipes below keep auto mode on for everything else. The most direct mechanism is [`permissions.ask`](</docs/en/permissions#permission-rule-syntax>). Content-scoped ask rules like the ones below are evaluated before the classifier and always force a permission prompt, even in auto mode, because an explicit ask rule is your stated intent to be prompted for that action. Add the rules in your [settings](</docs/en/settings#settings-files>):
+Auto mode allows pushes to any branch of the repository you’re working in, including the default branch, and pull request creation by default. A non-default branch whose name marks it as a deploy or publication target, such as `production`, `release`, or `gh-pages`, isn’t covered by that default: the classifier judges a push there on its own terms, including as a production deploy. The push’s content is also still checked, so a force push, a secret entering the commit, or a change that would send secrets outside the repository when CI or a deploy pipeline runs it stays blocked.
+
+Before v2.1.211, the classifier allowed pushes only to your working branch, branches Claude created, and routine pushes to the default branch.
+
+If you want a human checkpoint before every push or pull request, add permission rules: the recipes below keep auto mode on for everything else.
+
+###
+
+
+
+Add a human checkpoint
+
+The most direct mechanism is [`permissions.ask`](</docs/en/permissions#permission-rule-syntax>). Content-scoped ask rules like the ones below are evaluated before the classifier and always force a permission prompt, even in auto mode, because an explicit ask rule is your stated intent to be prompted for that action. Add the rules in your [settings](</docs/en/settings#settings-files>):
{
"permissions": {
@@ -71,13 +83,14 @@
* **Internal sharing / snippet hosting** : public paste and gist services are treated as outside the trust boundary until you name one
* **Org-specific CLIs**
* **Secrets management**
- * **Default / protected branches** : `main` and `master` are treated as protected until you name others
* **CI/CD deploy targets**
* **Network posture**
* **Protected deployment namespaces / environments** : falls back to the Sensitive remote targets heuristic until you name them
* **Data retention / declassification**
* **Trust slots** : name what the classifier treats as inside your boundary. The slots are Trusted repo, Source control, Trusted internal domains, Trusted cloud buckets, Key internal services, and Internal package registry. The repo and source-control entries default to the working repository and its configured remotes. Every other trust slot defaults to `None configured`, so nothing else is trusted until you add it. A repository’s visibility scopes only confidential material: a private repository is an acceptable destination for confidential material, but making a repository private never clears secrets or personal or entrusted data into it, and the classifier treats content ported, repointed, or first read from outside the working repository as not that repository’s own work. This scoping requires Claude Code v2.1.203 or later.
* **Sensitivity slots** : name what the protective rules treat as high-risk. The slots are Sensitive data locations & audiences, Sensitive remote targets, and Protected IaC scopes. Each defaults to a broad heuristic, such as treating any host or namespace whose name carries `prod` or `production` as a sensitive remote target, so the protective rules are active before you configure anything. Naming concrete targets in a sensitivity slot makes those rules apply to the named targets instead of the heuristic.
+
+Before v2.1.211, the context slots also included a Default / protected branches entry that treated `main` and `master` as protected until you named others. v2.1.211 removed it: pushes to any branch of the repository you’re working in are allowed by default, so there is no protected-branch default to configure.
To add your own entries alongside the defaults, include the literal string `"$defaults"` in the array. The default entries are spliced in at that position, so your custom entries can go before or after them. The following example keeps the default entries and adds an organization’s repos, buckets, domains, and services.
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,59 @@
This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version.
+
+
+
+2.1.212
+
+July 17, 2026
+
+ * `/fork` now copies your conversation into a new background session (its own row in `claude agents`) while you keep working; the in-session subagent it used to launch is now `/subtask`
+ * Added `claude auto-mode reset` to restore the default auto-mode configuration, with a confirmation prompt (pass `--yes` to skip)
+ * Added a session-wide limit on WebSearch tool calls (default 200, tunable via `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`) to stop runaway search loops
+ * Added a per-session cap on subagent spawns (default 200, override with `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`) to stop runaway delegation loops; `/clear` resets the budget
+ * MCP tool calls running longer than 2 minutes now move to the background automatically so the session stays usable; configure the threshold or disable with `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`
+ * Typing `/resume` in the agent view now opens a picker of past sessions — including sessions deleted from the list — and resumes your pick as a background session
+ * Fixed plan mode auto-running file-modifying Bash commands (e.g. `touch`, `rm`) without a permission prompt or SDK `canUseTool` callback
+ * Fixed worktree creation following a repository-committed symlink at `.claude/worktrees`, which could create files outside the repository
+ * Fixed a `continue:false` hook’s halt being dropped when the tool fails or completes mid-stream, and hook infrastructure errors being misreported as user rejections
+ * Fixed SIGTERM during a running Bash tool orphaning the command’s process tree in print/SDK mode; the CLI now aborts the turn, kills the tree, and exits 143
+ * Fixed `/background` and `claude --bg` failing with “EUNKNOWN: unknown error, uv_spawn” on Windows when Group Policy blocks PowerShell 5.1; the daemon now prefers PowerShell 7
+ * Fixed shell mode (`!`) not executing commands containing file paths while the path autocomplete popup was open
+ * Fixed auto-mode denial notifications rendering broken characters when a long denial reason was truncated mid-emoji
+ * Fixed Ctrl+J not inserting a newline in the agent view dispatch input on terminals with extended key reporting, and surfaced the newline shortcut in the `?` help overlay
+ * Fixed `/ultrareview` rejecting PR references like `#123`, `PR 123`, and pasted PR URLs; error hints now name the command you actually typed
+ * Fixed `/ultrareview <branch>` not fetching the branch from origin when it exists remotely; it now suggests the closest branch name on typos
+ * Fixed `/ultrareview` skipping the billing confirmation in a new conversation after `/clear`
+ * Fixed `/ultrareview`’s “not a git repository” error on Claude Desktop now suggesting the project’s repository folder instead of terminal commands
+ * Fixed hosted (host-managed) sessions failing at startup when repository settings configured mTLS certs, extra CA bundles, or OAuth scopes; these transport settings are now ignored with a warning
+ * Fixed a spurious “File has not been read yet” error when editing a file that had been read with offset/limit before resuming a session
+ * Fixed `ExitWorktree` failing with “no active EnterWorktree session” after resuming a session with `--continue`/`--resume` in print/SDK mode
+ * Fixed the workflow agent grid staying empty for Remote Control clients that join a session mid-run
+ * Fixed streaming-mode control requests being marked complete before their handler finished, which could lose the request on session restart
+ * Fixed background sessions created with `/fork` losing their live-parent protection after a state write failure
+ * Fixed reopening a stopped background session from the agent view failing silently — it now resumes the session, or shows why it can’t and lets you force a restart
+ * Fixed agent teams: a stopping teammate could send the leader duplicate idle notifications when team initialization re-ran within a session
+ * Fixed the plan-approval dialog footer splitting “ctrl+g to edit in `<editor>`” apart when the file path is long
+ * Fixed the welcome banner keeping its old panel widths after a combined width+height terminal resize in fullscreen mode
+ * Fixed diff previews losing their line numbers and +/- markers in narrow layouts
+ * Fixed @-mentions attaching nothing after a partial file read, plugin uninstall targeting the wrong marketplace, and false “Command timed out” on exit code 143
+ * Fixed OpenTelemetry HTTP exports being rejected with 411/400 by Azure Monitor and other endpoints that don’t accept chunked transfer encoding
+ * Fixed OTLP event log records missing `trace_id`/`span_id` when `TRACEPARENT` is set in SDK/headless mode
+ * Fixed conversations with many images incorrectly failing with “Request too large” errors, and improved the error message to explain the actual cause
+ * Fixed web search and web fetch returning “API Error” text as search results or page content when the API was overloaded
+ * Improved web search and web fetch reliability by retrying 529 errors and rate-limited requests with bounded backoff
+ * Improved prompt caching: the mid-conversation system block now works behind LLM gateways and custom base URLs (Bedrock, Vertex, 1P)
+ * Improved background agent attach: cold-attaching now instantly shows the formatted transcript while the session boots, instead of a blank wait
+ * Reduced token usage in inter-agent messaging: `SendMessage` bodies are no longer duplicated into replayed history and tool results
+ * Changed `/fork` to name the copy after your prompt when the session has no title, so the row is recognizable in the agent view
+ * Changed bare `/btw` to reopen the side-question panel on your most recent exchange so you can browse earlier answers
+ * Changed the `←` footer hint to pulse `N done` for a moment when a background agent finishes while nothing needs your input
+ * Deprecated the Task tool’s `mode` parameter (now ignored); subagents inherit the parent session’s permission mode by default
+ * Changed Enterprise `forceLoginMethod` to be enforced for VS Code extension, SDK, `setup-token`, and `install-github-app` logins, not just the terminal
+ * Changed session transcripts to record the reasoning effort level on each assistant message
+ * Changed headless/SDK sessions to apply a `set_model` control request mid-turn; the next model round-trip uses the new model instead of waiting for the next turn
+ * Changed agent view / `claude agents --json`: sessions waiting on a sandbox, MCP-input, or managed-settings prompt now show as “Needs input” instead of “Working”
+ * Updated the auth status panel title from “Cloud authentication” to “Authentication”
+ * Corrected an earlier release note (2.1.200): tmux through the 3.6 series lacks synchronized output; newer tmux with support is detected automatically
--- a/channels.md
+++ b/channels.md
@@ -32,7 +32,7 @@
/plugin install telegram@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install.After installing, run `/reload-plugins` to activate the plugin’s configure command.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install.After installing, run `/reload-plugins` to activate the plugin’s configure command.
3
@@ -105,7 +105,7 @@
/plugin install discord@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install.After installing, run `/reload-plugins` to activate the plugin’s configure command.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install.After installing, run `/reload-plugins` to activate the plugin’s configure command.
5
@@ -157,7 +157,7 @@
/plugin install imessage@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install.
3
@@ -207,7 +207,7 @@
/plugin install fakechat@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install.
2
Show diff (101 lines)
--- a/channels-reference.md
+++ b/channels-reference.md
@@ -50,10 +50,10 @@
Create the project
-Create a new directory and install the MCP SDK:
+The permission relay examples later on this page import `zod` directly, so it installs alongside the MCP SDK. Create a new directory and install both:
mkdir webhook-channel && cd webhook-channel
- bun add @modelcontextprotocol/sdk
+ bun add @modelcontextprotocol/sdk zod
2
@@ -130,15 +130,15 @@
claude --dangerously-load-development-channels server:webhook
-The first time you start a session in this project, Claude Code asks for consent before using the new server from `.mcp.json`. The dialog reports “New MCP server found in this project: webhook”. Select **Use this MCP server** to continue.When Claude Code starts, it reads your MCP config, spawns your `webhook.ts` as a subprocess, and the HTTP listener starts automatically on the port you configured (8788 in this example). You don’t need to run the server yourself.A dim notice below the startup banner confirms the channel is registered: `Channels (experimental) messages from server:webhook inject directly in this session · restart without --dangerously-load-development-channels to stop`.If you see “blocked by org policy,” your organization admin needs to [enable channels](</docs/en/channels#enterprise-controls>) first.In a separate terminal, simulate a webhook by sending an HTTP POST with a message to your server. This example sends a CI failure alert to port 8788 (or whichever port you configured):
+Claude Code first shows a full-screen warning dialog listing the development channels you’re loading. Select **I am using this for local development** to continue, or **Exit** to quit.The first time you start a session in this project, Claude Code also asks for consent before using the new server from `.mcp.json`. The dialog reports “New MCP server found in this project: webhook”. Select **Use this MCP server** to continue.After you accept, Claude Code spawns your `webhook.ts` as a subprocess, and the HTTP listener starts automatically on the port you configured, 8788 in this example. You don’t need to run the server yourself.A dim notice below the startup banner confirms the channel is registered: `Channels (experimental) messages from server:webhook inject directly in this session · restart without --dangerously-load-development-channels to stop`.If you see “blocked by org policy,” your organization admin needs to [enable channels](</docs/en/channels#enterprise-controls>) first.In a separate terminal, simulate a webhook by sending an HTTP POST with a message to your server. This example sends a CI failure alert to port 8788 (or whichever port you configured):
curl -X POST localhost:8788 -d "build failed on main: https://ci.example.com/run/1234"
-The payload arrives in your Claude Code session as a `<channel>` tag:
+The payload arrives in Claude’s context as a `<channel>` tag:
<channel source="webhook" path="/" method="POST">build failed on main: https://ci.example.com/run/1234</channel>
-In your Claude Code terminal, you’ll see Claude receive the message and start responding: reading files, running commands, or whatever the message calls for. This is a one-way channel, so Claude acts in your session but doesn’t send anything back through the webhook. To add replies, see Expose a reply tool.If the event doesn’t arrive, the diagnosis depends on what `curl` returned:
+Your terminal renders the event as a one-line summary, `← webhook: build failed on main: https://ci.example.com/run/1234`, rather than the raw tag. You’ll then see Claude start responding: reading files, running commands, or whatever the message calls for. This is a one-way channel, so Claude acts in your session but doesn’t send anything back through the webhook. To add replies, see Expose a reply tool.If the event doesn’t arrive, the diagnosis depends on what `curl` returned:
* **`curl` succeeds but nothing reaches Claude**: run `/mcp` in your session to check the server’s status. “Failed to connect” usually means a dependency or import error in your server file; check the debug log at `~/.claude/debug/<session-id>.txt` for the stderr trace.
* **`curl` fails with “connection refused”**: the port is either not bound yet or a stale process from an earlier run is holding it. `lsof -i :<port>` shows what’s listening; `kill` the stale process before restarting your session.
@@ -169,7 +169,7 @@
Server options
-A channel sets these options in the [`Server`](<https://modelcontextprotocol.io/docs/concepts/servers>) constructor. The `instructions` and `capabilities.tools` fields are [standard MCP](<https://modelcontextprotocol.io/docs/concepts/servers>); `capabilities.experimental['claude/channel']` and `capabilities.experimental['claude/channel/permission']` are the channel-specific additions:
+A channel sets these options in the [`Server`](<https://modelcontextprotocol.io/docs/learn/server-concepts>) constructor. The `instructions` and `capabilities.tools` fields are [standard MCP](<https://modelcontextprotocol.io/docs/learn/server-concepts>); `capabilities.experimental['claude/channel']` and `capabilities.experimental['claude/channel/permission']` are the channel-specific additions:
Field| Type| Description
---|---|---
@@ -446,10 +446,10 @@
---|---
`request_id`| Five lowercase letters drawn from `a`-`z` without `l`, so it never reads as a `1` or `I` when typed on a phone. Include it in your outgoing prompt so it can be echoed in the reply. Claude Code only accepts a verdict that carries an ID it issued. The local terminal dialog doesn’t display this ID, so your outbound handler is the only way to learn it.
`tool_name`| Name of the tool Claude wants to use, for example `Bash` or `Write`.
-`description`| Human-readable summary of what this specific tool call does, the same text the local terminal dialog shows. For a Bash call this is Claude’s description of the command, or the command itself if none was given.
-`input_preview`| The tool’s arguments as a JSON string, truncated to 200 characters. For Bash this is the command; for Write it’s the file path and a prefix of the content. Omit it from your prompt if you only have room for a one-line message. Your server decides what to show.
-
-The verdict your server sends back is `notifications/claude/channel/permission` with two fields: `request_id` echoing the ID above, and `behavior` set to `'allow'` or `'deny'`. Allow lets the tool call proceed; deny rejects it, the same as answering No in the local dialog. Neither verdict affects future calls.
+`description`| Human-readable summary of what this specific tool call does, never the command itself. For a Bash call this is Claude’s description of the command; when the model gives no description, the field is the constant `Run shell command` and carries zero command detail. Render `input_preview` when you have room.
+`input_preview`| The tool’s arguments as JSON-shaped display text, keyed per top-level field. For Bash this is the command; for Write, the file path and the content. Omit it from your prompt if you only have room for a one-line message. Your server decides what to show.
+
+Clients on Claude Code v2.1.211 or later sanitize both fields before relaying them: they neutralize direction-override and invisible characters and quote and angle-bracket lookalikes, fold whitespace runs to a single space, and relay text whole up to 3,500 code points, applied per top-level field for `input_preview`, which also keeps the JSON’s own structural quotes. A longer value keeps its start and end visible around a counted `⋯ N code points elided ⋯` marker, so the end of a long command still reaches the approver. Earlier clients relay `description` raw and cut `input_preview` to 200 UTF-16 units with a trailing ellipsis. Treat both fields as untrusted unless you control the client fleet. The verdict your server sends back is `notifications/claude/channel/permission` with two fields: `request_id` echoing the ID above, and `behavior` set to `'allow'` or `'deny'`. Allow lets the tool call proceed; deny rejects it, the same as answering No in the local dialog. Neither verdict affects future calls.
###
@@ -494,8 +494,8 @@
params: z.object({
request_id: z.string(), // five lowercase letters, include verbatim in your prompt
tool_name: z.string(), // e.g. "Bash", "Write"
- description: z.string(), // human-readable summary of this call
- input_preview: z.string(), // tool args as JSON, truncated to ~200 chars
+ description: z.string(), // summary of this call. Treat as untrusted.
+ input_preview: z.string(), // tool args as JSON-shaped text. Treat as untrusted.
}),
})
@@ -503,7 +503,11 @@
// send() is your outbound: POST to your chat platform, or for local
// testing the SSE broadcast shown in the full example below.
send(
- `Claude wants to run ${params.tool_name}: ${params.description}\n\n` +
+ `Claude wants to run ${params.tool_name}: ${params.description}\n` +
+ // input_preview carries the actual arguments; render it when you
+ // have room: for Bash the description alone may be just
+ // "Run shell command" with zero command detail
+ `${params.input_preview}\n\n` +
// the ID in the instruction is what your inbound handler parses in Step 3
`Reply "yes ${params.request_id}" or "no ${params.request_id}"`,
)
@@ -634,7 +638,8 @@
mcp.setNotificationHandler(PermissionRequestSchema, async ({ params }) => {
send(
- `Claude wants to run ${params.tool_name}: ${params.description}\n\n` +
+ `Claude wants to run ${params.tool_name}: ${params.description}\n` +
+ `${params.input_preview}\n\n` +
`Reply "yes ${params.request_id}" or "no ${params.request_id}"`,
)
})
@@ -695,7 +700,7 @@
},
})
-See all 132 lines
+See all 133 lines
Test the verdict path in three terminals. The first is your Claude Code session, started with the development flag so it spawns `webhook.ts`:
--- a/checkpointing.md
+++ b/checkpointing.md
@@ -19,7 +19,7 @@
* Every user prompt creates a new checkpoint
* Claude Code keeps file snapshots for the 100 most recent checkpoints in a session. Discarding an older checkpoint deletes the snapshot files that no remaining checkpoint references, except each file’s first snapshot, which the VS Code extension uses as the baseline for its session diffs. Before v2.1.208, those superseded snapshot files stayed on disk until the session was cleaned up.
* Checkpoints are saved with the conversation, so a resumed session can still `/rewind` to them
- * Automatically cleaned up along with sessions after 30 days (configurable)
+ * Automatically cleaned up along with sessions after 30 days, configurable via [`cleanupPeriodDays`](</docs/en/settings#available-settings>)
###
@@ -40,7 +40,7 @@
* **Summarize up to here** : compress the conversation before this point into a summary, keeping later messages intact
* **Never mind** : return to the message list without making changes
-After restoring the conversation or choosing Summarize from here, the original prompt from the selected message is restored into the input field so you can re-send or edit it. Choosing Summarize up to here leaves you at the end of the conversation with the input empty.
+The two code restore options appear only when the selected checkpoint has tracked file changes to revert. If no file edits were captured after that point, the menu offers only **Restore conversation** , the summarize options, and **Never mind**. After restoring the conversation or choosing Summarize from here, the original prompt from the selected message is restored into the input field so you can re-send or edit it. Choosing Summarize up to here leaves you at the end of the conversation with the input empty. With either summarize option, a **Summarized conversation** marker appears in the conversation where the compressed messages were.
####
@@ -61,7 +61,7 @@
* **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. You can type optional instructions to guide what the summary focuses on. This is similar to `/compact`, but targeted: instead of summarizing the entire conversation, you choose which side of the selected message to compress.
+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 [fork](</docs/en/sessions#branch-a-session>) instead (`claude --continue --fork-session`).
Show diff (125 lines)
--- a/chrome.md
+++ b/chrome.md
@@ -1,6 +1,6 @@
Claude Code integrates with the [Claude in Chrome browser extension](<https://chromewebstore.google.com/detail/claude/fcoeoabgfenejglbffodgkkbkcdhcgfn>) to give you browser automation capabilities from the CLI or the [VS Code extension](</docs/en/vs-code#automate-browser-tasks-with-chrome>). Build your code, then test and debug in the browser without switching contexts. Claude opens new tabs for browser tasks and shares your browser’s login state, so it can access any site you’re already signed into. Browser actions run in a visible Chrome window in real time. When Claude encounters a login page or CAPTCHA, it pauses and asks you to handle it manually.
-Chrome integration works with Google Chrome and Microsoft Edge. It isn’t yet supported on Brave, Arc, or other Chromium-based browsers. It also isn’t supported in Windows Subsystem for Linux (WSL).
+Chrome integration works with Google Chrome and Microsoft Edge. Claude Code also detects the extension and sets up the connection in other Chromium-based browsers, including Brave, Arc, Vivaldi, and Opera. Chrome integration isn’t supported in Windows Subsystem for Linux (WSL).
##
@@ -16,6 +16,7 @@
* **Authenticated web apps** : interact with Google Docs, Gmail, Notion, or any app you’re logged into without API connectors
* **Data extraction** : pull structured information from web pages and save it locally
* **Task automation** : automate repetitive browser tasks like data entry, form filling, or multi-site workflows
+ * **File uploads** : attach files from your machine to upload fields on web pages
* **Session recording** : record browser interactions as GIFs to document or share what happened
##
@@ -26,8 +27,8 @@
Before using Claude Code with Chrome, you need:
- * [Google Chrome](<https://www.google.com/chrome/>) or [Microsoft Edge](<https://www.microsoft.com/edge>) browser
- * [Claude in Chrome extension](<https://chromewebstore.google.com/detail/claude/fcoeoabgfenejglbffodgkkbkcdhcgfn>) version 1.0.36 or higher, available in the Chrome Web Store for both browsers
+ * [Google Chrome](<https://www.google.com/chrome/>), [Microsoft Edge](<https://www.microsoft.com/edge>), or another Chromium-based browser such as Brave, Arc, Vivaldi, or Opera
+ * [Claude in Chrome extension](<https://chromewebstore.google.com/detail/claude/fcoeoabgfenejglbffodgkkbkcdhcgfn>) version 1.0.36 or higher, available in the Chrome Web Store
* [Claude Code](</docs/en/quickstart#step-1-install-claude-code>)
* A direct Anthropic plan (Pro, Max, Team, or Enterprise)
@@ -47,7 +48,7 @@
claude --chrome
-You can also enable Chrome from within an existing session by running `/chrome`.
+The first time you launch with Chrome, Claude Code shows a one-time dialog that introduces the integration and explains how site permissions work. Press Enter to continue.To enable Chrome for future sessions without the flag, see Enable Chrome by default.
2
@@ -60,7 +61,7 @@
The first browser action asks for permission to use the `claude-in-chrome` skill. Approve it and Claude opens a new tab and starts the task.
-Run `/chrome` at any time to check the connection status, manage permissions, reconnect the extension, or choose which connected browser to use. If more than one browser is connected when a browser action starts, Claude prompts you to pick one. For VS Code, see [browser automation in VS Code](</docs/en/vs-code#automate-browser-tasks-with-chrome>).
+Run `/chrome` at any time to check the connection status, manage permissions, reconnect the extension, or choose which connected browser to use. The integration is working when the status panel shows “Status: Enabled” and “Extension: Installed”. If more than one browser is connected when a browser action starts, Claude prompts you to pick one. For VS Code, see [browser automation in VS Code](</docs/en/vs-code#automate-browser-tasks-with-chrome>).
###
@@ -68,7 +69,7 @@
Enable Chrome by default
-To avoid passing `--chrome` each session, run `/chrome` and select “Enabled by default”. In the [VS Code extension](</docs/en/vs-code#automate-browser-tasks-with-chrome>), Chrome is available whenever the Chrome extension is installed. No additional flag is needed.
+To avoid passing `--chrome` each session, run `/chrome` and select “Enabled by default”. Claude Code starts normally when Chrome isn’t running. Before v2.1.211, startup could hang when Chrome integration was enabled but Chrome wasn’t running. In the [VS Code extension](</docs/en/vs-code#automate-browser-tasks-with-chrome>), Chrome is available whenever the Chrome extension is installed. No additional flag is needed.
Enabling Chrome by default in the CLI increases context usage since browser tools are always loaded. If you notice increased context consumption, disable this setting and use `--chrome` only when needed.
@@ -146,6 +147,23 @@
+Upload files to web pages
+
+Claude can attach files from your machine to upload fields on a page. Claude Code reads the file and sends its contents to the browser, so uploads work in both local and remote sessions. Requires Claude Code v2.1.211 or later. This example attaches a log file to a form:
+
+ Open the bug tracker at bugs.example.com, create a new issue,
+ and attach logs/session.log to it
+
+Three restrictions apply to uploads:
+
+ * **Permissions** : Claude can upload a file only when the session is allowed to read it, so [permission rules](</docs/en/settings#permission-settings>) that deny `Read` access to a file also block uploading it.
+ * **Size** : a single upload can include up to 10 MB of files in total.
+ * **Hard links** : Claude refuses files that have multiple hard links, which is common inside package-manager stores like `node_modules`. Copy the file and upload the copy.
+
+###
+
+
+
Draft content in Google Docs
Use Claude to write directly in your documents without API setup:
@@ -194,6 +212,18 @@
an item to the cart through to the confirmation page.
Claude records the interaction sequence and saves it as a GIF file.
+
+###
+
+
+
+Save screenshots to disk
+
+Ask Claude to keep a screenshot as a file:
+
+ Take a screenshot of the checkout page and save it to disk
+
+Claude saves the image to disk and reports the file path. Before v2.1.211, the screenshot tool’s `save_to_disk` option didn’t write a file.
##
@@ -227,6 +257,8 @@
* **Linux** : `~/.config/microsoft-edge/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json`
* **Windows** : check `HKCU\Software\Microsoft\Edge\NativeMessagingHosts\` in the Windows Registry
+Other Chromium-based browsers read the same file from their own configuration directory, named after the browser. For example, Brave on macOS uses `~/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/`, and on Windows each browser has its own registry key, such as `HKCU\Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\`.
+
###
@@ -257,6 +289,7 @@
* **Named pipe conflicts (EADDRINUSE)** : if another process is using the same named pipe, restart Claude Code. Close any other Claude Code sessions that might be using Chrome.
* **Native messaging host errors** : if the native messaging host crashes on startup, try reinstalling Claude Code to regenerate the host configuration.
+ * **Setup pages fail to open** : update Claude Code. Before v2.1.211, the browser tab prompting you to connect the extension could fail to open on Windows.
###
@@ -269,7 +302,7 @@
Error| Cause| Fix
---|---|---
”Browser extension is not connected”| Native messaging host cannot reach the extension| Restart Chrome and Claude Code, then run `/chrome` to reconnect
-”Extension not detected”| Chrome extension is not installed or is disabled| Install or enable the extension in `chrome://extensions`
+Extension shows “Not detected” in `/chrome`| Chrome extension is not installed or is disabled| Install or enable the extension in `chrome://extensions`
”No tab available”| Claude tried to act before a tab was ready| Ask Claude to create a new tab and retry
”Receiving end does not exist”| Extension service worker went idle| Run `/chrome` and select “Reconnect extension”
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
@@ -60,7 +60,7 @@
PostgreSQL 14 or later| Backs the device sign-in flow, where the browser callback writes and the polling CLI reads, plus rate-limit counters. Any managed Postgres works, including the smallest tier. Without spend limits configured, the gateway stores a few KB of short-lived auth state; with [spend limits](</docs/en/claude-apps-gateway-spend-limits>), it also holds durable spend, audit, and identity tables that should be backed up. TLS via `?sslmode=require` is recommended.
Model upstream| Amazon Bedrock credentials, Claude Platform on AWS credentials, Google Cloud credentials, a Microsoft Foundry resource, or an Anthropic API key. Multiple upstreams are supported with failover.
HTTPS| The gateway must be reachable over `https://` from developer laptops and from any browser used for sign-in; the gateway serves the device-verification page on the same listener. Either provide a TLS cert via `listen.tls`, or run behind a TLS-terminating ingress and set `listen.public_url`. A plain `http://` origin is accepted only on loopback, for local development.
-Private-network address| At `/login`, Claude Code requires the gateway’s hostname or IP address to resolve only to private addresses: RFC 1918, CGNAT `100.64.0.0/10`, IPv6 ULA `fc00::/7`, or loopback for local development. The check runs on each resolved IP, so if any address the name resolves to is public, `/login` rejects the URL. If developer machines route HTTPS through a corporate proxy, sign-in also requires the proxy host to resolve to private addresses; if it doesn’t, add the gateway host to `NO_PROXY` so the CLI connects directly. Anthropic-operated public gateway endpoints are exempt from the private-address and proxy checks: `/login` accepts them over `https://` by exact hostname match, so the private-network requirement applies only to a gateway you host yourself. Before v2.1.206, `/login` rejected an Anthropic-operated endpoint like any other public address.
+Private-network address| At `/login`, Claude Code requires the gateway’s hostname or IP address to resolve only to private addresses: RFC 1918, link-local, CGNAT `100.64.0.0/10`, IPv6 ULA `fc00::/7`, or loopback for local development. For a gateway you host, any public address is rejected; see the [threat model](</docs/en/claude-apps-gateway-deploy#threat-model-summary>) in the deployment guide. The check runs on each resolved IP, so if any address the name resolves to is public, `/login` rejects the URL. If developer machines route HTTPS through a corporate proxy, sign-in also requires the proxy host to resolve to private addresses; if it doesn’t, add the gateway host to `NO_PROXY` so the CLI connects directly. Anthropic-operated public gateway endpoints are exempt from the private-address and proxy checks: `/login` accepts them over `https://` by exact hostname match, so the private-network requirement applies only to a gateway you host yourself. Before v2.1.206, `/login` rejected an Anthropic-operated endpoint like any other public address.
Linux runtime| The gateway server runs only on the native Linux binary. macOS works for local development. Windows isn’t supported as a server platform.
The gateway server requires the native `claude` binary; download a pinned release as described in [Install Claude Code](</docs/en/setup>). The server uses runtime features that aren’t available when Claude Code runs under Node. If you see `requires the native binary` at boot, switch to one of the standalone install methods.
@@ -132,13 +132,13 @@
Run it
-Build a container image around the `claude` binary that meets the [image requirements](</docs/en/claude-apps-gateway-deploy#container-image>), then run it alongside Postgres:
+Build a container image around the `claude` binary that meets the [image requirements](</docs/en/claude-apps-gateway-deploy#container-image>), then run it alongside Postgres. The Compose file references the image as `registry.example.com/claude-gateway:2.1.198`; substitute your own registry and image tag:
docker-compose.yaml
services:
gateway:
- image: <your-registry>/claude-gateway:<version>
+ image: registry.example.com/claude-gateway:2.1.198
ports: ["8080:8080"]
volumes: ["./gateway.yaml:/etc/claude/gateway.yaml:ro"]
environment:
Show diff (149 lines)
--- a/claude-code-features.md
+++ b/claude-code-features.md
@@ -13,23 +13,27 @@
TypeScript
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ResultMessage
-
- async for message in query(
- prompt="Help me refactor the auth module",
- options=ClaudeAgentOptions(
- # "user" loads from ~/.claude/, "project" loads from ./.claude/ in cwd.
- # Together they give the agent access to CLAUDE.md, skills, hooks, and
- # permissions from both locations.
- setting_sources=["user", "project"],
- allowed_tools=["Read", "Edit", "Bash"],
- ),
- ):
- if isinstance(message, AssistantMessage):
- for block in message.content:
- if hasattr(block, "text"):
- print(block.text)
- if isinstance(message, ResultMessage) and message.subtype == "success":
- print(f"\nResult: {message.result}")
+ import asyncio
+
+ async def main():
+ async for message in query(
+ prompt="Help me refactor the auth module",
+ options=ClaudeAgentOptions(
+ # "user" loads from ~/.claude/, "project" loads from ./.claude/ in cwd.
+ # Together they give the agent access to CLAUDE.md, skills, hooks, and
+ # permissions from both locations.
+ setting_sources=["user", "project"],
+ allowed_tools=["Read", "Edit", "Bash"],
+ ),
+ ):
+ if isinstance(message, AssistantMessage):
+ for block in message.content:
+ if hasattr(block, "text"):
+ print(block.text)
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(f"\nResult: {message.result}")
+
+ asyncio.run(main())
import { query } from "@anthropic-ai/claude-agent-sdk";
@@ -53,7 +57,7 @@
}
}
-Each source loads settings from a specific location, where `<cwd>` is the working directory you pass via the `cwd` option, or the process’s current directory if unset. For the full type definition, see [`SettingSource`](</docs/en/agent-sdk/typescript#settingsource>) (TypeScript) or [`SettingSource`](</docs/en/agent-sdk/python#settingsource>) (Python).
+When this runs, the assistant’s response prints to stdout, followed by a final result line once the run completes. Each source loads settings from a specific location, where `<cwd>` is the working directory you pass via the `cwd` option, or the process’s current directory if unset. For the full type definition, see [`SettingSource`](</docs/en/agent-sdk/typescript#settingsource>) (TypeScript) or [`SettingSource`](</docs/en/agent-sdk/python#settingsource>) (Python).
Source| What it loads| Location
---|---|---
@@ -123,19 +127,23 @@
TypeScript
from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
+ import asyncio
# Skills in .claude/skills/ are discovered automatically
# when settingSources includes "project"
- async for message in query(
- prompt="Review this PR using our code review checklist",
- options=ClaudeAgentOptions(
- setting_sources=["user", "project"],
- skills="all",
- allowed_tools=["Read", "Grep", "Glob"],
- ),
- ):
- if isinstance(message, ResultMessage) and message.subtype == "success":
- print(message.result)
+ async def main():
+ async for message in query(
+ prompt="Review this PR using our code review checklist",
+ options=ClaudeAgentOptions(
+ setting_sources=["user", "project"],
+ skills="all",
+ allowed_tools=["Read", "Grep", "Glob"],
+ ),
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+
+ asyncio.run(main())
import { query } from "@anthropic-ai/claude-agent-sdk";
@@ -176,11 +184,12 @@
TypeScript
from claude_agent_sdk import query, ClaudeAgentOptions, HookMatcher, ResultMessage
+ import asyncio
# PreToolUse hook callback. Positional args:
# input_data: HookInput dict with tool_name, tool_input, hook_event_name
# tool_use_id: str | None, the ID of the tool call being intercepted
- # context: HookContext, carries session metadata
+ # context: HookContext, reserved for future abort-signal support
async def audit_bash(input_data, tool_use_id, context):
command = input_data.get("tool_input", {}).get("command", "")
if "rm -rf" in command:
@@ -195,19 +204,22 @@
# Filesystem hooks from .claude/settings.json run automatically
# when settingSources loads them. You can also add programmatic hooks:
- async for message in query(
- prompt="Refactor the auth module",
- options=ClaudeAgentOptions(
- setting_sources=["project"], # Loads hooks from .claude/settings.json
- hooks={
- "PreToolUse": [
- HookMatcher(matcher="Bash", hooks=[audit_bash]),
- ]
- },
- ),
- ):
- if isinstance(message, ResultMessage) and message.subtype == "success":
- print(message.result)
+ async def main():
+ async for message in query(
+ prompt="Refactor the auth module",
+ options=ClaudeAgentOptions(
+ setting_sources=["project"], # Loads hooks from .claude/settings.json
+ hooks={
+ "PreToolUse": [
+ HookMatcher(matcher="Bash", hooks=[audit_bash]),
+ ]
+ },
+ ),
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+
+ asyncio.run(main())
import { query, type HookInput, type HookJSONOutput } from "@anthropic-ai/claude-agent-sdk";
@@ -254,7 +266,7 @@
Hook type| Best for
---|---
**Filesystem** (`settings.json`)| Sharing hooks between CLI and SDK sessions. Supports `"command"` (shell scripts), `"http"` (POST to an endpoint), `"mcp_tool"` (call a connected MCP server’s tool), `"prompt"` (LLM evaluates a prompt), and `"agent"` (spawns a verifier agent). These fire in the main agent and any subagents it spawns.
-**Programmatic** (callbacks in `query()`)| Application-specific logic, structured decisions, and in-process integration. These also fire inside subagents. The callback receives `agent_id` and `agent_type` to distinguish.
+**Programmatic** (callbacks in `query()`)| Application-specific logic, structured decisions, and in-process integration. These also fire inside subagents. The hook input, the callback’s first argument, carries `agent_id` and `agent_type` fields that identify which agent fired the hook.
The TypeScript SDK supports additional hook events beyond Python, including `SessionStart`, `SessionEnd`, `TeammateIdle`, and `TaskCompleted`. See the [hooks guide](</docs/en/agent-sdk/hooks>) for the full event compatibility table.
--- a/claude-code-on-the-web.md
+++ b/claude-code-on-the-web.md
@@ -254,7 +254,7 @@
}
}
-Create the script at `scripts/install_pkgs.sh` and make it executable with `chmod +x`. The `CLAUDE_CODE_REMOTE` environment variable is set to `true` in cloud sessions, so you can use it to skip local execution:
+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
@@ -265,6 +265,10 @@
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:
@@ -609,7 +613,7 @@
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.
+These workflows require the [Claude Code CLI](</docs/en/quickstart>) signed in to the same claude.ai account. You can start new cloud sessions from your terminal, or pull cloud sessions into your terminal to continue locally. Cloud sessions persist even if you close your laptop, and you can monitor them from anywhere including the Claude mobile app. The `--cloud` and `--teleport` flags don’t appear in `claude --help` output, but the CLI accepts them as shown below.
From the CLI, session handoff is one-way: you can pull cloud sessions into your terminal with `--teleport`, but you can’t push an existing terminal session to the web. The `--cloud` flag creates a new cloud session for your current repository. The [Desktop app](</docs/en/desktop#continue-in-another-surface>) provides a Continue in menu that can send a local session to the web.
@@ -704,7 +708,7 @@
`--teleport` is unavailable
-Teleport requires claude.ai subscription authentication. If you’re authenticated via API key, Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, run `/login` to sign in with your claude.ai account instead. If you’re already signed in via claude.ai and `--teleport` is still unavailable, your organization may have disabled cloud sessions.
+Teleport requires claude.ai subscription authentication. If you’re authenticated via API key, run `/login` to sign in with your claude.ai account instead. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, `--teleport` stops with `Cloud sessions aren't available with <provider>` because cloud sessions run on Anthropic’s infrastructure and aren’t available through those providers. If you’re already signed in via claude.ai and `--teleport` is still unavailable, your organization may have disabled cloud sessions.
##
@@ -855,6 +859,14 @@
* Check [status.claude.com](<https://status.claude.com>) for cloud session incidents
* Retry after a minute, as capacity is provisioned on demand
* Confirm your repository is reachable. The connecting GitHub account must have access to the repository on GitHub, either through the Claude GitHub App authorization or a `gh` token synced via `/web-setup`. Installing the App on the repository isn’t required. See GitHub authentication options.
+
+###
+
+
+
+Unable to get organization UUID
+
+`claude --cloud` and `claude --teleport` require sign-in with a claude.ai account. If you authenticate with an API key, or your stored account details are stale, these commands fail with `Unable to get organization UUID` or a message that API key authentication is not sufficient. Run `/login` to sign in with your claude.ai account, then retry the command. On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the commands stop earlier with `Cloud sessions aren't available with <provider>`. Cloud sessions run on Anthropic’s infrastructure and aren’t available through those providers.
###
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -122,6 +122,8 @@
`feedback-bundles/`| Redacted transcript archives written by `/feedback` on third-party providers or when no Anthropic credentials are configured, for sending to your Anthropic account team
`todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory.
+`sessions/` holds one small file per running session, used to detect concurrent sessions and crashes. It isn’t part of the age-based sweep: Claude Code removes each file when its session exits and clears crash leftovers on the next launch.
+
###
@@ -135,6 +137,8 @@
`history.jsonl`| Every prompt you’ve typed, with timestamp and project path. Used for up-arrow recall.
`stats-cache.json`| Aggregated token and cost counts shown by `/usage`
`remote-settings.json`| Cached copy of [server-managed settings](</docs/en/server-managed-settings>) for your organization. Only present when your organization has configured them. Refreshed on each launch.
+`cache/changelog.md`| Cached copy of the Claude Code changelog, used to show release notes after an update. Refreshed in the background.
+`policy-limits.json`| Cached feature policy settings for your organization. Only present for some account types. Refreshed automatically.
Other small cache and lock files appear depending on which features you use and are safe to delete.
@@ -163,19 +167,34 @@
* Matching prompt lines in `history.jsonl`
* The project’s entry in `~/.claude.json`
-The command prints the full deletion plan and asks for confirmation before removing anything. Preview the plan without deleting anything:
+The command prints the full deletion plan and asks for confirmation before removing anything. The examples below use `~/work/my-repo` as a placeholder. Replace it with the path to your project. If no state matches the path, the command prints an error and exits with status 1. Preview the plan without deleting anything:
claude project purge ~/work/my-repo --dry-run
+The plan lists each matching item and why it is included:
+
+ Purge plan for /home/user/work/my-repo:
+
+ dir: /home/user/.claude/projects/-home-user-work-my-repo
+ project transcripts (.jsonl) and memory/
+ config: projects["/home/user/work/my-repo"]
+ project entry in ~/.claude.json (trust, history, MCP servers)
+ filter: /home/user/.claude/history.jsonl
+ 12 prompt(s) typed in this project
+
+ shell-snapshots/ are not project-scoped and will not be touched
+ backups/ may still contain this project entry in old .claude.json snapshots (/home/user/.claude/backups); at most 5 are kept and they rotate out automatically
+ Dry run: 3 item(s) would be deleted.
+
Delete with a single confirmation prompt:
claude project purge ~/work/my-repo
-Omit the path to pick a project from an interactive list. Skip the confirmation prompt for use in scripts:
+The command prints the same plan, then asks `Delete 3 item(s) for /home/user/work/my-repo? This cannot be undone. [y/N]` and deletes only if you answer `y`. Omit the path to pick a project from an interactive list. Skip the confirmation prompt for use in scripts:
claude project purge ~/work/my-repo --yes
-Pass `--all` instead of a path to purge state for every project at once, which deletes `history.jsonl` outright rather than filtering it. Pass `-i` to step through the deletion plan one item at a time. The command leaves `shell-snapshots/` and `backups/` alone because those are not project-scoped, and warns about them in the plan output. It exits with status 1 if no state matches the given path. You can also delete any of the application-data paths above by hand. New sessions are unaffected. The table below shows what you lose for past sessions.
+Pass `--all` instead of a path to purge state for every project at once, which deletes `history.jsonl` outright rather than filtering it. Pass `-i` to step through the deletion plan one item at a time. The command leaves `shell-snapshots/` and `backups/` alone because those are not project-scoped, and warns about them in the plan output. You can also delete any of the application-data paths above by hand. New sessions are unaffected. The table below shows what you lose for past sessions.
Delete| You lose
---|---
@@ -184,6 +203,8 @@
`~/.claude/file-history/`| Checkpoint restore for past sessions
`~/.claude/stats-cache.json`| Historical totals shown by `/usage`
`~/.claude/remote-settings.json`| Nothing. Re-fetched on next launch.
+`~/.claude/cache/changelog.md`| Nothing. Refreshed in the background.
+`~/.claude/policy-limits.json`| Nothing. Refreshed automatically.
`~/.claude/debug/`, `~/.claude/plans/`, `~/.claude/paste-cache/`, `~/.claude/image-cache/`, `~/.claude/session-env/`, `~/.claude/tasks/`, `~/.claude/shell-snapshots/`, `~/.claude/backups/`| Nothing user-facing
`~/.claude/todos/`, `~/.claude/statsig/`, `~/.claude/logs/`| Nothing. Legacy directories not written by current versions.
--- a/claude-platform-on-aws.md
+++ b/claude-platform-on-aws.md
@@ -32,13 +32,13 @@
aws sso login --profile my-profile
export AWS_PROFILE=my-profile
-For CI and automation, give the runner an IAM role with permission to invoke the Anthropic service and set `AWS_REGION`. The credential chain picks the role up automatically. If your SSO credentials expire mid-session, configure [`awsAuthRefresh`](</docs/en/amazon-bedrock#advanced-credential-configuration>) so Claude Code re-runs your login command and retries instead of failing. Automatic refresh on Claude Platform on AWS requires Claude Code v2.1.198 or later; earlier versions stop with a prompt to run `/login`, which can’t refresh AWS credentials. Add the command to your `settings.json`:
+For CI and automation, give the runner an IAM role with permission to invoke the Anthropic service and set `AWS_REGION`. The credential chain picks the role up automatically. If your SSO credentials expire mid-session, configure [`awsAuthRefresh`](</docs/en/amazon-bedrock#advanced-credential-configuration>) so Claude Code re-runs your login command and retries instead of failing. Automatic refresh on Claude Platform on AWS requires Claude Code v2.1.198 or later; earlier versions stop with a prompt to run `/login`, which can’t refresh AWS credentials. Add the command to your [settings file](</docs/en/settings>), such as `~/.claude/settings.json`:
{
"awsAuthRefresh": "aws sso login --profile my-profile"
}
-With `awsAuthRefresh` configured, `/login` shows a **Claude Platform on AWS · refresh credentials** option under **Using 3rd-party platforms**. Selecting it runs the configured command and re-reads your AWS credentials without restarting Claude Code. **Option B: Workspace API key** A workspace API key is a long-lived secret, useful when you don’t want to manage federated AWS credentials. Generate one in the AWS Console under **Claude Platform on AWS → API keys** and set it as `ANTHROPIC_AWS_API_KEY`:
+Claude Code also runs this command at startup when it can’t validate your existing AWS credentials, and shows the command’s output in a Cloud authentication panel until the login completes. With `awsAuthRefresh` configured, `/login` shows a **Claude Platform on AWS · refresh credentials** option under **Using 3rd-party platforms**. Selecting it runs the configured command and re-reads your AWS credentials without restarting Claude Code. **Option B: Workspace API key** A workspace API key is a long-lived secret, useful when you don’t want to manage federated AWS credentials. Generate one in the AWS Console under **Claude Platform on AWS → API keys** and set it as `ANTHROPIC_AWS_API_KEY`:
export ANTHROPIC_AWS_API_KEY=sk-ant-xxxxx
@@ -58,7 +58,7 @@
export ANTHROPIC_AWS_WORKSPACE_ID=wrkspc_01ABCDEFGHIJKLMN
export AWS_REGION=us-east-1
-`ANTHROPIC_AWS_WORKSPACE_ID` is required and is sent on every request as the `anthropic-workspace-id` header. The base URL is computed from `AWS_REGION` as `https://aws-external-anthropic.{region}.api.aws`. To override the URL directly, set `ANTHROPIC_AWS_BASE_URL`. Claude Platform on AWS is opt-in even when AWS credentials are present in your environment. Amazon Bedrock and Microsoft Foundry take precedence in provider routing, so unset `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_FOUNDRY` if they’re set.
+`ANTHROPIC_AWS_WORKSPACE_ID` is required and is sent on every request as the `anthropic-workspace-id` header. Replace the example `wrkspc_01ABCDEFGHIJKLMN` value with your own workspace ID from your Claude Platform on AWS setup. The base URL is computed from `AWS_REGION` as `https://aws-external-anthropic.{region}.api.aws`. To override the URL directly, set `ANTHROPIC_AWS_BASE_URL`. Claude Platform on AWS is opt-in even when AWS credentials are present in your environment. Amazon Bedrock and Microsoft Foundry take precedence in provider routing, so unset `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_FOUNDRY` if they’re set.
###
@@ -74,6 +74,18 @@
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5
For the full list of model IDs and aliases, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). For other model-related variables, see [Model configuration](</docs/en/model-config>). [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`. The API bills 1-hour cache writes at a higher rate. See [prompt caching pricing](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing>) for the rates.
+
+###
+
+
+
+4\. Launch and verify
+
+Start Claude Code and confirm the routing:
+
+ claude
+
+The startup banner shows `Claude Platform on AWS` when the provider is active. Run `/status` to check the details: the `API provider` line reads `Claude Platform on AWS`, and the output includes your `Workspace ID`, the `AWS region`, and the `Claude Platform on AWS base URL` if you set an override.
##
@@ -136,7 +148,7 @@
Requests fail with a missing-workspace error
-`ANTHROPIC_AWS_WORKSPACE_ID` is likely unset or empty. Every Claude Platform on AWS request must include the workspace ID. It is not implied by your AWS credentials. Find the ID under **Workspaces** on the AWS Console service page and export it before starting Claude Code.
+`ANTHROPIC_AWS_WORKSPACE_ID` is likely unset or empty. Every Claude Platform on AWS request must include the workspace ID. It is not implied by your AWS credentials. Find the ID in your Claude Platform on AWS setup and export it before starting Claude Code.
###
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -53,7 +53,7 @@
Flag| Description| Example
---|---|---
`--add-dir`| Add additional working directories for Claude to read and edit files. Grants file access; most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from these directories. Validates each path exists as a directory. To persist these directories across sessions, set [`permissions.additionalDirectories`](</docs/en/settings#permission-settings>) in settings| `claude --add-dir ../apps ../lib`
-`--advisor <model>`| Enable the server-side [advisor tool](</docs/en/advisor>) for this session with a model alias: `opus`, `sonnet`, or `fable` (v2.1.170+), or a full model ID. Takes precedence over the `advisorModel` setting for the session| `claude --advisor opus`
+`--advisor <model>`| Enable the server-side [advisor tool](</docs/en/advisor>) for this session with a model alias, `opus` or `sonnet`, or a full model ID. Takes precedence over the `advisorModel` setting for the session. [Claude Code doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>): `claude --advisor fable` exits with an error| `claude --advisor opus`
`--agent`| Specify an agent for the current session (overrides the `agent` setting)| `claude --agent my-custom-agent`
`--agents`| Define custom subagents dynamically via JSON. Uses the same field names as subagent [frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>), plus a `prompt` field for the agent’s instructions| `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'`
`--allow-dangerously-skip-permissions`| Add `bypassPermissions` to the `Shift+Tab` mode cycle without starting in it. Lets you begin in a different mode like `plan` and switch to `bypassPermissions` later. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>)| `claude --permission-mode plan --allow-dangerously-skip-permissions`
@@ -81,7 +81,8 @@
`--exec`| Run a shell command as a PTY-backed background job instead of starting a Claude session. Use with `--bg` to launch from the shell| `claude --bg --exec 'pytest -x'`
`--fallback-model`| Enable automatic fallback to the specified model(s) when the primary model is overloaded or not available, for example a retired model. Accepts a comma-separated list tried in order. See [Fallback model chains](</docs/en/model-config#fallback-model-chains>). To persist a chain across sessions, use the [`fallbackModel` setting](</docs/en/settings#available-settings>), which this flag overrides| `claude --fallback-model sonnet,haiku`
`--fork-session`| When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`)| `claude --resume abc123 --fork-session`
-`--from-pr`| Resume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123`
+`--forward-subagent-text`| Emit [subagent](</docs/en/sub-agents>) text and thinking blocks in the output stream as `assistant` and `user` messages with `parent_tool_use_id` set, so you can reconstruct each subagent’s transcript. Without this flag, Claude Code emits only subagent `tool_use` and `tool_result` blocks. Requires `--print` and `--output-format stream-json`. The [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) environment variable enables the same behavior. Requires Claude Code v2.1.211 or later| `claude -p --output-format stream-json --verbose --forward-subagent-text "query"`
+`--from-pr`| Open the session picker filtered to sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123`
`--ide`| Automatically connect to IDE on startup if exactly one valid IDE is available| `claude --ide`
`--init`| Run [Setup hooks](</docs/en/hooks#setup>) with the `init` matcher before the session (print mode only)| `claude -p --init "query"`
`--init-only`| Run [Setup](</docs/en/hooks#setup>) and `SessionStart` hooks, then exit without starting a conversation| `claude --init-only`
--- a/commands.md
+++ b/commands.md
@@ -26,7 +26,7 @@
Command| Purpose
---|---
`/add-dir <path>`| Add a working directory for file access during the current session. Typing a partial path shows matching directory suggestions; press `Tab` to accept one. Most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from the added directory. You can later resume the session from the added directory with `--continue` or `--resume`
-`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `opus`, `sonnet`, `fable` (v2.1.170+), or a full model ID. Without an argument, opens a picker
+`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `opus`, `sonnet`, or a full model ID. Claude Code [doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>) and rejects `/advisor fable`. Without an argument, opens a picker
`/agents`| As of v2.1.198, running `/agents` prints a reminder to ask Claude to create or manage [subagents](</docs/en/sub-agents>), or to edit `.claude/agents/` or `~/.claude/agents/` directly. On v2.1.197 and earlier, opens an interactive interface for creating and managing subagent configurations
`/autofix-pr [prompt]`| Spawn a [Claude Code on the web](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) session that watches the current branch’s PR and pushes fixes when CI fails or reviewers leave comments. Detects the open PR from your checked-out branch with `gh pr view`; to watch a different PR, check out its branch first. By default the cloud session is told to fix every CI failure and review comment; pass a prompt to give it different instructions, for example `/autofix-pr only fix lint and type errors`. Requires the `gh` CLI and access to [Claude Code on the web](</docs/en/claude-code-on-the-web>)
`/background [prompt]`| Detach the current session to run as a [background agent](</docs/en/agent-view>) and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with `claude agents`. Alias: `/bg`
@@ -120,7 +120,7 @@
`/ultrareview [PR]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). The preferred invocation is now `/code-review ultra`, and `/ultrareview` remains as an alias. Includes 3 free runs on Pro and Max, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>)
`/upgrade`| Open the upgrade page in your browser to switch to a higher plan tier. When the browser fails to open, the command shows a sign-in prompt without printing the URL
`/usage`| Show session cost, plan usage limits, and activity stats. On a Pro, Max, Team, or Enterprise plan, includes a breakdown of usage by skill, subagent, plugin, and MCP server. See the [cost tracking guide](</docs/en/costs#using-the-%2Fusage-command>) for details. `/cost` and `/stats` are aliases
-`/usage-credits`| Configure usage credits to keep working when you hit a limit. On Pro and Max plans, opens an [in-CLI dialog](</docs/en/costs#set-a-spend-limit-on-pro-and-max>) to buy usage credits, set a monthly spend limit, and configure auto-reload; on Claude Code versions before v2.1.207 and on other plans, opens the usage-credits billing page in your browser, except that Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI. When no browser can open the billing page, for example over SSH, the command prints the URL to visit instead; this requires Claude Code v2.1.205 or later, and earlier versions showed nothing in that case. Previously `/extra-usage`
+`/usage-credits`| Configure usage credits, or request them from your admin, when you hit a limit. On Pro and Max plans, opens an [in-CLI dialog](</docs/en/costs#set-a-spend-limit-on-pro-and-max>) to buy usage credits, set a monthly spend limit, and configure auto-reload; on Claude Code versions before v2.1.207 and on other plans, opens the usage-credits billing page in your browser, except that Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI, after confirming in a dialog that the request notifies their admins. Before v2.1.211, Claude Code sent the request without a confirmation step. When no browser can open the billing page, for example over SSH, the command prints the URL to visit instead; this requires Claude Code v2.1.205 or later, and earlier versions showed nothing in that case. Previously `/extra-usage`
`/verify`| **[Skill](</docs/en/skills#bundled-skills>).** Confirm a code change does what it should by building your project’s app, running it, and observing the result, rather than relying on tests or type checks. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later
`/vim`| Removed in v2.1.92. To toggle between Vim and Normal editing modes, use `/config` → Editor mode
`/voice [hold|tap|off]`| Toggle [voice dictation](</docs/en/voice-dictation>), or enable it in a specific mode. Requires a Claude.ai account
--- a/common-workflows.md
+++ b/common-workflows.md
@@ -37,6 +37,8 @@
cd /path/to/project
+Replace `/path/to/project` with the path to your project.
+
2
Start Claude Code
@@ -235,7 +237,7 @@
enhance the PR description with more context about the security improvements
-When you create a PR using `gh pr create`, the session is automatically linked to that PR. To return to it later, run `claude --from-pr 123`, replacing 123 with the PR number, or paste the PR URL into the [`/resume` picker](</docs/en/sessions#use-the-session-picker>) search.
+When you create a PR using `gh pr create`, the session is automatically linked to that PR. To find it later, run `claude --from-pr 1234` with your own PR number, which opens the session picker filtered to sessions linked to that PR, or paste the PR URL into the [`/resume` picker](</docs/en/sessions#use-the-session-picker>) search.
Review Claude’s generated PR before submitting and ask Claude to highlight potential risks or considerations.
@@ -378,6 +380,7 @@
Tips:
* File paths can be relative or absolute
+ * Type `@` to open a path suggestion menu, then press Enter or Tab to accept the highlighted path and Enter again to send the message
* @ file references add `CLAUDE.md` in the file’s directory and parent directories to context
* Directory references show file listings, not contents
* You can reference multiple files in a single message (for example, “@file1.js and @file2.js”)
@@ -457,11 +460,11 @@
Run parallel sessions with worktrees
-Work on a feature in one terminal while Claude fixes a bug in another, without the edits colliding. Each worktree is a separate checkout on its own branch.
+Work on a feature in one terminal while Claude fixes a bug in another, without the edits colliding. Each [git worktree](<https://git-scm.com/docs/git-worktree>) is a separate checkout on its own branch, created from an existing commit, so the repository needs at least one commit first.
claude --worktree feature-auth
-Run the same command with a different name in a second terminal to start an isolated parallel session. See [Worktrees](</docs/en/worktrees>) for cleanup, `.worktreeinclude`, and non-git VCS support. To monitor parallel sessions from one screen instead of separate terminals, see [background agents](</docs/en/agent-view>).
+Run the same command with a different name in a second terminal to start an isolated parallel session. In a repository with no commits, the command fails with `Failed to resolve base branch "HEAD": git rev-parse failed`. See [Worktrees](</docs/en/worktrees>) for cleanup, `.worktreeinclude`, and non-git VCS support. To monitor parallel sessions from one screen instead of separate terminals, see [background agents](</docs/en/agent-view>).
##
@@ -469,11 +472,11 @@
Plan before editing
-For changes you want to review before they touch disk, switch to plan mode. Claude reads files and proposes a plan but makes no edits until you approve.
+For changes you want to review before they touch disk, switch to plan mode. Claude reads files and proposes a plan but makes no edits until you approve. The status bar shows `⏸ plan mode on` while plan mode is active.
claude --permission-mode plan
-You can also press `Shift+Tab` mid-session to toggle into plan mode. See [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for the approval flow and editing the plan in your text editor.
+You can also press `Shift+Tab` mid-session to cycle to plan mode. The cycle runs `default` → `acceptEdits` → `plan`. See [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for the approval flow and editing the plan in your text editor.
##
--- a/context-window.md
+++ b/context-window.md
@@ -53,7 +53,7 @@
Check your own session
-The visualization uses representative numbers. To see your actual context usage at any point, run `/context` for a live breakdown by category with optimization suggestions. Run `/memory` to check which CLAUDE.md and auto memory files loaded at startup.
+The visualization uses representative numbers. To see your actual context usage at any point, run `/context` for a live breakdown by category with optimization suggestions, including which CLAUDE.md and auto memory files loaded. Run `/memory` to open and edit those files.
##
Show diff (149 lines)
--- a/corporate-launcher.md
+++ b/corporate-launcher.md
@@ -0,0 +1,146 @@
+Some organizations require every process on a workstation to start through a mandatory launcher. The launcher applies the sandbox, network controls, or credential injection that the company’s security posture depends on, and a binary that starts without it is a policy violation. `CLAUDE_CODE_PROCESS_WRAPPER` starts every process Claude Code launches from its own binary through your launcher: the background service, every session it hosts in [agent view](</docs/en/agent-view>), and Claude Code’s relaunches after an update. Set it to your launcher’s absolute path, and Claude Code runs the launcher with the Claude Code command as its arguments. A launcher that wraps the `claude` command on your `PATH` can’t reach these processes, because they start from the binary’s direct path without looking up `claude`.
+
+`CLAUDE_CODE_PROCESS_WRAPPER` requires Claude Code v2.1.208 or later. Earlier versions ignore the variable and start every process unwrapped. The equivalent [`processWrapper` setting](</docs/en/settings#available-settings>) requires v2.1.210 or later. Earlier versions ignore it as an unknown key, apply no launcher, and report no error.After deploying either form, use the Verify step to confirm the running version applies it.
+
+##
+
+
+
+What the launcher covers
+
+With `CLAUDE_CODE_PROCESS_WRAPPER` set, Claude Code starts each of the following processes through your launcher:
+
+ * The background service that `claude agents` and background sessions start on demand.
+ * The terminal host and the Claude Code session inside every agent view row, including the warm standby sessions the service keeps ready.
+ * Sessions the service respawns after an update or a crash.
+ * The relaunch Claude Code performs of itself to finish installing an update, including agent view’s restart-for-update action.
+ * The [Remote Control](</docs/en/remote-control>) worker processes the background service manages. Requires Claude Code v2.1.210 or later.
+ * The split-pane teammate sessions that [agent teams](</docs/en/agent-teams>) start in tmux or iTerm2. Teammate panes are interactive rather than background processes, but Claude Code starts them from its own binary, so the launcher covers them. Requires Claude Code v2.1.210 or later.
+
+On Windows, the variable is ignored: the launcher contract depends on `exec`, which Windows doesn’t support. A Windows machine with the variable set runs every process unwrapped and keeps working, and the only signal is a warning in the [debug log](</docs/en/troubleshooting>). If your launcher policy covers Windows, the variable doesn’t satisfy it there: count Windows machines as unwrapped when you plan the rollout.
+
+###
+
+
+
+Processes that start outside the launcher
+
+The following processes don’t start through the launcher:
+
+ * An [installed background service](</docs/en/agent-view#the-supervisor-process>) whose unit was written before the launcher was configured: `launchd` or `systemd` starts that process from its unit file. `/status` and `claude daemon status` warn while the running service and the configured launcher don’t match, and the sessions the service spawns still start through the launcher once the service restarts with the variable in its settings.
+ * A session you start yourself in a terminal, which runs however you invoked it. To cover these sessions, put a script named `claude` in a directory earlier on `PATH` that runs your launcher with the real binary; don’t replace the managed symlink. Self-spawns don’t consult `PATH`, so the two launchers never stack.
+ * The first process of a `claude-cli://` deep link, which the operating system’s protocol handler starts directly. Everything that session starts in the background afterward runs through the launcher. To close this path entirely, [prevent handler registration](</docs/en/deep-links#registration-and-supported-platforms>) with the `disableDeepLinkRegistration` setting.
+ * The relaunch that `--worktree` combined with `--tmux` performs: the terminal multiplexer starts that pane, not Claude Code’s binary.
+ * The native-messaging host that [Claude in Chrome](</docs/en/chrome>) registers: the browser starts it, not Claude Code’s binary.
+
+###
+
+
+
+Helper process names in process monitors
+
+With a launcher configured, `ps` and Activity Monitor show the versioned binary name for the background helper processes instead of Claude Code’s `claude bg-pty-host` and `claude bg-spare` labels, because the launcher’s `exec` rebuilds the argument list. The renaming is a side effect, not concealment: the processes are otherwise unchanged, and Claude Code identifies its own processes by binary path, never by display name.
+
+##
+
+
+
+Set up the launcher
+
+1
+
+Write the launcher script
+
+Create an executable script at an absolute path, such as `/opt/corp/launcher`. Claude Code runs it with the full Claude Code command as its arguments, and the script must end by calling `exec "$@"` so it replaces itself with Claude Code:
+
+ #!/bin/sh
+ # Your organization's setup: enter the sandbox, apply
+ # network controls, or inject credentials.
+ exec "$@"
+
+Make it executable with `chmod +x`. The setup portion is whatever your launcher must do before Claude Code runs; the launcher contract below lists the rules the script has to follow.
+
+If you previously replaced the `~/.local/bin/claude` symlink with your launcher, restore the original symlink in the same change. A replaced symlink makes the first wrapped session start the background service through both launchers at once, and it puts the installation into an externally managed state: `/doctor` reports it, auto-update leaves the file in place, and cleanup of old versions stays disabled until the installer manages that path again.
+
+2
+
+Set CLAUDE_CODE_PROCESS_WRAPPER in settings
+
+Set the variable in the `env` block of a settings file so the detached background service inherits it. A shell `export` isn’t enough: the background service starts on demand, outlives your shell, and never re-reads shell profiles.For one machine, add it to `~/.claude/settings.json`. To deploy it to every machine in your organization, put the same block in [managed settings](</docs/en/permissions#managed-settings>):
+
+ {
+ "env": {
+ "CLAUDE_CODE_PROCESS_WRAPPER": "/opt/corp/launcher"
+ }
+ }
+
+When more than one source sets the variable, the managed settings value overrides both `~/.claude/settings.json` and a value exported in the shell, so users can’t point self-spawns at a different launcher.The [`processWrapper` setting](</docs/en/settings#available-settings>) carries the same value as a named, top-level settings key. Set it when your organization pushes settings as individual keys rather than an `env` block. The `processWrapper` setting requires Claude Code v2.1.210 or later. The following settings file sets the same launcher through the key:
+
+ {
+ "processWrapper": "/opt/corp/launcher"
+ }
+
+`CLAUDE_CODE_PROCESS_WRAPPER` takes precedence when both are set.Because `processWrapper` is a named setting, an organization that delivers it through [remote managed settings](</docs/en/settings#settings-files>) sees it listed on the [security approval dialog](</docs/en/server-managed-settings#security-approval-dialogs>) alongside the other settings that run administrator-supplied executables.Project and local settings can’t configure the launcher. A file committed to a repository must not be able to put a binary in front of every Claude Code process on the machine, so Claude Code ignores `CLAUDE_CODE_PROCESS_WRAPPER` in `.claude/settings.json` or `.claude/settings.local.json` with a warning in the [debug log](</docs/en/troubleshooting>), and never reads the `processWrapper` key from those files.
+
+3
+
+Restart the background service and your sessions
+
+A running background service and any open `claude` sessions read the variable once at startup, so they keep launching unwrapped processes until restarted. Run `claude daemon stop --any` to stop the on-demand service; the next command that needs it, such as `claude agents`, starts a wrapped one. An [installed service](</docs/en/agent-view#the-supervisor-process>) takes `claude daemon stop` without `--any`. Then restart your open `claude` sessions.On machines you can’t restart by hand, the first session started after the settings push retires a leftover unwrapped on-demand service automatically. A machine where no new session starts keeps its unwrapped service until one does, and an installed service always needs the restart in this step.
+
+4
+
+Verify
+
+Run `/status` in a session: the Self-exec entry shows the resolved launch command and warns when the running background service doesn’t match it. `claude daemon status` prints the same information from the shell, including after you unset the variable, when `/status` no longer shows the entry.
+
+##
+
+
+
+The launcher contract
+
+When the launcher can’t run, Claude Code refuses to start the process instead of starting it unwrapped. On Windows, the variable is ignored and processes start unwrapped. Claude Code holds the script to these rules:
+
+ * **End with`exec "$@"`.** A launcher that forks a child and exits leaves an orphaned Claude Code process the background service can’t track. Agent view marks such a session failed with a message naming the launcher, and the service reaps what the launcher left behind.
+ * **Don’t reorder, absorb, or prepend arguments.** The first argument is the Claude Code binary and everything after it is its argv.
+ * **Pass every inherited environment variable through to`exec`.** Adding variables, such as injected credentials, is fine; dropping inherited ones is not.
+ * The per-session authentication tokens, the model and provider selection, and `CLAUDE_CODE_PROCESS_WRAPPER` itself all travel on the inherited environment, so a launcher that rebuilds it from an allow list breaks the sessions it starts, and `/status` reports a launcher mismatch.
+ * If the launcher must enter a namespace or sandbox that resets the environment, re-export the inherited environment inside it verbatim.
+ * **Reach`exec` within about three seconds each time the launcher runs.** A cold background dispatch runs the launcher twice in series before the first byte of output, so do slow work such as a single sign-on exchange lazily or from a cache.
+ * A launcher that runs far past the budget is treated as a stalled start and restarted.
+ * **Tolerate being invoked from inside itself.** Claude Code applies the launcher to every nested self-spawn, so a launcher that acquires an exclusive resource must detect that it already holds it.
+ * **Don’t write to the terminal before Claude Code starts.** Anything printed before the `exec` is reported as the crash cause if the session dies before initializing.
+
+###
+
+
+
+Format of the launcher value
+
+`CLAUDE_CODE_PROCESS_WRAPPER` and the `processWrapper` setting take the same format. For most launchers, the value is the script’s absolute path, like `/opt/corp/launcher`. To pass your launcher arguments of its own, write them after the path. Claude Code parses the value as an argument list, not a shell command:
+
+ * Whitespace separates tokens, and double quotes group a token that contains spaces.
+ * A value that starts with `[` is read as a JSON string array, such as `["/opt/corp/launcher", "--profile", "cc"]`.
+ * Shell syntax doesn’t work: there is no variable expansion or globbing, and an unquoted operator such as `;`, `|`, `&`, or `$(` is rejected as a configuration error rather than reinterpreted.
+
+When the value can’t be used, Claude Code refuses to start the affected process and [reports the reason](</docs/en/errors#claude_code_process_wrapper-launcher-errors>).
+
+##
+
+
+
+Relationship to `CLAUDE_CODE_SHELL_PREFIX`
+
+`CLAUDE_CODE_PROCESS_WRAPPER` wraps Claude Code’s own processes and passes the command through as separate argv tokens for the launcher to `exec`. [`CLAUDE_CODE_SHELL_PREFIX`](</docs/en/env-vars>) wraps the shell commands Claude runs on your behalf, such as Bash tool calls, hooks, and the commands that start stdio MCP servers, and passes each one as a single shell-quoted string in `$1` for the wrapper to re-evaluate. A launcher written for one doesn’t work as the other.
+
+##
+
+
+
+Related resources
+
+ * [Agent view](</docs/en/agent-view>): the background sessions and supervisor process the launcher covers
+ * [Environment variables](</docs/en/env-vars>): the `CLAUDE_CODE_PROCESS_WRAPPER` reference entry
+ * [Managed settings](</docs/en/permissions#managed-settings>): deliver the `env` block across a fleet
+ * [Launcher error reference](</docs/en/errors#claude_code_process_wrapper-launcher-errors>): the refusal messages and how to recover
--- a/cost-tracking.md
+++ b/cost-tracking.md
@@ -288,7 +288,7 @@
Extend the prompt cache TTL to one hour
-Cache entries written by the SDK use a 5-minute TTL by default when you authenticate with an API key or run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. If your workload runs many short sessions against the same system prompt and context with gaps longer than 5 minutes between them, the cache expires between sessions and each new session pays full input price. To request a 1-hour TTL on cache writes, set the [`ENABLE_PROMPT_CACHING_1H`](</docs/en/env-vars>) environment variable. You can export it in your shell or container environment, or pass it through `options.env`. The following example enables 1-hour TTL for an agent running on Amazon Bedrock:
+Cache entries written by the SDK use a 5-minute TTL by default when you authenticate with an API key or run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. If your workload runs many short sessions against the same system prompt and context with gaps longer than 5 minutes between them, the cache expires between sessions and each new session pays full input price. To request a 1-hour TTL on cache writes, set the [`ENABLE_PROMPT_CACHING_1H`](</docs/en/env-vars>) environment variable. You can export it in your shell or container environment, or pass it through `options.env`. The following example enables 1-hour TTL for an agent running on Amazon Bedrock. Because it sets `CLAUDE_CODE_USE_BEDROCK`, it requires working AWS credentials for [Amazon Bedrock](</docs/en/amazon-bedrock>); without them the query fails.
Python
--- a/costs.md
+++ b/costs.md
@@ -17,11 +17,13 @@
The Session block at the top of `/usage` shows detailed token usage statistics for your current session. The dollar figure is an estimate computed locally from token counts and may differ from your actual bill. For authoritative billing, see the Usage page in the [Claude Console](<https://platform.claude.com/usage>).
Total cost: $0.55
- Total duration (API): 6m 19.7s
- Total duration (wall): 6h 33m 10.2s
+ Total duration (API): 6m 20s
+ Total duration (wall): 6h 33m 10s
Total code changes: 0 lines added, 0 lines removed
-
-On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits. It attributes recent usage to skills, subagents, plugins, and individual MCP servers, with each shown as a percentage of the total. Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. When the request for your plan limits fails, most often because the usage endpoint is rate limited, `/usage` shows the last usage bars it loaded on this machine within the past 60 minutes, along with a `Showing last-known usage` note stating how long ago that data was fetched. Press `r` to retry; a successful retry replaces the last-known bars with fresh data. Without a snapshot from the past 60 minutes, `/usage` reports that the usage endpoint is rate limited and offers the same retry shortcut. Before v2.1.208, a rate-limited request in a session that hadn’t loaded usage yet always showed the error with no bars. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the same breakdown appears in the Account & usage dialog with a Day and Week toggle. Requires Claude Code v2.1.174 or later.
+ Usage by model:
+ claude-sonnet-4-6: 1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55)
+
+These totals reset when `/clear` starts a new session, so the next session’s total cost starts at $0. Before v2.1.211, they kept accumulating across `/clear` for the lifetime of the Claude Code process. On a Pro, Max, Team, or Enterprise plan, `/usage` also shows a breakdown of what counts against your plan limits. It attributes recent usage to skills, subagents, plugins, and individual MCP servers, with each shown as a percentage of the total. Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. When the request for your plan limits fails, most often because the usage endpoint is rate limited, `/usage` shows the last usage bars it loaded on this machine within the past 60 minutes, along with a `Showing last-known usage` note stating how long ago that data was fetched. Press `r` to retry; a successful retry replaces the last-known bars with fresh data. Without a snapshot from the past 60 minutes, `/usage` reports that the usage endpoint is rate limited and offers the same retry shortcut. Before v2.1.208, a rate-limited request in a session that hadn’t loaded usage yet always showed the error with no bars. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the same breakdown appears in the Account & usage dialog with a Day and Week toggle. Requires Claude Code v2.1.174 or later.
###
@@ -29,14 +31,14 @@
Set a spend limit on Pro and Max
-On Pro and Max plans, the `/usage-credits` command opens a dialog in the CLI where you manage [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>). From the dialog you can:
+On Pro and Max plans, the `/usage-credits` command opens a dialog in the CLI where you manage [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>). The command requires signing in with your claude.ai subscription through `/login` and isn’t available with API key authentication. From the dialog you can:
* Turn on usage credits for your account
* Buy more usage credits, either a listed bundle or a custom amount
* Set, change, or remove your monthly spend limit
* Configure auto-reload, which buys more usage credits automatically when your balance falls below a threshold you set
-On Claude Code versions before v2.1.207 and on accounts where the in-CLI dialog isn’t available, `/usage-credits` opens the usage-credits billing page in your browser instead. On Team and Enterprise plans, members with billing access get the same browser page, and members without billing access send a request from the CLI asking their admin to turn on usage credits or raise the limit. Changing the monthly spend limit requires billing access on the account. If you reach the limit while you still have usage credits available, Claude Code prompts you to raise or remove it so you can continue without leaving the CLI. Amounts you type into the dialog, such as a custom purchase amount, the monthly spend limit, or the auto-reload threshold and target, must be digits, optionally followed by a period and one or two decimal digits, for example `20` or `20.50`. Any other input, including commas, shows an inline error and isn’t saved. Versions before v2.1.207 don’t show the dialog and open the billing page instead. Claude Code asks you to type `yes` to confirm every purchase and every auto-reload change, whatever the amount, and the purchase confirmation shows the post-tax total you are approving. Changing the monthly spend limit asks for the same typed confirmation only above $1,000, or above 1,000 units of a non-US-dollar billing currency. Before v2.1.208, purchases and auto-reload changes used that threshold too, so smaller amounts went through the standard dialog flow without the extra typed `yes` step. Amount fields open prefilled with a suggested value, and the first digit you type replaces the suggestion instead of appending to it. The screen that turns on usage credits opens with Cancel selected, so turning them on takes a deliberate selection rather than a stray Enter. Both require Claude Code v2.1.208 or later.
+On Claude Code versions before v2.1.207 and on accounts where the in-CLI dialog isn’t available, `/usage-credits` opens the usage-credits billing page in your browser instead. On Team and Enterprise plans, members with billing access get the same browser page, and members without billing access request usage credits from their admin through the CLI. Because that request notifies your organization’s admins, the CLI asks for confirmation before sending it. Select **Send request** to ask your admin to turn on usage credits or raise the limit, or cancel to send nothing; canceling reports `No request sent to your admin.` The confirmation appears only in interactive sessions, so in non-interactive mode with the `-p` flag and from [Remote Control](</docs/en/remote-control>), `/usage-credits` doesn’t send a request and instead tells you to run the command in an interactive session. Before v2.1.211, Claude Code sent the request as soon as you ran the command, without a confirmation step. Changing the monthly spend limit requires billing access on the account. If you reach the limit while you still have usage credits available, Claude Code prompts you to raise or remove it so you can continue without leaving the CLI. Amounts you type into the dialog, such as a custom purchase amount, the monthly spend limit, or the auto-reload threshold and target, must be digits, optionally followed by a period and one or two decimal digits, for example `20` or `20.50`. Any other input, including commas, shows an inline error and isn’t saved. Versions before v2.1.207 don’t show the dialog and open the billing page instead. Claude Code asks you to type `yes` to confirm every purchase and every auto-reload change, whatever the amount, and the purchase confirmation shows the post-tax total you are approving. Changing the monthly spend limit asks for the same typed confirmation only above $1,000, or above 1,000 units of a non-US-dollar billing currency. Before v2.1.208, purchases and auto-reload changes used that threshold too, so smaller amounts went through the standard dialog flow without the extra typed `yes` step. Amount fields open prefilled with a suggested value, and the first digit you type replaces the suggestion instead of appending to it. The screen that turns on usage credits opens with Cancel selected, so turning them on takes a deliberate selection rather than a stray Enter. Both require Claude Code v2.1.208 or later.
##
@@ -157,7 +159,7 @@
Use `/usage` to check your current token usage, or [configure your status line](</docs/en/statusline#context-window-usage>) to display it continuously.
* **Clear between tasks** : Use `/clear` to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message. Use `/rename` before clearing so you can easily find the session later, then `/resume` to return to it.
- * **Add custom compaction instructions** : `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization.
+ * **Add custom compaction instructions** : `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization. In a fresh session, `/compact` prints `Not enough messages to compact.` because there’s no conversation history to summarize yet.
You can also customize compaction behavior in your CLAUDE.md file at the root of your project:
@@ -236,6 +238,8 @@
echo "{}"
fi
+To verify the setup, run `/hooks` and check that the hook appears under PreToolUse. You can also start Claude Code with `claude --debug` and run a test command such as `npm test`. The debug log shows `modified tool input keys: [command]` when the hook rewrites the command.
+
###
@@ -284,7 +288,7 @@
For longer or more complex work, these habits help avoid wasted tokens from going down the wrong path:
- * **Use plan mode for complex tasks** : Press Shift+Tab to enter [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) before implementation. Claude explores the codebase and proposes an approach for your approval, preventing expensive re-work when the initial direction is wrong.
+ * **Use plan mode for complex tasks** : Press Shift+Tab to cycle to [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) before implementation. Claude explores the codebase and proposes an approach for your approval, preventing expensive re-work when the initial direction is wrong.
* **Course-correct early** : If Claude starts heading the wrong direction, press Escape to stop immediately. Use `/rewind` or double-tap Escape to restore conversation and code to a previous checkpoint.
* **Give verification targets** : Include test cases, paste screenshots, or define expected output in your prompt. When Claude can verify its own work, it catches issues before you need to request fixes.
* **Test incrementally** : Write one file, test it, then continue. This catches issues early when they’re cheap to fix.
Show diff (130 lines)
--- a/custom-tools.md
+++ b/custom-tools.md
@@ -292,6 +292,9 @@
async def get_temperature(args):
return {"content": [{"type": "text", "text": "..."}]}
+ import { tool } from "@anthropic-ai/claude-agent-sdk";
+ import { z } from "zod";
+
tool(
"get_temperature",
"Get the current temperature at a location",
@@ -360,6 +363,8 @@
import json
import httpx
from typing import Any
+
+ from claude_agent_sdk import tool
@tool(
"fetch_data",
@@ -393,6 +398,9 @@
"is_error": True,
}
+ import { tool } from "@anthropic-ai/claude-agent-sdk";
+ import { z } from "zod";
+
tool(
"fetch_data",
"Fetch data from an API",
@@ -471,6 +479,8 @@
import base64
import httpx
+ from claude_agent_sdk import tool
+
# Define a tool that fetches an image from a URL and returns it to Claude
@tool("fetch_image", "Fetch an image from a URL and return it to Claude", {"url": str})
async def fetch_image(args):
@@ -491,6 +501,9 @@
]
}
+ import { tool } from "@anthropic-ai/claude-agent-sdk";
+ import { z } from "zod";
+
tool(
"fetch_image",
"Fetch an image from a URL and return it to Claude",
@@ -570,7 +583,7 @@
Return structured data
-`structuredContent` is an optional JSON object on the result, separate from the `content` array. Use it to return raw values that Claude can read as exact fields instead of parsing them out of a text string or image. When `structuredContent` is set, Claude receives the JSON plus any image or resource blocks from `content`. Text blocks in `content` are not forwarded, since they are assumed to duplicate the structured data. The example below renders a chart as an image block and returns the data points behind it in `structuredContent` from the same handler.
+`structuredContent` is an optional JSON object on the result, separate from the `content` array. Use it to return raw values that Claude can read as exact fields instead of parsing them out of a text string or image. When `structuredContent` is set, Claude receives the JSON plus any image or resource blocks from `content`. Text blocks in `content` are not forwarded, since they are assumed to duplicate the structured data. The example below renders a chart as an image block and returns the data points behind it in `structuredContent` from the same handler. In the snippet, `chartPngBuffer` is a `Buffer` holding the rendered PNG bytes.
TypeScript
@@ -783,13 +796,19 @@
]
for prompt in prompts:
- async for message in query(prompt=prompt, options=options):
- if isinstance(message, AssistantMessage):
- for block in message.content:
- if isinstance(block, ToolUseBlock):
- print(f"[tool call] {block.name}({block.input})")
- elif isinstance(message, ResultMessage) and message.subtype == "success":
- print(f"Q: {prompt}\nA: {message.result}\n")
+ try:
+ async for message in query(prompt=prompt, options=options):
+ if isinstance(message, AssistantMessage):
+ for block in message.content:
+ if isinstance(block, ToolUseBlock):
+ print(f"[tool call] {block.name}({block.input})")
+ elif isinstance(message, ResultMessage) and message.subtype == "success":
+ print(f"Q: {prompt}\nA: {message.result}\n")
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result. Only success
+ # results are printed above, so handle the failure here and continue with
+ # the next prompt.
+ print(f"Call failed: {error}")
asyncio.run(main())
@@ -802,22 +821,29 @@
];
for (const prompt of prompts) {
- for await (const message of query({
- prompt,
- options: {
- mcpServers: { converter: converterServer },
- allowedTools: ["mcp__converter__convert_units"]
- }
- })) {
- if (message.type === "assistant") {
- for (const block of message.message.content) {
- if (block.type === "tool_use") {
- console.log(`[tool call] ${block.name}`, block.input);
+ try {
+ for await (const message of query({
+ prompt,
+ options: {
+ mcpServers: { converter: converterServer },
+ allowedTools: ["mcp__converter__convert_units"]
+ }
+ })) {
+ if (message.type === "assistant") {
+ for (const block of message.message.content) {
+ if (block.type === "tool_use") {
+ console.log(`[tool call] ${block.name}`, block.input);
+ }
}
+ } else if (message.type === "result" && message.subtype === "success") {
+ console.log(`Q: ${prompt}\nA: ${message.result}\n`);
}
- } else if (message.type === "result" && message.subtype === "success") {
- console.log(`Q: ${prompt}\nA: ${message.result}\n`);
- }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result. Only success
+ // results are logged above, so handle the failure here and continue with
+ // the next prompt.
+ console.error(`Call failed: ${error}`);
}
}
--- a/data-usage.md
+++ b/data-usage.md
@@ -83,7 +83,7 @@
Anthropic API| Infrastructure-level disk encryption (AES-256). Enable [Zero Data Retention](</docs/en/zero-data-retention>) for no server-side persistence.
Amazon Bedrock| AES-256 with AWS-managed keys. Customer-managed keys available via AWS KMS.
Google Cloud’s Agent Platform| Google-managed encryption keys. CMEK available.
-Microsoft Foundry| Requests route to Anthropic infrastructure with AES-256 disk encryption.
+Microsoft Foundry| Depends on the deployment’s [hosting option](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>). For Hosted on Azure deployments, prompts and completions remain within Azure; only usage metadata and content flagged by Anthropic’s safety systems egress to Anthropic. For Hosted on Anthropic deployments, requests route to Anthropic infrastructure with AES-256 disk encryption.
Claude Code is built on Anthropic’s APIs. For details on API security controls, including API logging procedures, see the compliance artifacts in the [Anthropic Trust Center](<https://trust.anthropic.com>).
--- a/debug-your-config.md
+++ b/debug-your-config.md
@@ -6,11 +6,11 @@
See what loaded into context
-The `/context` command shows everything occupying the context window for the current session, broken down by category: system prompt, memory files, skills, custom subagents with the source each loaded from, MCP tools, and conversation messages. Run it first to confirm whether your `CLAUDE.md`, rules, or skill descriptions are present at all. For detail on a specific category, follow up with the dedicated command:
+The `/context` command shows everything occupying the context window for the current session, broken down by category: system prompt, system tools, MCP tools, custom subagents with the source each loaded from, memory files, skills, and conversation messages. Run it first to confirm whether your `CLAUDE.md`, rules, or skill descriptions are present at all. For detail on a specific category, follow up with the dedicated command:
Command| Shows
---|---
-`/memory`| Which `CLAUDE.md` and rules files loaded, plus auto-memory entries
+`/memory`| Memory file locations across user and project scopes with the option to open each in your editor, plus access to the auto memory folder and the auto memory toggle
`/skills`| Available skills from project, user, and plugin sources
`/hooks`| Active hook configurations
`/mcp`| Connected MCP servers and their status
@@ -19,7 +19,7 @@
`/debug [issue]`| Enables debug logging for the session and prompts Claude to diagnose using the log output and settings paths
`/status`| Active settings sources, including whether managed settings are in effect
-If a memory file is missing from `/memory`, check its location against [how CLAUDE.md files load](</docs/en/memory#how-claude-md-files-load>). Subdirectory `CLAUDE.md` files load on demand when Claude reads a file in that directory with the Read tool, not at session start. If `/memory` confirms the file loaded but Claude still isn’t following a particular instruction, the issue is likely how the instruction is written rather than whether it loaded. CLAUDE.md works well for the kinds of guidance you’d give a new teammate, such as project conventions, build commands, and where files belong. Adherence drops when an instruction is vague enough to interpret multiple ways, when two files give conflicting direction, or when the file has grown long enough that individual rules get less attention. [Write effective instructions](</docs/en/memory#write-effective-instructions>) covers the specificity, size, and structure patterns that keep adherence high.
+If a memory file is missing from the `/context` breakdown, check its location against [how CLAUDE.md files load](</docs/en/memory#how-claude-md-files-load>). Subdirectory `CLAUDE.md` files load on demand when Claude reads a file in that directory with the Read tool, not at session start. If `/context` confirms the file loaded but Claude still isn’t following a particular instruction, the issue is likely how the instruction is written rather than whether it loaded. CLAUDE.md works well for the kinds of guidance you’d give a new teammate, such as project conventions, build commands, and where files belong. Adherence drops when an instruction is vague enough to interpret multiple ways, when two files give conflicting direction, or when the file has grown long enough that individual rules get less attention. [Write effective instructions](</docs/en/memory#write-effective-instructions>) covers the specificity, size, and structure patterns that keep adherence high.
CLAUDE.md and permissions solve different problems. CLAUDE.md tells Claude how your project works so it makes good decisions. [Permissions](</docs/en/permissions>) and [hooks](</docs/en/hooks>) enforce limits regardless of what Claude decides. Use CLAUDE.md for “we do it this way here.” Use permissions or hooks for security boundaries and anything that must never happen, where you need a guarantee instead of guidance.
@@ -69,7 +69,7 @@
cd /tmp && CLAUDE_CONFIG_DIR=/tmp/claude-clean claude
-The clean session has no user or project settings, hooks, MCP servers, plugins, or memory.
+The clean session has no user or project settings, hooks, MCP servers, plugins, or memory. On the first launch, expect the first-run setup screens, starting with theme selection. If you see them, the clean configuration directory is in effect. Later launches with the same directory skip these screens because Claude Code saves onboarding state there.
* Managed settings still apply if your organization deploys them, since they live at a system path outside `~/.claude`
* On Linux and Windows, you’ll be prompted to log in again because credentials are stored under the configuration directory
--- a/deep-links.md
+++ b/deep-links.md
@@ -42,7 +42,7 @@
claude-cli://open
-Add parameters to control where the session starts and what the prompt box contains:
+To try a link without putting it on a page, paste it into your browser’s address bar or open it from the shell. Add parameters to control where the session starts and what the prompt box contains:
Parameter| Description
---|---
@@ -106,7 +106,7 @@
Open a link from the shell
-You can also open a deep link from a shell script, alias, or automation rather than by clicking it. Call your operating system’s URL-opening command with the link as the argument.
+You can also open a deep link from a shell script, alias, or automation rather than by clicking it. Call your operating system’s URL-opening command with the link as the argument. These commands rely on the handler that Claude Code registers when you send your first prompt of an interactive session on the machine.
* macOS
@@ -122,6 +122,8 @@
xdg-open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"
+On success, a new terminal window opens with Claude Code running and the prompt pre-filled. If the shell reports that `xdg-open` isn’t found, see Troubleshooting.
+
In PowerShell, `Start-Process` passes the URL to the registered handler:
Start-Process "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"
@@ -136,7 +138,7 @@
Registration and supported platforms
-Claude Code registers the `claude-cli://` handler with your operating system the first time you start an interactive session on macOS, Linux, and Windows. You do not run a separate install command. Registration writes to user-level locations only:
+Claude Code registers the `claude-cli://` handler with your operating system on macOS, Linux, and Windows when you send your first prompt of an interactive session. Starting `claude` and exiting without sending a prompt doesn’t register the handler. You don’t run a separate install command. Registration writes to user-level locations only:
Platform| Handler location
---|---
@@ -166,7 +168,15 @@
Clicking the link does nothing
-The handler likely is not registered yet. Start an interactive `claude` session once on that machine, exit, and try the link again. If you are on Linux without a desktop environment, `xdg-open` may have nothing to dispatch to.
+The handler likely isn’t registered yet. Registration happens when you send your first prompt of an interactive session, not when the session starts. Start an interactive `claude` session on that machine, send any prompt, exit, and try the link again. If you are on Linux without a desktop environment, `xdg-open` may have nothing to dispatch to.
+
+###
+
+
+
+xdg-open is not found on Linux
+
+The `xdg-open` command is part of the `xdg-utils` package, which minimal server images, containers, and WSL distributions often leave out. Install `xdg-utils` with your distribution’s package manager, for example `sudo apt install xdg-utils`, then run the command again. If the command then runs but nothing opens, `xdg-open` may have no desktop environment to dispatch to; see Clicking the link does nothing.
###
--- a/desktop.md
+++ b/desktop.md
@@ -82,7 +82,7 @@
**Auto**| `auto`| Claude executes all actions with background safety checks that verify alignment with your request. Reduces permission prompts while maintaining oversight. Appears when your account meets the availability requirements below; there is no separate Settings toggle for it.
**Bypass permissions**| `bypassPermissions`| Claude runs without permission prompts, except those forced by explicit [ask rules](</docs/en/permissions#manage-permissions>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), or safety classifiers when Claude acts on external sites; equivalent to `--dangerously-skip-permissions` in the CLI. On Pro and Max plans, enable it in your Settings → Claude Code under “Allow bypass permissions mode”; on Team and Enterprise plans there is no Settings toggle, and organization policy controls it instead. Only use this in sandboxed containers or VMs.
-Earlier versions of the Code tab labeled these modes Ask permissions, Auto accept edits, and Plan mode. The `dontAsk` permission mode is available only in the [CLI](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>). Auto mode is available to all users on the Anthropic API and requires Claude Opus 4.6 or later, or Sonnet 4.6 or later. Organization administrators can turn auto mode off with the `disableAutoMode` key in managed settings. In Enterprise deployments that route Desktop to Google Cloud’s Agent Platform, auto mode is [available by default](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), and only Claude Sonnet 5, Opus 4.7, and Opus 4.8 are supported there. Before Claude Code v2.1.207, Enterprise deployments on Google Cloud’s Agent Platform had to set `CLAUDE_CODE_ENABLE_AUTO_MODE` to enable auto mode.
+Earlier versions of the Code tab labeled these modes Ask permissions, Auto accept edits, and Plan mode. The `dontAsk` permission mode is available only in the [CLI](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>). Auto mode is available to all users on the Anthropic API and requires Claude Opus 4.6 or later, Sonnet 4.6 or later, or Fable 5. Organization administrators can turn auto mode off with the `disableAutoMode` key in managed settings. In Enterprise deployments that route Desktop to Google Cloud’s Agent Platform, auto mode is [available by default](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), and only Claude Sonnet 5, Opus 4.7, Opus 4.8, and Fable 5 are supported there. Before Claude Code v2.1.207, Enterprise deployments on Google Cloud’s Agent Platform had to set `CLAUDE_CODE_ENABLE_AUTO_MODE` to enable auto mode.
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.
@@ -440,7 +440,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. Plugins are not available for cloud or 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, but plugins declared in the repository’s `.claude/settings.json` under [`enabledPlugins`](</docs/en/settings#enabledplugins>) still load. Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins>).
###
--- a/discover-plugins.md
+++ b/discover-plugins.md
@@ -32,7 +32,7 @@
/plugin install github@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install.
+`/plugin` opens an interactive panel in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, use the [plugin browser](</docs/en/desktop#install-plugins>) in the Claude desktop app, or declare the plugin under [`enabledPlugins`](</docs/en/settings#enabledplugins>) in `.claude/settings.json` for cloud sessions. If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install.
The official marketplace is curated by Anthropic, and inclusion is at Anthropic’s discretion. The in-app submission forms add plugins to the community marketplace, not the official one. To distribute plugins independently, [create your own marketplace](</docs/en/plugin-marketplaces>) and share it with users.
--- a/env-vars.md
+++ b/env-vars.md
@@ -41,13 +41,27 @@
To set it for every session, run `setx API_TIMEOUT_MS "1200000"` and open a new terminal.
+The assignment line prints nothing on success, so confirm the variable is set by printing it in the same shell before you run `claude`:
+
+ * macOS, Linux, WSL
+
+ * Windows PowerShell
+
+ * Windows CMD
+
+ echo $API_TIMEOUT_MS
+
+ echo $env:API_TIMEOUT_MS
+
+ echo %API_TIMEOUT_MS%
+
###
In settings files
-Add variables under the `env` key in a `settings.json` file. Claude Code reads them directly from the file at startup, so they take effect no matter how `claude` was launched.
+Add variables under the `env` key in a `settings.json` file, creating the file if it doesn’t exist. Claude Code reads them directly from the file, so they take effect no matter how `claude` was launched. A running session applies new and changed values to its environment when you save the file, but a feature that reads its variables once at startup, such as [OpenTelemetry monitoring](</docs/en/monitoring-usage>), keeps its startup values until you relaunch. Removing a variable from the file doesn’t unset it in a running session; the removal takes effect the next time you launch `claude`.
~/.claude/settings.json
@@ -75,13 +89,15 @@
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, 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 environment variables at startup, so changes take effect the next time you launch `claude`.
+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.
##
Variables
+
+Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits. 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.
Variable| Purpose
---|---
@@ -216,6 +232,7 @@
`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later
`CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer
`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p`
+`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later
`CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>)
`CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read
`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>)
@@ -251,18 +268,19 @@
`CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>)
`CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting
`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells
-`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary through a wrapper executable, given as an argv prefix such as `/opt/corp/launcher`. Covers the background service that hosts [agent view](</docs/en/agent-view>) sessions, every session it spawns, and the relaunch Claude Code performs of itself to finish installing an update. The first token must be the absolute path of an executable that ends by running `exec "$@"`, and most launchers are that single path. The value is an argument list, not a shell command: whitespace separates tokens, double quotes group a path that contains spaces, and a value that starts with `[` is read as a JSON string array. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. `CLAUDE_CODE_SHELL_PREFIX` is a separate control: it wraps the shell commands Claude runs as a single quoted string, while this variable wraps Claude Code’s own processes as an argv prefix. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>)
+`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later
`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_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
`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable
`CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control
-`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling
+`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling
`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget
`CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them
`CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations
@@ -286,7 +304,6 @@
`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background
`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting
`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_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members
`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
--- a/errors.md
+++ b/errors.md
@@ -78,7 +78,9 @@
`headersHelper for MCP server '<name>' references ${user_config.*}`| Plugin errors
`would be spawned with zero tools — refusing`| Tool errors
`File is covered by a Read deny rule in your permission settings`| Tool errors
+`Error: this write left the memory index at MEMORY.md at ..., over its ... read limit`| Tool errors
`Can't open MCP settings in a background session`| Background session errors
+`This session has no saved transcript`| Background session errors
`CLAUDE_CODE_PROCESS_WRAPPER: launcher ...`| Background session errors
`Ignoring N permissions.allow entries from ... this workspace has not been trusted`| Configuration warnings
Responses seem lower quality than usual| Response quality
@@ -534,7 +536,7 @@
Failed to authenticate: OAuth session expired and could not be refreshed
-This is not the same state as OAuth token revoked or expired. Those messages report a 401 the API returned. Claude Code itself produces `Login expired` for a login it already failed to renew, so it sends no request. Sessions authenticated with an API key, [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/env-vars>), or a third-party provider don’t use the saved login and never see this message. **What to do:**
+This is not the same state as OAuth token revoked or expired. Those messages report a 401 the API returned. Claude Code itself produces `Login expired` for a login it already failed to renew, so it sends no request. Sessions authenticated with an API key, [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/env-vars>), or a third-party provider don’t use the saved login and never see this message. You can check for this state before a request fails: [`/status`](</docs/en/commands>) shows a `Login` row reading `Expired — log in again`, plus the organization and email it has saved for the expired login. The row appears only when the saved login is your active credential and can no longer be refreshed. Sessions authenticated another way don’t show the row, even if an expired login remains saved. Before v2.1.210, `/status` gave no indication in this state that a login had ever existed, because the cleared credential left it nothing to report. **What to do:**
* Run `/login` to sign in again. Retrying without signing in shows the same message on every request.
* In non-interactive mode, run `claude` in the same environment, complete `/login`, then rerun your command. For automation that can’t sign in interactively, authenticate with `ANTHROPIC_API_KEY` or [generate a long-lived token with `claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>).
@@ -1159,7 +1161,7 @@
Tool errors
-These errors come from Claude’s built-in tools refusing an input. Claude corrects most tool errors on its own; the two below need a change from you, because they come from a subagent definition or a permission rule you control.
+These errors come from Claude’s built-in tools. Claude corrects most tool errors on its own; the first two below need a change from you, because they come from a subagent definition or a permission rule you control.
###
@@ -1192,6 +1194,21 @@
* If Claude should be able to edit the file, remove or narrow the `Read` deny rule in `/permissions` or in [settings](</docs/en/settings#permission-settings>)
* If the file must stay untouched, keep the rule and add an `Edit` deny rule for the same path so the Write and NotebookEdit tools are blocked too
+###
+
+
+
+Memory index is over its read limit
+
+Claude wrote to the [auto memory](</docs/en/memory#auto-memory>) index `MEMORY.md` and left it over one of its read limits: 200 lines or 25KB. The write succeeded, but only the first 200 lines or 25KB, whichever comes first, load at the start of a session, so everything past the limit is dropped each time the index is read. Before v2.1.210, an over-limit index was silently truncated on the next load with no write-time signal.
+
+ Error: this write left the memory index at MEMORY.md at 214 lines, over its 200-line read limit. The write succeeded, but everything past the limit is silently dropped each time the index is loaded — entries at the end are already invisible to readers. Rewrite it to under 140 lines now: keep one line per entry, move detail into topic files, and merge or drop stale entries.
+
+Only the content that loads counts toward the limits. YAML frontmatter and block-level HTML comments are stripped before the index is loaded, so they’re excluded from the measurement. Before v2.1.211, Claude Code measured the raw file, and frontmatter or comments could trigger this error even when the loaded content fit. Claude Code delivers the error to Claude after the write rather than printing it as a banner in your terminal, so you may notice it only in the transcript. When Claude’s write brings the file near a limit without crossing it, Claude Code returns a milder reminder to compact the index instead of this error. **What to do:**
+
+ * Let Claude rewrite `MEMORY.md`, or ask it to: keep one line per entry, move detail into topic files, and merge or drop stale entries
+ * To trim the index yourself, see [Audit and edit your memory](</docs/en/memory#audit-and-edit-your-memory>)
+
##
@@ -1214,6 +1231,21 @@
* Use the form the message names, such as `/mcp reconnect <server>`, `/mcp enable`, or `/mcp disable`
* For sign-in and authorization flows, run the command from a regular `claude` session in a terminal
+
+###
+
+
+
+This session has no saved transcript
+
+You opened a stopped [background session](</docs/en/agent-view>) that was backgrounded from another conversation with `←` or `/background` and stopped before its first response finished. Until that first response finishes, the conversation still lives only in the session it was backgrounded from, so Claude Code refuses to start the stopped session rather than begin a blank conversation under the same session ID. The message ends with the `claude respawn` command for this session:
+
+ This session has no saved transcript — it was stopped before its first response finished. If it was backgrounded from another conversation, that one is still intact; `claude respawn <id>` starts this one fresh.
+
+Before v2.1.211, opening the stopped session silently started that blank conversation and could re-run the session’s original prompt. **What to do:**
+
+ * The conversation you backgrounded from is intact: resume it with [`claude --resume`](</docs/en/sessions>) or keep working in it
+ * To start the stopped session fresh anyway, run `claude respawn <id>` with the ID from the message
###
--- a/feature-availability.md
+++ b/feature-availability.md
@@ -85,7 +85,7 @@
[Server-managed settings](</docs/en/server-managed-settings>)| ✓ (Team and Enterprise)| ✓ (Team and Enterprise)| ✗| ✗| ✗| ✗
[Zero Data Retention](</docs/en/zero-data-retention>)| ✓ (qualified Enterprise accounts)| ✓ (qualified accounts)| See note 4| ✓ (qualified accounts)| See note 4| See note 4
1 On Google Cloud’s Agent Platform, web search is available for Claude 4 models and later.
-2 On these providers, auto mode supports only Claude Sonnet 5, Opus 4.7, and Opus 4.8. See [Auto mode configuration](</docs/en/auto-mode-config>). In v2.1.158 through v2.1.206, auto mode on these providers also required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
+2 On these providers, auto mode supports only Claude Sonnet 5, Opus 4.7, Opus 4.8, and Fable 5. See [Auto mode configuration](</docs/en/auto-mode-config>). In v2.1.158 through v2.1.206, auto mode on these providers also required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
3 Explicit intervals such as `/loop every 2 hours` work on every provider. On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, `/loop` cannot pick its own interval or supply the default maintenance prompt, so a prompt with no interval runs every 10 minutes, and `/loop` with no arguments shows the usage message. See [Scheduled tasks](</docs/en/scheduled-tasks>).
4 Subject to your agreement with the cloud provider.
5 Dashboard and API only. [Contribution metrics](</docs/en/analytics#enable-contribution-metrics>) requires a claude.ai Team or Enterprise organization.
@@ -113,7 +113,7 @@
**Not available:** all features that require a Claude subscription, plus [web search](</docs/en/tools-reference#websearch-tool-behavior>), [fast mode](</docs/en/fast-mode>), [Advisor](</docs/en/advisor>), [Channels](</docs/en/channels>), the [analytics dashboard](</docs/en/analytics>), [server-managed settings](</docs/en/server-managed-settings>), and the [`/design-sync` and `/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>)
- * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, and Opus 4.8 only
+ * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, Opus 4.8, and Fable 5 only
* [`/loop`](</docs/en/scheduled-tasks>): explicit intervals only
* [Zero Data Retention](</docs/en/zero-data-retention>): subject to your AWS agreement
@@ -129,7 +129,7 @@
* [Desktop](</docs/en/desktop>): via [managed settings](<https://claude.com/docs/third-party/claude-desktop/configuration>) or [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>)
* [Web search](</docs/en/tools-reference#websearch-tool-behavior>): Claude 4 models and later
- * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, and Opus 4.8 only
+ * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, Opus 4.8, and Fable 5 only
* [`/loop`](</docs/en/scheduled-tasks>): explicit intervals only
* [Zero Data Retention](</docs/en/zero-data-retention>): subject to your Google Cloud agreement
@@ -138,7 +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>)
- * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, and Opus 4.8 only
+ * [Auto mode](</docs/en/auto-mode-config>): Sonnet 5, Opus 4.7, Opus 4.8, 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
Show diff (153 lines)
--- a/file-checkpointing.md
+++ b/file-checkpointing.md
@@ -106,13 +106,21 @@
let sessionId: string | undefined;
// Step 2: Capture checkpoint UUID from the first user message
- for await (const message of response) {
- if (message.type === "user" && message.uuid && !checkpointId) {
- checkpointId = message.uuid;
- }
- if ("session_id" in message && !sessionId) {
- sessionId = message.session_id;
- }
+ try {
+ for await (const message of response) {
+ if (message.type === "user" && message.uuid && !checkpointId) {
+ checkpointId = message.uuid;
+ }
+ if ("session_id" in message && !sessionId) {
+ sessionId = message.session_id;
+ }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result. If the
+ // failure was an error result, sessionId and checkpointId were already
+ // captured by the loop above; connection or process failures yield no
+ // result message.
+ console.error(`Session ended with an error: ${error}`);
}
// Step 3: Later, rewind by resuming the session with an empty prompt
@@ -215,7 +223,8 @@
) as client:
await client.query("") # Empty prompt to open the connection
async for message in client.receive_response():
- await client.rewind_files(checkpoint_id)
+ if checkpoint_id:
+ await client.rewind_files(checkpoint_id)
break
const rewindQuery = query({
@@ -224,7 +233,9 @@
});
for await (const msg of rewindQuery) {
- await rewindQuery.rewindFiles(checkpointId);
+ if (checkpointId) {
+ await rewindQuery.rewindFiles(checkpointId);
+ }
break;
}
@@ -409,17 +420,25 @@
const checkpoints: Checkpoint[] = [];
let sessionId: string | undefined;
- for await (const message of response) {
- if (message.type === "user" && message.uuid) {
- checkpoints.push({
- id: message.uuid,
- description: `After turn ${checkpoints.length + 1}`,
- timestamp: new Date()
- });
- }
- if ("session_id" in message && !sessionId) {
- sessionId = message.session_id;
- }
+ try {
+ for await (const message of response) {
+ if (message.type === "user" && message.uuid) {
+ checkpoints.push({
+ id: message.uuid,
+ description: `After turn ${checkpoints.length + 1}`,
+ timestamp: new Date()
+ });
+ }
+ if ("session_id" in message && !sessionId) {
+ sessionId = message.session_id;
+ }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result. If the
+ // failure was an error result, sessionId and the checkpoints array were
+ // already populated by the loop above; connection or process failures
+ // yield no result message.
+ console.error(`Session ended with an error: ${error}`);
}
// Later: rewind to any checkpoint by resuming the session
@@ -586,15 +605,23 @@
options: opts
});
- for await (const message of response) {
- // Capture the first user message UUID - this is our restore point
- if (message.type === "user" && message.uuid && !checkpointId) {
- checkpointId = message.uuid;
- }
- // Capture the session ID so we can resume later
- if ("session_id" in message) {
- sessionId = message.session_id;
- }
+ try {
+ for await (const message of response) {
+ // Capture the first user message UUID - this is our restore point
+ if (message.type === "user" && message.uuid && !checkpointId) {
+ checkpointId = message.uuid;
+ }
+ // Capture the session ID so we can resume later
+ if ("session_id" in message) {
+ sessionId = message.session_id;
+ }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result. If the
+ // failure was an error result, checkpointId and sessionId were already
+ // captured by the loop above; connection or process failures yield no
+ // result message.
+ console.error(`Session ended with an error: ${error}`);
}
console.log("Done! Open utils.ts to see the added doc comments.\n");
@@ -740,7 +767,8 @@
) as client:
await client.query("")
async for message in client.receive_response():
- await client.rewind_files(checkpoint_id)
+ if checkpoint_id:
+ await client.rewind_files(checkpoint_id)
break
// Resume session with empty prompt, then rewind
@@ -749,9 +777,17 @@
options: { ...opts, resume: sessionId }
});
- for await (const msg of rewindQuery) {
- await rewindQuery.rewindFiles(checkpointId);
- break;
+ try {
+ for await (const msg of rewindQuery) {
+ if (checkpointId) {
+ await rewindQuery.rewindFiles(checkpointId);
+ }
+ break;
+ }
+ } catch (error) {
+ // An error here means the rewind didn't complete, for example the checkpoint
+ // wasn't found or the session couldn't be resumed.
+ console.error(`Rewind session ended with an error: ${error}`);
}
##
--- a/fullscreen.md
+++ b/fullscreen.md
@@ -92,7 +92,7 @@
export CLAUDE_CODE_SCROLL_SPEED=3
-A value of `3` matches the default in `vim` and similar applications. The setting accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. To adjust scroll speed interactively, run `/scroll-speed`. The dialog shows a ruler you can scroll while it is open so you can feel the change immediately. Press `←` and `→` to adjust, `r` to reset to the auto-detected default, and `Enter` to save. The command writes the same value the `CLAUDE_CODE_SCROLL_SPEED` environment variable sets, persisted to `~/.claude/settings.json`. The command isn’t available in the JetBrains IDE terminal. Separately from the base speed, Claude Code accelerates the scroll rate when you spin the wheel quickly, so a fast spin covers more distance than the same number of slow notches. To turn acceleration off and keep a constant rate per notch, set `wheelScrollAccelerationEnabled` to `false` in [`settings.json`](</docs/en/settings#available-settings>). This setting requires Claude Code v2.1.174 or later.
+A value of `3` matches the default in `vim` and similar applications. The setting accepts any positive value up to 20, including fractional values below 1 such as `0.25` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. To adjust scroll speed interactively, run `/scroll-speed`. The dialog shows a ruler you can scroll while it is open so you can feel the change immediately. Press `←` and `→` to adjust the speed, `r` to reset to the auto-detected default, and `Enter` to save. The dialog steps in whole numbers up to 10, and on terminals that support finer control it also offers quarter steps down to 0.25. Quarter steps require Claude Code v2.1.172 or later. The command writes the same value the `CLAUDE_CODE_SCROLL_SPEED` environment variable sets, persisted to `~/.claude/settings.json`. The dialog’s maximum is 10: if you set a higher value through the environment variable, the dialog shows 10, and saving from the dialog persists 10. The command isn’t available in the JetBrains IDE terminal. Separately from the base speed, Claude Code accelerates the scroll rate when you spin the wheel quickly, so a fast spin covers more distance than the same number of slow notches. To turn acceleration off and keep a constant rate per notch, set `wheelScrollAccelerationEnabled` to `false` in [`settings.json`](</docs/en/settings#available-settings>). This setting requires Claude Code v2.1.174 or later.
###
@@ -116,6 +116,7 @@
`n` / `N`| Jump to next or previous match. Works after you’ve closed the search bar
`j` / `k` or `↑` / `↓`| Scroll one line
`g` / `G` or `Home` / `End`| Jump to top or bottom
+`{` / `}`| Jump to the previous or next prompt
`Ctrl+u` / `Ctrl+d`| Scroll half a page
`Ctrl+b` / `Ctrl+f` or `Space` / `b`| Scroll a full page
`Ctrl+o`, `Esc`, or `q`| Exit transcript mode and return to the prompt
@@ -201,4 +202,4 @@
Research preview
-Fullscreen rendering is a research preview feature. It has been tested on common terminal emulators, but you may encounter rendering issues on less common terminals or unusual configurations. If you encounter a problem, run `/feedback` inside Claude Code to report it, or open an issue on the [claude-code GitHub repo](<https://github.com/anthropics/claude-code/issues>). Include your terminal emulator name and version. To turn fullscreen rendering off, run `/tui default`, or unset `CLAUDE_CODE_NO_FLICKER` if you enabled it that way. To force the classic renderer regardless of the saved `tui` setting, set `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1`. The classic renderer keeps the conversation in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Background sessions opened from [agent view](</docs/en/agent-view>) or `claude attach` always use fullscreen rendering. The attaching terminal enters the alternate screen buffer to show the session, and the classic renderer has no scrollback or mouse handling there, so the `tui` setting and `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN` don’t apply to them.
+Fullscreen rendering is a research preview feature. It has been tested on common terminal emulators, but you may encounter rendering issues on less common terminals or unusual configurations. If you encounter a problem, run `/feedback` inside Claude Code to report it, or open an issue on the [claude-code GitHub repo](<https://github.com/anthropics/claude-code/issues>). Include your terminal emulator name and version. To turn fullscreen rendering off, run `/tui default`, or unset `CLAUDE_CODE_NO_FLICKER` if you enabled it that way. When you switch back with `/tui default`, Claude Code may first show an optional feedback prompt asking what made you switch. Type a reason and press `Enter` to send it, or press `Esc` to skip. The CLI relaunches into the classic renderer either way. To force the classic renderer regardless of the saved `tui` setting, set `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1`. The classic renderer keeps the conversation in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Background sessions opened from [agent view](</docs/en/agent-view>) or `claude attach` always use fullscreen rendering. The attaching terminal enters the alternate screen buffer to show the session, and the classic renderer has no scrollback or mouse handling there, so the `tui` setting and `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN` don’t apply to them.
--- a/github-enterprise-server.md
+++ b/github-enterprise-server.md
@@ -101,7 +101,7 @@
Developer workflow
-Once an Owner has connected the GHES instance, no developer-side configuration is needed. Claude Code detects your GHES hostname automatically from the git remote in your working directory. Clone a repository from your GHES instance as you normally would:
+Once an Owner has connected the GHES instance, no developer-side configuration is needed. Claude Code detects your GHES hostname automatically from the git remote in your working directory. Clone a repository from your GHES instance as you normally would, replacing `github.example.com` and the repository path with your GHES hostname and repository:
git clone git@github.example.com:platform/api-service.git
cd api-service
@@ -144,7 +144,7 @@
Add a GHES marketplace
-The `owner/repo` shorthand always resolves to github.com. For GHES-hosted marketplaces, use the full git URL. HTTPS URLs are recommended:
+The `owner/repo` shorthand always resolves to github.com. For GHES-hosted marketplaces, use the full git URL, replacing `github.example.com` and the repository path with your own. HTTPS URLs are recommended:
/plugin marketplace add https://github.example.com/platform/claude-plugins.git
@@ -248,6 +248,14 @@
If reviews or web sessions time out, your GHES instance may not be reachable from Anthropic infrastructure. Confirm your firewall allows inbound connections from the [Anthropic API IP addresses](<https://platform.claude.com/docs/en/api/ip-addresses>).
+###
+
+
+
+Session start fails with `Unable to get organization UUID`
+
+Web sessions require a Team or Enterprise organization. Sign in with `/login` using your organization account. If you authenticate with an API key instead, web sessions fail earlier with a message asking you to run `/login`.
+
##
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -32,7 +32,7 @@
Start Claude Code and choose Google Cloud's Agent Platform
-Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI** , the label the login prompt still uses for Google Cloud’s Agent Platform.
+Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI** , the label the login prompt still uses for Google Cloud’s Agent Platform. If you’re already signed in, run `/login` to open the same menu.
3
@@ -66,7 +66,7 @@
1\. Enable Agent Platform API
-Enable Google Cloud’s Agent Platform API in your GCP project:
+Enable Google Cloud’s Agent Platform API in your GCP project. Replace `YOUR-PROJECT-ID` with your GCP project ID here and in the configuration step below:
# Set your project ID
gcloud config set project YOUR-PROJECT-ID
@@ -103,7 +103,7 @@
Advanced credential configuration
-Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request.
+Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. Add it to your Claude Code [settings file](</docs/en/settings>), for example `~/.claude/settings.json`. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request.
{
"gcpAuthRefresh": "gcloud auth application-default login",
@@ -131,10 +131,10 @@
# export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com
# Optional: Disable prompt caching if needed
- export DISABLE_PROMPT_CACHING=1
+ # export DISABLE_PROMPT_CACHING=1
# Optional: Request 1-hour prompt cache TTL instead of the 5-minute default
- export ENABLE_PROMPT_CACHING_1H=1
+ # export ENABLE_PROMPT_CACHING_1H=1
# When CLOUD_ML_REGION=global, override region for models that don't support global endpoints
export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5
@@ -175,13 +175,23 @@
export ANTHROPIC_MODEL='claude-opus-4-8'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
+###
+
+
+
+6\. Verify your configuration
+
+Start Claude Code and run `/status` to confirm the setup. The `API provider` line shows `Google Vertex AI`, and the `GCP project`, `Default region`, and `Model` lines show your project ID, region, and resolved model. If the provider line is missing, the environment variables aren’t reaching the process. Confirm they are exported in the shell where you launched `claude`, or set them in the `env` block of your [settings file](</docs/en/settings>).
+
##
Startup model checks
-When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent.
+When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize.
+
+Before v2.1.211, Claude Code checked the default model’s availability even when a session model was explicitly configured, and could show a fallback notice for a default the session didn’t use.
##
--- a/headless.md
+++ b/headless.md
@@ -74,6 +74,8 @@
As of Claude Code v2.1.128, piped stdin is capped at 10MB. If you exceed the cap, Claude Code exits with a clear error and a non-zero status. To work with larger inputs, write the content to a file and reference the file path in your prompt instead of piping it.
+If Claude Code can’t read stdin, for example because the process that started it disconnected its end, Claude Code prints a warning to stderr and continues with the prompt from the command line. Before v2.1.211, an unreadable stdin on Windows crashed the session or made it exit silently with no output.
+
###
@@ -112,7 +114,7 @@
If the value isn’t a valid JSON Schema, `claude` exits with `Error: --json-schema is not a valid JSON Schema` followed by the validator’s diagnostic. Claude Code accepts schemas that use the `format` keyword, such as `"format": "email"`, but treats `format` as an annotation and doesn’t enforce it. Before v2.1.205, Claude Code silently ignored an invalid schema and returned unstructured text, and treated any schema containing `format` as invalid.
-Use a tool like [jq](<https://jqlang.github.io/jq/>) to parse the response and extract specific fields:
+Use a tool like [jq](<https://jqlang.org/>) to parse the response and extract specific fields:
# Extract the text result
claude -p "Summarize this project" --output-format json | jq -r '.result'
@@ -133,7 +135,7 @@
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. Before v2.1.208, piping a large response could truncate the final line and omit the `result` message. The following example uses [jq](<https://jqlang.github.io/jq/>) 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. 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:
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'
--- a/hooks.md
+++ b/hooks.md
@@ -93,7 +93,7 @@
exit 0 # no decision; normal permission flow applies
fi
-Now suppose Claude Code decides to run `Bash "rm -rf /tmp/build"`. Here’s what happens:
+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
@@ -916,6 +916,8 @@
echo '{"hookSpecificOutput": {"hookEventName": "SessionStart", "reloadSkills": true}}'
+The repository URL is a placeholder; replace it with your own skills repository. With the placeholder, the clone fails and prints a `fatal:` message to stderr. Stderr from a SessionStart hook that exits 0 is informational only, so the `reloadSkills` request still applies.
+
####
@@ -968,7 +970,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. 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.
+`--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.
####
@@ -1290,7 +1292,7 @@
PreToolUse runs only when Claude calls a tool. Files you [reference with `@` in your prompt](</docs/en/common-workflows#reference-files-and-directories>) are added without any tool call: Claude Code inserts their contents while building the prompt, so no PreToolUse hook fires for them, including hooks matching `Read`. To block specific paths from `@` references, use a [`Read` deny rule](</docs/en/permissions#read-and-edit>) instead.
-Use PreToolUse decision control to allow, deny, ask, or defer the tool call.
+Use PreToolUse decision control to allow, deny, ask, or defer the tool call. An [Agent SDK callback hook](</docs/en/agent-sdk/hooks>) on `PreToolUse` that exceeds its timeout blocks the tool call, and Claude receives an error result naming the timeout. An explicit deny returned by another hook still takes precedence.
####
@@ -1444,7 +1446,7 @@
`updatedInput`| Modifies the tool’s input parameters before execution. Replaces the entire input object, so include unchanged fields alongside modified ones. Combine with `"allow"` to auto-approve, or `"ask"` to show the modified input to the user. For `"defer"`, ignored
`additionalContext`| String added to Claude’s context alongside the tool result. Ignored when `permissionDecision` is `"defer"`. See Add context for Claude
-When multiple PreToolUse hooks return different decisions, precedence is `deny` > `defer` > `ask` > `allow`. When a hook returns `"ask"`, the permission prompt displayed to the user includes a label identifying where the hook came from: for example, `[User]`, `[Project]`, `[Plugin]`, or `[Local]`. This helps users understand which configuration source is requesting confirmation.
+When multiple PreToolUse hooks return different decisions, precedence is `deny` > `defer` > `ask` > `allow`. When a hook returns `"ask"`, the permission prompt displayed to the user includes a label identifying where the hook came from: for example, `[User]`, `[Project]`, `[Plugin]`, or `[Local]`. This helps users understand which configuration source is requesting confirmation. A hook’s `"ask"` also forces a permission prompt in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>): the classifier can still deny the tool call, but it can’t approve the call silently. Before v2.1.211, the classifier could approve a Bash command running outside the [sandbox](</docs/en/sandboxing>) without showing the prompt the hook requested; the classifier still applied its own safety rules to that command, and a hook `"deny"` was always honored.
{
"hookSpecificOutput": {
@@ -1492,7 +1494,7 @@
There is no timeout or retry limit. The session remains on disk until you resume it, subject to the [`cleanupPeriodDays`](</docs/en/settings#available-settings>) retention sweep that deletes session files after 30 days by default. If the answer is not ready when you resume, the hook can return `"defer"` again and the process exits the same way. The calling process controls when to break the loop by eventually returning `"allow"` or `"deny"` from the hook. `"defer"` only works when Claude makes a single tool call in the turn. If Claude makes several tool calls at once, `"defer"` is ignored with a warning and the tool proceeds through the normal permission flow. The constraint exists because resume can only re-run one tool: there is no way to defer one call from a batch without leaving the others unresolved. If the deferred tool is no longer available when you resume, the process exits with `stop_reason: "tool_deferred_unavailable"` and `is_error: true` before the hook fires. This happens when an MCP server that provided the tool is not connected for the resumed session. The `deferred_tool_use` payload is still included so you can identify which tool went missing.
-`--resume` restores the permission mode that was active when the tool was deferred, so you don’t need to pass `--permission-mode` again. The exceptions are `plan` and `bypassPermissions`, which are never carried over. Passing `--permission-mode` explicitly on resume overrides the restored value.
+`--resume` restores the permission mode that was active when the tool was deferred, so you don’t need to pass `--permission-mode` again. The exceptions are `plan` and `bypassPermissions`, which are never carried over, and `auto`, which is restored only when your account still meets the [auto mode requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Passing `--permission-mode` explicitly on resume overrides the restored value.
###
--- a/hooks-guide.md
+++ b/hooks-guide.md
@@ -166,7 +166,7 @@
Auto-format code after edits
-Automatically run [Prettier](<https://prettier.io/>) on every file Claude edits, so formatting stays consistent without manual intervention. This hook uses the `PostToolUse` event with an `Edit|Write` matcher, so it runs only after file-editing tools. The command extracts the edited file path with [`jq`](<https://jqlang.github.io/jq/>) and passes it to Prettier. Add this to `.claude/settings.json` in your project root:
+Automatically run [Prettier](<https://prettier.io/>) on every file Claude edits, so formatting stays consistent without manual intervention. This hook uses the `PostToolUse` event with an `Edit|Write` matcher, so it runs only after file-editing tools. The command extracts the edited file path with [`jq`](<https://jqlang.org/>) and passes it to Prettier. Add this to `.claude/settings.json` in your project root:
{
"hooks": {
@@ -186,7 +186,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.
-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.github.io/jq/download/>).
+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/>).
###
--- a/hosting.md
+++ b/hosting.md
@@ -90,16 +90,24 @@
// ...
}
- from claude_agent_sdk import query, ClaudeAgentOptions
-
- async for message in query(
- prompt=user_input,
- options=ClaudeAgentOptions(
- resume=session_id, # looked up from your database by user
- session_store=session_store, # S3, Redis, Postgres, or your own adapter
- ),
- ):
- ...
+ from claude_agent_sdk import query, ClaudeAgentOptions, SessionStore
+ import asyncio
+
+ user_input: str = ...
+ session_id: str = ... # looked up from your database by user
+ session_store: SessionStore = ... # S3, Redis, Postgres, or your own adapter
+
+ async def main():
+ async for message in query(
+ prompt=user_input,
+ options=ClaudeAgentOptions(
+ resume=session_id,
+ session_store=session_store,
+ ),
+ ):
+ ...
+
+ asyncio.run(main())
See [Session storage](</docs/en/agent-sdk/session-storage>) for the full `SessionStore` interface and reference adapters.
@@ -285,19 +293,27 @@
}
from claude_agent_sdk import query, ClaudeAgentOptions
-
- async for message in query(
- prompt=prompt,
- options=ClaudeAgentOptions(
- cwd=tenant_dir,
- setting_sources=[],
- env={
- "CLAUDE_CONFIG_DIR": config_dir,
- "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
- },
- ),
- ):
- ...
+ import asyncio
+
+ prompt: str = ...
+ tenant_dir: str = ...
+ config_dir: str = ...
+
+ async def main():
+ async for message in query(
+ prompt=prompt,
+ options=ClaudeAgentOptions(
+ cwd=tenant_dir,
+ setting_sources=[],
+ env={
+ "CLAUDE_CONFIG_DIR": config_dir,
+ "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
+ },
+ ),
+ ):
+ ...
+
+ asyncio.run(main())
For per-tenant network controls, see [Secure Deployment](</docs/en/agent-sdk/secure-deployment>).
Show diff (110 lines)
--- a/interactive-mode.md
+++ b/interactive-mode.md
@@ -4,7 +4,7 @@
Keyboard shortcuts
-Keyboard shortcuts may vary by platform and terminal. In [fullscreen rendering](</docs/en/fullscreen>), press `?` in the transcript viewer to see available shortcuts there.**macOS users** : Option/Alt key shortcuts (`Alt+B`, `Alt+F`, `Alt+Y`, `Alt+M`, `Alt+P`) require configuring Option as Meta in your terminal:
+Keyboard shortcuts may vary by platform and terminal. In [fullscreen rendering](</docs/en/fullscreen>), press `?` in the transcript viewer to see available shortcuts there.**macOS users** : Option/Alt key shortcuts (`Alt+B`, `Alt+F`, `Alt+Y`, `Alt+P`) require configuring Option as Meta in your terminal:
* **iTerm2** : Settings → Profiles → Keys → General → set Left/Right Option key to “Esc+”
* **Apple Terminal** : Settings → Profiles → Keyboard → check “Use Option as Meta Key”
@@ -22,19 +22,21 @@
---|---|---
`Ctrl+C`| Interrupt, or clear input| Interrupts a running operation. If nothing is running, the first press clears the prompt input and a second press exits Claude Code
`Ctrl+X Ctrl+K`| Stop all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session. Press twice within 3 seconds to confirm| Subagent control
-`Ctrl+D`| Exit Claude Code session| EOF signal
-`Ctrl+G` or `Ctrl+X Ctrl+E`| Open in default text editor| Edit your prompt or custom response in your default text editor. `Ctrl+X Ctrl+E` is the readline-native binding. Turn on Show last response in external editor in `/config` to prepend Claude’s previous reply as `#`-commented context above your prompt; the comment block is stripped when you save
+`Ctrl+D`| Exit Claude Code session| The first press shows a confirmation hint and a second press within 800ms exits. When the prompt has text, `Ctrl+D` deletes the character after the cursor instead
+`Ctrl+G` or `Ctrl+X Ctrl+E`| Open in default text editor| Edit your prompt or custom response in your default text editor. `Ctrl+X Ctrl+E` is the readline-native binding. Turn on **Show last response in external editor** in `/config` to prepend Claude’s previous reply as `#`-commented context above your prompt; Claude Code strips the comment block when you save
`Ctrl+L`| Redraw screen| Forces a full terminal redraw. Input and conversation history are kept. Use this to recover if the display becomes garbled or partially blank
`Ctrl+O`| Toggle transcript viewer| Shows detailed tool usage and execution, with a timestamp and the model used on each assistant message. Also expands MCP calls, which collapse to a single line like “Called slack 3 times” by default
`Ctrl+R`| Reverse search command history| Search through previous commands interactively
`Ctrl+V` or `Cmd+V` (iTerm2) or `Alt+V` (Windows and WSL)| Paste image from clipboard| Inserts an `[Image #N]` chip at the cursor so you can reference it positionally in your prompt. On WSL, both `Ctrl+V` and `Alt+V` are bound; use `Alt+V` if your terminal intercepts `Ctrl+V`
`Ctrl+B`| Background running tasks| Backgrounds Bash commands and agents. Tmux users press twice
`Ctrl+T`| Toggle Claude’s task checklist| Show or hide Claude’s to-do checklist in the status area. This is not the background-task view; use [`/tasks`](</docs/en/commands>) to see running shells and subagents
+`Ctrl+S`| Stash or restore prompt| With text in the input, stashes it and clears the prompt. Pressed again on an empty prompt, restores the stashed text, cursor position, and pasted content
+`Ctrl+Z`| Suspend Claude Code| Unix only. Suspends the process to your shell; run `fg` to resume
`Left/Right arrows`| Cycle through dialog tabs| Navigate between tabs in permission dialogs and menus
`Up/Down arrows` or `Ctrl+P`/`Ctrl+N`| Move cursor or navigate command history| When the input spans more than one visual row, whether wrapped or multiline, first moves the cursor within the prompt. Once the cursor is on the first or last visual row, pressing again navigates command history. As of v2.1.169, wrapped single-line input behaves the same as multiline
`Esc`| Interrupt Claude, or close a dialog| Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far. When a dialog such as a permission prompt is open, `Esc` closes the dialog rather than interrupting Claude. Before v2.1.202, `Esc` on some dialogs interrupted Claude and left the dialog open
`Esc` \+ `Esc`| Clear input draft, or rewind| When the prompt input contains text, double `Esc` clears it and saves the draft to history so `Up` recalls it. When the input is empty, double `Esc` opens the [rewind menu](</docs/en/checkpointing>) to restore or summarize code and conversation from a previous point
-`Shift+Tab` or `Alt+M` (some configurations)| Cycle permission modes| Cycle through `default` (labeled Manual in the mode indicator), `acceptEdits`, `plan`, and any modes you have enabled, such as `auto` or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>).
+`Shift+Tab`, or `Alt+M` on Windows when the Node or Bun runtime doesn’t enable VT input mode| Cycle permission modes| Cycle through `default` (labeled Manual in the mode indicator), `acceptEdits`, `plan`, and any modes you have enabled, such as `auto` or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>).
`Option+P` (macOS) or `Alt+P` (Windows/Linux)| Switch model| Switch models without clearing your prompt
`Option+T` (macOS) or `Alt+T` (Windows/Linux)| Toggle extended thinking| Enable or disable extended thinking mode. Has no effect on Fable 5, which always uses extended thinking. As of v2.1.132 this shortcut works on macOS without configuring Option as Meta
`Option+O` (macOS) or `Alt+O` (Windows/Linux)| Toggle fast mode| Enable or disable [fast mode](</docs/en/fast-mode>)
@@ -56,6 +58,7 @@
`Alt+Y` (after `Ctrl+Y`)| Cycle paste history| After pasting, cycle through previously deleted text. Requires Option as Meta on macOS
`Alt+B`| Move cursor back one word| Word navigation. Requires Option as Meta on macOS
`Alt+F`| Move cursor forward one word| Word navigation. Requires Option as Meta on macOS
+`Ctrl+_` or `Ctrl+Shift+-`| Undo last input edit| Restores the previous input text and cursor position
###
@@ -94,6 +97,7 @@
`/` at start| Command or skill| See commands and [skills](</docs/en/skills>)
`!` at start| Shell mode| Run a command directly, add its output to the session, and have Claude respond to it
`@`| File path mention| Trigger file path autocomplete
+`?` on empty input| Toggle the shortcut help panel| Typing `?` when the input already contains text inserts the character. Before v2.1.211, an edit that left a lone `?` in the input, such as backspacing from `?x`, also toggled the panel and discarded the edit
###
@@ -101,13 +105,13 @@
Transcript viewer
-When the transcript viewer is open (toggled with `Ctrl+O`), these shortcuts are available. In [fullscreen rendering](</docs/en/fullscreen>), press `?` to show the full shortcut reference panel inside the viewer. `Ctrl+E` can be rebound via [`transcript:toggleShowAll`](</docs/en/keybindings>).
+When the transcript viewer is open (toggled with `Ctrl+O`), these shortcuts are available. Run `/tui` with no argument to check which renderer is active. In [fullscreen rendering](</docs/en/fullscreen>), press `?` to show the full shortcut reference panel inside the viewer. `Ctrl+E` can be rebound via [`transcript:toggleShowAll`](</docs/en/keybindings>).
Shortcut| Description
---|---
`?`| Toggle the keyboard shortcut help panel. Requires [fullscreen rendering](</docs/en/fullscreen>)
`{` / `}`| Jump to the previous or next user prompt, like vim paragraph motion. Requires [fullscreen rendering](</docs/en/fullscreen>)
-`Ctrl+E`| Toggle show all content
+`Ctrl+E`| Toggle show all content. Available in the default renderer only, not in [fullscreen rendering](</docs/en/fullscreen>)
`[`| Write the full conversation to your terminal’s native scrollback so `Cmd+F`, tmux copy mode, and other native tools can search it. Requires [fullscreen rendering](</docs/en/fullscreen#search-and-review-the-conversation>)
`v`| Write the conversation to a temporary file and open it in `$VISUAL` or `$EDITOR`. Requires [fullscreen rendering](</docs/en/fullscreen>)
`q`, `Ctrl+C`, `Esc`| Exit transcript view. All three can be rebound via [`transcript:exit`](</docs/en/keybindings>)
@@ -214,6 +218,8 @@
`cc`| Change line
`C`| Change to end of line
`cw`/`ce`/`cb`| Change word/to end/back
+`s`| Substitute character: delete the character under the cursor and enter INSERT mode. Requires Claude Code v2.1.211 or later
+`S`| Substitute line: clear the line and enter INSERT mode. Requires Claude Code v2.1.211 or later
`yy`/`Y`| Yank (copy) line
`yw`/`ye`/`yb`| Yank word/to end/back
`p`| Paste after cursor
@@ -286,12 +292,12 @@
Reverse search with Ctrl+R
-Press `Ctrl+R` to interactively search through your command history:
+Press `Ctrl+R` to interactively search through your command history. In [fullscreen rendering](</docs/en/fullscreen>), `Ctrl+R` opens a search dialog instead: type to filter, press `Up` and `Down` to move through matches, and press `Ctrl+S` to cycle the scope through this session, this project, and all projects. Press `Enter` or `Tab` to place a match in the prompt input, or `Esc` to cancel. The steps below describe the default inline search:
1. **Start search** : press `Ctrl+R` to activate reverse history search
2. **Type query** : enter text to search for in previous commands. The search term is highlighted in matching results
3. **Navigate matches** : press `Ctrl+R` again to cycle through older matches
- 4. **Change scope** : search defaults to prompts from all projects. Press `Ctrl+S` to cycle the scope through this session, this project, and all projects
+ 4. **Search scope** : the inline search always searches prompts from all projects
5. **Accept match** :
* Press `Tab` or `Esc` to accept the current match and continue editing
* Press `Enter` to accept and execute the command immediately
@@ -299,7 +305,7 @@
* Press `Ctrl+C` to cancel and restore your original input
* Press `Backspace` on empty search to cancel
-The search loads the 100 most recent unique prompts in the selected scope, with duplicates collapsed to the newest occurrence. Matching prompts display with the search term highlighted, so you can find and reuse previous inputs. Accepting a match or canceling the search takes effect immediately, even while Claude Code is still loading the history. Before v2.1.202, accepting or canceling during that load could report an internal error.
+The inline search scans your full prompt history, newest first, with duplicates collapsed to the newest occurrence. The fullscreen dialog lists the 100 most recent unique prompts in the selected scope. Matching prompts display with the search term highlighted, so you can find and reuse previous inputs. Accepting a match or canceling the search takes effect immediately, even while Claude Code is still loading the history. Before v2.1.202, accepting or canceling during that load could report an internal error.
##
@@ -372,7 +378,7 @@
* Press `Tab` or `Right arrow` to place the suggestion in the prompt input, then `Enter` to submit
* Start typing to dismiss it
-The suggestion runs as a background request that reuses the parent conversation’s prompt cache, so the additional cost is minimal. Claude Code skips suggestion generation when the cache is cold to avoid unnecessary cost. Suggestions are automatically skipped after the first turn of a conversation and in plan mode. In print mode they are off by default. Pass [`--prompt-suggestions`](</docs/en/cli-reference#cli-flags>) with `--output-format stream-json --verbose` to emit a `prompt_suggestion` message after each turn instead. To disable prompt suggestions entirely, set the environment variable or toggle the setting in `/config`:
+The suggestion runs as a background request that reuses the parent conversation’s prompt cache, so the additional cost is minimal. Claude Code skips suggestion generation when the cache is cold to avoid unnecessary cost. Suggestions are automatically skipped after the first turn of a conversation and in plan mode. In print mode they are off by default. Pass [`--prompt-suggestions`](</docs/en/cli-reference#cli-flags>) with `-p "<prompt>" --output-format stream-json --verbose` to emit a `prompt_suggestion` message after each turn instead. To disable prompt suggestions entirely, set the environment variable or toggle the setting in `/config`:
export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false
--- a/jetbrains.md
+++ b/jetbrains.md
@@ -95,7 +95,9 @@
1. Run `claude`
2. Enter the `/config` command
- 3. Set the diff tool to `auto` to show diffs in the IDE, or `terminal` to keep them in the terminal
+ 3. Set **Diff tool** to `auto` to show diffs in the IDE, or `terminal` to keep them in the terminal
+
+The **Diff tool** entry appears in `/config` only when Claude Code is connected to the IDE, so run `claude` from the JetBrains terminal or run [`/ide`](</docs/en/commands>) first from an external terminal. See [`diffTool`](</docs/en/settings#global-config-settings>) for the underlying setting.
###
--- a/keybindings.md
+++ b/keybindings.md
@@ -83,7 +83,7 @@
Action| Default| Description
---|---|---
`app:interrupt`| Ctrl+C| Cancel current operation
-`app:exit`| Ctrl+D| Exit Claude Code
+`app:exit`| Ctrl+D| Exit Claude Code. Press twice within 800ms to confirm
`app:redraw`| (unbound)| Force terminal redraw
`app:toggleTodos`| Ctrl+T| Toggle visibility of Claude’s to-do checklist. This is not the [`/tasks`](</docs/en/commands>) background-task view
`app:toggleTranscript`| Ctrl+O| Toggle verbose transcript
@@ -189,6 +189,8 @@
`transcript:toggleShowAll`| Ctrl+E| Toggle show all content
`transcript:exit`| q, Ctrl+C, Escape| Exit transcript view
+`transcript:toggleShowAll` applies in the default renderer only; in [fullscreen rendering](</docs/en/fullscreen>), the transcript viewer doesn’t offer a show-all toggle.
+
###
@@ -204,6 +206,8 @@
`historySearch:cancel`| Ctrl+C| Cancel search
`historySearch:execute`| Enter| Execute selected command
`historySearch:cycleScope`| Ctrl+S| Cycle scope: session, project, everywhere
+
+The `historySearch:next`, `historySearch:accept`, `historySearch:cancel`, and `historySearch:execute` defaults apply to the inline history search in the default renderer, which always searches prompts from all projects. `historySearch:cycleScope` takes effect only in [fullscreen rendering](</docs/en/fullscreen>), where `Ctrl+R` opens a search dialog instead and `Ctrl+S` cycles its scope. The dialog’s other keys are fixed and can’t be rebound: `Enter` or `Tab` places the highlighted match in the prompt input and `Esc` cancels.
###
--- a/large-codebases.md
+++ b/large-codebases.md
@@ -167,7 +167,13 @@
Block reads of generated and vendored code
-Claude’s content searches respect `.gitignore` by default, so paths already listed there, such as `node_modules/`, `dist/`, and `build/`, stay out of search results without additional configuration. For paths that are checked in, such as a vendored SDK or committed generated code, add `Read` deny rules in `permissions.deny` to block Claude from opening those files even when a search lists them. To apply these exclusions for everyone working in the repository, commit them to `.claude/settings.json`. To keep them personal, use `.claude/settings.local.json` instead. Like other project settings on this page, these files load only from your starting directory. Place them at the repository root if you start Claude there, or in each package’s `.claude/` if you start from subdirectories. To enforce the same deny rules in every session regardless of starting directory, set them in [managed settings](</docs/en/settings#settings-files>), which user and project settings cannot override. The example below blocks build artifacts and a vendored SDK:
+Claude’s content searches respect `.gitignore` by default, so paths already listed there, such as `node_modules/`, `dist/`, and `build/`, stay out of search results without additional configuration. For paths that are checked in, such as a vendored SDK or committed generated code, add `Read` deny rules in `permissions.deny` to block Claude from opening those files even when a search lists them. The deny rules can cover everyone working in the repository, only you, or every session on the machine, depending on which settings file you put them in:
+
+ * **Everyone working in the repository** : commit the rules to `.claude/settings.json`. Like other project settings on this page, that file loads only from your starting directory, so place it at the repository root if you start Claude there, or in each package’s `.claude/` if you start from subdirectories.
+ * **Yourself only** : use `.claude/settings.local.json` at the repository root, which loads in every CLI session inside the repository regardless of starting directory. Relative patterns like the example’s `Read(./vendor/**)` still [anchor at the directory you start Claude Code from](</docs/en/permissions#read-and-edit>), so if you start sessions from subdirectories, write the rules in this file as `//`-absolute paths, such as `Read(//absolute/path/to/repo/vendor/**)`. Before v2.1.211, `.claude/settings.local.json` also loaded only from the starting directory.
+ * **Everyone, enforced in every session** : set the rules in [managed settings](</docs/en/settings#settings-files>), which user and project settings cannot override.
+
+The example below blocks build artifacts and a vendored SDK:
.claude/settings.json
@@ -194,7 +200,7 @@
/plugin install typescript-lsp@claude-plugins-official
-To enable a plugin for everyone in the repository rather than installing it yourself, add it to the [`enabledPlugins` project setting](</docs/en/settings#plugin-settings>). Code intelligence plugins require the language’s language server binary on each developer’s machine. See [which binary each language requires](</docs/en/discover-plugins#code-intelligence>). Installing from the official marketplace requires network access to GitHub, where the marketplace is hosted. On a restricted network, [add the marketplace from an internal Git host or local path](</docs/en/discover-plugins#add-from-other-git-hosts>) instead. This pairs well with `claudeMdExcludes` and the `Read` deny rules above. Those keep irrelevant content out of context, and code intelligence keeps Claude from reading through what remains to locate a definition.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. To enable a plugin for everyone in the repository rather than installing it yourself, add it to the [`enabledPlugins` project setting](</docs/en/settings#plugin-settings>). Code intelligence plugins require the language’s language server binary on each developer’s machine. See [which binary each language requires](</docs/en/discover-plugins#code-intelligence>). Installing from the official marketplace requires network access to GitHub, where the marketplace is hosted. On a restricted network, [add the marketplace from an internal Git host or local path](</docs/en/discover-plugins#add-from-other-git-hosts>) instead. This pairs well with `claudeMdExcludes` and the `Read` deny rules above. Those keep irrelevant content out of context, and code intelligence keeps Claude from reading through what remains to locate a definition.
##
--- a/llm-gateway-connect.md
+++ b/llm-gateway-connect.md
@@ -21,7 +21,7 @@
Check the Status tab
-If Claude Code started a session without showing the login screen, run `/status`, open the **Status** tab, and check two lines:
+If Claude Code started a session without showing the login screen, run `/status`, which opens on the **Status** tab, and check two lines:
* `Anthropic base URL`: this line only appears when a gateway address is set. If it isn’t there, Claude Code isn’t pointed at the gateway; configure it yourself below.
* `Auth token` or `API key`: a line naming `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, or an `apiKeyHelper` confirms a gateway credential is active. A `Login method` line naming a claude.ai account instead means the credential wasn’t distributed; set it yourself.
@@ -95,7 +95,7 @@
$env:ANTHROPIC_BASE_URL = "https://llm-gateway.example.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-gateway-key"
-Shell exports apply only to that terminal session and programs started from it; an editor launched from the dock or Start menu won’t see them. To make them persist across new terminals, add the same lines to your shell profile, such as `~/.zshrc`, `~/.bashrc`, or your PowerShell `$PROFILE`, or use a settings file instead.
+Shell exports apply only to that terminal session and programs started from it. An editor launched from the dock or Start menu won’t see them. To make the values persist across new terminals, add the same lines to your shell profile, such as `~/.zshrc`, `~/.bashrc`, or your PowerShell `$PROFILE`. If you export the gateway only in your shell, it doesn’t reliably reach background agents hosted by the [supervisor](</docs/en/agent-view#how-background-sessions-are-hosted>); see [how each background session sources its gateway](</docs/en/agent-view#the-supervisor-process>). Use a settings file for any gateway that background agents must always route through.
####
@@ -103,7 +103,7 @@
Set in a settings file
-To make the configuration apply everywhere Claude Code runs without depending on your shell, set the variables in the `env` block of a [settings file](</docs/en/settings>). Settings files have different scopes:
+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
@@ -481,7 +481,7 @@
A startup warning naming two credential sources and ending in `auth may not work as expected`. Older versions show `Auth conflict: Both a token (SOURCE) and an API key (SOURCE) are set` instead.| A gateway credential and a saved login are both active; the variable is used for requests, but the stale login can cause unexpected auth behavior| Unset the variable to use the saved login, or run `/logout` to use the gateway credential
`401` errors naming an invalid or unrecognized token| The credential isn’t one the gateway issued, or it’s in a header the gateway doesn’t read| Confirm the variable matches your credential kind in the credential table, and regenerate the key at the gateway if it was revoked
`Your apiKeyHelper script is failing`| The command in the [`apiKeyHelper`](</docs/en/settings#available-settings>) setting exited with an error, timed out, or printed nothing, so requests carry a placeholder key| Run the command directly to see why it fails, and re-authenticate with your credential provider if it reports an expired session; see [the error reference](</docs/en/errors#your-apikeyhelper-script-is-failing>)
-`Unable to connect to API (ConnectionRefused)`, or `(ECONNREFUSED)` from npm installs, often after a silent pause while Claude Code [retries with backoff](</docs/en/errors#automatic-retries>)| Nothing answered at the base URL: the address is wrong, or a VPN or firewall blocks the path to the gateway| Run the curl test above, which fails immediately with the same cause, and confirm the URL and network path with your gateway team
+`Unable to connect to API (ConnectionRefused)` when nothing answers at the address, `Unable to connect to API (FailedToOpenSocket)` when the hostname doesn’t resolve, or `(ECONNREFUSED)` from npm installs, often after a silent pause while Claude Code [retries with backoff](</docs/en/errors#automatic-retries>)| Nothing answered at the base URL: the address is wrong, or a VPN or firewall blocks the path to the gateway| Run the curl test above, which fails immediately with the same cause, and confirm the URL and network path with your gateway team
`API returned an empty or malformed response (HTTP 200)`| The gateway or an intermediate proxy returned a non-API response, often an HTML error or login page| Test with the curl request above; fix the gateway route that returns non-JSON
`400` errors naming `context_management`, `Extra inputs are not permitted`, or other unrecognized fields| The gateway forwards requests to an upstream that rejects fields Claude Code sends to Anthropic-format endpoints| Set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`, which suppresses most pre-release fields; see [feature pass-through](</docs/en/llm-gateway-protocol#feature-pass-through>). Some betas aren’t gated by this flag; for those, set the matching `CLAUDE_CODE_USE_*` provider variable so Claude Code sends only what that provider accepts
`400` errors naming `thinking` or `adaptive`, such as `Input tag 'adaptive' found`| The upstream model build doesn’t accept adaptive reasoning, which Claude Code requests for Claude 4.6 and later models| Upgrade the gateway’s upstream. On Opus 4.6 and Sonnet 4.6, `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` works instead. The [model configuration](</docs/en/model-config>) capability variables apply only to the provider configurations, such as `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_VERTEX`, not behind an `ANTHROPIC_BASE_URL` gateway
--- a/mcp.md
+++ b/mcp.md
@@ -35,7 +35,7 @@
/plugin install mcp-server-dev@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. Once installed, run `/reload-plugins` to activate it in the current session.
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. Once installed, run `/reload-plugins` to activate it in the current session.
2
@@ -97,7 +97,7 @@
Option 3: Add a local stdio server
-Stdio servers run as local processes on your machine. They’re ideal for tools that need direct system access or custom scripts. Claude Code sets `CLAUDE_PROJECT_DIR` in the spawned server’s environment to the project root, so your server can resolve project-relative paths without depending on the working directory. This is the same directory hooks receive in their `CLAUDE_PROJECT_DIR` variable. Read it from inside your server process, for example `process.env.CLAUDE_PROJECT_DIR` in Node or `os.environ["CLAUDE_PROJECT_DIR"]` in Python. `CLAUDE_PROJECT_DIR` is the stable project root and doesn’t change when you add or remove working directories mid-session. A server that limits its own filesystem access to a set of allowed directories should implement the MCP `roots/list` request instead. Claude Code answers `roots/list` with the session’s launch directory plus every [additional working directory](</docs/en/permissions#working-directories>) you’ve granted with `--add-dir`, `/add-dir`, or the `additionalDirectories` setting. Claude Code sends `notifications/roots/list_changed` when that set changes. Before v2.1.203, `roots/list` returned only the launch directory and Claude Code didn’t send `notifications/roots/list_changed`. This variable is set in the server’s environment, not in Claude Code’s own environment, so referencing it via `${VAR}` expansion in a project- or user-scoped `.mcp.json` `command` or `args` requires a default such as `${CLAUDE_PROJECT_DIR:-.}`. Plugin-provided MCP configurations substitute `${CLAUDE_PROJECT_DIR}` directly and don’t need the default.
+Stdio servers run as local processes on your machine. They’re ideal for tools that need direct system access or custom scripts. Claude Code sets `CLAUDE_PROJECT_DIR` in the spawned server’s environment to the project root, so your server can resolve project-relative paths without depending on the working directory. This is the same directory hooks receive in their `CLAUDE_PROJECT_DIR` variable. Read it from inside your server process, for example `process.env.CLAUDE_PROJECT_DIR` in Node or `os.environ["CLAUDE_PROJECT_DIR"]` in Python. `CLAUDE_PROJECT_DIR` is the stable project root and doesn’t change when you add or remove working directories mid-session. A server that limits its own filesystem access to a set of allowed directories should implement the MCP `roots/list` request instead. Claude Code answers `roots/list` with the session’s launch directory plus every [additional working directory](</docs/en/permissions#working-directories>) you’ve granted with `--add-dir`, `/add-dir`, or the `additionalDirectories` setting. Claude Code sends `notifications/roots/list_changed` when that set changes. Before v2.1.203, `roots/list` returned only the launch directory and Claude Code didn’t send `notifications/roots/list_changed`. This variable is set in the server’s environment, not in Claude Code’s own environment, so referencing it via `${VAR}` expansion in the `command` or `args` of a project-scoped `.mcp.json` entry or a local- or user-scoped server entry in `~/.claude.json` requires a default such as `${CLAUDE_PROJECT_DIR:-.}`. Plugin-provided MCP configurations substitute `${CLAUDE_PROJECT_DIR}` directly and don’t need the default.
# Basic syntax
claude mcp add [options] <name> -- <command> [args...]
@@ -146,7 +146,7 @@
# (within Claude Code) Check server status
/mcp
-Project-scoped servers from `.mcp.json` that are awaiting your approval appear in `claude mcp list` as `⏸ Pending approval`. Run `claude` interactively to review and approve them. `claude mcp get <name>` shows pending servers as `⏸ Pending approval` and rejected servers as `✗ Rejected`. 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:
+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:
* your user `~/.claude/settings.json`
* managed settings
@@ -234,7 +234,10 @@
**Plugin MCP features** :
- * **Automatic lifecycle** : at session startup, servers for enabled plugins connect automatically. If you enable or disable a plugin during a session, run `/reload-plugins` to connect or disconnect its MCP servers
+ * **Automatic lifecycle** : servers connect and disconnect at these points:
+ * At session startup, servers for enabled plugins connect automatically
+ * If you enable or disable a plugin during a session, run `/reload-plugins` to connect or disconnect its MCP servers
+ * 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`
* `http`, `sse`, and `ws` servers: `url`, `headers`, and `headersHelper`. Before v2.1.195, `headersHelper` passed the placeholder through as a literal string
@@ -388,7 +391,7 @@
}
}
-If a referenced environment variable isn’t set and has no default value, Claude Code leaves the literal `${VAR}` text in the value and reports a missing-variable warning for that server. The config still loads, so set the variable or add a `:-default` fallback so the server starts with the value you intend.
+If a referenced environment variable isn’t set and has no default value, the config still loads: Claude Code reports a missing-variable warning for that server in `claude mcp list` output and uses the unexpanded `${VAR}` text as-is. Set the variable or add a `:-default` fallback so the server starts with the value you intend.
##
--- a/mcp-quickstart.md
+++ b/mcp-quickstart.md
@@ -38,7 +38,7 @@
* `claude-code-docs`: a name you make up. Calling the same server `docs` would work identically. Claude Code uses whatever name you pick to label the server’s tools in Claude’s output and to refer to the server in commands like `claude mcp remove`.
* `https://code.claude.com/docs/mcp`: the URL where the server is hosted.
-The command prints a confirmation like `Added HTTP MCP server claude-code-docs with URL: https://code.claude.com/docs/mcp to local config`. The `local config` part means the server is registered to you, in this project: if you start Claude Code in a different project, this server isn’t active there. To register a server once for all your projects, add it at user scope, covered in Change server scope.
+The command prints a confirmation like `Added HTTP MCP server claude-code-docs with URL: https://code.claude.com/docs/mcp to local config`, followed by a `File modified:` line showing the configuration file it wrote. The `local config` part means the server is registered to you, in this project: if you start Claude Code in a different project, this server isn’t active there. To register a server once for all your projects, add it at user scope, covered in Change server scope.
2
@@ -52,12 +52,14 @@
Status| Meaning
---|---
-`✓ Connected`| Ready to use. This is what you should see for `claude-code-docs`
+`✔ Connected`| Ready to use. This is what you should see for `claude-code-docs`
`! Connected · tools fetch failed`| The server connected but couldn’t list its tools. Run `claude mcp get <name>` for the error detail
`! Needs authentication`| The server is reachable but needs a browser sign-in, or a token passed with `--header`. See Connect a server that requires sign-in
-`✗ Failed to connect`| Server didn’t respond. See Troubleshooting
-`✗ Connection error`| The connection attempt threw an error. See Troubleshooting
-`⏸ Pending approval`| A project-scoped server you haven’t approved yet. See Edit .mcp.json directly
+`✘ Failed to connect`| Server didn’t respond. See Troubleshooting
+`✘ Connection error`| The connection attempt threw an error. See Troubleshooting
+`⏸ Pending approval (run `claude` to approve)`| A project-scoped server you haven’t approved yet. See Edit .mcp.json directly
+
+Some legacy Windows consoles, such as the default console on Windows 10, don’t support these Unicode glyphs and show `√` and `×` in place of `✔` and `✘`.
3
@@ -80,6 +82,8 @@
This step is optional. When you’re done experimenting, you can remove the server:
claude mcp remove claude-code-docs
+
+The command confirms with `Removed MCP server "claude-code-docs" from local config` and a `File modified:` line showing the file it updated.
Each connected server takes some space in [Claude’s context window](</docs/en/how-claude-code-works#the-context-window>) because its tool names and server instructions load into every session. Removing servers you no longer use keeps that space free.
@@ -177,7 +181,7 @@
* Everything after the `--` separator is the command Claude Code runs to start the server.
* `-y` tells `npx` to install the package without prompting.
-Playwright drives whichever Chrome is already installed on your machine. To use a different browser, append `--browser` with the browser name, for example `--browser firefox`, after `@playwright/mcp@latest`.
+The command prints a confirmation like `Added stdio MCP server playwright with command: npx -y @playwright/mcp@latest to local config`, followed by a `File modified:` line showing the configuration file it wrote.Playwright drives whichever Chrome is already installed on your machine. To use a different browser, append `--browser` with the browser name, for example `--browser firefox`, after `@playwright/mcp@latest`.
2
@@ -187,7 +191,7 @@
claude mcp list
-The first check can show `✗ Failed to connect` while `npx` downloads the package, so wait a moment and run it again.
+The first check can show `✘ Failed to connect` while `npx` downloads the package, so wait a moment and run it again. Once the download finishes, the status changes to `✔ Connected`. If it still shows `✘ Failed to connect` after a couple of retries, see Troubleshooting.
3
--- a/memory.md
+++ b/memory.md
@@ -184,7 +184,7 @@
│ ├── testing.md # Testing conventions
│ └── security.md # Security requirements
-Rules without `paths` frontmatter are loaded at launch with the same priority as `.claude/CLAUDE.md`.
+Rules without `paths` frontmatter are loaded at launch with the same priority as `.claude/CLAUDE.md`. Project rules are skipped if you exclude `project` from [`--setting-sources`](</docs/en/cli-reference>). Before v2.1.211, rules that load on demand, including path-scoped rules and rules in nested `.claude/rules/` directories, loaded even when `project` was excluded.
####
@@ -367,7 +367,7 @@
How it works
-The first 200 lines of `MEMORY.md`, or the first 25KB, whichever comes first, are loaded at the start of every conversation. Content beyond that threshold is not loaded at session start. Claude keeps `MEMORY.md` concise by moving detailed notes into separate topic files. This limit applies only to `MEMORY.md`. CLAUDE.md files are loaded in full regardless of length, though shorter files produce better adherence. Topic files like `debugging.md` or `patterns.md` are not loaded at startup. Claude reads them on demand using its standard file tools when it needs the information. Claude reads and writes memory files during your session. When you see “Writing memory” or “Recalled memory” in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`.
+The first 200 lines of `MEMORY.md`, or the first 25KB, whichever comes first, are loaded at the start of every conversation. Content beyond that threshold is not loaded at session start. Claude keeps `MEMORY.md` concise by moving detailed notes into separate topic files. After Claude writes to `MEMORY.md`, Claude Code measures the file against the 200-line and 25KB read limits. If the file is near a limit, Claude Code reminds Claude to shorten it: keep one line per entry, move detail into topic files, and merge or drop stale entries. If the file is over a limit, the write still succeeds, but Claude Code returns an [error telling Claude to rewrite the index](</docs/en/errors#memory-index-is-over-its-read-limit>), because everything past the limit is dropped on the next load. The check measures only the content that loads: YAML frontmatter and block-level HTML comments are stripped before the index is loaded, so they don’t count toward the limits. Before v2.1.211, Claude Code measured the raw file, and frontmatter or comments could trigger the error even when the loaded content fit. This limit applies only to `MEMORY.md`. CLAUDE.md files are loaded in full regardless of length, though shorter files produce better adherence. Topic files like `debugging.md` or `patterns.md` are not loaded at startup. Claude reads them on demand using its standard file tools when it needs the information. Claude reads and writes memory files during your session. When you see “Writing memory” or “Recalled memory” in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`.
###
@@ -383,7 +383,7 @@
View and edit with `/memory`
-The `/memory` command lists all CLAUDE.md, CLAUDE.local.md, and rules files loaded in your current session, lets you toggle auto memory on or off, and provides a link to open the auto memory folder. Select any file to open it in your editor. When you ask Claude to remember something, like “always use pnpm, not npm” or “remember that the API tests require a local Redis instance,” Claude saves it to auto memory. To add instructions to CLAUDE.md instead, ask Claude directly, like “add this to CLAUDE.md,” or edit the file yourself via `/memory`.
+The `/memory` command lists your CLAUDE.md, CLAUDE.local.md, and other memory file locations across user and project scopes, lets you toggle auto memory on or off, and provides an option to open the auto memory folder. Select any file to open it in your editor. To check which files actually loaded into the current session, run `/context`. When you ask Claude to remember something, like “always use pnpm, not npm” or “remember that the API tests require a local Redis instance,” Claude saves it to auto memory. To add instructions to CLAUDE.md instead, ask Claude directly, like “add this to CLAUDE.md,” or edit the file yourself via `/memory`.
##
@@ -401,7 +401,7 @@
CLAUDE.md content is delivered as a user message after the system prompt, not as part of the system prompt itself. Claude reads it and tries to follow it, but there’s no guarantee of strict compliance, especially for vague or conflicting instructions. To debug:
- * Run `/memory` to verify your CLAUDE.md and CLAUDE.local.md files are being loaded. If a file isn’t listed, Claude can’t see it.
+ * Run `/context` to verify your CLAUDE.md and CLAUDE.local.md files loaded. If a file is missing from the breakdown, Claude can’t see it. Use `/memory` to open and edit the files.
* Check that the relevant CLAUDE.md is in a location that gets loaded for your session (see Choose where to put CLAUDE.md files).
* Make instructions more specific. “Use 2-space indentation” works better than “format code nicely.”
* Look for conflicting instructions across CLAUDE.md files. If two files give different guidance for the same behavior, Claude may pick one arbitrarily.
--- a/microsoft-foundry.md
+++ b/microsoft-foundry.md
@@ -32,6 +32,7 @@
* Claude Opus
* Claude Sonnet
* Claude Haiku
+When you configure a deployment, you also choose its [hosting option](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>), which determines whether inference runs on Azure or on Anthropic infrastructure.
###
Show diff (120 lines)
--- a/migration-guide.md
+++ b/migration-guide.md
@@ -60,7 +60,7 @@
{
"dependencies": {
- "@anthropic-ai/claude-agent-sdk": "^0.2.0"
+ "@anthropic-ai/claude-agent-sdk": "^0.3.0"
}
}
@@ -74,9 +74,9 @@
**1\. Uninstall the old package:**
- pip uninstall claude-code-sdk
-
-**2\. Install the new package:**
+ pip uninstall -y claude-code-sdk
+
+If the old package isn’t installed, pip prints `WARNING: Skipping claude-code-sdk as it is not installed.` That’s expected and you can continue to the next step. **2\. Install the new package:**
pip install claude-agent-sdk
@@ -164,28 +164,32 @@
}
});
- # BEFORE (v0.0.x) - Used Claude Code's system prompt by default
- async for message in query(prompt="Hello"):
- print(message)
-
- # AFTER (v0.1.0) - Uses minimal system prompt by default
- # To get the old behavior, explicitly request Claude Code's preset:
- from claude_agent_sdk import query, ClaudeAgentOptions
-
- async for message in query(
- prompt="Hello",
- options=ClaudeAgentOptions(
- system_prompt={"type": "preset", "preset": "claude_code"} # Use the preset
- ),
- ):
- print(message)
-
- # Or use a custom system prompt:
- async for message in query(
- prompt="Hello",
- options=ClaudeAgentOptions(system_prompt="You are a helpful coding assistant"),
- ):
- print(message)
+ from claude_agent_sdk import query, ClaudeAgentOptions
+ import asyncio
+
+ async def main():
+ # BEFORE (v0.0.x) - Used Claude Code's system prompt by default
+ async for message in query(prompt="Hello"):
+ print(message)
+
+ # AFTER (v0.1.0) - Uses minimal system prompt by default
+ # To get the old behavior, explicitly request Claude Code's preset:
+ async for message in query(
+ prompt="Hello",
+ options=ClaudeAgentOptions(
+ system_prompt={"type": "preset", "preset": "claude_code"} # Use the preset
+ ),
+ ):
+ print(message)
+
+ # Or use a custom system prompt:
+ async for message in query(
+ prompt="Hello",
+ options=ClaudeAgentOptions(system_prompt="You are a helpful coding assistant"),
+ ):
+ print(message)
+
+ asyncio.run(main())
**Why this changed:** Provides better control and isolation for SDK applications. You can now build agents with custom behavior without inheriting Claude Code’s CLI-focused instructions.
@@ -219,21 +223,25 @@
});
from claude_agent_sdk import query, ClaudeAgentOptions
-
- async for message in query(
- prompt="Hello",
- options=ClaudeAgentOptions(setting_sources=[]), # No filesystem settings loaded
- ):
- print(message)
-
- # Or load only specific sources:
- async for message in query(
- prompt="Hello",
- options=ClaudeAgentOptions(
- setting_sources=["project"] # Only project settings
- ),
- ):
- print(message)
+ import asyncio
+
+ async def main():
+ async for message in query(
+ prompt="Hello",
+ options=ClaudeAgentOptions(setting_sources=[]), # No filesystem settings loaded
+ ):
+ print(message)
+
+ # Or load only specific sources:
+ async for message in query(
+ prompt="Hello",
+ options=ClaudeAgentOptions(
+ setting_sources=["project"] # Only project settings
+ ),
+ ):
+ print(message)
+
+ asyncio.run(main())
Isolation is especially important for CI/CD pipelines, deployed applications, test environments, and multi-tenant systems where local customizations should not leak in.
--- a/model-config.md
+++ b/model-config.md
@@ -65,6 +65,8 @@
Fable 5 requires Claude Code v2.1.170 or later. Older versions do not show Fable 5 in the model picker and cannot select it. Run `claude update` to upgrade. Fable 5 is not available under [zero data retention](</docs/en/zero-data-retention>), where the `/model` picker either omits it or shows it disabled.
+On the Anthropic API, the `/model` picker lists Fable 5 only after the server reports it available for your organization. When you type `/model fable`, Claude Code checks availability with the server directly, so the selection can succeed before the picker lists the entry.
+
###
@@ -83,26 +85,26 @@
* `Enter`: switch model and save as your default
* `s`: switch model for this session only
-Typing `/model <name>` directly behaves like `Enter`. A model set with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. When a model switch is requested through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. On the Anthropic API, Claude Code recognizes:
+Typing `/model <name>` directly behaves like `Enter`. A model set with `/model` in [non-interactive mode](</docs/en/headless>), with the `-p` flag, applies to the current session only and isn’t saved as your default. Project and managed settings still take precedence and reapply on the next launch. An organization default model that your admin has configured to override user selection also reapplies on the next launch. In v2.1.144 through v2.1.152, `/model` applied to the current session only and `d` in the picker saved a default. The `--model` flag and `ANTHROPIC_MODEL` environment variable apply only to the session you launch with them. To run different models in different terminals at the same time, launch each one with its own `--model` flag rather than switching with `/model`. Prices in the `/model` picker appear when Claude Code talks to the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>) that proxies it, and the price on a row is the price of the model that row selects. On [third-party providers](</docs/en/third-party-integrations>) such as Amazon Bedrock and on the [Claude apps gateway](</docs/en/claude-apps-gateway>), your provider or gateway determines what you pay, so picker rows show no price. The price is a display label only; it doesn’t affect which model a row selects or what your provider bills. Before v2.1.206, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) and gateway sessions showed Anthropic list prices, and a row could show the price of a different model than the one it selected. Resumed sessions started with `claude --resume`, `--continue`, or the `/resume` picker keep the model they were using when the transcript was saved, regardless of the current `model` setting. If the restored model has been retired or is excluded by `availableModels`, the session falls through to the normal precedence order. This prevents another session’s `/model` choice from changing the model on resume. On providers that use provider-specific deployment IDs rather than Anthropic model IDs, such as Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, the transcript model isn’t restored at all and the session resolves its model through the normal precedence order. A model you pick for the new launch with `--model` or `ANTHROPIC_MODEL` still takes precedence over the restored model. As of v2.1.195, so does an `ANTHROPIC_DEFAULT_OPUS_MODEL` family variable. When the active model at startup comes from project or managed settings rather than your own selection, the startup header shows which settings file set it. Run `/model` to override; the project or managed setting reapplies on the next launch. When a model switch is requested through the [Agent SDK](</docs/en/agent-sdk/overview>) `setModel()` method or by an app such as the [Desktop app](</docs/en/desktop>) that runs the Claude Code CLI for you, Claude Code checks that the string is one it recognizes before saving it. This check requires Claude Code v2.1.200 or later. On the Anthropic API, Claude Code recognizes:
* a model alias
* an entry from the `/model` picker
* any name that starts with `claude-`
* a value you configured yourself as a custom model option or in `modelOverrides`
-Claude Code rejects an unrecognized string with `Model "<name>" is not a recognized model id.` and the session keeps its current model, instead of saving the string and failing on the next request. See [the error reference](</docs/en/errors#model-is-not-a-recognized-model-id>) for recovery steps. The check runs only on the Anthropic API. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and behind an [LLM gateway](</docs/en/llm-gateway>) or a custom `ANTHROPIC_BASE_URL`, your provider or gateway defines the model names, so Claude Code passes any string through without checking it. The check also doesn’t cover the `--model` flag, the `ANTHROPIC_MODEL` environment variable, or the `model` setting; a mistyped value there produces [There’s an issue with the selected model](</docs/en/errors#theres-an-issue-with-the-selected-model>) on the first request instead. When the requested model has a scheduled retirement date or is automatically remapped to a newer version, Claude Code shows a warning that names the requested model. Interactive sessions show it as a startup notice. From v2.1.182, the same warning is written to stderr in [non-interactive mode](</docs/en/headless>) when using the default text output format. The check also covers a `model` set in [subagent frontmatter](</docs/en/sub-agents>). The stderr warning is suppressed for `--output-format json` and `stream-json`; read the actual model from the `modelUsage` field of the [result message](</docs/en/headless#get-structured-output>) instead. Example usage:
-
- # Start with Opus
+Claude Code rejects an unrecognized string with `Model "<name>" is not a recognized model id.` and the session keeps its current model, instead of saving the string and failing on the next request. See [the error reference](</docs/en/errors#model-is-not-a-recognized-model-id>) for recovery steps. The check runs only on the Anthropic API. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and behind an [LLM gateway](</docs/en/llm-gateway>) or a custom `ANTHROPIC_BASE_URL`, your provider or gateway defines the model names, so Claude Code passes any string through without checking it. The check also doesn’t cover the `--model` flag, the `ANTHROPIC_MODEL` environment variable, or the `model` setting; a mistyped value there produces [There’s an issue with the selected model](</docs/en/errors#theres-an-issue-with-the-selected-model>) on the first request instead. When the requested model has a scheduled retirement date or is automatically remapped to a newer version, Claude Code shows a warning that names the requested model. Interactive sessions show it as a startup notice. From v2.1.182, the same warning is written to stderr in [non-interactive mode](</docs/en/headless>) when using the default text output format. The check also covers a `model` set in [subagent frontmatter](</docs/en/sub-agents>). The stderr warning is suppressed for `--output-format json` and `stream-json`; read the actual model from the `modelUsage` field of the [result message](</docs/en/headless#get-structured-output>) instead. For example, start a session on Opus:
+
claude --model opus
- # Switch to Sonnet during session
+Then switch models from within the session:
+
/model sonnet
Example settings file:
{
"permissions": {
- ...
+ "allow": ["Bash(npm run lint)"]
},
"model": "opus"
}
@@ -136,6 +138,7 @@
* **Fallback model chains** : elements outside the allowlist are dropped
* **Plan-mode upgrades** : on the Anthropic API and Claude Platform on AWS, an upgrade such as `opusplan` to an excluded model uses the newest permitted version of the upgrade family. On providers with provider-specific model IDs, and when no version is permitted, the upgrade is skipped and planning continues on the session’s model
* **Automatic model fallback** : a fallback whose target is excluded does not run, so the flagged request ends with a refusal instead
+ * **[Auto mode classifier](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)** : the classifier’s Claude Sonnet 5 default applies only when the allowlist permits Sonnet 5. When it’s excluded, the classifier runs on the session’s model, which the allowlist already governs, or on an Opus model when the session runs on Fable 5. On providers other than the Anthropic API, that Opus fallback runs on the provider’s default Opus model without consulting the allowlist. Requires Claude Code v2.1.210 or later
* **[Fast mode](</docs/en/fast-mode>)** : enabling fast mode is refused when the model the session would run on afterward is outside the allowlist
{
@@ -320,7 +323,7 @@
"fallbackModel": ["claude-sonnet-5", "claude-haiku-4-5"]
}
-The `--fallback-model` flag takes precedence over the `fallbackModel` setting. Each element accepts a model name or alias, and `"default"` expands to the default model. Two cases cause an element to be skipped:
+The `--fallback-model` flag takes precedence over the `fallbackModel` setting. Each element accepts a model name or alias, and `"default"` expands to the default model. Claude Code doesn’t confirm the chain at startup and `/status` doesn’t display it. The notice shown when a switch happens is the first visible sign that a fallback is configured. Two cases cause an element to be skipped:
* **Unavailable model** : a model that can’t be reached, such as a retired model pinned in settings, is skipped and Claude Code continues to the next element.
* **Outside the allowlist** : an element not permitted by `availableModels` is dropped when the chain is read and never tried.
@@ -395,7 +398,7 @@
* **`--effort` flag**: launch with `claude --effort ultracode`, which starts the session at `xhigh` effort with ultracode on
* **`--settings` or an Agent SDK control request**: pass `"ultracode": true`. An [`applyFlagSettings()`](</docs/en/agent-sdk/typescript#applyflagsettings>) request also accepts `effortLevel: "ultracode"`
-Passing `ultracode` to the `--effort` flag or the Agent SDK `effortLevel` value requires Claude Code v2.1.203 or later. Before v2.1.203, `--effort ultracode` printed `Unknown --effort value 'ultracode'` and the session started at the default effort. The persisted `effortLevel` setting and the `CLAUDE_CODE_EFFORT_LEVEL` environment variable don’t accept `ultracode`. When ultracode isn’t available, for example when [workflows are turned off](</docs/en/workflows#turn-workflows-off>), `--effort ultracode` sets `xhigh` effort only.
+Passing `ultracode` to the `--effort` flag or the Agent SDK `effortLevel` value requires Claude Code v2.1.203 or later. Before v2.1.203, `--effort ultracode` printed `Unknown --effort value 'ultracode'` and the session started at the default effort. The persisted `effortLevel` setting and the `CLAUDE_CODE_EFFORT_LEVEL` environment variable don’t accept `ultracode`. When `CLAUDE_CODE_EFFORT_LEVEL` is set to a level other than `xhigh`, requests run at that level and ultracode’s workflow orchestration stays inactive. Selecting ultracode then shows a warning that the environment variable overrides effort for the session. When ultracode isn’t available, for example when [workflows are turned off](</docs/en/workflows#turn-workflows-off>), `--effort ultracode` sets `xhigh` effort only.
####
@@ -439,7 +442,7 @@
* **Settings** : set `effortLevel` to `low`, `medium`, `high`, or `xhigh` in your settings file. `max` and `ultracode` are session-only and are not accepted here
* **Skill and subagent frontmatter** : set `effort` in a [skill](</docs/en/skills#frontmatter-reference>) or [subagent](</docs/en/sub-agents#supported-frontmatter-fields>) markdown file to override the effort level when that skill or subagent runs
-The environment variable takes precedence over all other methods, then your configured level, then the model default. Frontmatter effort applies when that skill or subagent is active, overriding the session level but not the environment variable. The effort slider appears in `/model` when a supported model is selected. The current effort level is also displayed next to the logo and spinner, for example “with low effort”, so you can confirm which setting is active without opening `/model`.
+The environment variable takes precedence over all other methods, then your configured level, then the model default. Frontmatter effort applies when that skill or subagent is active, overriding the session level but not the environment variable. The `effortLevel` key in [managed settings](</docs/en/settings#settings-precedence>) is a starting default, not enforcement: users can change it for a session with `/effort` or `--effort`, and the managed value re-asserts as the default in new sessions. The effort slider appears in `/model` when a supported model is selected. The current effort level is also displayed next to the logo and spinner, for example “with low effort”, so you can confirm which setting is active without opening `/model`.
####
@@ -516,7 +519,7 @@
Add a custom model option
-Use `ANTHROPIC_CUSTOM_MODEL_OPTION` to add a single custom entry to the `/model` picker without replacing the built-in aliases. This is useful for testing model IDs that Claude Code does not list by default. For LLM gateway deployments, Claude Code can populate the picker from the gateway’s `/v1/models` endpoint when `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` is set, so this variable is needed only when discovery is disabled or does not return the model you want. See [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>). This example sets all three variables to make a gateway-routed Opus deployment selectable:
+Use `ANTHROPIC_CUSTOM_MODEL_OPTION` to add a single custom entry to the `/model` picker without replacing the built-in aliases. This is useful for testing model IDs that Claude Code does not list by default. For LLM gateway deployments, Claude Code can populate the picker from the gateway’s `/v1/models` endpoint when `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` is set, so this variable is needed only when discovery is disabled or does not return the model you want. See [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>). This example sets all three variables to make a gateway-routed Opus deployment selectable. Claude Code reads environment variables at startup, so run the exports before launching `claude`, or restart an existing session to pick them up:
export ANTHROPIC_CUSTOM_MODEL_OPTION="my-gateway/claude-opus-4-8"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Opus via Gateway"
@@ -548,7 +551,7 @@
Pin models for third-party deployments
-When deploying Claude Code through [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), pin model versions before rolling out to users. Without pinning, Claude Code uses model aliases such as `fable`, `opus`, `sonnet`, and `haiku` that resolve to a built-in default model ID for each provider. That default can lag the newest Anthropic release, and the model it points to may not yet be enabled in a user’s account. When the default is unavailable, Amazon Bedrock and Google Cloud’s Agent Platform users see a notice and the session falls back to an earlier version of the default model, or to the default Sonnet model when the default is an Opus model and no Opus version is available. Microsoft Foundry users see errors instead, because Microsoft Foundry has no equivalent startup check.
+When deploying Claude Code through [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), or [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), pin model versions before rolling out to users. Without pinning, Claude Code uses model aliases such as `fable`, `opus`, `sonnet`, and `haiku` that resolve to a built-in default model ID for each provider. That default can lag the newest Anthropic release, and the model it points to may not yet be enabled in a user’s account. When the default is unavailable, Amazon Bedrock and Google Cloud’s Agent Platform users see a notice and the session falls back to an earlier version of the default model, or to the default Sonnet model when the default is an Opus model and no Opus version is available. Microsoft Foundry users see errors instead, because Microsoft Foundry has no equivalent startup check. On Amazon Bedrock and Google Cloud’s Agent Platform, a user who starts the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, pins that version as the session’s default for the matching alias: the startup check skips the built-in default it replaces and shows no fallback notice. Before v2.1.211, the check ran and could show a notice even when a session model was explicitly configured.
Set the model environment variables to specific version IDs as part of your initial setup. Pinning lets you control when your users move to a new model.
--- a/network-config.md
+++ b/network-config.md
@@ -94,6 +94,32 @@
+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.
+
+###
+
+
+
+Set network variables in settings, not the shell
+
+The supervisor is one process shared by every terminal. It inherits the environment of whichever shell starts it first, and an OS-installed supervisor receives no shell environment at all. If you export a proxy, CA path, or mTLS variable only in your shell, it reaches background agents when that shell happened to cold-start the supervisor, and silently doesn’t when a different shell did. Put the same variables in the `env` block of `~/.claude/settings.json` or [managed settings](</docs/en/settings>) instead. Every variable on this page can be set there, and settings are the only configuration that reaches every background session on every machine.
+
+###
+
+
+
+Configure a corporate launcher as a setting
+
+Some organizations require every Claude Code process to start through a corporate launcher that applies sandboxing, network controls, or credential injection. The supervisor and its workers start Claude Code from a fixed path rather than by looking up `claude` on `PATH`, so every background agent bypasses a wrapper you place earlier on `PATH`. Set the [`processWrapper`](</docs/en/settings#available-settings>) setting to prefix the supervisor, its workers, and the other background processes listed under [What the launcher covers](</docs/en/corporate-launcher#what-the-launcher-covers>) with your launcher. The equivalent [`CLAUDE_CODE_PROCESS_WRAPPER`](</docs/en/env-vars>) environment variable takes precedence when both are set, and it is subject to the same rule: deliver it through managed settings or `~/.claude/settings.json`, not a shell export. [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) covers the contract the launcher must satisfy, what it does and doesn’t reach, and how to roll it out.
+
+An already-running supervisor keeps the launch configuration it started with. After deploying the launcher setting, run [`claude daemon stop --any`](</docs/en/agent-view#the-supervisor-process>) so the next `claude agents` or `--bg` starts a supervisor that honors it. An installed service takes `claude daemon stop` without `--any`.
+
+##
+
+
+
Network access requirements
Claude Code requires access to the following URLs. Allowlist these in your proxy configuration and firewall rules, especially in containerized or restricted network environments.
Show diff (114 lines)
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -40,14 +40,14 @@
**During a session** : press `Shift+Tab` to cycle `default` → `acceptEdits` → `plan`. The current mode appears in the status bar. Manual mode, `default` in that cycle, shows a gray `⏸ manual mode on` badge. Before v2.1.203, the status bar showed no badge in Manual mode.Not every mode is in the default cycle:
* `auto`: appears when your account meets the auto mode requirements; cycling to it switches modes without a confirmation prompt
- * `bypassPermissions`: appears after you start with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, or `--allow-dangerously-skip-permissions`; the `--allow-` variant adds the mode to the cycle without activating it
+ * `bypassPermissions`: appears after you start with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, `--allow-dangerously-skip-permissions`, or `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>); the `--allow-` variant adds the mode to the cycle without activating it
* `dontAsk`: never appears in the cycle; set it with `--permission-mode dontAsk`
Enabled optional modes slot in after `plan`, with `bypassPermissions` first and `auto` last. If you have both enabled, you will cycle through `bypassPermissions` on the way to `auto`.**At startup** : pass the mode as a flag.
claude --permission-mode plan
-**As a default** : set `defaultMode` in [settings](</docs/en/settings#settings-files>).
+**As a default** : set `defaultMode` in a [settings file](</docs/en/settings#settings-files>) such as `~/.claude/settings.json`:
{
"permissions": {
@@ -121,15 +121,14 @@
Review and approve a plan
-When the plan is ready, Claude presents it and asks how to proceed. From that prompt you can:
-
- * Approve and start in auto mode
- * Approve and accept edits
- * Approve and review each edit manually
- * Keep planning with feedback
- * Refine with [Ultraplan](</docs/en/ultraplan>) for browser-based review
-
-Approving a plan exits plan mode and switches the session to the permission mode each approve option describes, so Claude starts editing. To plan again, cycle back to plan mode with `Shift+Tab`, or prefix your next prompt with `/plan`. Press `Ctrl+G` to open the proposed plan in your default text editor and edit it directly before Claude proceeds. When [`showClearContextOnPlanAccept`](</docs/en/settings#available-settings>) is enabled, each approve option also offers to clear the planning context first. Accepting a plan also names the session from the plan content automatically, unless you’ve already set a name with `--name` or `/rename`.
+When the plan is ready, Claude presents it and asks how to proceed. From that prompt you can choose:
+
+ * **Yes, and use auto mode** : approve and start in auto mode. When auto mode is unavailable, this option reads **Yes, auto-accept edits**. Sessions started with bypass permissions enabled show **Yes, and bypass permissions** instead.
+ * **Yes, manually approve edits** : approve and review each edit individually.
+ * **No, refine with Ultraplan on Claude Code on the web** : send the plan to [Ultraplan](</docs/en/ultraplan>) for browser-based review.
+ * **No, keep planning** : stay in plan mode and tell Claude what to change.
+
+Approving a plan exits plan mode and switches the session to the permission mode each approve option describes, so Claude starts editing. To plan again, cycle back to plan mode with `Shift+Tab`, or prefix your next prompt with `/plan`. Press `Ctrl+G` to open the proposed plan in your default text editor and edit it directly before Claude proceeds. When [`showClearContextOnPlanAccept`](</docs/en/settings#available-settings>) is enabled, the list gains a first option that approves the plan and clears the planning context. Accepting a plan also names the session from the plan content automatically, unless you’ve already set a name with `--name` or `/rename`.
###
@@ -159,8 +158,8 @@
* **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.
- * **Model** : on the Anthropic API, Claude Opus 4.6 or later, or Sonnet 4.6 or later. 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, and Opus 4.8. 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, 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 until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement.
+ * **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, Opus 4.8, 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.
If Claude Code reports auto mode as unavailable, one of these requirements is unmet; this is not a transient outage. A separate message that names a model and says auto mode “cannot determine the safety” of an action is a transient classifier outage; see the [error reference](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>). If you set `defaultMode: "auto"` in [settings](</docs/en/settings#available-settings>) and the session starts in `default` mode with no error, the setting is likely in `.claude/settings.json` or `.claude/settings.local.json`. Claude Code v2.1.142 and later ignore `auto` from those files so a repository cannot grant itself auto mode. Move it to `~/.claude/settings.json`.
@@ -170,7 +169,7 @@
Auto mode on Bedrock, Agent Platform, or Foundry
-On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the mode a session starts in: sessions still start in your [`defaultMode`](</docs/en/settings#available-settings>), which is Manual unless you change it. Only Claude Sonnet 5, Opus 4.7, and Opus 4.8 are supported on these providers. To make auto mode the default starting mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). This removes `auto` from the `Shift+Tab` cycle and rejects `--permission-mode auto` at startup. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward.
+On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the mode a session starts in: sessions still start in your [`defaultMode`](</docs/en/settings#available-settings>), which is Manual unless you change it. Only Claude Sonnet 5, Opus 4.7, Opus 4.8, and Fable 5 are supported on these providers. To make auto mode the default starting mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. The [`/doctor`](</docs/en/commands#all-commands>) checkup proposes this user-settings default on these providers the same way it does on the Anthropic API. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). This removes `auto` from the `Shift+Tab` cycle and rejects `--permission-mode auto` at startup. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward.
###
@@ -188,7 +187,7 @@
* Modifying shared infrastructure
* Irreversibly destroying files that existed before the session
* Force push
- * Pushing to the repository’s default branch when the push carries sensitive content such as secrets or personal or entrusted data, carries changes concealed or misdescribed relative to what you asked for, carries content ported in or first read from outside the repository, or routes around a pull request, review, or check you asked for. A plain push to the default branch isn’t blocked on its own, and clearing a flagged push requires naming the flagged content or the bypassed review, not only the push. The classifier is one layer: [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) apply in every mode and can block pushes to the default branch outright, and the remote’s own branch protection still applies. Before v2.1.203, any direct push to the default branch was blocked
+ * Committing or pushing a change that would send secrets or sensitive data outside the repository when it runs, or widen what a deploy exposes. This covers a CI workflow or deploy configuration that hands a secret to a destination that doesn’t already receive it, a script or setup step that reads a secret store and sends the data out, and a config change that widens what a deploy publishes, such as a registry, visibility, artifact, or sourcemap setting. The check applies on any branch, applies even when the repository is public, and fires when the change lands, whether or not that landing triggers the pipeline; clearing it requires naming the execution effect, not only the commit or push. Before v2.1.211, this check was scoped to the default branch instead: a push there was blocked when it carried sensitive content, changes concealed or misdescribed relative to what you asked for, content ported in from outside the repository, or routed around a review you asked for, and before v2.1.203 any direct push to the default branch was blocked
* `git reset --hard`, `git checkout -- .`, `git restore .`, `git clean -fd`, `git stash drop`, or `git stash clear`, which the classifier presumes would discard uncommitted changes
* `git commit --amend` when the commit at HEAD was not created in this session
* From v2.1.198, `git commit --amend` when the commit at HEAD has already been pushed. A message-only reword is not blocked: `--amend -m` with nothing newly staged, on a commit that Claude created during this session
@@ -242,8 +241,7 @@
* Installing dependencies declared in your lock files or manifests
* Reading `.env` and sending credentials to their matching API
* Read-only HTTP requests
- * Pushing to the branch you started on or one Claude created
- * Routine pushes to the repository default branch. Before v2.1.203, any direct push to the default branch was blocked
+ * Pushing to any branch of the repository you’re working in, including the default branch. A non-default branch whose name marks it as a deploy or publication target, such as `production` or `gh-pages`, isn’t covered: the classifier judges a push there on its own terms. The push’s content is still checked against the other rules, [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) can still block pushes to specific branches outright in every mode, and the remote’s own branch protection still applies. Before v2.1.211, only pushes to the branch you started on, branches Claude created, and routine pushes to the default branch were allowed by default, and before v2.1.203 any direct push to the default branch was blocked
Claude Code v2.1.195 and later also allow these by default:
@@ -260,7 +258,7 @@
* In [non-interactive mode](</docs/en/headless>) and Agent SDK sessions there is no turn boundary, so a deny is reused for the rest of the run
* Changing your permission mode or rules drops all cached verdicts
-Run `claude auto-mode defaults` to see the full rule lists. If routine actions get blocked, an administrator can add trusted repos, buckets, and services via the `autoMode.environment` setting: see [Configure auto mode](</docs/en/auto-mode-config>). Pushing to your working branch, making a routine push to the repository default branch, and creating a pull request that matches your request all run without a prompt. The classifier blocks a push only when it carries risk, such as a force push or content that routes around a review you set up. To require a human checkpoint before these actions while staying in auto mode, add `permissions.ask` rules: see [Common boundaries](</docs/en/auto-mode-config#common-boundaries>).
+Run `claude auto-mode defaults` to print the full rule lists as JSON. If routine actions get blocked, an administrator can add trusted repos, buckets, and services via the `autoMode.environment` setting: see [Configure auto mode](</docs/en/auto-mode-config>). Pushing to any branch of the repository you’re working in and creating a pull request that matches your request run without a prompt, with the two exceptions the lists above cover: the classifier judges a push to a deploy-named branch such as `production` or `gh-pages` on its own terms, and still blocks a push whose content carries risk. To require a human checkpoint before these actions while staying in auto mode, add `permissions.ask` rules: see [Common boundaries](</docs/en/auto-mode-config#common-boundaries>).
###
@@ -308,7 +306,7 @@
Cost and latency
-The classifier runs on a server-configured model that is independent of your `/model` selection, so switching models does not change classifier availability. Classifier calls count toward your token usage. Each check sends a portion of the transcript plus the pending action, adding a round-trip before execution. Reads and working-directory edits outside protected paths skip the classifier, so the overhead comes mainly from shell commands and network operations. As of v2.1.198, a sandbox network verdict for a host and port is reused instead of re-classified on every connection, so repeated connections to the same host don’t each add a check. What the classifier blocks by default describes how long an allow and a deny last.
+The classifier runs on Claude Sonnet 5 by default rather than on your `/model` selection. A classifier model that Anthropic configures server-side takes precedence over that default. When your session’s model is Claude Sonnet 4.6, or when [`availableModels`](</docs/en/model-config#restrict-model-selection>) excludes Sonnet 5, the classifier runs on the session’s model instead, or on an Opus model when the session runs on [Fable 5](</docs/en/model-config#work-with-fable-5>); on providers other than the Anthropic API, that Opus fallback is the provider’s default Opus model.The session’s first auto-mode request validates the Sonnet 5 default: if the request succeeds, Sonnet 5 stays the session’s classifier model, and if it fails because the model isn’t available, the session uses the fallback instead. After that validation settles, the classifier’s model doesn’t change for the session.Classifier calls count toward your token usage. Each check sends a portion of the transcript plus the pending action, adding a round-trip before execution. Reads and working-directory edits outside protected paths skip the classifier, so the overhead comes mainly from shell commands and network operations.The classifier reuses a sandbox network verdict for a host and port, so repeated connections to the same host don’t each add a check. What the classifier blocks by default describes how long an allow and a deny last.
##
@@ -330,11 +328,11 @@
Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.
-You cannot enter `bypassPermissions` from a session that was started without one of the enabling flags; restart with one to enable it:
+You can’t enter `bypassPermissions` from a session that was started without it enabled. Enable it at launch with `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>) or with an enabling flag:
claude --permission-mode bypassPermissions
-The `--dangerously-skip-permissions` flag is equivalent. On Linux and macOS, Claude Code refuses to start in this mode when running as root or under `sudo`:
+The `--dangerously-skip-permissions` flag is equivalent. The first time you start an interactive session with this mode enabled, Claude Code shows a warning dialog asking you to accept responsibility for actions taken without permission checks. Claude Code saves your acceptance to user settings, so the dialog appears only once. If you decline, Claude Code exits. In [non-interactive mode](</docs/en/headless>) no dialog is shown, and a [background session](</docs/en/agent-view>) started with `--bg` is refused until you’ve accepted the dialog in an interactive session. On Linux and macOS, Claude Code refuses to start in this mode when running as root or under `sudo`:
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons
--- a/permissions.md
+++ b/permissions.md
@@ -11,10 +11,10 @@
Tool type| Example| Approval required| ”Yes, don’t ask again” behavior
---|---|---|---
Read-only| File reads, Grep| No, within the working directory and additional directories| N/A
-Bash commands| Shell execution| Yes, except a built-in set of read-only commands| Permanently per project directory and command
+Bash commands| Shell execution| Yes, except a built-in set of read-only commands| Permanently per repository and command
File modification| Edit/write files| Yes| Until session end
-On a Bash or PowerShell permission prompt, press `Ctrl+E` to show an explanation of the command: what it does, why Claude is running it, and what could go wrong, labeled **Low risk** , **Med risk** , or **High risk**. Claude Code sends the command and Claude’s own description of the call to the model to generate the explanation only when you press `Ctrl+E`, not on every prompt. Showing the explanation doesn’t run the command; press `Ctrl+E` again to hide it. To turn the shortcut off, set [`permissionExplainerEnabled`](</docs/en/settings#global-config-settings>) to `false` in `~/.claude.json`.
+When you choose “Yes, don’t ask again” and the approval saves permanently, such as for a Bash command, Claude Code saves the rule to `.claude/settings.local.json` at the root of the git repository, resolved through [worktrees](</docs/en/worktrees>) to the main checkout. The rule applies to future sessions anywhere in that repository, including sessions started in subdirectories and in worktrees. A file-modification approval isn’t saved to the file: as the table shows, it lasts until the session ends. Outside a git repository, and when the repository root is your home directory, Claude Code saves the rule in the directory you started it from. Before v2.1.211, Claude Code always saved the rule in the starting directory, so an approval granted in a worktree or subdirectory didn’t apply to the rest of the repository. Rules that earlier versions saved in a subdirectory or worktree still apply to sessions started there. On a Bash or PowerShell permission prompt, press `Ctrl+E` to show an explanation of the command: what it does, why Claude is running it, and what could go wrong, labeled **Low risk** , **Med risk** , or **High risk**. Claude Code sends the command and Claude’s own description of the call to the model to generate the explanation only when you press `Ctrl+E`, not on every prompt. Showing the explanation doesn’t run the command; press `Ctrl+E` again to hide it. To turn the shortcut off, set [`permissionExplainerEnabled`](</docs/en/settings#global-config-settings>) to `false` in `~/.claude.json`.
##
@@ -211,7 +211,7 @@
* Options before URL: `curl -X GET http://github.com/...`
* Different protocol: `curl https://github.com/...`
- * Redirects: `curl -L http://bit.ly/xyz`, which redirects to GitHub
+ * Redirects: `curl -L http://short.example.com/xyz`, which redirects to GitHub
* Variables: `URL=http://github.com && curl $URL`
* Extra spaces: `curl http://github.com`
@@ -251,7 +251,9 @@
Read and Edit
-`Edit` rules apply to all built-in tools that edit files. Claude makes a best-effort attempt to apply `Read` rules to all built-in tools that read files like Grep and Glob, to `@file` mentions in your prompts, and to the selection and open-file context that a connected [IDE](</docs/en/vs-code#the-built-in-ide-mcp-server>) shares with Claude. A `Read` deny rule also blocks the [Edit tool](</docs/en/errors#file-is-covered-by-a-read-deny-rule>) on the same path, including creating a new file there. Write and NotebookEdit aren’t covered, so add an `Edit` deny rule for paths no tool may change. Requires Claude Code v2.1.208 or later.
+`Edit` rules apply to all built-in tools that edit files. Claude makes a best-effort attempt to apply `Read` rules to all built-in tools that read files like Grep and Glob, to `@file` mentions in your prompts, and to the selection and open-file context that a connected [IDE](</docs/en/vs-code#the-built-in-ide-mcp-server>) shares with Claude. A `Read` deny rule also blocks the [Edit tool](</docs/en/errors#file-is-covered-by-a-read-deny-rule>) on the same path, including creating a new file there. Write and NotebookEdit aren’t covered, so add an `Edit` deny rule for paths no tool may change. Requires Claude Code v2.1.208 or later. The file permission checks match only `Edit(path)` and `Read(path)` rules. A `Write(path)`, `NotebookEdit(path)`, or `Glob(path)` rule is accepted but never matched by those checks, so Claude Code warns at startup for each allow, deny, or ask rule in one of these unmatched forms. Use `Edit(docs/**)` in place of `Write(docs/**)` or `NotebookEdit(docs/**)`, and `Read(docs/**)` in place of `Glob(docs/**)`. A tool-name rule with no path, such as a deny rule for `Write`, isn’t affected: it matches the tool everywhere and produces no warning. Requires Claude Code v2.1.210 or later. A deny rule `Write(docs/**)` in project settings produces this startup warning:
+
+ Permission deny rule (.claude/settings.json): Write(docs/**) is not matched by file permission checks — only Edit(path) rules are. Use Edit(docs/**) instead (Edit rules cover all file-editing tools).
Read and Edit deny rules apply to Claude’s built-in file tools and to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, and `sed`. They don’t apply to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself. For OS-level enforcement that blocks all processes from accessing a path, [enable the sandbox](</docs/en/sandboxing>).
@@ -266,16 +268,17 @@
A pattern like `/Users/alice/file` isn’t an absolute path. The single leading slash anchors at the settings source, not the filesystem root. Use `//Users/alice/file` for absolute paths.
-A `/path` pattern anchors at the directory associated with the settings file that defines it, so the same rule matches different locations depending on where you put it:
+A `/path` pattern anchors at a directory associated with the settings source that defines it, so the same rule matches different locations depending on where you put it:
Rule defined in| `/path` resolves to
---|---
-Project or local settings, such as `.claude/settings.json`| `<project root>/path`
+Project settings at `.claude/settings.json`| `<project root>/path`
+Local settings at `.claude/settings.local.json`| `<original cwd>/path`
User settings at `~/.claude/settings.json`| `~/.claude/path`
A file passed with `--settings <file>`| `<directory of file>/path`
CLI flags, `/permissions`, or session rules| `<original cwd>/path`
-A deny rule such as `Read(/secrets/**)` in user settings blocks `~/.claude/secrets/**`, not a `secrets` directory in your project. To write a rule in user settings that applies inside every project, use a `//` absolute path or a `~/` home-relative path instead. On Windows, paths are normalized to POSIX form before matching. `C:\Users\alice` becomes `/c/Users/alice`, so use `//c/**/.env` to match `.env` files anywhere on that drive. To match across all drives, use `//**/.env`. Examples:
+Local settings rules anchor at the directory you started Claude Code from, not at the repository root where Claude Code stores the file in v2.1.211 and later. In a session started at the repository root, the two directories are the same; in a [worktree](</docs/en/worktrees>) session, a shared rule such as `Edit(/src/**)` matches that worktree’s own `src/` directory. A deny rule such as `Read(/secrets/**)` in user settings blocks `~/.claude/secrets/**`, not a `secrets` directory in your project. To write a rule in user settings that applies inside every project, use a `//` absolute path or a `~/` home-relative path instead. On Windows, paths are normalized to POSIX form before matching. `C:\Users\alice` becomes `/c/Users/alice`, so use `//c/**/.env` to match `.env` files anywhere on that drive. To match across all drives, use `//**/.env`. Examples:
* `Edit(/docs/**)`: edits in `<project>/docs/`, not `/docs/` or `<project>/.claude/docs/`
* `Read(~/.zshrc)`: reads your home directory’s `.zshrc`
@@ -397,7 +400,7 @@
[Settings](</docs/en/settings>) in `.claude/settings.json` and `.claude/settings.local.json`| `enabledPlugins` and `extraKnownMarketplaces` keys only
[CLAUDE.md](</docs/en/memory>) files, `.claude/rules/`, and `CLAUDE.local.md`| Only when `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` is set. `CLAUDE.local.md` additionally requires the `local` setting source, which is enabled by default
-Commands and output styles are discovered from the current working directory and its parents, your user directory at `~/.claude/`, and managed settings. Hooks and other `settings.json` keys load from the current working directory’s `.claude/` folder with no parent-directory fallback, alongside your user `~/.claude/settings.json` and managed settings. To share that configuration across projects, use one of these approaches:
+Claude Code discovers commands and output styles from the current working directory and its parents, your user directory at `~/.claude/`, and managed settings. Hooks and other `.claude/settings.json` keys load from the current working directory’s `.claude/` folder with no parent-directory fallback, alongside your user `~/.claude/settings.json` and managed settings. `.claude/settings.local.json` loads from the git repository root instead, even when you start Claude Code in a subdirectory; before v2.1.211, it too loaded only from the current working directory. [Agent SDK](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>) sessions load it from the working directory in all versions. To share that configuration across projects, use one of these approaches:
* **User-level configuration** : place files in `~/.claude/agents/`, `~/.claude/output-styles/`, or `~/.claude/settings.json` to make them available in every project
* **Plugins** : package and distribute configuration as a [plugin](</docs/en/plugins>) that teams can install
--- a/plugins.md
+++ b/plugins.md
@@ -179,7 +179,7 @@
You’ve created a plugin with a skill, but plugins can include much more: custom agents, hooks, MCP servers, LSP servers, and background monitors.
-**Common mistake** : Don’t put `commands/`, `agents/`, `skills/`, or `hooks/` inside the `.claude-plugin/` directory. Only `plugin.json` goes inside `.claude-plugin/`. All other directories must be at the plugin root level.The plugin root is the individual plugin’s own directory: the one containing `.claude-plugin/plugin.json`. It is never `~/.claude/`. For example, Claude Code doesn’t read a `.mcp.json` placed at `~/.claude/.mcp.json`.
+**Common mistake** : Don’t put `commands/`, `agents/`, `skills/`, or `hooks/` inside the `.claude-plugin/` directory. Only `plugin.json` goes inside `.claude-plugin/`. All other directories must be at the plugin root level.The plugin root is the individual plugin’s own directory: the one you pass to `--plugin-dir` or that contains `.claude-plugin/plugin.json`. It is never `~/.claude/`. For example, Claude Code doesn’t read a `.mcp.json` placed at `~/.claude/.mcp.json`.
Directory| Location| Purpose
---|---|---
Show diff (101 lines)
--- a/plugins-reference.md
+++ b/plugins-reference.md
@@ -882,6 +882,7 @@
Option| Description| Default
---|---|---
`-s, --scope <scope>`| Installation scope: `user`, `project`, or `local`| `user`
+`--config <key=value>`| Set a `userConfig` option declared in the plugin’s manifest. Repeat the flag to set multiple options|
`-h, --help`| Display help for command|
Scope determines which settings file the installed plugin is added to. For example, `--scope project` writes to `enabledPlugins` in .claude/settings.json, making the plugin available to everyone who clones the project repository. **Examples:**
@@ -962,7 +963,7 @@
Option| Description| Default
---|---|---
-`-s, --scope <scope>`| Scope to enable: `user`, `project`, or `local`| `user`
+`-s, --scope <scope>`| Scope to enable: `user`, `project`, or `local`. When omitted, Claude Code detects the scope where the plugin is installed| Auto-detect
`-h, --help`| Display help for command|
###
@@ -973,17 +974,18 @@
Disable a plugin without uninstalling it. Fails when another enabled plugin [depends on](</docs/en/plugin-dependencies#enable-or-disable-a-plugin-with-dependencies>) the target. The error message includes a chained command that disables every dependent first.
- claude plugin disable <plugin> [options]
+ claude plugin disable [plugin] [options]
**Arguments:**
- * `<plugin>`: Plugin name or `plugin-name@marketplace-name`
+ * `[plugin]`: Plugin name or `plugin-name@marketplace-name`. Optional when using `--all`
**Options:**
Option| Description| Default
---|---|---
-`-s, --scope <scope>`| Scope to disable: `user`, `project`, or `local`| `user`
+`-a, --all`| Disable all enabled plugins. Can’t be combined with `--scope`|
+`-s, --scope <scope>`| Scope to disable: `user`, `project`, or `local`. When omitted, Claude Code detects the scope where the plugin is installed| Auto-detect
`-h, --help`| Display help for command|
###
@@ -1027,7 +1029,12 @@
`--available`| Include available plugins from marketplaces. Requires `--json`|
`-h, --help`| Display help for command|
-Within an interactive session, `/plugin list` prints the same listing inline. The interactive form accepts `--enabled` or `--disabled` to show only plugins in that state, and `ls` as a shorthand for `list`.
+Within an interactive session, `/plugin list` prints a similar listing inline, but it covers marketplace-installed plugins only:
+
+ * Plugins loaded from skills directories appear in the `/plugin` interface and in `claude plugin list`, but not in the inline `/plugin list` output.
+ * Plugins loaded for the session with `--plugin-dir` or `--plugin-url` appear in the `/plugin` interface, and in `claude plugin list` only when the same flag precedes the subcommand, as in `claude --plugin-dir <dir> plugin list`. They have no installed record, so a bare `claude plugin list` doesn’t show them.
+
+The interactive form accepts `--enabled` or `--disabled` to show only plugins in that state, and `ls` as a shorthand for `list`.
###
@@ -1063,7 +1070,7 @@
Component inventory
Skills (2) scan-dependencies, review-changes
Agents (0)
- Hooks (1) (harness-only — no model context cost)
+ Hooks (1) SessionStart (harness-only — no model context cost)
MCP servers (0)
LSP servers (0)
@@ -1086,9 +1093,13 @@
plugin tag
-Create a release git tag for the plugin in the current directory. Run from inside the plugin’s folder. See [Tag plugin releases](</docs/en/plugin-dependencies#tag-plugin-releases-for-version-resolution>).
-
- claude plugin tag [options]
+Create a release git tag for a plugin. By default the command tags the plugin in the current directory; pass a path to tag a plugin elsewhere. See [Tag plugin releases](</docs/en/plugin-dependencies#tag-plugin-releases-for-version-resolution>).
+
+ claude plugin tag [path] [options]
+
+**Arguments:**
+
+ * `[path]`: Path to the plugin directory. Defaults to the current directory.
**Options:**
@@ -1097,6 +1108,8 @@
`--push`| Push the tag to the remote after creating it|
`--dry-run`| Print what would be tagged without creating the tag|
`-f, --force`| Create the tag even if the working tree is dirty or the tag already exists|
+`-m, --message <msg>`| Tag annotation message. Use `%s` as a placeholder for the version|
+`--remote <name>`| Remote to push to with `--push`| `origin`
`-h, --help`| Display help for command|
* * *
@@ -1144,8 +1157,8 @@
**Manifest validation errors** :
* `Invalid JSON syntax: Unexpected token } in JSON at position 142`: check for missing commas, extra commas, or unquoted strings
- * `Plugin has an invalid manifest file at .claude-plugin/plugin.json. Validation errors: name: Required`: a required field is missing
- * `Plugin has a corrupt manifest file at .claude-plugin/plugin.json. JSON parse error: ...`: JSON syntax error
+ * `Plugin <name> has an invalid manifest file at .claude-plugin/plugin.json. Validation errors: name: Invalid input: expected string, received undefined`: a required field is missing
+ * `Plugin <name> has a corrupt manifest file at .claude-plugin/plugin.json. JSON parse error: ...`: JSON syntax error
**Plugin loading errors** :
--- a/prompt-caching.md
+++ b/prompt-caching.md
@@ -31,10 +31,10 @@
* **API key, Claude subscription, or[Claude Platform on AWS](</docs/en/claude-platform-on-aws>)**: the cache lives in Anthropic’s infrastructure, accessed through the [Claude API](<https://platform.claude.com/docs>)
* **Amazon Bedrock or Google Cloud’s Agent Platform** : the cache lives in your cloud provider’s serving infrastructure
- * **Microsoft Foundry** : requests route to Anthropic’s infrastructure
+ * **Microsoft Foundry** : depends on the deployment’s [hosting option](<https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options>). Hosted on Azure deployments are served on Azure infrastructure; Hosted on Anthropic deployments are served on Anthropic’s infrastructure
* **Custom`ANTHROPIC_BASE_URL` or [LLM gateway](</docs/en/llm-gateway>)**: the cache lives wherever your requests are forwarded, and whether caching works depends on the gateway
-For what each provider stores and processes, see [data usage](</docs/en/data-usage>). Wherever the cache lives, entries expire after a period of inactivity, and Cache lifetime below covers the TTL and how to extend it.
+System context that Claude Code appends mid-conversation, such as file-change notices, is cached on Amazon Bedrock and its [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), Google Cloud’s Agent Platform, and Microsoft Foundry the same way it is on the Claude API. Before v2.1.211, these providers billed that appended system context as uncached input tokens on every request. For what each provider stores and processes, see [data usage](</docs/en/data-usage>). Wherever the cache lives, entries expire after a period of inactivity, and Cache lifetime below covers the TTL and how to extend it.
##
--- a/python.md
+++ b/python.md
@@ -3385,19 +3385,24 @@
Error handling
+ import asyncio
+
from claude_agent_sdk import query, CLINotFoundError, ProcessError, CLIJSONDecodeError
- try:
- async for message in query(prompt="Hello"):
- print(message)
- except CLINotFoundError:
- print(
- "Claude Code CLI not found. Try reinstalling: pip install --force-reinstall claude-agent-sdk"
- )
- except ProcessError as e:
- print(f"Process failed with exit code: {e.exit_code}")
- except CLIJSONDecodeError as e:
- print(f"Failed to parse response: {e}")
+ async def main():
+ try:
+ async for message in query(prompt="Hello"):
+ print(message)
+ except CLINotFoundError:
+ print(
+ "Claude Code CLI not found. Try reinstalling: pip install --force-reinstall claude-agent-sdk"
+ )
+ except ProcessError as e:
+ print(f"Process failed with exit code: {e.exit_code}")
+ except CLIJSONDecodeError as e:
+ print(f"Failed to parse response: {e}")
+
+ asyncio.run(main())
###
@@ -3529,13 +3534,15 @@
`ignoreViolations`| `SandboxIgnoreViolations`| `None`| Configure which sandbox violations to ignore
`enableWeakerNestedSandbox`| `bool`| `False`| Enable a weaker nested sandbox for compatibility
-The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. By default, when `enabled` is `True` but the sandbox can’t start, commands run unsandboxed with a warning on stderr. This default differs from the TypeScript SDK, where `failIfUnavailable` defaults to `true`.Set `"failIfUnavailable": True` in your sandbox settings to stop instead. The key isn’t declared on `SandboxSettings` yet, but the SDK forwards it to Claude Code, which honors it. `query()` then reports a `ResultMessage` with `subtype="error_during_execution"` and the reason in `errors`. Watch for that subtype rather than expecting `query()` to raise before yielding messages.
+The sandbox depends on platform support and, on Linux, tools like `bubblewrap` and `socat`. By default, when `enabled` is `True` but the sandbox can’t start, commands run unsandboxed with a warning on stderr. This default differs from the TypeScript SDK, where `failIfUnavailable` defaults to `true`.Set `"failIfUnavailable": True` in your sandbox settings to stop instead. The key isn’t declared on `SandboxSettings` yet, but the SDK forwards it to Claude Code, which honors it. `query()` then reports a `ResultMessage` with `subtype="error_during_execution"` and the reason in `errors`. Because this is a single-shot `query()` call, the SDK raises after yielding that error result, so wrap the loop in a try block to continue past it. See [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>) for the error contract.
####
Example usage
+
+ import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, SandboxSettings
@@ -3545,11 +3552,19 @@
"network": {"allowLocalBinding": True},
}
- async for message in query(
- prompt="Build and test my project",
- options=ClaudeAgentOptions(sandbox=sandbox_settings),
- ):
- print(message)
+ async def main():
+ try:
+ async for message in query(
+ prompt="Build and test my project",
+ options=ClaudeAgentOptions(sandbox=sandbox_settings),
+ ):
+ print(message)
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result,
+ # such as when failIfUnavailable is set and the sandbox can't start.
+ print(f"Session ended with an error: {error}")
+
+ asyncio.run(main())
**Unix socket security** : The `allowUnixSockets` option can grant access to powerful system services. For example, allowing `/var/run/docker.sock` effectively grants full host system access through the Docker API, bypassing sandbox isolation. Only allow Unix sockets that are strictly necessary and understand the security implications of each.
--- a/quickstart.md
+++ b/quickstart.md
@@ -55,7 +55,11 @@
WinGet installations do not auto-update. Run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes.
-You can also install with [apt, dnf, or apk](</docs/en/setup#install-with-linux-package-managers>) on Debian, Fedora, RHEL, and Alpine.
+You can also install with [apt, dnf, or apk](</docs/en/setup#install-with-linux-package-managers>) on Debian, Fedora, RHEL, and Alpine. To confirm the installation worked, run:
+
+ claude --version
+
+The command prints a version number followed by `(Claude Code)`.
##
@@ -91,7 +95,7 @@
cd /path/to/your/project
claude
-You’ll see the Claude Code prompt with the version, current model, and working directory shown above it. Type `/help` for available commands or `/resume` to continue a previous conversation.
+Replace `/path/to/your/project` with the path to the project you want to work on. You’ll see the Claude Code prompt with the version, current model, and working directory shown above it. Type `/help` for available commands or `/resume` to continue a previous conversation.
After logging in (Step 2), your credentials are stored on your system. Learn more in [Credential Management](</docs/en/authentication#credential-management>).
@@ -137,10 +141,10 @@
1. Find the appropriate file
2. Show you the proposed changes
- 3. Ask for your approval
+ 3. Ask for your approval before changing files, depending on your permission mode
4. Make the edit
-Claude Code always asks for permission before modifying files. You can approve individual changes or enable “Accept all” mode for a session.
+Whether Claude Code asks before changing files depends on your [permission mode](</docs/en/permission-modes>). In default mode, Claude asks for approval before each change. Press `Shift+Tab` to cycle through modes: `acceptEdits` auto-approves file edits, and `plan` lets Claude propose changes without editing. Some accounts also have an `auto` mode that runs a background safety check and blocks risky actions, returning to prompts only after repeated blocks.
##
@@ -229,7 +233,7 @@
---|---|---
`/clear`| Clear conversation history| `/clear`
`/help`| Show available commands| `/help`
-`/exit` or Ctrl+D| Exit Claude Code| `/exit`
+`/exit` or Ctrl+D twice| Exit Claude Code| `/exit`
See the [CLI reference](</docs/en/cli-reference>) for the complete list of shell commands and the [commands reference](</docs/en/commands>) for the complete list of session commands.
--- a/remote-control.md
+++ b/remote-control.md
@@ -18,7 +18,7 @@
Before using Remote Control, confirm that your environment meets these conditions:
* **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.
+ * **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.
* **Workspace trust** : run `claude` in your project directory at least once to accept the workspace trust dialog.
@@ -84,7 +84,7 @@
/remote-control
-A banner appears above the prompt box showing connection status. Once connected, click **Open in browser** in the banner to go directly to the session, or find it in the session list at [claude.ai/code](<https://claude.ai/code>). The session URL is also posted in the conversation.To disconnect, click the close icon on the banner or run `/remote-control` again.Unlike the CLI, the VS Code command does not accept a name argument or display a QR code. The session title is derived from your conversation history or first prompt.
+A banner appears above the prompt box showing connection status. Once connected, click **claude.ai/code** in the banner to go directly to the session, or find it in the session list at [claude.ai/code](<https://claude.ai/code>). Claude Code also posts the session URL in the conversation.To disconnect, click the close icon on the banner or run `/remote-control` again.Unlike the CLI, the VS Code command does not accept a name argument or display a QR code. The session title is derived from your conversation history or first prompt.
###
@@ -255,8 +255,9 @@
* **Some commands are local-only** : commands that only run in the terminal interface, such as `/plugin` or `/resume`, work only from the local CLI, whether or not you pass an argument. The following work from mobile and web:
* Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits` (runs the text form instead of opening the in-CLI dialog), `/recap`, `/reload-plugins`
* `/model`, `/effort`, `/fast`, `/color`, and `/rename`: pass the value as an argument, for example `/model sonnet` or `/effort high`. From mobile and web, `/model` and `/effort` take the argument in place of the terminal picker or slider.
- * `/mcp`, from v2.1.166: returns a text summary of server status instead of opening the picker, and accepts the `reconnect`, `enable`, and `disable` [subcommands](</docs/en/commands#all-commands>). Unlike the local CLI, `/mcp reconnect` without a server name reconnects every server that has failed or needs authentication.
+ * `/mcp`, from v2.1.166: from the mobile app, returns a text summary of server status instead of opening the picker. On the web, `/mcp` on its own opens a directory of [claude.ai connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) instead of returning the summary. The `reconnect`, `enable`, and `disable` [subcommands](</docs/en/commands#all-commands>) work from both. Unlike the local CLI, `/mcp reconnect` without a server name reconnects every server that has failed or needs authentication.
* `/config`, from v2.1.181: from the mobile app, pass `key=value` to set a setting, or run it with no argument to list the keys you can set. On the web, `/config` opens the Claude Code section of your settings instead, and ignores text after the command.
+ * On Team and Enterprise, `/usage-credits` from mobile or web doesn’t send a [usage-credits request to your admin](</docs/en/costs#set-a-spend-limit-on-pro-and-max>). Sending requires a confirmation that appears only in the interactive CLI, so the command tells you to run it there instead. Before v2.1.211, the text form sent the request without confirmation.
##
--- a/routines.md
+++ b/routines.md
@@ -14,7 +14,7 @@
Example use cases
-Each example pairs a trigger type with the kind of work routines are suited to: unattended, repeatable, and tied to a clear outcome. **Backlog maintenance.** A schedule trigger runs every weeknight against your issue tracker via a connector. The routine reads issues opened since the last run, applies labels, assigns owners based on the area of code referenced, and posts a summary to Slack so the team starts the day with a groomed queue. **Alert triage.** Your monitoring tool calls the routine’s API endpoint when an error threshold is crossed, passing the alert body as `text`. The routine pulls the stack trace, correlates it with recent commits in the repository, and opens a draft pull request with a proposed fix and a link back to the alert. On-call reviews the PR instead of starting from a blank terminal. **Bespoke code review.** A GitHub trigger runs on `pull_request.opened`. The routine applies your team’s own review checklist, leaves inline comments for security, performance, and style issues, and adds a summary comment so human reviewers can focus on design instead of mechanical checks. **Deploy verification.** Your CD pipeline calls the routine’s API endpoint after each production deploy. The routine runs smoke checks against the new build, scans error logs for regressions, and posts a go or no-go to the release channel before the deploy window closes. **Docs drift.** A schedule trigger runs weekly. The routine scans merged PRs since the last run, flags documentation that references changed APIs, and opens update PRs against the docs repository for an editor to review. **Library port.** A GitHub trigger runs on `pull_request.closed` filtered to merged PRs in one SDK repository. The routine ports the change to a parallel SDK in another language and opens a matching PR, keeping the two libraries in step without a human re-implementing each change. The sections below walk through creating a routine and configuring each of these trigger types.
+Each example pairs a trigger type with the kind of work routines are suited to: unattended, repeatable, and tied to a clear outcome. **Backlog maintenance.** A schedule trigger runs every weeknight against your issue tracker via a connector. The routine reads issues opened since the last run, applies labels, assigns owners based on the area of code referenced, and posts a summary to Slack so the team starts the day with a groomed queue. **Alert triage.** Your monitoring tool calls the routine’s API endpoint when an error threshold is crossed, passing the alert body as `text`. The routine’s prompt tells Claude to investigate the alert in the fire payload, so it pulls the stack trace, correlates it with recent commits in the repository, and opens a draft pull request with a proposed fix and a link back to the alert. On-call reviews the PR instead of starting from a blank terminal. **Bespoke code review.** A GitHub trigger runs on `pull_request.opened`. The routine applies your team’s own review checklist, leaves inline comments for security, performance, and style issues, and adds a summary comment so human reviewers can focus on design instead of mechanical checks. **Deploy verification.** Your CD pipeline calls the routine’s API endpoint after each production deploy. The routine runs smoke checks against the new build, scans error logs for regressions, and posts a go or no-go to the release channel before the deploy window closes. **Docs drift.** A schedule trigger runs weekly. The routine scans merged PRs since the last run, flags documentation that references changed APIs, and opens update PRs against the docs repository for an editor to review. **Library port.** A GitHub trigger runs on `pull_request.closed` filtered to merged PRs in one SDK repository. The routine ports the change to a parallel SDK in another language and opens a matching PR, keeping the two libraries in step without a human re-implementing each change. The sections below walk through creating a routine and configuring each of these trigger types.
##
@@ -96,7 +96,7 @@
Create from the CLI
-Run `/schedule` in any session to create a scheduled routine conversationally. You can also pass a description directly, for a recurring routine like `/schedule daily PR review at 9am` or a one-off like `/schedule clean up feature flag in one week`. Claude walks through the same information the web form collects, then saves the routine to your account. A successful start looks like a conversation: Claude asks follow-up questions about the schedule, repositories, and prompt before saving. If Claude instead replies that you need to authenticate or that it can’t connect to your remote claude.ai account, no routine was created; see Troubleshooting. `/schedule` in the CLI creates scheduled routines only. To add an API or GitHub trigger, edit the routine on the web at [claude.ai/code/routines](<https://claude.ai/code/routines>). The CLI also supports managing existing routines. Run `/schedule list` to see all routines, `/schedule update` to change one, or `/schedule run` to trigger it immediately.
+Run `/schedule` in any session to create a scheduled routine conversationally. You can also pass a description directly, for a recurring routine like `/schedule daily PR review at 9am` or a one-off like `/schedule clean up feature flag in one week`. Claude walks through the same information the web form collects, then saves the routine to your account. A successful start looks like a conversation: Claude asks follow-up questions about the schedule, repositories, and prompt before saving. If Claude instead replies that you need to authenticate or that it can’t connect to your remote claude.ai account, no routine was created; see Troubleshooting. `/schedule` in the CLI creates scheduled routines only. To add an API or GitHub trigger, edit the routine on the web at [claude.ai/code/routines](<https://claude.ai/code/routines>). The CLI also supports managing existing routines. Run `/schedule list` to see all routines, `/schedule update` to change one, or `/schedule run` to trigger it immediately. A routine with no schedule trigger, such as one started only by API calls or GitHub events, has no next run time, and the CLI shows none when Claude saves or updates it. Before v2.1.211, the CLI reported a next run time in the year 1 for these routines.
##
@@ -172,7 +172,7 @@
Trigger a routine
-Send a POST request to the `/fire` endpoint with the bearer token in the `Authorization` header. The request body accepts an optional `text` field for run-specific context such as an alert body or a failing log, passed to the routine alongside its saved prompt. The value is freeform text and is not parsed: if you send JSON or another structured payload, the routine receives it as a literal string. The example below triggers a routine from a shell. The routine ID and token shown are placeholders: replace them with the URL and token you copied when adding the API trigger, or the request fails with a `401` authentication error:
+Send a POST request to the `/fire` endpoint with the bearer token in the `Authorization` header. The request body accepts an optional `text` field for run-specific context such as an alert body or a failing log, passed to the routine alongside its saved prompt. The value is freeform text and is not parsed: if you send JSON or another structured payload, the routine receives it as a literal string. The `text` value doesn’t reach the routine as a bare message. It arrives wrapped in a `<routine-fire-payload>` block that labels it as untrusted data and tells Claude not to follow instructions inside it unless the routine’s own prompt says to. The same wrapping applies to text supplied with **Run now** in the web UI. This means a routine’s saved prompt must opt in to acting on fire text: write the prompt to reference the payload explicitly, for example “Investigate the alert described in the routine-fire-payload block”, or the routine treats the text as inert context. Anyone holding the bearer token can send `text`, so the wrapper makes fire text from a leaked token arrive labeled as untrusted data rather than as direct instructions to your routine. The example below triggers a routine from a shell. The routine ID and token shown are placeholders: replace them with the URL and token you copied when adding the API trigger, or the request fails with a `401` authentication error:
curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABCDEFGHJKLMNOPQRSTUVW/fire \
-H "Authorization: Bearer sk-ant-oat01-xxxxx" \
@@ -311,7 +311,7 @@
From the routine detail page you can:
- * Click **Run now** to start a run immediately without waiting for the next scheduled time.
+ * Click **Run now** to start a run immediately without waiting for the next scheduled time. You can optionally supply run-specific text, which reaches the routine the same way as the API trigger’s `text` field.
* Use the toggle in the **Repeats** section to pause or resume the schedule. Paused routines keep their configuration but don’t run until you re-enable them.
* Click the pencil icon to open **Edit routine** and change the name, prompt, repositories, environment, connectors, or any of the routine’s triggers. The **Select a trigger** section is where you add or remove schedules, API tokens, and GitHub event triggers.
* Click the delete icon to remove the routine. Past sessions created by the routine remain in your session list.
--- a/sandbox-environments.md
+++ b/sandbox-environments.md
@@ -71,7 +71,7 @@
Sandbox runtime
-The [`@anthropic-ai/sandbox-runtime`](<https://github.com/anthropic-experimental/sandbox-runtime>) package wraps an entire process in the same Seatbelt or bubblewrap isolation that the built-in Bash sandbox uses. Running Claude Code through it constrains every tool, hook, and MCP server in the session, not only Bash. The runtime is a beta research preview, and its configuration format may change as the package evolves. The runtime denies all write and network access by default, so configure it before launching Claude Code through it. In `~/.srt-settings.json`, or a file you pass with `--settings`, allow write access to at least your project directory and Claude Code’s configuration paths `~/.claude` and `~/.claude.json`. Allow the network domains your session needs, including `api.anthropic.com` or your configured provider’s endpoint. See the package [README](<https://github.com/anthropic-experimental/sandbox-runtime>) for the full configuration schema. Once the settings file is in place, launch Claude Code with `npx` and pass `claude` as the command to wrap:
+The [`@anthropic-ai/sandbox-runtime`](<https://github.com/anthropic-experimental/sandbox-runtime>) package wraps an entire process in the same Seatbelt or bubblewrap isolation that the built-in Bash sandbox uses. Running Claude Code through it constrains every tool, hook, and MCP server in the session, not only Bash. The runtime is a beta research preview, and its configuration format may change as the package evolves. The runtime denies all write and network access by default, so configure it before launching Claude Code through it. In `~/.srt-settings.json`, or a file you pass with `--settings`, allow write access to at least your project directory, Claude Code’s configuration paths `~/.claude` and `~/.claude.json`, and `/tmp`, where Claude Code writes runtime files. Allow the network domains your session needs, including `api.anthropic.com` or your configured provider’s endpoint. See the package [README](<https://github.com/anthropic-experimental/sandbox-runtime>) for the full configuration schema. Once the settings file is in place, launch Claude Code with `npx` and pass `claude` as the command to wrap:
npx @anthropic-ai/sandbox-runtime claude
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -18,7 +18,7 @@
/sandbox
-This opens the sandbox panel with three tabs:
+This opens the sandbox panel with three tabs, plus a Dependencies tab on Linux when the optional seccomp filter is missing:
* **Mode** : choose how sandboxed commands are approved, covered in the next step
* **Overrides** : choose whether commands that fail under the sandbox can fall back to running unsandboxed. This is the [`allowUnsandboxedCommands`](</docs/en/settings#sandbox-settings>) setting
@@ -63,11 +63,11 @@
sudo dnf install bubblewrap socat
-After installing, the Dependencies tab in `/sandbox` shows whether `ripgrep`, `bubblewrap`, `socat`, and the seccomp filter are available on your platform. Ripgrep is bundled with the native Claude Code binary. The seccomp filter is optional and adds Unix domain socket blocking. Install it with `npm install -g @anthropic-ai/sandbox-runtime` if it is missing. When a required dependency is missing, the Dependencies tab is the only tab shown until you install it. The dependency check runs at startup, so restart Claude Code after installing packages for `/sandbox` to detect them.
+When a dependency is missing, the Dependencies tab in `/sandbox` lists which of `ripgrep`, `bubblewrap`, `socat`, and the seccomp filter your platform lacks. If you don’t see the tab after installing and restarting Claude Code, all dependencies are present. Ripgrep is bundled with the native Claude Code binary. The seccomp filter is optional and adds Unix domain socket blocking. Install it with `npm install -g @anthropic-ai/sandbox-runtime` if it is missing. When a required dependency is missing, the Dependencies tab is the only tab shown until you install it. When only the optional seccomp filter is missing, the Dependencies tab appears alongside the other tabs. The dependency check runs at startup, so restart Claude Code after installing packages for `/sandbox` to detect them.
Ubuntu 24.04 and later: allow bubblewrap to create user namespaces
-On Ubuntu 24.04 and later, the default AppArmor policy prevents bubblewrap from creating the user namespaces it needs for isolation.To check whether your environment enforces this restriction, including inside WSL2, run `sysctl kernel.apparmor_restrict_unprivileged_userns`. If the key does not exist or returns `0`, skip this step. If it returns `1`, add an AppArmor profile that grants `bwrap` this capability:
+On Ubuntu 24.04 and later, the default AppArmor policy prevents bubblewrap from creating the user namespaces it needs for isolation.To check whether your environment enforces this restriction, including inside WSL2, run `sysctl kernel.apparmor_restrict_unprivileged_userns`. If the command returns `0`, skip this step. If it prints a `No such file or directory` error, the key doesn’t exist and you can skip this step. If it returns `1`, add an AppArmor profile that grants `bwrap` this capability:
sudo tee /etc/apparmor.d/bwrap > /dev/null <<'EOF'
abi <abi/4.0>,
@@ -232,8 +232,8 @@
Network access is controlled through a proxy server running outside the sandbox:
- * **Domain restrictions** : no domains are pre-allowed. The first time a command needs a new domain, Claude Code prompts for approval. As of v2.1.191, choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely.
- * **Managed lockdown** : if [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, non-allowed domains are blocked automatically instead of prompting, and only `allowedDomains` from managed settings are honored.
+ * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval. As of v2.1.191, choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules.
+ * **Managed lockdown** : if [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, non-allowed domains are blocked automatically instead of prompting, and only `allowedDomains` and `WebFetch(domain:...)` allow rules from managed settings are honored.
* **Custom proxy support** : advanced users can implement custom rules on outgoing traffic
* **Comprehensive coverage** : restrictions apply to all scripts, programs, and subprocesses spawned by commands
@@ -380,7 +380,7 @@
* **`open`, `osascript`, or browser-based auth flows fail with error `-600` on macOS**: the sandbox blocks Apple Events by default. Set [`allowAppleEvents`](</docs/en/settings#sandbox-settings>) to `true` in your user, managed, or CLI settings to allow them. Project settings are ignored for this key. Enabling it removes code-execution isolation, since sandboxed commands can then launch other applications unsandboxed with no user prompt and send AppleScript commands to running applications, subject to the macOS automation-consent prompt (TCC). Alternatively, add the command to `excludedCommands` to run it outside the sandbox.
* **`docker` commands fail**: `docker` is incompatible with the sandbox. Add `docker *` to `excludedCommands` to run it outside the sandbox.
* **Bubblewrap fails to start inside a container** : in an unprivileged container, bubblewrap cannot mount a fresh `/proc` filesystem. Set [`enableWeakerNestedSandbox`](</docs/en/settings#sandbox-settings>) to `true` so the inner sandbox bind-mounts the container’s existing `/proc` instead. Only use this setting when the outer container already provides the isolation boundary you need, since it exposes process information to sandboxed commands that a fresh `/proc` mount would hide.
- * **Seccomp filter on Linux** : the seccomp filter is required to block Unix domain sockets. The Dependencies tab in `/sandbox` shows whether it is available. If it is missing, run `npm install -g @anthropic-ai/sandbox-runtime` to install the helper.
+ * **Seccomp filter on Linux** : the seccomp filter is required to block Unix domain sockets. The Dependencies tab in `/sandbox` appears only when a dependency is missing; if you don’t see the tab after a restart, the filter is already installed. If the filter is missing, run `npm install -g @anthropic-ai/sandbox-runtime` to install the helper, then restart Claude Code so the startup dependency check detects it.
* **`--dangerously-skip-permissions` fails as root**: this flag is blocked when running as root or via sudo on Linux and macOS, because root access combined with no permission prompts can modify any file or service on the system. The check is skipped automatically inside a recognized sandbox. To run autonomously in a container, use the [dev container](</docs/en/devcontainer>) configuration, which runs Claude Code as a non-root user.
##
@@ -405,7 +405,7 @@
* **Filesystem permission escalation** : overly broad filesystem write permissions can enable privilege escalation attacks. Allowing writes to directories containing executables in `$PATH`, system configuration directories, or user shell configuration files such as `.bashrc` or `.zshrc` can lead to code execution in different security contexts when other users or system processes access these files.
* **Linux sandbox strength** : the Linux implementation provides strong filesystem and network isolation but includes an `enableWeakerNestedSandbox` mode that enables it to work inside Docker environments without privileged namespaces, or on Linux hosts where unprivileged user namespaces are disabled by sysctl. This option considerably weakens security and should only be used when additional isolation is otherwise enforced.
* **Apple Events on macOS** : the macOS sandbox blocks Apple Events by default. The `allowAppleEvents` setting lifts this restriction so tools such as `open` and `osascript` work, but it removes code-execution isolation: sandboxed commands can launch other applications unsandboxed with no user prompt, and can send AppleScript commands to running applications, subject to the per-app macOS automation-consent prompt (TCC). It is only honored from user, managed, or CLI settings. Project settings cannot enable it.
- * **Settings files protected** : the sandbox automatically denies write access to Claude Code’s `settings.json` files at every scope and to the managed settings directory, so a sandboxed command cannot modify its own policy.
+ * **Settings files protected** : the sandbox automatically denies write access to Claude Code’s `settings.json` files at every scope and to the managed settings directory, so a sandboxed command cannot modify its own policy. In v2.1.210 and later, the deny rules resolve symlinks: when a symlink appears at a protected settings file path after startup, the sandbox adds its target to the deny list for the next command, so a linked settings file can’t be edited through the link.
###
--- a/scheduled-tasks.md
+++ b/scheduled-tasks.md
@@ -41,7 +41,7 @@
* built-in commands such as `/permissions`, `/model`, or `/clear`
* skills marked [`disable-model-invocation: true`](</docs/en/skills#frontmatter-reference>)
* skills withheld from Claude by a [`skillOverrides`](</docs/en/skills#override-skill-visibility-from-settings>) setting or a `Skill` [deny rule](</docs/en/skills#restrict-claude%E2%80%99s-skill-access>)
- * [MCP prompts](</docs/en/mcp#use-mcp-prompts-as-commands>) such as `/mcp__github__list_prs`; skills an MCP server exposes still run
+ * [MCP prompts](</docs/en/mcp#use-mcp-prompts-as-commands>) such as `/mcp__github__list_prs`
###
--- a/security-guidance.md
+++ b/security-guidance.md
@@ -18,11 +18,16 @@
Install the plugin
-In a Claude Code session, install from the [official Anthropic marketplace](</docs/en/discover-plugins#official-anthropic-marketplace>):
+In a terminal Claude Code session, install from the [official Anthropic marketplace](</docs/en/discover-plugins#official-anthropic-marketplace>):
/plugin install security-guidance@claude-plugins-official
-The install prompts for a scope. Choose user scope to write the plugin to your user settings, so it loads in every new local session you start on this machine. If Claude Code reports that the marketplace is not found, run `/plugin marketplace add anthropics/claude-plugins-official` first, then retry the install. Then activate it in the current session with `/reload-plugins`, which applies pending plugin changes without a restart:
+`/plugin` opens an interactive panel and is available only in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, install another way:
+
+ * **Claude desktop app, local or SSH session** : open the [plugin browser](</docs/en/desktop#install-plugins>) by clicking the **+** button next to the prompt, then **Plugins** , then **Add plugin**
+ * **Claude Code on the web or a desktop cloud session** : declare the plugin in `.claude/settings.json` as shown under Enable in cloud sessions
+
+The terminal install prompts for a scope. Choose user scope to write the plugin to your user settings, so it loads in every new local session you start on this machine. If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. Then activate it in the current session with `/reload-plugins`, which applies pending plugin changes without a restart:
/reload-plugins
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -217,7 +217,7 @@
* **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.
+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.
Show diff (174 lines)
--- a/session-storage.md
+++ b/session-storage.md
@@ -10,14 +10,14 @@
The `SessionStore` interface
-A `SessionStore` is an object with two required methods, `append` and `load`, and three optional methods. The SDK calls `append` to write transcript entries during a query and `load` to read them back for resume.
+A `SessionStore` is an object with two required methods, `append` and `load`, and four optional methods. The SDK calls `append` to write transcript entries during a query and `load` to read them back for resume.
TypeScript
Python
// Exported from @anthropic-ai/claude-agent-sdk as
- // SessionStore, SessionKey, SessionStoreEntry.
+ // SessionStore, SessionKey, SessionStoreEntry, SessionSummaryEntry.
type SessionKey = {
projectKey: string;
@@ -34,6 +34,7 @@
listSessions?(
projectKey: string,
): Promise<Array<{ sessionId: string; mtime: number }>>;
+ listSessionSummaries?(projectKey: string): Promise<SessionSummaryEntry[]>;
delete?(key: SessionKey): Promise<void>;
listSubkeys?(key: {
projectKey: string;
@@ -41,8 +42,14 @@
}): Promise<string[]>;
};
+ type SessionSummaryEntry = {
+ sessionId: string;
+ mtime: number;
+ data: Record<string, unknown>;
+ };
+
# Exported from claude_agent_sdk as
- # SessionStore, SessionKey, SessionStoreEntry.
+ # SessionStore, SessionKey, SessionStoreEntry, SessionSummaryEntry.
class SessionKey(TypedDict):
project_key: str
@@ -60,19 +67,30 @@
async def list_sessions(
self, project_key: str
) -> list[SessionStoreListEntry]: ...
+ async def list_session_summaries(
+ self, project_key: str
+ ) -> list[SessionSummaryEntry]: ...
async def delete(self, key: SessionKey) -> None: ...
async def list_subkeys(self, key: SessionListSubkeysKey) -> list[str]: ...
+
+ class SessionSummaryEntry(TypedDict):
+ session_id: str
+ mtime: int
+ data: dict[str, Any]
`SessionKey` addresses one transcript. `projectKey` is a stable, filesystem-safe encoding of the working directory, `sessionId` is the session UUID, and `subpath` is set when the entry belongs to a subagent transcript or sidecar file rather than the main conversation. Treat `subpath` as an opaque key suffix; it follows the on-disk layout, for example `subagents/agent-<id>`. When `subpath` is undefined the key refers to the main transcript.
Method| Required| Called when
---|---|---
`append`| Yes| After each batch of transcript entries is written locally. Entries are JSON-safe objects, one per line in the local JSONL.
-`load`| Yes| Once before the subprocess spawns, when `resume` is set. Return `null` if the session is unknown.
-`listSessions`| No| By `listSessions({ sessionStore })` and by `query()`/`startup()` with `continue: true`. If undefined, those calls throw.
-`delete`| No| By `deleteSession({ sessionStore })`. Deleting the main key (no `subpath`) must cascade to all subkeys for that session. If undefined, deletion is a no-op, which suits append-only backends.
+`load`| Yes| Before the subprocess spawns when `resume` is set, and once per session when listing falls back from `listSessionSummaries`. Return `null` if the session is unknown.
+`listSessions`| No| By `listSessions({ sessionStore })` and by `query()`/`startup()` with `continue: true`. If undefined, `continue: true` throws, and `listSessions({ sessionStore })` throws unless `listSessionSummaries` is implemented.
+`listSessionSummaries`| No| By `listSessions({ sessionStore })` to read metadata for all sessions in one call. Maintain the summaries inside `append`. If undefined, listing falls back to `listSessions` plus a per-session `load`.
+`delete`| No| By `deleteSession({ sessionStore })`. Deleting the main key (no `subpath`) must cascade to all subkeys for that session and also remove the session’s summary entry, so a deleted session stops appearing in `listSessionSummaries`. If undefined, deletion is a no-op, which suits append-only backends.
`listSubkeys`| No| During resume, to discover subagent transcripts. If undefined, only the main transcript is restored.
+In a `SessionSummaryEntry`, `mtime` is the sidecar’s storage write time and must share a clock source with the `mtime` values `listSessions` returns. `data` is opaque SDK-owned state; persist it verbatim without interpreting it. Build the entries by calling the exported `foldSessionSummary` helper, `fold_session_summary` in Python, on each batch inside `append`. Skip batches whose key has a `subpath`; subagent transcripts must not contribute to the main session’s summary. The fold never sets `mtime`: stamp it at persist time, through the `options.mtime` argument in TypeScript or by overwriting the field on the returned entry in Python. Concurrent `append` calls for the same session can race on the sidecar, so serialize the read-fold-write with a transaction, a compare-and-swap, or a per-session lock; the fold itself is pure.
+
##
@@ -90,13 +108,20 @@
const store = new InMemorySessionStore();
let sessionId: string | undefined;
- for await (const message of query({
- prompt: "List the TypeScript files under src/",
- options: { sessionStore: store },
- })) {
- if (message.type === "result") {
- sessionId = message.session_id;
+ try {
+ for await (const message of query({
+ prompt: "List the TypeScript files under src/",
+ options: { sessionStore: store },
+ })) {
+ if (message.type === "result") {
+ sessionId = message.session_id;
+ }
}
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result. If the
+ // failure was an error result, sessionId was already captured by the loop
+ // above; connection or process failures yield no result message.
+ console.error(`Session ended with an error: ${error}`);
}
// Resume from the store. The agent has full context from the first call.
@@ -121,12 +146,18 @@
async def main():
session_id = None
- async for message in query(
- prompt="List the Python files under src/",
- options=ClaudeAgentOptions(session_store=store),
- ):
- if isinstance(message, ResultMessage):
- session_id = message.session_id
+ try:
+ async for message in query(
+ prompt="List the Python files under src/",
+ options=ClaudeAgentOptions(session_store=store),
+ ):
+ if isinstance(message, ResultMessage):
+ session_id = message.session_id
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result. If the
+ # failure was an error result, session_id was already captured by the
+ # loop above; connection or process failures yield no result message.
+ print(f"Session ended with an error: {error}")
# Resume from the store. The agent has full context from the first call.
async for message in query(
@@ -146,7 +177,7 @@
Write your own adapter
-Implement `append` and `load` against your backend. Add `listSessions`, `delete`, and `listSubkeys` if you want `listSessions()`, `deleteSession()`, and subagent resume to work against the store. Entries passed to `append` are typed as `SessionStoreEntry` (a `{ type: string; ... }` object). Treat them as opaque JSON-safe values: persist them in order and return them from `load` in the same order. `load` must return entries that are deep-equal to what was appended; byte-equal serialization is not required, so backends like Postgres `jsonb` that reorder object keys are fine.
+Implement `append` and `load` against your backend. Add `listSessions`, `listSessionSummaries`, `delete`, and `listSubkeys` if you want `listSessions()`, one-call metadata reads, `deleteSession()`, and subagent resume to work against the store. Entries passed to `append` are typed as `SessionStoreEntry` (a `{ type: string; ... }` object). Treat them as opaque JSON-safe values: persist them in order and return them from `load` in the same order. `load` must return entries that are deep-equal to what was appended; byte-equal serialization is not required, so backends like Postgres `jsonb` that reorder object keys are fine.
##
@@ -208,7 +239,7 @@
@pytest.mark.asyncio
async def test_my_store_conformance():
- await run_session_store_conformance(MyRedisStore)
+ await run_session_store_conformance(MyRedisStore) # Your adapter class
##
@@ -222,7 +253,7 @@
Dual-write architecture
-The store is a mirror, not a replacement. The Claude Code subprocess always writes to local disk first; the SDK then forwards each batch to `append()`. If you want the local copy to be ephemeral, point `CLAUDE_CONFIG_DIR` at a temp directory in `options.env`. Because the mirror depends on local writes, `sessionStore` cannot be combined with `persistSession: false`; the SDK throws if you set both. It also throws if combined with `enableFileCheckpointing`, since file-history backup blobs are written directly to local disk and are not mirrored to the store.
+The store is a mirror, not a replacement. The Claude Code subprocess always writes to local disk first; the SDK then forwards each batch to `append()`. If you want the local copy to be ephemeral, point `CLAUDE_CONFIG_DIR` at a temp directory in `options.env`. Because the mirror depends on local writes, the TypeScript SDK throws if you combine `sessionStore` with `persistSession: false`. Both SDKs also throw if you combine the store with file checkpointing, `enableFileCheckpointing` in TypeScript or `enable_file_checkpointing` in Python, since file-history backup blobs are written directly to local disk and are not mirrored to the store.
###
@@ -270,7 +301,7 @@
Supported on
-The following SDK functions accept a `sessionStore` option and operate against the store instead of the local filesystem when it is provided:
+The following TypeScript SDK functions accept a `sessionStore` option and operate against the store instead of the local filesystem when it is provided:
* [`query()`](</docs/en/agent-sdk/typescript#query>)
* [`startup()`](</docs/en/agent-sdk/typescript#startup>)
@@ -284,6 +315,8 @@
* [`listSubagents()`](</docs/en/agent-sdk/typescript>)
* [`getSubagentMessages()`](</docs/en/agent-sdk/typescript>)
+In the Python SDK, set `session_store` in [`ClaudeAgentOptions`](</docs/en/agent-sdk/python#claudeagentoptions>) to run `query()` against a store. The remaining operations each have a store-backed Python function that takes the store as an argument: `list_sessions_from_store()`, `get_session_info_from_store()`, `get_session_messages_from_store()`, `list_subagents_from_store()`, `get_subagent_messages_from_store()`, `rename_session_via_store()`, `tag_session_via_store()`, `delete_session_via_store()`, and `fork_session_via_store()`. `startup()` has no Python equivalent. The standalone functions documented in the [Python SDK reference](</docs/en/agent-sdk/python#functions>), such as `list_sessions()`, read local session files.
+
##
--- a/sessions.md
+++ b/sessions.md
@@ -13,7 +13,7 @@
`claude --continue`| Resumes the most recent session in the current directory
`claude --resume`| Opens the session picker
`claude --resume <name>`| Resumes the named session directly
-`claude --from-pr <number>`| Resumes the session linked to that pull request
+`claude --from-pr <number>`| Opens the session picker filtered to sessions linked to that pull request
`/resume`| Switches to a different conversation from inside an active session
Sessions created with [`claude -p`](</docs/en/headless>) or the [Agent SDK](</docs/en/agent-sdk/overview>) do not appear in the session picker, but you can still resume one by passing its session ID to `claude --resume <session-id>`. Run this from the directory the session was started in: session ID lookup is scoped to the current project directory and its git worktrees, so a session created elsewhere reports `No conversation found with session ID: <session-id>`.
@@ -22,9 +22,25 @@
+What a resumed session restores
+
+A resumed session restores the conversation along with the state saved in it:
+
+ * Conversation history: the full history, including tool calls and results.
+ * Model: the session continues on the model it was using. The model isn’t restored when it has been retired or isn’t allowed by `availableModels`, when a `--model` flag or `ANTHROPIC_MODEL`-family environment variable picks one at launch, or on providers that use provider-specific deployment IDs, such as [Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry](</docs/en/third-party-integrations>); see [model configuration](</docs/en/model-config#setting-your-model>) for the resolution order.
+ * Permission mode: the mode the session was in. `plan` and `bypassPermissions` are never restored; [bypassing permissions](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) must be enabled again at launch, with one of its launch flags or `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>). `auto` is restored only when your account still meets the [auto mode requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Pass `--permission-mode` to override the restored mode.
+ * Active goal: a [goal](</docs/en/goal#resume-with-an-active-goal>) that was still active when the session ended carries over; its turn count, timer, and token-spend baseline reset.
+ * 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.
+
+###
+
+
+
Where the session picker looks
-Sessions are stored per project directory. By default the session picker shows interactive sessions from the current worktree, plus sessions started elsewhere that added the current directory with `/add-dir`. Use `Ctrl+W` to widen to all worktrees of the repository or `Ctrl+A` to widen to every project on this machine. From v2.1.169, moving a session with [`/cd`](</docs/en/commands>) relocates it to the new directory’s project storage, so it appears in that directory’s picker afterward. As of v2.1.196, a moved session stays out of the old directory’s picker even after a crash or forced exit. On earlier versions, it could also reappear in the old directory’s list after an exit that wasn’t clean when the old path contained special characters such as underscores. Selecting a session from another worktree of the same repository resumes it in place. Selecting a session from an unrelated project copies a `cd` and resume command to your clipboard instead. Resuming by name resolves across the current repository and its worktrees. Both forms look for an exact match and resume it directly even if it lives in a different worktree:
+Sessions are stored per project directory. By default the session picker shows interactive sessions from the current worktree, plus sessions started elsewhere that added the current directory with `/add-dir`. Use `Ctrl+W` to widen to all worktrees of the repository or `Ctrl+A` to widen to every project on this machine. Sessions whose first prompt was a [`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>) command don’t appear in the picker; running `/loop` later in a conversation doesn’t hide the session. Before v2.1.211, a `/loop` run early in a conversation hid the session from the picker permanently. From v2.1.169, moving a session with [`/cd`](</docs/en/commands>) relocates it to the new directory’s project storage, so it appears in that directory’s picker afterward. As of v2.1.196, a moved session stays out of the old directory’s picker even after a crash or forced exit. On earlier versions, it could also reappear in the old directory’s list after an exit that wasn’t clean when the old path contained special characters such as underscores. Selecting a session from another worktree of the same repository resumes it in place. Selecting a session from an unrelated project copies a `cd` and resume command to your clipboard instead. Resuming by name resolves across the current repository and its worktrees. Both forms look for an exact match and resume it directly even if it lives in a different worktree:
Command| Exact match| Ambiguous name
---|---|---
Show diff (121 lines)
--- a/settings.md
+++ b/settings.md
@@ -1,4 +1,4 @@
-Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command, which opens a tabbed Settings interface where you can view status information and modify configuration options. From v2.1.181, you can change a single option without opening the interface by passing `key=value` to `/config`, for example `/config verbose=true`.
+Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command in an interactive session, which opens a tabbed Settings interface where you can view status information and modify configuration options. From v2.1.181, you can change a single option without opening the interface by passing `key=value` to `/config`, for example `/config verbose=true`.
##
@@ -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`| 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 creates it)
###
@@ -98,7 +98,11 @@
* **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. Because this file is yours rather than the repository’s, its permission `allow` rules take effect without the [workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>) step that `.claude/settings.json` allow rules require. If the repository supplies the file, for example by committing it, workspace trust still applies.
+ * `.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.
+
+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.
+
+Claude Code also saves permanent “don’t ask again” [permission approvals](</docs/en/permissions#permission-system>), such as Bash command approvals, to this file. Because this file is yours rather than the repository’s, its permission `allow` rules take effect without the [workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>) step that `.claude/settings.json` allow rules require. If the repository supplies the file, for example by committing it, workspace trust still applies.
* **Managed settings** : For organizations that need centralized control, Claude Code supports multiple delivery mechanisms for managed settings. All use the same JSON format and cannot be overridden by user or project settings:
* **Server-managed settings** : delivered remotely at sign-in, either from Anthropic’s servers via the claude.ai admin console or from a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>). See [server-managed settings](</docs/en/server-managed-settings>).
* **MDM/OS-level policies** : delivered through native device management on macOS and Windows:
@@ -120,6 +124,11 @@
* **Other configuration** is stored in `~/.claude.json`. This file contains your OAuth session, [MCP server](</docs/en/mcp>) configurations for user and local scopes, per-project state (allowed tools, trust settings), and various caches. Project-scoped MCP servers are stored separately in `.mcp.json`.
Claude Code automatically creates timestamped backups of configuration files and retains the five most recent backups to prevent data loss.
+
+The following example works in any of the settings file locations above. Where you save the file determines where it applies:
+
+ * To apply it to all of your projects, save it as `~/.claude/settings.json`. This file lives in your home directory rather than in any project, so Claude Code reads it in every session regardless of which project you open.
+ * To share it with collaborators on one project, save it as `.claude/settings.json` in that project. Claude Code reads this file from the directory the session runs in, so it applies only to that project, and checking it into source control gives every collaborator the same settings.
Example settings.json
@@ -151,6 +160,8 @@
The `$schema` line in the example above points to the [official JSON schema](<https://json.schemastore.org/claude-code-settings.json>) for Claude Code settings. Adding it to your `settings.json` enables autocomplete and inline validation in VS Code, Cursor, and any other editor that supports JSON schema validation. The published schema is updated periodically and may not include settings added in the most recent CLI releases, so a validation warning on a recently documented field does not necessarily mean your configuration is invalid.
+After you edit a settings file, run `/status` inside Claude Code to confirm it was loaded. The `Setting sources` line lists each settings source loaded for the current session; a source appears once it loads with at least one setting, so a file with broken JSON doesn’t appear even if it contains settings. See Verify active settings.
+
###
@@ -198,7 +209,7 @@
Key| Description| Example
---|---|---
-`advisorModel`| Model for the server-side [advisor tool](</docs/en/advisor>). Accepts a model alias such as `"opus"`, `"sonnet"`, or `"fable"` (v2.1.170+), or a full model ID. Written automatically when you run `/advisor`. Unset to disable the advisor| `"opus"`
+`advisorModel`| Model for the server-side [advisor tool](</docs/en/advisor>). Accepts the model aliases `"opus"` and `"sonnet"`, or a full model ID. Written automatically when you run `/advisor`. Unset to disable the advisor. [Claude Code doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>): a saved `"fable"` value attaches no advisor and raises no error.| `"opus"`
`agent`| Run the main thread as a named subagent, and set the default agent for sessions dispatched from `claude agents`. Applies that subagent’s system prompt, tool restrictions, and model. See [Invoke subagents explicitly](</docs/en/sub-agents#invoke-subagents-explicitly>)| `"code-reviewer"`
`agentPushNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Appears in `/config` as **Push when Claude decides**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). Requires Claude Code v2.1.119 or later| `true`
`allowAllClaudeAiMcps`| (Managed settings only) Load claude.ai connectors alongside a deployed `managed-mcp.json`, which otherwise takes exclusive control and suppresses them. See [Managed MCP configuration](</docs/en/managed-mcp>)| `true`
@@ -231,7 +242,7 @@
`claudeMdExcludes`| Glob patterns or absolute paths of `CLAUDE.md` files to skip when loading [memory](</docs/en/memory>). Patterns match against absolute file paths. Only applies to user, project, and local memory; managed policy files cannot be excluded| `["**/vendor/**/CLAUDE.md"]`
`cleanupPeriodDays`| **Default** : `30` days, minimum `1`. Claude Code deletes [session files and other application data](</docs/en/claude-directory#cleaned-up-automatically>) older than this period at startup. Setting `0` fails with a validation error. The same age cutoff applies to automatic removal of [orphaned worktrees](</docs/en/worktrees#clean-up-worktrees>) at startup. If Claude Code can’t read or parse a settings file, it pauses the retention cleanup sweep and shows a warning in `/status` until you fix the file, unless [managed settings](</docs/en/server-managed-settings>) provide `cleanupPeriodDays`, in which case the sweep runs at the managed value. Before v2.1.203, cleanup ran at the 30-day default in that state and could delete transcripts a longer `cleanupPeriodDays` was meant to keep; files newer than 30 days were never removed. To disable transcript writes entirely, set the [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](</docs/en/env-vars>) environment variable. In non-interactive mode, pass `--no-session-persistence` alongside `-p` or set `persistSession: false` in the Agent SDK.| `20`
`companyAnnouncements`| Announcement to display to users at startup. If multiple announcements are provided, they will be cycled through at random.| `["Welcome to Acme Corp! Review our code guidelines at docs.acme.com"]`
-`defaultShell`| **Default** : `"bash"`, or `"powershell"` on Windows when Bash isn’t available. Default shell for input-box `!` commands. Accepts `"bash"` or `"powershell"`. Setting `"powershell"` routes interactive `!` commands through PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>)| `"powershell"`
+`defaultShell`| **Default** : `"bash"`, or `"powershell"` on Windows when Bash isn’t available. Default shell for input-box `!` commands. Accepts `"bash"` or `"powershell"`. Setting `"powershell"` routes interactive `!` commands through PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere| `"powershell"`
`deniedMcpServers`| When set in managed-settings.json, denylist of MCP servers that are explicitly blocked. Applies to all scopes including managed servers. Denylist takes precedence over allowlist. See [Managed MCP configuration](</docs/en/managed-mcp>)| `[{ "serverName": "filesystem" }]`
`disableAgentView`| Set to `true` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Typically set in [managed settings](</docs/en/permissions#managed-settings>). Equivalent to setting `CLAUDE_CODE_DISABLE_AGENT_VIEW` to `1`| `true`
`disableAllHooks`| Disable all [hooks](</docs/en/hooks>) and any custom [status line](</docs/en/statusline>)| `true`
@@ -240,7 +251,7 @@
`disableBrowserExternalNavigation`| (Managed settings only) Set to `true` to turn off external browsing in the desktop app’s [Browser pane](</docs/en/desktop#browse-external-sites>). Neither users nor Claude can navigate to external sites, and localhost dev server previews are unaffected. The value must be the JSON boolean `true`; the string `"true"` is ignored| `true`
`disableBundledSkills`| Set to `true` 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`](</docs/en/env-vars>) instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to setting `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS` to `1`| `true`
`disableClaudeAiConnectors`| Disable [claude.ai MCP connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) so they are not auto-fetched or connected. Set in any settings scope. `true` in any source takes precedence, so a checked-in project `.claude/settings.json` can opt a repo out of cloud connectors, but a project-level `false` cannot override a user- or policy-level `true`. Servers passed explicitly via `--mcp-config` are unaffected. To deny individual connectors instead of all of them, use [`deniedMcpServers`](</docs/en/managed-mcp>). Requires Claude Code v2.1.182 or later| `true`
-`disableDeepLinkRegistration`| Set to `"disable"` to prevent Claude Code from registering the `claude-cli://` protocol handler with the operating system on startup. [Deep links](</docs/en/deep-links>) let external tools open a Claude Code session with a pre-filled prompt. Useful in environments where protocol handler registration is restricted or managed separately| `"disable"`
+`disableDeepLinkRegistration`| Set to `"disable"` to prevent Claude Code from registering the `claude-cli://` protocol handler with the operating system when you send the first prompt of an interactive session. [Deep links](</docs/en/deep-links>) let external tools open a Claude Code session with a pre-filled prompt. Useful in environments where protocol handler registration is restricted or managed separately| `"disable"`
`disabledMcpjsonServers`| List of specific MCP servers from `.mcp.json` files to reject| `["filesystem"]`
`disableRemoteControl`| Disable [Remote Control](</docs/en/remote-control>): blocks `claude remote-control`, the `--remote-control` flag, auto-start, and the in-session toggle. Typically placed in [managed settings](</docs/en/permissions#managed-settings>) for per-device MDM enforcement, but works from any scope. Requires Claude Code v2.1.128 or later| `true`
`disableSideloadFlags`| (Managed settings only) Reject the `--plugin-dir`, `--plugin-url`, `--agents`, and `--mcp-config` CLI flags at startup, which users could otherwise pass to bypass `strictKnownMarketplaces` for a single run. Also rejects these flags from any surface that spawns the CLI with them internally, currently [Cowork](</docs/en/desktop>) local sessions in the desktop app. A `--mcp-config` whose servers are all in-process `type: "sdk"` entries is still accepted, so the Agent SDK and VS Code extension keep working. Doesn’t block `claude mcp add`, `.mcp.json`, or SDK `setMcpServers()`; pair with [`allowedMcpServers`](</docs/en/managed-mcp>) for per-server MCP control. Requires Claude Code v2.1.193 or later| `true`
@@ -283,6 +294,7 @@
`policyHelper`| Admin-deployed executable that computes managed settings dynamically at startup. Only honored from MDM or a system `managed-settings.json` file. See Compute managed settings with a policy helper. Requires Claude Code v2.1.136 or later| `{"path": "/usr/local/bin/claude-policy"}`
`preferredNotifChannel`| **Default** : `"auto"`. Method for task-complete and permission-prompt notifications: `"auto"`, `"terminal_bell"`, `"iterm2"`, `"iterm2_with_bell"`, `"kitty"`, `"ghostty"`, or `"notifications_disabled"`. `"auto"` sends a desktop notification in iTerm2, Ghostty, and Kitty and does nothing in other terminals. Set `"terminal_bell"` to ring the bell character in any terminal. Appears in `/config` as **Notifications**. See [Get a terminal bell or notification](</docs/en/terminal-config#get-a-terminal-bell-or-notification>)| `"terminal_bell"`
`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`
`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"`
@@ -316,7 +328,7 @@
`voice`| [Voice dictation](</docs/en/voice-dictation>) settings: `enabled` turns dictation on, `mode` selects `"hold"` or `"tap"`, and `autoSubmit` sends the prompt on key release in hold mode. Written automatically when you run `/voice`. Requires a Claude.ai account| `{ "enabled": true, "mode": "tap" }`
`voiceEnabled`| Legacy alias for `voice.enabled`. Prefer the `voice` object| `true`
`wheelScrollAccelerationEnabled`| **Default** : `true`. In [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>), accelerate mouse-wheel scroll speed during fast scrolls. Set to `false` for a constant scroll rate per wheel notch. Requires Claude Code v2.1.174 or later| `false`
-`workflowKeywordTriggerEnabled`| **Default** : `true`. Whether the keyword `ultracode` in a prompt triggers a [dynamic workflow](</docs/en/workflows#ask-for-a-workflow-in-your-prompt>). Set to `false` to type the word without triggering one. The `ultracode` effort setting, `/workflows`, and saved workflow commands are unaffected. Appears in `/config` as **Ultracode keyword trigger**. Added in v2.1.157; before v2.1.160 the trigger keyword was `workflow`| `false`
+`workflowKeywordTriggerEnabled`| **Default** : `true`. Whether the keyword `ultracode` in a prompt you type triggers a [dynamic workflow](</docs/en/workflows#ask-for-a-workflow-in-your-prompt>). Set to `false` to type the word without triggering one. The `ultracode` effort setting, `/workflows`, and saved workflow commands are unaffected. Appears in `/config` as **Ultracode keyword trigger**. Added in v2.1.157; before v2.1.160 the trigger keyword was `workflow`| `false`
`wslInheritsWindowsSettings`| (Windows managed settings only) When `true`, Claude Code on WSL reads managed settings from the Windows policy chain in addition to `/etc/claude-code`, with Windows sources taking priority. Only honored when set in the HKLM registry key or `C:\Program Files\ClaudeCode\managed-settings.json`, both of which require Windows admin to write. For HKCU policy to also apply on WSL, the flag must additionally be set in HKCU itself. Has no effect on native Windows| `true`
###
@@ -325,7 +337,7 @@
Global config settings
-These settings are stored in `~/.claude.json` rather than `settings.json`. Adding them to `settings.json` will trigger a schema validation error.
+These settings are stored in `~/.claude.json` rather than `settings.json`. If you add these keys to `settings.json`, Claude Code silently ignores them at startup, so double-check the table below for which file each key belongs in.
Versions before v2.1.119 also store a number of `/config` preference keys here instead of in `settings.json`, including `theme`, `verbose`, `editorMode`, `autoCompactEnabled`, and `preferredNotifChannel`.
@@ -333,6 +345,7 @@
---|---|---
`autoConnectIde`| **Default** : `false`. Automatically connect to a running IDE when Claude Code starts from an external terminal. Appears in `/config` as **Auto-connect to IDE (external terminal)** when running outside a VS Code or JetBrains terminal. The [`CLAUDE_CODE_AUTO_CONNECT_IDE`](</docs/en/env-vars>) environment variable overrides this when set| `true`
`autoInstallIdeExtension`| **Default** : `true`. Automatically install the Claude Code IDE extension when running from a VS Code terminal. Appears in `/config` as **Auto-install IDE extension** when running inside a VS Code or JetBrains terminal. You can also set the [`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`](</docs/en/env-vars>) environment variable to `1`| `false`
+`diffTool`| **Default** : `auto`. Where to display file diffs when an IDE is connected: `auto` opens diffs in the IDE’s diff viewer, `terminal` keeps them in the terminal. Appears in `/config` as **Diff tool** only when Claude Code is connected to a VS Code or JetBrains IDE| `"terminal"`
`externalEditorContext`| **Default** : `false`. Prepend Claude’s previous response as `#`-commented context when you open the external editor with `Ctrl+G`. Appears in `/config` as **Show last response in external editor**| `true`
`permissionExplainerEnabled`| **Default** : `true`. Show a model-generated [explanation of the command](</docs/en/permissions#permission-system>) when you press `Ctrl+E` on a Bash or PowerShell permission prompt. Set to `false` to turn the shortcut off| `false`
`teammateDefaultModel`| Default model for [agent team](</docs/en/agent-teams>) teammates when the spawn prompt doesn’t specify one. Set to a model alias such as `"sonnet"`, or `null` to inherit the lead’s current `/model` selection. Appears in `/config` as **Default teammate model**| `"sonnet"`
@@ -666,7 +679,7 @@
Verify active settings
-Run `/status` inside Claude Code to see which settings sources are active. Inside the menu, the **Status** tab includes a `Setting sources` line that lists each layer Claude Code loaded for the current session, such as `User settings` or `Project local settings`. When [managed settings](</docs/en/admin-setup#decide-how-settings-reach-devices>) are in effect, the entry shows the delivery channel in parentheses, for example `Enterprise managed settings (remote)`, `(plist)`, `(HKLM)`, `(HKCU)`, or `(file)`. The `remote` channel covers both claude.ai server-managed settings and [Claude apps gateway](</docs/en/claude-apps-gateway>)-delivered policies. A layer appears in the list only when that source is loaded with at least one key, so an empty list means no settings sources were found. The `Setting sources` line confirms which sources are being read. It does not show which layer supplied each individual key. The **Config** tab in the same dialog is an editor for a fixed set of toggles such as theme and verbose output, not a view of your `settings.json` contents. If a settings file contains errors, such as invalid JSON or a value that fails validation, `/status` lists the affected files. Run `claude doctor` to see the details for each error.
+Run `/status` inside Claude Code to see which settings sources are active. Inside the menu, the **Status** tab includes a `Setting sources` line that lists each layer Claude Code loaded for the current session, such as `User settings` or `Project local settings`. When [managed settings](</docs/en/admin-setup#decide-how-settings-reach-devices>) are in effect, the entry shows the delivery channel in parentheses, for example `Enterprise managed settings (remote)`, `(plist)`, `(HKLM)`, `(HKCU)`, or `(file)`. The `remote` channel covers both claude.ai server-managed settings and [Claude apps gateway](</docs/en/claude-apps-gateway>)-delivered policies. A layer appears in the list only when that source is loaded with at least one key, so an empty list means no settings sources were found. The `Setting sources` line confirms which sources are being read. It does not show which layer supplied each individual key. The **Config** tab in the same dialog is an editor for a fixed set of toggles such as theme and verbose output, not a view of your `settings.json` contents. If a user, project, or local settings file contains errors, such as invalid JSON or a value that fails validation, an interactive session shows a **Settings Error** dialog at startup. The dialog lets you fix the file with Claude’s help, exit, or continue without the broken settings. After you continue, `/status` lists the affected files. Run `claude doctor` to see the details for each error. Managed settings entries that fail validation follow the more tolerant flow described in Invalid entries in managed settings: the file isn’t rejected as a whole, and the remaining valid policies stay enforced.
###
--- a/setup.md
+++ b/setup.md
@@ -73,7 +73,7 @@
claude
-If you encounter any issues during installation, see [Troubleshoot installation and login](</docs/en/troubleshoot-install>).
+Claude Code opens an interactive session in your terminal. If you encounter any issues during installation, see [Troubleshoot installation and login](</docs/en/troubleshoot-install>).
###
@@ -108,11 +108,15 @@
Alpine Linux and musl-based distributions
-The native installer on Alpine and other musl/uClibc-based distributions requires `libgcc`, `libstdc++`, and `ripgrep`. Install these using your distribution’s package manager, then set `USE_BUILTIN_RIPGREP=0`. This example installs the required packages on Alpine:
-
- apk add libgcc libstdc++ ripgrep
-
-Then set `USE_BUILTIN_RIPGREP` to `0` in your [`settings.json`](</docs/en/settings#available-settings>) file:
+Installing Claude Code on Alpine and other musl/uClibc-based distributions requires `bash` and `curl` for the install command, and `libgcc`, `libstdc++`, and `ripgrep` at runtime. Alpine doesn’t include `bash` or `curl` by default, so the documented install command fails with a `not found` error until you install them. Install these packages using your distribution’s package manager, then set `USE_BUILTIN_RIPGREP=0`. This example installs the required packages on Alpine:
+
+ apk add bash curl libgcc libstdc++ ripgrep
+
+On Alpine, `ripgrep` is in the community repository. If `apk` reports that the package is missing, add the community repository to `/etc/apk/repositories`, using your Alpine version:
+
+ echo "https://dl-cdn.alpinelinux.org/alpine/v3.22/community" >> /etc/apk/repositories
+
+Run `apk update` to refresh the package index, and retry the `apk add` command. Then set `USE_BUILTIN_RIPGREP` to `0` in your [`settings.json`](</docs/en/settings#available-settings>) file:
{
"env": {
@@ -130,17 +134,19 @@
claude --version
-If this fails with `command not found` or another error, see [Troubleshoot installation and login](</docs/en/troubleshoot-install>). For a more detailed check of your installation and configuration, run [`claude doctor`](</docs/en/troubleshooting#get-more-help>):
+A working installation prints a version number such as `2.1.211 (Claude Code)`. If this fails with `command not found` or another error, see [Troubleshoot installation and login](</docs/en/troubleshoot-install>). For a more detailed check of your installation and configuration, run [`claude doctor`](</docs/en/troubleshooting#get-more-help>):
claude doctor
+`claude doctor` prints read-only installation and settings diagnostics without starting a session, including install health, settings-file validation errors, and any warnings with suggested fixes.
+
##
Authenticate
-Claude Code requires a Pro, Max, Team, Enterprise, or Console account. The free Claude.ai plan does not include Claude Code access. You can also use Claude Code with a third-party API provider like [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>). After installing, log in by running `claude` and following the browser prompts. See [Authentication](</docs/en/authentication>) for all account types and team setup options.
+Claude Code requires a Pro, Max, Team, Enterprise, or Console account. The free Claude.ai plan does not include Claude Code access. You can also use Claude Code with a third-party API provider like [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>). After installing, log in by running `claude` and following the browser prompts. If the `ANTHROPIC_API_KEY` environment variable is set, Claude Code prompts you once to approve the key instead of opening a browser. See [Authentication](</docs/en/authentication>) for all account types and team setup options.
##
@@ -219,6 +225,8 @@
To apply an update immediately without waiting for the next background check, run:
claude update
+
+When an update installs, the command reports `Successfully updated from <old version> to version <new version>`. If you’re already on the newest version, it reports `Claude Code is up to date (<version>)`. Installs managed by Homebrew, WinGet, or apk report `Claude is up to date!` instead.
##
Show diff (111 lines)
--- a/skills.md
+++ b/skills.md
@@ -26,7 +26,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. `/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.
##
@@ -175,7 +175,7 @@
- Return consistent error formats
- Include request validation
-**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically.
+**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically. The example below adds `context: fork`, which runs the skill in its own subagent context; see Run skills in a subagent.
---
name: deploy
@@ -219,15 +219,15 @@
`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). As of v2.1.196, also prevents the skill from running when a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
-`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list.
+`allowed-tools`| No| Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See Pre-approve tools for a skill.
`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
-`context`| No| Set to `fork` to run in a forked subagent context.
+`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
-`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
+`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere.
####
@@ -266,7 +266,7 @@
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
`${CLAUDE_PROJECT_DIR}`| The project root directory. This is the same path [hooks](</docs/en/hooks#reference-scripts-by-path>) and MCP servers receive as `CLAUDE_PROJECT_DIR`. Use this to reference project-local scripts or files, such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/helper.sh`, independent of where the skill is installed.
-The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
+The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
@@ -343,7 +343,7 @@
Skill content lifecycle
-When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
+When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. This persistence applies to the skill’s instructions, not its permissions: an `allowed-tools` grant clears when you send your next message. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
###
@@ -351,7 +351,7 @@
Pre-approve tools for a skill
-The `allowed-tools` field grants permission for the listed tools while the skill is active, so Claude can use them without prompting you for approval. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
+The `allowed-tools` field grants permission for the listed tools during the turn that invokes the skill, so Claude can use them without prompting you for approval. The grant clears when you send your next message, even though the skill content stays in context; invoking the skill again re-applies it for that turn. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. To pre-approve tools for the whole session rather than a single turn, add allow rules to those permission settings instead. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
---
name: commit
@@ -508,7 +508,7 @@
Restrict Claude’s skill access
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
# Add to deny rules:
Skill
@@ -532,7 +532,7 @@
Override skill visibility from settings
-The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo or provided by an MCP server. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
+The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
Value| Listed to Claude| In `/` menu
---|---|---
@@ -541,7 +541,7 @@
`"user-invocable-only"`| Hidden| Yes
`"off"`| Hidden| Hidden
-As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
+The `/skills` menu labels the `"user-invocable-only"` state `user-only`. As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
{
"skillOverrides": {
@@ -570,7 +570,7 @@
/plugin install skill-creator@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
* **Test cases** : stores prompts, input files, and expected behavior in `evals/evals.json` inside the skill directory
* **Isolated runs** : spawns a [subagent](</docs/en/sub-agents>) per test case so each run starts with a clean context, and records token count and duration
@@ -777,7 +777,7 @@
See all 133 lines
-To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, generates `codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
+To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, which prints the generated file’s path, such as `Generated /path/to/codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
##
--- a/statusline.md
+++ b/statusline.md
@@ -78,7 +78,7 @@
Create a script that reads JSON and prints output
-Claude Code sends JSON data to your script via stdin. This script uses [`jq`](<https://jqlang.github.io/jq/>), a command-line JSON parser you may need to install, to extract the model name, directory, and context percentage, then prints a formatted line.Save this to `~/.claude/statusline.sh` (where `~` is your home directory, such as `/Users/username` on macOS or `/home/username` on Linux):
+Claude Code sends JSON data to your script via stdin. This script uses [`jq`](<https://jqlang.org/>), a command-line JSON parser you may need to install, to extract the model name, directory, and context percentage, then prints a formatted line.Save this to `~/.claude/statusline.sh` (where `~` is your home directory, such as `/Users/username` on macOS or `/home/username` on Linux):
#!/bin/bash
# Read JSON data that Claude Code sends to stdin
@@ -148,7 +148,7 @@
`workspace.added_dirs`| Additional directories added via `/add-dir` or `--add-dir`. Empty array if none have been added
`workspace.git_worktree`| Git worktree name when the current directory is inside a linked worktree created with `git worktree add`. Absent in the main working tree. Populated for any git worktree, unlike `worktree.*` which applies only to `--worktree` sessions
`workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured
-`cost.total_cost_usd`| Estimated session cost in USD, computed client-side. May differ from your actual bill
+`cost.total_cost_usd`| Estimated session cost in USD, computed client-side. May differ from your actual bill. Resets to $0 when `/clear` starts a new session
`cost.total_duration_ms`| Total wall-clock time since the session started, in milliseconds
`cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds
`cost.total_lines_added`, `cost.total_lines_removed`| Lines of code changed
@@ -316,7 +316,7 @@
2. Make it executable: `chmod +x ~/.claude/statusline.sh`
3. Add the path to your settings
-The Bash examples use [`jq`](<https://jqlang.github.io/jq/>) to parse JSON. Python and Node.js have built-in JSON parsing.
+The Bash examples use [`jq`](<https://jqlang.org/>) to parse JSON. Python and Node.js have built-in JSON parsing.
###
Show diff (121 lines)
--- a/streaming-vs-single-mode.md
+++ b/streaming-vs-single-mode.md
@@ -56,6 +56,8 @@
Implementation Example
+
+These examples read an image named `diagram.png` from the working directory. Create one there first, or change the filename to point at your own image.
TypeScript
@@ -176,6 +178,8 @@
asyncio.run(streaming_analysis())
+When you run the example, the TypeScript version prints each response as it completes. The Python version’s `receive_response()` loop ends at the first result message, so it prints the security analysis; to read both responses, use one `query()` and `receive_response()` pair per message as shown in the [Python reference’s example of continuing a conversation](</docs/en/agent-sdk/python#example-continuing-a-conversation>).
+
In the TypeScript SDK, if your message generator throws, for example when a file it reads is missing, the stream ends with an error that reads `Claude Code process aborted by user` instead of the original error, so check the code inside your generator first when you see that message. The error may also be preceded by a long minified line of bundled SDK source, so read to the end of the output for the error text.In the Python SDK, a generator exception is logged at debug level and the session stalls without raising, so if a streaming session hangs with no output, enable debug logging and check your generator.
##
@@ -226,29 +230,38 @@
import { query } from "@anthropic-ai/claude-agent-sdk";
// Simple one-shot query
- for await (const message of query({
- prompt: "Explain the authentication flow",
- options: {
- maxTurns: 1,
- allowedTools: ["Read", "Grep"]
- }
- })) {
- if (message.type === "result" && message.subtype === "success") {
- console.log(message.result);
- }
+ // query() throws after an error result, such as error_max_turns
+ try {
+ for await (const message of query({
+ prompt: "Explain the authentication flow",
+ options: {
+ maxTurns: 5,
+ allowedTools: ["Read", "Grep"]
+ }
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+ } catch (error) {
+ console.error(`Query failed: ${error}`);
}
// Continue conversation with session management
- for await (const message of query({
- prompt: "Now explain the authorization process",
- options: {
- continue: true,
- maxTurns: 1
- }
- })) {
- if (message.type === "result" && message.subtype === "success") {
- console.log(message.result);
- }
+ try {
+ for await (const message of query({
+ prompt: "Now explain the authorization process",
+ options: {
+ continue: true,
+ maxTurns: 5
+ }
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+ } catch (error) {
+ console.error(`Query failed: ${error}`);
}
from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
@@ -256,19 +269,29 @@
async def single_message_example():
# Simple one-shot query using query() function
- async for message in query(
- prompt="Explain the authentication flow",
- options=ClaudeAgentOptions(max_turns=1, allowed_tools=["Read", "Grep"]),
- ):
- if isinstance(message, ResultMessage):
- print(message.result)
+ # query() raises after an error result, such as error_max_turns
+ try:
+ async for message in query(
+ prompt="Explain the authentication flow",
+ options=ClaudeAgentOptions(max_turns=5, allowed_tools=["Read", "Grep"]),
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+ # The SDK raises a plain Exception for error results, so match Exception here
+ except Exception as e:
+ print(f"Query failed: {e}")
# Continue conversation with session management
- async for message in query(
- prompt="Now explain the authorization process",
- options=ClaudeAgentOptions(continue_conversation=True, max_turns=1),
- ):
- if isinstance(message, ResultMessage):
- print(message.result)
+ try:
+ async for message in query(
+ prompt="Now explain the authorization process",
+ options=ClaudeAgentOptions(continue_conversation=True, max_turns=5),
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+ except Exception as e:
+ print(f"Query failed: {e}")
asyncio.run(single_message_example())
+
+When you run the example, each query prints its final result text: first the authentication explanation, then the authorization explanation.
Show diff (375 lines)
--- a/structured-outputs.md
+++ b/structured-outputs.md
@@ -63,20 +63,26 @@
required: ["company_name"]
};
- for await (const message of query({
- prompt: "Research Anthropic and provide key company information",
- options: {
- outputFormat: {
- type: "json_schema",
- schema: schema
+ try {
+ for await (const message of query({
+ prompt: "Research Anthropic and provide key company information",
+ options: {
+ outputFormat: {
+ type: "json_schema",
+ schema: schema
+ }
+ }
+ })) {
+ // The result message contains structured_output with validated data
+ if (message.type === "result" && message.subtype === "success" && message.structured_output) {
+ console.log(message.structured_output);
+ // { company_name: "Anthropic", founded_year: 2021, headquarters: "San Francisco, CA" }
}
}
- })) {
- // The result message contains structured_output with validated data
- if (message.type === "result" && message.subtype === "success" && message.structured_output) {
- console.log(message.structured_output);
- // { company_name: "Anthropic", founded_year: 2021, headquarters: "San Francisco, CA" }
- }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result, such as
+ // error_max_structured_output_retries; see the Error handling section.
+ console.error(`Session ended with an error: ${error}`);
}
import asyncio
@@ -94,16 +100,21 @@
}
async def main():
- async for message in query(
- prompt="Research Anthropic and provide key company information",
- options=ClaudeAgentOptions(
- output_format={"type": "json_schema", "schema": schema}
- ),
- ):
- # The result message contains structured_output with validated data
- if isinstance(message, ResultMessage) and message.structured_output:
- print(message.structured_output)
- # {'company_name': 'Anthropic', 'founded_year': 2021, 'headquarters': 'San Francisco, CA'}
+ try:
+ async for message in query(
+ prompt="Research Anthropic and provide key company information",
+ options=ClaudeAgentOptions(
+ output_format={"type": "json_schema", "schema": schema}
+ ),
+ ):
+ # The result message contains structured_output with validated data
+ if isinstance(message, ResultMessage) and message.structured_output:
+ print(message.structured_output)
+ # {'company_name': 'Anthropic', 'founded_year': 2021, 'headquarters': 'San Francisco, CA'}
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result, such as
+ # error_max_structured_output_retries; see the Error handling section.
+ print(f"Session ended with an error: {error}")
asyncio.run(main())
@@ -142,28 +153,34 @@
const schema = z.toJSONSchema(FeaturePlan);
// Use in query
- for await (const message of query({
- prompt:
- "Plan how to add dark mode support to a React app. Break it into implementation steps.",
- options: {
- outputFormat: {
- type: "json_schema",
- schema: schema
+ try {
+ for await (const message of query({
+ prompt:
+ "Plan how to add dark mode support to a React app. Break it into implementation steps.",
+ options: {
+ outputFormat: {
+ type: "json_schema",
+ schema: schema
+ }
+ }
+ })) {
+ if (message.type === "result" && message.subtype === "success" && message.structured_output) {
+ // Validate and get fully typed result
+ const parsed = FeaturePlan.safeParse(message.structured_output);
+ if (parsed.success) {
+ const plan: FeaturePlan = parsed.data;
+ console.log(`Feature: ${plan.feature_name}`);
+ console.log(`Summary: ${plan.summary}`);
+ plan.steps.forEach((step) => {
+ console.log(`${step.step_number}. [${step.estimated_complexity}] ${step.description}`);
+ });
+ }
}
}
- })) {
- if (message.type === "result" && message.subtype === "success" && message.structured_output) {
- // Validate and get fully typed result
- const parsed = FeaturePlan.safeParse(message.structured_output);
- if (parsed.success) {
- const plan: FeaturePlan = parsed.data;
- console.log(`Feature: ${plan.feature_name}`);
- console.log(`Summary: ${plan.summary}`);
- plan.steps.forEach((step) => {
- console.log(`${step.step_number}. [${step.estimated_complexity}] ${step.description}`);
- });
- }
- }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result, such as
+ // error_max_structured_output_retries; see the Error handling section.
+ console.error(`Session ended with an error: ${error}`);
}
import asyncio
@@ -182,24 +199,29 @@
risks: list[str]
async def main():
- async for message in query(
- prompt="Plan how to add dark mode support to a React app. Break it into implementation steps.",
- options=ClaudeAgentOptions(
- output_format={
- "type": "json_schema",
- "schema": FeaturePlan.model_json_schema(),
- }
- ),
- ):
- if isinstance(message, ResultMessage) and message.structured_output:
- # Validate and get fully typed result
- plan = FeaturePlan.model_validate(message.structured_output)
- print(f"Feature: {plan.feature_name}")
- print(f"Summary: {plan.summary}")
- for step in plan.steps:
- print(
- f"{step.step_number}. [{step.estimated_complexity}] {step.description}"
- )
+ try:
+ async for message in query(
+ prompt="Plan how to add dark mode support to a React app. Break it into implementation steps.",
+ options=ClaudeAgentOptions(
+ output_format={
+ "type": "json_schema",
+ "schema": FeaturePlan.model_json_schema(),
+ }
+ ),
+ ):
+ if isinstance(message, ResultMessage) and message.structured_output:
+ # Validate and get fully typed result
+ plan = FeaturePlan.model_validate(message.structured_output)
+ print(f"Feature: {plan.feature_name}")
+ print(f"Summary: {plan.summary}")
+ for step in plan.steps:
+ print(
+ f"{step.step_number}. [{step.estimated_complexity}] {step.description}"
+ )
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result, such as
+ # error_max_structured_output_retries; see the Error handling section.
+ print(f"Session ended with an error: {error}")
asyncio.run(main())
@@ -261,25 +283,31 @@
};
// Agent uses Grep to find TODOs, Bash to get git blame info
- for await (const message of query({
- prompt: "Find all TODO comments in this codebase and identify who added them",
- options: {
- outputFormat: {
- type: "json_schema",
- schema: todoSchema
+ try {
+ for await (const message of query({
+ prompt: "Find all TODO comments in this codebase and identify who added them",
+ options: {
+ outputFormat: {
+ type: "json_schema",
+ schema: todoSchema
+ }
+ }
+ })) {
+ if (message.type === "result" && message.subtype === "success" && message.structured_output) {
+ const data = message.structured_output as { total_count: number; todos: Array<{ file: string; line: number; text: string; author?: string; date?: string }> };
+ console.log(`Found ${data.total_count} TODOs`);
+ data.todos.forEach((todo) => {
+ console.log(`${todo.file}:${todo.line} - ${todo.text}`);
+ if (todo.author) {
+ console.log(` Added by ${todo.author} on ${todo.date}`);
+ }
+ });
}
}
- })) {
- if (message.type === "result" && message.subtype === "success" && message.structured_output) {
- const data = message.structured_output as { total_count: number; todos: Array<{ file: string; line: number; text: string; author?: string; date?: string }> };
- console.log(`Found ${data.total_count} TODOs`);
- data.todos.forEach((todo) => {
- console.log(`${todo.file}:${todo.line} - ${todo.text}`);
- if (todo.author) {
- console.log(` Added by ${todo.author} on ${todo.date}`);
- }
- });
- }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result, such as
+ // error_max_structured_output_retries; see the Error handling section.
+ console.error(`Session ended with an error: ${error}`);
}
import asyncio
@@ -310,19 +338,24 @@
async def main():
# Agent uses Grep to find TODOs, Bash to get git blame info
- async for message in query(
- prompt="Find all TODO comments in this codebase and identify who added them",
- options=ClaudeAgentOptions(
- output_format={"type": "json_schema", "schema": todo_schema}
- ),
- ):
- if isinstance(message, ResultMessage) and message.structured_output:
- data = message.structured_output
- print(f"Found {data['total_count']} TODOs")
- for todo in data["todos"]:
- print(f"{todo['file']}:{todo['line']} - {todo['text']}")
- if "author" in todo:
- print(f" Added by {todo['author']} on {todo['date']}")
+ try:
+ async for message in query(
+ prompt="Find all TODO comments in this codebase and identify who added them",
+ options=ClaudeAgentOptions(
+ output_format={"type": "json_schema", "schema": todo_schema}
+ ),
+ ):
+ if isinstance(message, ResultMessage) and message.structured_output:
+ data = message.structured_output
+ print(f"Found {data['total_count']} TODOs")
+ for todo in data["todos"]:
+ print(f"{todo['file']}:{todo['line']} - {todo['text']}")
+ if "author" in todo:
+ print(f" Added by {todo['author']} on {todo['date']}")
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result, such as
+ # error_max_structured_output_retries; see the Error handling section.
+ print(f"Session ended with an error: {error}")
asyncio.run(main())
@@ -345,39 +378,80 @@
Python
- for await (const msg of query({
- prompt: "Extract contact info from the document",
- options: {
- outputFormat: {
- type: "json_schema",
- schema: contactSchema
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ const contactSchema = {
+ type: "object",
+ properties: {
+ name: { type: "string" },
+ email: { type: "string" }
+ },
+ required: ["name"]
+ };
+
+ try {
+ for await (const msg of query({
+ prompt: "Extract contact info from the document",
+ options: {
+ outputFormat: {
+ type: "json_schema",
+ schema: contactSchema
+ }
+ }
+ })) {
+ if (msg.type === "result") {
+ if (msg.subtype === "success" && msg.structured_output) {
+ // Use the validated output
+ console.log(msg.structured_output);
+ } else if (msg.subtype === "error_max_structured_output_retries") {
+ console.error("Could not produce valid output");
+ }
}
}
- })) {
- if (msg.type === "result") {
- if (msg.subtype === "success" && msg.structured_output) {
- // Use the validated output
- console.log(msg.structured_output);
- } else if (msg.subtype === "error_max_structured_output_retries") {
- // Handle the failure - retry with simpler prompt, fall back to unstructured, etc.
- console.error("Could not produce valid output");
- }
- }
- }
-
- async for message in query(
- prompt="Extract contact info from the document",
- options=ClaudeAgentOptions(
- output_format={"type": "json_schema", "schema": contact_schema}
- ),
- ):
- if isinstance(message, ResultMessage):
- if message.subtype == "success" and message.structured_output:
- # Use the validated output
- print(message.structured_output)
- elif message.subtype == "error_max_structured_output_retries":
- # Handle the failure
- print("Could not produce valid output")
+ } 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.
+ console.log(`Session ended with an error: ${error}`);
+ }
+
+ import asyncio
+ from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
+
+ contact_schema = {
+ "type": "object",
+ "properties": {
+ "name": {"type": "string"},
+ "email": {"type": "string"},
+ },
+ "required": ["name"],
+ }
+
+ async def main():
+ try:
+ async for message in query(
+ prompt="Extract contact info from the document",
+ options=ClaudeAgentOptions(
+ output_format={"type": "json_schema", "schema": contact_schema}
+ ),
+ ):
+ if isinstance(message, ResultMessage):
+ if message.subtype == "success" and message.structured_output:
+ # Use the validated output
+ print(message.structured_output)
+ elif message.subtype == "error_max_structured_output_retries":
+ print("Could not produce valid 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.
+ print(f"Session ended with an error: {error}")
+
+ asyncio.run(main())
**Tips for avoiding errors:**
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -208,7 +208,7 @@
You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.
-The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the full Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), the [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag appends the text you provide to the end of every subagent’s system prompt, including nested subagents. Requires Claude Code v2.1.205 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. Before v2.1.203, such a command could run in the main checkout.
+The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the full Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), the [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag appends the text you provide to the end of every subagent’s system prompt, including nested subagents. Requires Claude Code v2.1.205 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. Before v2.1.203, such a command could run in the main checkout. This working-directory check covers the whole repository containing the directory you launched Claude Code from. When your session runs in a linked [worktree](</docs/en/worktrees>) of its own, the check also covers the main checkout that worktree is linked from. Before v2.1.210, the check covered only the launch directory itself. A command whose working directory resolved elsewhere in the same repository, such as the repository root when you launched Claude Code from a monorepo subdirectory, ran there instead of failing.
####
@@ -257,7 +257,7 @@
3. The subagent definition’s `model` frontmatter
4. The main conversation’s model
-As of v2.1.196, setting `CLAUDE_CODE_SUBAGENT_MODEL` to `inherit` is the same as leaving it unset: resolution continues with the per-invocation `model` parameter, then the frontmatter. In earlier versions, `inherit` forced subagents onto the main conversation’s model and ignored both of those sources. Claude Code checks the environment variable, per-invocation parameter, and frontmatter values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. It skips a value that resolves to an excluded model and runs the subagent on the inherited model instead. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting.
+As of v2.1.196, setting `CLAUDE_CODE_SUBAGENT_MODEL` to `inherit` is the same as leaving it unset: resolution continues with the per-invocation `model` parameter, then the frontmatter. In earlier versions, `inherit` forced subagents onto the main conversation’s model and ignored both of those sources. Claude Code checks the environment variable, per-invocation parameter, and frontmatter values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. It skips a value that resolves to an excluded model and runs the subagent on the inherited model instead. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. Before v2.1.211, resuming dropped the per-invocation value and the subagent reverted to its definition’s `model` field or, without one, the main conversation’s model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting.
###
@@ -663,7 +663,7 @@
* **Foreground subagents** block the main conversation until complete. Permission prompts are passed through to you as they come up.
* **Background subagents** run concurrently while you continue working. As of v2.1.186, when a background subagent reaches a tool call that needs permission, the prompt surfaces in your main session and names the subagent that is asking. Approve to let the subagent continue, or press Esc to deny that one tool call without stopping the subagent. Before v2.1.186, background subagents auto-denied any tool call that would have prompted.
-As of v2.1.198, subagents run in the background by default. Claude runs a subagent in the foreground when it needs the result before continuing. The default changes where a subagent runs, not what it’s allowed to do: background subagents still surface every permission prompt in your main session. Before v2.1.198, Claude chose between foreground and background based on the task. You can also steer this yourself:
+As of v2.1.198, subagents run in the background by default. Claude runs a subagent in the foreground when it needs the result before continuing. The default changes where a subagent runs, not what it’s allowed to do: background subagents still surface every permission prompt in your main session. Before v2.1.198, Claude chose between foreground and background based on the task. A background subagent’s results reach Claude as a completion notification in a later turn. Claude waits for that notification before reporting the subagent’s results, and if you ask about progress first, it reports that the subagent is still running. Before v2.1.211, Claude sometimes reported results for a background subagent that hadn’t finished. You can also steer this yourself:
* Ask Claude to run a task in the background or in the foreground
* Press **Ctrl+B** to background a running task
@@ -682,6 +682,21 @@
* **Background** : the subagent is marked failed, and the message Claude receives when it ends names the API error and includes the subagent’s last output, so partial work isn’t lost.
Once the underlying API error clears, ask Claude to retry the task or resume the subagent.
+
+###
+
+
+
+Subagent output scanning
+
+Claude Code scans each subagent’s final report before Claude reads it. A subagent may have read files, web pages, or command output you never reviewed, and text from those sources can carry instructions aimed at the main conversation. The scan never removes or rewords anything; it makes two kinds of change you may notice in a report:
+
+ * **Backslash insertion** : the scan inserts a backslash into text that imitates Claude Code’s own output, such as a `<system-reminder>` tag or a line starting with `Human:` or `Assistant:`, so the imitation reads as ordinary text instead of being mistaken for part of the conversation.
+ * **Marker line** : the scan prepends a line starting with `[harness: subagent output matched instruction-shaped pattern(s):` when the report imitates a tag like `<system-reminder>` or mentions permission settings such as `bypassPermissions` or `--dangerously-skip-permissions`. Permission-setting mentions get the marker line, but the text itself stays as written.
+
+The scan doesn’t judge whether content is malicious, and it doesn’t change what an instruction in a report can do: a tool call the report leads Claude to make still goes through the session’s [permission checks](</docs/en/permissions>) and [sandboxing](</docs/en/sandboxing>). It isn’t a substitute for restricting what a subagent can reach.
+
+Subagent output scanning requires Claude Code v2.1.210 or later.
###
--- a/subagents.md
+++ b/subagents.md
@@ -217,7 +217,13 @@
Project CLAUDE.md (loaded via [`settingSources`](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>))| Preloaded skill content, unless listed in `AgentDefinition.skills`
Tool definitions (inherited from parent, or the subset in `tools`)| The parent’s system prompt
-The parent receives the subagent’s final message verbatim as the Agent tool result, but may summarize it in its own response. To preserve subagent output verbatim in the user-facing response, include an instruction to do so in the prompt or `systemPrompt` option you pass to the main `query()` call.
+The parent receives the subagent’s final message as the Agent tool result, but may summarize it in its own response. To preserve subagent output verbatim in the user-facing response, include an instruction to do so in the prompt or `systemPrompt` option you pass to the main `query()` call.In v2.1.210 and later, Claude Code [scans the final message for instruction-shaped patterns](</docs/en/sub-agents#subagent-output-scanning>) before the parent reads it. The scan treats three kinds of pattern differently:
+
+ * **Control-tag imitation** : Claude Code neutralizes a tag that only the harness emits, such as a `<system-reminder>` block, in place. It inserts a backslash after the opening angle bracket and deletes nothing.
+ * **Permission-configuration mentions** : Claude Code keeps references to the permission configuration, such as `.claude/settings.json`, `bypassPermissions`, or `--dangerously-skip-permissions`, as written.
+ * **Turn markers** : a line that starts with `Human:` or `Assistant:` gets a backslash before the colon, so the message can’t imitate a conversation turn boundary.
+
+For a control-tag or permission-configuration match, Claude Code prepends a `[harness: ...]` marker line naming the matched patterns; a turn-marker match doesn’t add the marker line. Those are the only modifications the scan makes: it never removes or rewords the subagent’s text.
An API error that ends the subagent early, such as a rate limit, is never delivered as its result. If a rate limit, overload, or server error cuts off a foreground subagent that already produced text output, the Agent tool returns that partial output with a note that the subagent didn’t finish. A subagent that produced nothing, or whose only output was tool calls with no text, fails with an error message, `Agent terminated early due to an API error`, followed by the error detail. See [API errors in subagents](</docs/en/sub-agents#api-errors-in-subagents>) for the foreground and background behavior. This partial-output handling requires Claude Code v2.1.199 or later. In v2.1.199, a rate limit, overload, or server error left the tool-calls-only shape with an empty partial result containing only the cutoff note.
--- a/terminal-config.md
+++ b/terminal-config.md
@@ -23,7 +23,7 @@
VS Code, Cursor, Devin Desktop, Alacritty, Zed| Run `/terminal-setup` once
gnome-terminal, JetBrains IDEs such as PyCharm and Android Studio| Not available; use Ctrl+J or `\` then Enter
-For VS Code, Cursor, Devin Desktop, Alacritty, and Zed, `/terminal-setup` writes Shift+Enter and other keybindings into the terminal’s configuration file. Existing bindings are left in place; if you see a message such as `VSCode terminal Shift+Enter key binding already configured`, no change was made. Run `/terminal-setup` directly in the host terminal rather than inside tmux or screen, since it needs to write to the host terminal’s configuration. In VS Code, Cursor, and Devin Desktop, `/terminal-setup` also updates two editor settings: it sets `terminal.integrated.gpuAcceleration` to `"off"` to prevent garbled text in the integrated terminal, and it sets `terminal.integrated.mouseWheelScrollSensitivity` for smoother scrolling in [fullscreen mode](</docs/en/fullscreen>). To undo the GPU acceleration change, set it back to `"auto"` and reload the editor window. If you are running inside tmux, Shift+Enter also requires the tmux configuration below even when the outer terminal supports it. To bind newline to a different key, or to swap behavior so Enter inserts a newline and Shift+Enter submits, map the `chat:newline` and `chat:submit` actions in your [keybindings file](</docs/en/keybindings>).
+For VS Code, Cursor, Devin Desktop, Alacritty, and Zed, `/terminal-setup` writes Shift+Enter and other keybindings into the terminal’s configuration file. On the first run you see a confirmation such as `Installed VSCode terminal Shift+Enter key binding`. Existing bindings are left in place; if you see a message such as `VSCode terminal Shift+Enter key binding already configured`, no change was made. Run `/terminal-setup` directly in the host terminal rather than inside tmux or screen, since it needs to write to the host terminal’s configuration. In VS Code, Cursor, and Devin Desktop, `/terminal-setup` also updates two editor settings: it sets `terminal.integrated.gpuAcceleration` to `"off"` to prevent garbled text in the integrated terminal, and it sets `terminal.integrated.mouseWheelScrollSensitivity` for smoother scrolling in [fullscreen mode](</docs/en/fullscreen>). To undo the GPU acceleration change, set it back to `"auto"` and reload the editor window. If you are running inside tmux, Shift+Enter also requires the tmux configuration below even when the outer terminal supports it. To bind newline to a different key, or to swap behavior so Enter inserts a newline and Shift+Enter submits, map the `chat:newline` and `chat:submit` actions in your [keybindings file](</docs/en/keybindings>).
##
@@ -39,7 +39,7 @@
* VS Code
-Open Settings → Profiles → Keyboard and check “Use Option as Meta Key”.If you accepted Claude Code’s first-run prompt that offered “Option+Enter for newlines and visual bell”, this is already done. That prompt runs `/terminal-setup` for you, which enables Option as Meta and switches the audio bell to a visual screen flash in your Apple Terminal profile.
+Open Settings → Profiles → Keyboard and check “Use Option as Meta Key”.If you accepted Claude Code’s first-run terminal setup prompt, this is already done. That prompt runs `/terminal-setup` for you, which enables Option as Meta and turns off the audible bell in your Apple Terminal profile.In [screen reader mode](</docs/en/accessibility>), `/terminal-setup` leaves the bell setting unchanged so the terminal bell stays audible. Before v2.1.211, `/terminal-setup` turned the bell off even in screen reader mode. If an earlier run turned the bell off, turn it back on under Settings → Profiles → Advanced → “Audible bell”.
Open Settings → Profiles → Keys → General and set Left Option key and Right Option key to “Esc+”.Running `/terminal-setup` in iTerm2 enables “Applications in terminal may access clipboard” under Settings → General → Selection so the `/copy` command can write to your system clipboard. The command detects iTerm2 even when run from inside tmux. Restart iTerm2 for the change to take effect.
@@ -53,7 +53,15 @@
Get a terminal bell or notification
-When Claude finishes a task or pauses for a permission prompt, it fires a notification event. Surfacing this as a terminal bell or desktop notification lets you switch to other work while a long task runs. By default Claude Code sends a desktop notification only in Ghostty, Kitty, and iTerm2. In other terminals, set [`preferredNotifChannel`](</docs/en/settings#available-settings>) to `"terminal_bell"` to ring the terminal bell instead, or configure a Notification hook for a custom sound or command. The desktop notification reaches your local machine over SSH, so a remote session can still alert you. Ghostty and Kitty forward it to your OS notification center without further setup. iTerm2 requires you to enable forwarding:
+When Claude finishes a task or pauses for a permission prompt, it fires a notification event. Surfacing this as a terminal bell or desktop notification lets you switch to other work while a long task runs. By default Claude Code sends a desktop notification only in Ghostty, Kitty, and iTerm2. In other terminals, set [`preferredNotifChannel`](</docs/en/settings#available-settings>) to `"terminal_bell"` to ring the terminal bell instead, or configure a Notification hook for a custom sound or command. The following settings entry turns on the terminal bell:
+
+~/.claude/settings.json
+
+ {
+ "preferredNotifChannel": "terminal_bell"
+ }
+
+The desktop notification reaches your local machine over SSH, so a remote session can still alert you. Ghostty and Kitty forward it to your OS notification center without further setup. iTerm2 requires you to enable forwarding:
1
@@ -143,7 +151,7 @@
}
}
-Claude Code watches `~/.claude/themes/` and reloads when a file changes, so edits made in your editor apply to a running session without a restart. The reference below covers the tokens you can set in `overrides`. The interactive editor in `/theme` shows the same tokens with a live preview, plus a few single-purpose accents such as onboarding screen colors that are omitted here.
+Claude Code watches `~/.claude/themes/` and reloads when a file is added or changed, so edits made in your editor apply to a running session without a restart. If the `~/.claude/themes/` folder itself didn’t exist when Claude Code started, restart once after creating your first theme file. After that, changes apply without a restart. The reference below covers the tokens you can set in `overrides`. The interactive editor in `/theme` shows the same tokens with a live preview, plus a few single-purpose accents such as onboarding screen colors that are omitted here.
Color token reference
@@ -243,7 +251,6 @@
---|---
`userMessageBackground`| Background behind your messages in the transcript
`userMessageBackgroundHover`| Background behind a message while hovered or expanded
-`messageActionsBackground`| Background behind the selected message when the action bar is open
`bashMessageBackgroundColor`| Background behind `!` shell command entries in the transcript
`memoryBackgroundColor`| Background behind `#` memory entries in the transcript
`selectionBg`| Background of text selected with the mouse
@@ -310,7 +317,7 @@
Paste large content
-When you paste more than 10,000 characters into the prompt, Claude Code collapses the input to a `[Pasted text]` placeholder so the input box stays usable. The full content is still sent to Claude when you submit. The VS Code integrated terminal can drop characters from very large pastes before they reach Claude Code, so prefer file-based workflows there. For very large inputs such as entire files or long logs, write the content to a file and ask Claude to read it instead of pasting. This keeps the conversation transcript readable and lets Claude reference the file by path in later turns.
+When you paste more than 800 characters or more than two lines into the prompt, Claude Code collapses the input to a placeholder such as `[Pasted text #1 +120 lines]` so the input box stays usable. The full content is still sent to Claude when you submit. The VS Code integrated terminal can drop characters from very large pastes before they reach Claude Code, so prefer file-based workflows there. For very large inputs such as entire files or long logs, write the content to a file and ask Claude to read it instead of pasting. This keeps the conversation transcript readable and lets Claude reference the file by path in later turns.
##
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -101,7 +101,13 @@
Bash tool behavior
-The Bash tool runs each command in a separate process with the following persistence behavior:
+The Bash tool runs each command in a separate process.
+
+###
+
+
+
+What persists between commands
* When Claude runs `cd` in the main session, the new working directory carries over to later Bash commands as long as it stays inside the project directory or an [additional working directory](</docs/en/permissions#working-directories>) you added with `--add-dir`, `/add-dir`, or `additionalDirectories` in settings. Subagent sessions never carry over working directory changes.
* If `cd` lands outside those directories, Claude Code resets to the project directory and appends `Shell cwd was reset to <dir>` to the tool result.
@@ -109,12 +115,29 @@
* Environment variables don’t persist. An `export` in one command won’t be available in the next.
* Aliases and shell functions defined in your shell startup file are available. At session start, Claude Code sources `~/.zshrc`, `~/.bashrc`, or `~/.profile` depending on your shell, captures the resulting aliases, functions, and shell options, and applies them to every Bash command.
-Activate your virtualenv or conda environment before launching Claude Code. To make environment variables persist across Bash commands, set [`CLAUDE_ENV_FILE`](</docs/en/env-vars>) to a shell script before launching Claude Code, or use a [SessionStart hook](</docs/en/hooks#persist-environment-variables>) to populate it dynamically. Two limits bound each command:
+Activate your virtualenv or conda environment before launching Claude Code. To make environment variables persist across Bash commands, set [`CLAUDE_ENV_FILE`](</docs/en/env-vars>) to a shell script before launching Claude Code, or use a [SessionStart hook](</docs/en/hooks#persist-environment-variables>) to populate it dynamically.
+
+###
+
+
+
+Timeout and output limits
+
+Two limits bound each command:
* **Timeout** : two minutes by default. Claude can request up to 10 minutes per command with the `timeout` parameter. Override the default and ceiling with [`BASH_DEFAULT_TIMEOUT_MS` and `BASH_MAX_TIMEOUT_MS`](</docs/en/env-vars>).
* **Output length** : 30,000 characters by default. When a command produces more than that, Claude Code saves the full output to a file in the session directory and gives Claude the file path plus a short preview from the start. Claude reads or searches that file when it needs the rest. Raise the limit with [`BASH_MAX_OUTPUT_LENGTH`](</docs/en/env-vars>), up to a hard ceiling of 150,000 characters.
-For long-running processes such as dev servers or watch builds, Claude can set `run_in_background: true` to start the command as a background task and continue working while it runs. List and stop background tasks with `/tasks`. In non-interactive mode with the `-p` flag, [background tasks end shortly after the run’s final result](</docs/en/headless#background-tasks-at-exit>).
+###
+
+
+
+Background commands
+
+For long-running processes such as dev servers or watch builds, Claude can set `run_in_background: true` to start the command as a background task and continue working while it runs. List and stop background tasks with `/tasks`. In non-interactive mode with the `-p` flag, [background tasks end shortly after the run’s final result](</docs/en/headless#background-tasks-at-exit>). When a command reaches its timeout without finishing, Claude Code moves it to the background instead of stopping it, so Claude keeps working while the command runs to completion. Claude Code never auto-backgrounds a command that starts with `sleep`, and setting [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1`](</docs/en/env-vars#variables>) disables auto-backgrounding along with the rest of the background task functionality. The result of a command moved this way states what happened:
+
+ * When the timeout triggers the move, the result reports it explicitly: `Command did not complete within its 120s timeout and was moved to the background`, with the seconds matching the timeout that applied, followed by the task ID and the path of the file the output is being written to.
+ * A `cd`, `pushd`, `popd`, or `chdir` inside a command that is moved to the background never carries over: the result states `Session cwd remains <dir>; directory changes made by the backgrounded command do not apply to subsequent commands.`, so Claude doesn’t act on a directory change that didn’t happen.
##
@@ -153,7 +176,7 @@
The Grep tool searches file contents for patterns. Where Glob finds files by name, Grep finds lines inside them. Grep is built on [ripgrep](<https://github.com/BurntSushi/ripgrep>) and uses ripgrep’s regex syntax, not POSIX grep. Patterns that include regex metacharacters need escaping. For example, finding `interface{}` in Go code takes the pattern `interface\{\}`. A pattern, glob, or file type that ripgrep rejects returns an error that includes ripgrep’s diagnostic, so Claude can correct the input and search again. Before v2.1.208, Claude Code reported a rejected input as `No files found` instead of an error, even when the searched-for text existed in the target files. Three output modes control what comes back:
* `files_with_matches`: file paths only, no line content. This is the default.
- * `content`: matching lines with file and line number.
+ * `content`: matching lines with file and line number. When the tool’s `offset` parameter points past the last match for a pattern that has matches, Grep returns `No entries at this offset`, so Claude widens or resets the offset instead of concluding the pattern doesn’t match.
* `count`: match count per file, followed by a total across all matching files. The total covers every match even when the tool’s `head_limit` or `offset` parameters truncate the listed per-file entries. Before v2.1.208, the total only summed the listed entries.
Claude can scope results by file with the `glob` parameter, such as `**/*.tsx`, or by language with the `type` parameter, such as `py` or `rust`. By default, patterns match within a single line. Claude can set `multiline: true` to match across line boundaries. Grep respects `.gitignore`, so gitignored files are skipped. To search a gitignored file, Claude passes its path directly.
--- a/troubleshoot-install.md
+++ b/troubleshoot-install.md
@@ -511,6 +511,8 @@
apk add libgcc libstdc++ ripgrep
+On Alpine, `ripgrep` is in the community repository. If `apk` reports that the package is missing, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>).
+
###
@@ -687,7 +689,7 @@
Not logged in or token expired
-If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. On macOS, login can also fail when the Keychain is locked or its password is out of sync with your account password, which prevents Claude Code from saving credentials. Run `claude doctor` to check Keychain access. To unlock the Keychain manually, run `security unlock-keychain ~/Library/Keychains/login.keychain-db`. If unlocking doesn’t help, open Keychain Access, select the `login` keychain, and choose Edit > Change Password for Keychain “login” to resync it with your account password.
+If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. Parallel sessions on one machine share a saved login and coordinate its renewal so that only one process refreshes the token at a time. Before v2.1.211, waking the machine from sleep could cause two sessions to renew with the same token, which revoked the saved login and prompted every open session to log in again at once. On macOS, login can also fail when the Keychain is locked or its password is out of sync with your account password, which prevents Claude Code from saving credentials. Run `claude doctor` to check Keychain access. To unlock the Keychain manually, run `security unlock-keychain ~/Library/Keychains/login.keychain-db`. If unlocking doesn’t help, open Keychain Access, select the `login` keychain, and choose Edit > Change Password for Keychain “login” to resync it with your account password.
###
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -103,6 +103,8 @@
apk add ripgrep
+`ripgrep` is in Alpine’s community repository. If `apk` reports that the package is missing, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>).
+
pacman -S ripgrep
winget install BurntSushi.ripgrep.MSVC
Show diff (108 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -6,7 +6,7 @@
npm install @anthropic-ai/claude-agent-sdk
-The SDK bundles a native Claude Code binary for your platform as an optional dependency such as `@anthropic-ai/claude-agent-sdk-darwin-arm64`. You don’t need to install Claude Code separately. If your package manager skips optional dependencies, the SDK throws `Native CLI binary for <platform> not found`; set `pathToClaudeCodeExecutable` to a separately installed `claude` binary instead.
+The SDK bundles a native Claude Code binary for your platform as an optional dependency such as `@anthropic-ai/claude-agent-sdk-darwin-arm64`. You don’t need to install Claude Code separately. The SDK version tracks the bundled Claude Code version: SDK v0.3.191 bundles Claude Code v2.1.191, so a feature on this page that requires a Claude Code version needs the SDK release with the same patch number or later. If your package manager skips optional dependencies, the SDK throws `Native CLI binary for <platform> not found`; set `pathToClaudeCodeExecutable` to a separately installed `claude` binary instead.
###
@@ -628,7 +628,7 @@
`accountInfo()`| Returns account information
`reconnectMcpServer(serverName)`| Reconnect an MCP server by name
`toggleMcpServer(serverName, enabled)`| Enable or disable an MCP server by name
-`setMcpServers(servers)`| Dynamically replace the set of MCP servers for this session. Returns info about which servers were added, removed, and any errors
+`setMcpServers(servers)`| Dynamically replace the set of MCP servers for this session. Returns which servers were added and removed, and any errors. The call keeps plugin-provided servers it doesn’t name; naming one replaces it.
`streamInput(stream)`| Stream input messages to the query for multi-turn conversations
`stopTask(taskId)`| Stop a running background task by ID
`close()`| Close the query and terminate the underlying process. Forcefully ends the query and cleans up all resources
@@ -1150,9 +1150,10 @@
message: BetaMessage; // From Anthropic SDK
parent_tool_use_id: string | null;
error?: SDKAssistantMessageError;
- };
-
-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?: 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.
###
@@ -1460,7 +1461,7 @@
`kind`| Meaning
---|---
-`human`| Direct input from the end user. On user messages, an absent `origin` also means human input.
+`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.
`task-notification`| Synthetic turn injected after a background task finished. See `SDKTaskNotificationMessage`.
@@ -1490,6 +1491,7 @@
| "PostToolBatch"
| "Notification"
| "UserPromptSubmit"
+ | "UserPromptExpansion"
| "SessionStart"
| "SessionEnd"
| "Stop"
@@ -2073,7 +2075,7 @@
dangerouslyDisableSandbox?: boolean;
};
-Executes bash commands in a persistent shell session with optional timeout and background execution.
+Executes Bash commands with optional timeout and background execution. The working directory persists between commands; shell state such as exported environment variables doesn’t.
###
@@ -2589,6 +2591,8 @@
isImage?: boolean;
backgroundTaskId?: string;
backgroundedByUser?: boolean;
+ timedOutAfterMs?: number;
+ backgroundCwdHint?: string;
dangerouslyDisableSandbox?: boolean;
returnCodeInterpretation?: string;
structuredContent?: unknown[];
@@ -2596,7 +2600,7 @@
persistedOutputSize?: number;
};
-Returns command output with stdout/stderr split. Background commands include a `backgroundTaskId`.
+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.
###
@@ -2753,9 +2757,11 @@
numFiles: number;
filenames: string[];
truncated: boolean;
- };
-
-Returns file paths matching the glob pattern, sorted by modification time.
+ totalMatches?: number;
+ countIsComplete?: boolean;
+ };
+
+Returns file paths matching the glob pattern, sorted by modification time. `totalMatches` and `countIsComplete` require Claude Code v2.1.191 or later. `totalMatches` reports the number of matching files before truncation. When `countIsComplete` is false, `totalMatches` is a lower bound because the underlying search truncated its own output.
###
@@ -2772,11 +2778,13 @@
content?: string;
numLines?: number;
numMatches?: number;
+ totalFiles?: number;
+ totalLines?: number;
appliedLimit?: number;
appliedOffset?: number;
};
-Returns search results. The shape varies by `mode`: file list, content with matches, or match counts.
+Returns search results. The shape varies by `mode`: file list, content with matches, or match counts. In `count` mode, `numFiles` and `numMatches` are totals over the full result set, not the paginated slice. Before v2.1.208, a `head_limit` or `offset` that truncated the listed entries also truncated those totals. `totalFiles` requires Claude Code v2.1.208 or later and reports the total number of results before `head_limit` and `offset` pagination in `files_with_matches` mode. `totalLines` requires Claude Code v2.1.210 or later and reports the total number of lines before pagination in `content` mode.
###
--- a/vs-code.md
+++ b/vs-code.md
@@ -284,6 +284,8 @@
open "vscode://anthropic.claude-code/open"
xdg-open "vscode://anthropic.claude-code/open"
+
+The `xdg-open` command comes from the `xdg-utils` package. If the shell reports it isn’t found, see [xdg-open is not found on Linux](</docs/en/deep-links#xdg-open-is-not-found-on-linux>).
In PowerShell:
--- a/web-quickstart.md
+++ b/web-quickstart.md
@@ -230,7 +230,11 @@
`/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.
+`/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:
+
+ * 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>)
+ * your Enterprise organization has [Zero Data Retention](</docs/en/zero-data-retention>) enabled, which makes Claude Code on the web unavailable
###
--- a/workflows.md
+++ b/workflows.md
@@ -122,7 +122,30 @@
ultracode: audit every API endpoint under src/routes/ for missing auth checks
-Claude Code highlights the keyword in your input and Claude writes a workflow script for the task instead of working through it turn by turn. If you didn’t mean to start a workflow, press `Option+W` on macOS or `Alt+W` on Windows and Linux to dismiss the highlight for this prompt, or press backspace while the cursor is right after the highlighted keyword. To stop the keyword from triggering at all, turn off Ultracode keyword trigger in `/config`. If the run does what you wanted, you can save it as a command afterward. If you already have an orchestrator built another way, such as a folder of subagent prompts or a skill that fans work out, you can point Claude at it and ask for a workflow that does the same thing.
+Claude Code highlights the keyword in your input and Claude writes a workflow script for the task instead of working through it turn by turn. The keyword only chooses how Claude structures the work: a workflow started this way runs inside the session’s existing [permission mode](</docs/en/permission-modes>), and its agents’ tool calls receive the same permission checks and [sandboxing](</docs/en/sandboxing>) as any other tool call in the session. If the run does what you wanted, you can save it as a command afterward. If you already have an orchestrator built another way, such as a folder of subagent prompts or a skill that fans work out, you can point Claude at it and ask for a workflow that does the same thing.
+
+####
+
+
+
+Dismiss or turn off the keyword
+
+If you didn’t mean to start a workflow, press `Option+W` on macOS or `Alt+W` on Windows and Linux to dismiss the highlight for this prompt, or press backspace while the cursor is right after the highlighted keyword. To stop the keyword from triggering at all, turn off Ultracode keyword trigger in `/config`.
+
+####
+
+
+
+Where the keyword works
+
+The keyword is an opt-in only in a prompt you type yourself: at the interactive prompt, in an IDE extension panel, in a [Remote Control](</docs/en/remote-control>) client, or in an Agent SDK application that stamps your keyboard input’s [`origin`](</docs/en/agent-sdk/typescript#sdkmessageorigin>) as `{ kind: "human" }`. It doesn’t start a workflow when it reaches the session another way:
+
+ * a prompt passed with `-p`
+ * a prompt an Agent SDK application sends without stamping it as human input
+ * a scheduled task prompt
+ * a webhook payload or pull request comment relayed into the conversation
+
+Before v2.1.210, the keyword started a workflow from any of these routes too, including a webhook payload or pull request comment relayed into the conversation.
###
--- a/worktrees.md
+++ b/worktrees.md
@@ -18,7 +18,7 @@
claude --worktree
-You can also ask Claude to “work in a worktree” during a session, and it will create one with the [`EnterWorktree`](</docs/en/tools-reference>) tool. Once in a worktree, Claude can switch directly to another one under `.claude/worktrees/` by calling `EnterWorktree` with the target path. The previous worktree stays on disk untouched. Entering a path outside the repository’s `.claude/worktrees/` directory asks for your approval first, because it moves the session’s working directory, write access, and project configuration such as `CLAUDE.md` and settings to that location. An `EnterWorktree` [permission rule](</docs/en/permissions>) or choosing “don’t ask again” doesn’t suppress this prompt; only `bypassPermissions` mode skips it. Before v2.1.206, Claude could enter any existing worktree path without asking. As of v2.1.198, entering or exiting a worktree also relocates the session transcript to that directory’s project storage, the same way [`/cd`](</docs/en/commands>) does, so `/desktop` and `--resume` find the session there afterward. Worktrees created by a `WorktreeCreate` hook are excluded and keep the transcript at the launch directory. Worktrees work with [sandboxing](</docs/en/sandboxing#filesystem-isolation>) enabled: the sandbox allows writes to the main repository’s shared `.git` directory so commands such as `git commit` can update refs and the index from inside a linked worktree. Before using `--worktree` interactively in a directory for the first time, accept the workspace trust dialog by running `claude` once in that directory. If trust has not yet been accepted, `--worktree` exits with an error and prompts you to run `claude` in the directory first. Non-interactive runs with `-p` skip the [trust check](</docs/en/security>), so `claude -p --worktree` proceeds without it. If Claude Code can’t enter the worktree directory at startup, for example because a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) printed something other than the directory it created, or because the directory was deleted after it was set up, Claude Code prints an error naming the path and exits with code 1. Before v2.1.205, this crashed the session, and with `-p` it stalled for about 30 seconds before exiting with code 0. Plugins installed at [project scope](</docs/en/plugins-reference#plugin-installation-scopes>) from the main checkout also load in worktrees of the same repository, so you don’t need to reinstall them per worktree. This applies whether you create the worktree with `--worktree` or with `git worktree add`. Requires Claude Code v2.1.200 or later.
+You can also ask Claude to “work in a worktree” during a session, and it will create one with the [`EnterWorktree`](</docs/en/tools-reference>) tool. Once in a worktree, Claude can switch directly to another one under `.claude/worktrees/` by calling `EnterWorktree` with the target path. The previous worktree stays on disk untouched. Entering a path outside the repository’s `.claude/worktrees/` directory asks for your approval first, because it moves the session’s working directory, write access, and project configuration such as `CLAUDE.md` and settings to that location. An `EnterWorktree` [permission rule](</docs/en/permissions>) or choosing “don’t ask again” doesn’t suppress this prompt; only `bypassPermissions` mode skips it. Before v2.1.206, Claude could enter any existing worktree path without asking. As of v2.1.198, entering or exiting a worktree also relocates the session transcript to that directory’s project storage, the same way [`/cd`](</docs/en/commands>) does, so `/desktop` and `--resume` find the session there afterward. Worktrees created by a `WorktreeCreate` hook are excluded and keep the transcript at the launch directory. Worktrees work with [sandboxing](</docs/en/sandboxing#filesystem-isolation>) enabled: the sandbox allows writes to the main repository’s shared `.git` directory so commands such as `git commit` can update refs and the index from inside a linked worktree. Before using `--worktree` interactively in a directory for the first time, accept the workspace trust dialog by running `claude` once in that directory. If trust has not yet been accepted, `--worktree` exits with an error and prompts you to run `claude` in the directory first. Non-interactive runs with `-p` skip the [trust check](</docs/en/security>), so `claude -p --worktree` proceeds without it. If Claude Code can’t enter the worktree directory at startup, for example because a [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>) printed something other than the directory it created, or because the directory was deleted after it was set up, Claude Code prints an error naming the path and exits with code 1. Before v2.1.205, this crashed the session, and with `-p` it stalled for about 30 seconds before exiting with code 0. Plugins installed at [project scope](</docs/en/plugins-reference#plugin-installation-scopes>) from the main checkout also load in worktrees of the same repository, so you don’t need to reinstall them per worktree. This applies whether you create the worktree with `--worktree` or with `git worktree add`. Requires Claude Code v2.1.200 or later. Permission approvals are shared across worktrees the same way: choosing “Yes, don’t ask again” for a Bash command in a worktree session saves the rule to the main checkout’s `.claude/settings.local.json`, so it applies in the main checkout and in every other worktree of the repository, and it survives the worktree’s removal. This covers worktrees created with `--worktree`, with `git worktree add`, and by the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>). Before v2.1.211, an approval granted in a worktree was saved inside that worktree, didn’t apply elsewhere, and was lost when the worktree was removed. See [where approvals are saved](</docs/en/permissions#permission-system>).
Add `.claude/worktrees/` to your `.gitignore` so worktree contents don’t appear as untracked files in your main checkout.
@@ -92,7 +92,21 @@
* **Uncommitted changes, untracked files, or new commits exist** : Claude prompts you to keep or remove the worktree. Keeping preserves the directory and branch so you can return later. Removing deletes the worktree directory and its branch, discarding any uncommitted changes, untracked files, and commits
* **Non-interactive runs** : worktrees created with `--worktree` alongside `-p` are not cleaned up automatically since there is no exit prompt. Remove them with `git worktree remove`
-Worktrees that Claude created for subagents and [background sessions](</docs/en/agent-view#how-file-edits-are-isolated>) are removed automatically once they are older than your [`cleanupPeriodDays`](</docs/en/settings#available-settings>) setting, provided they have no uncommitted changes, no untracked files, and no unpushed commits. Worktrees you create with `--worktree` are never removed by this sweep. While an agent is running, Claude runs `git worktree lock` on its worktree so that concurrent cleanup cannot remove it. The lock is released when the agent finishes. To clean up a worktree that the sweep keeps, run `git worktree remove`, adding `--force` if the worktree has uncommitted changes or untracked files. On Windows, before removing a worktree, Claude Code removes any NTFS junction or directory symlink at any depth inside it as a link entry, so removing the worktree doesn’t delete the files a link points to. Before v2.1.205, Claude Code removed only top-level links as link entries, and removing a worktree with a junction nested in a subdirectory could delete the contents of the directory the link pointed to outside the worktree.
+###
+
+
+
+Clean up subagent and background-session worktrees
+
+A periodic sweep removes worktrees that Claude created for subagents and [background sessions](</docs/en/agent-view#how-file-edits-are-isolated>) once they are older than your [`cleanupPeriodDays`](</docs/en/settings#available-settings>) setting, provided they have no uncommitted changes, no untracked files, and no unpushed commits. The sweep never removes worktrees you create with `--worktree`. While an agent is running, Claude runs `git worktree lock` on its worktree so that concurrent cleanup cannot remove it. The lock is released when the agent finishes. The sweep also releases a lock Claude Code set for a session whose process has exited, so a killed background session doesn’t leave its worktree permanently locked. Before v2.1.210, that stale lock stayed in place until you ran `git worktree unlock`. The sweep never releases a lock you set yourself with `git worktree lock`. To clean up a worktree that the sweep keeps, run `git worktree remove`, adding `--force` if the worktree has uncommitted changes or untracked files.
+
+###
+
+
+
+Worktree removal on Windows
+
+On Windows, before removing a worktree, Claude Code removes any NTFS junction or directory symlink at any depth inside it as a link entry, so removing the worktree doesn’t delete the files a link points to. Before v2.1.205, Claude Code removed only top-level links as link entries, and removing a worktree with a junction nested in a subdirectory could delete the contents of the directory the link pointed to outside the worktree.
##
@@ -128,7 +142,7 @@
Non-git version control
-Worktree isolation uses git by default. For SVN, Perforce, Mercurial, or other systems, configure [`WorktreeCreate` and `WorktreeRemove` hooks](</docs/en/hooks#worktreecreate>) to provide custom creation and cleanup logic. Because the hook replaces the default git behavior, `.worktreeinclude` is not processed when you use `--worktree`. Copy any local configuration files inside your hook script instead. This `WorktreeCreate` hook reads the worktree name from stdin, checks out a fresh SVN working copy, and prints the directory path so Claude Code can use it as the session’s working directory:
+Worktree isolation uses git by default. For SVN, Perforce, Mercurial, or other systems, configure [`WorktreeCreate` and `WorktreeRemove` hooks](</docs/en/hooks#worktreecreate>) to provide custom creation and cleanup logic. Because the hook replaces the default git behavior, `.worktreeinclude` is not processed when you use `--worktree`. Copy any local configuration files inside your hook script instead. This `WorktreeCreate` hook reads the worktree name from stdin, checks out a fresh SVN working copy, and prints the directory path so Claude Code can use it as the session’s working directory. Add the configuration to your [`settings.json`](</docs/en/settings#settings-files>):
{
"hooks": {
--- a/zero-data-retention.md
+++ b/zero-data-retention.md
@@ -20,6 +20,14 @@
ZDR covers Claude Code inference on Claude for Enterprise.
ZDR is enabled on a per-organization basis. Each new organization requires ZDR to be enabled separately by your Anthropic account team. ZDR does not automatically apply to new organizations created under the same account. Contact your account team to enable ZDR for any new organizations.
+
+###
+
+
+
+Route Claude Code traffic to your ZDR organization
+
+ZDR applies to requests that authenticate into a ZDR-enabled organization. If a developer signs in to Claude Code with a personal account or with an API key from a different organization, those sessions are not covered. To restrict login to your ZDR organization, deploy the `forceLoginMethod` and `forceLoginOrgUUID` managed settings; see [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>).
###