Changes on
64 changes detected
--- a/accessibility.md
+++ b/accessibility.md
@@ -1,4 +1,4 @@
-Claude Code has a screen reader mode that replaces its visual terminal interface with plain, linear text. Instead of boxes, progress animations, and in-place redraws, Claude Code prints labeled lines that a screen reader such as VoiceOver or NVDA reads in order. You can hold a full conversation, approve tool permissions, and review output end to end. Screen reader mode is opt-in. If you use a screen magnifier, reduced motion, or a colorblind-friendly theme instead of a screen reader, set `CLAUDE_CODE_ACCESSIBILITY`, `prefersReducedMotion`, or `theme` from the Accessibility settings table. Screen reader mode requires Claude Code v2.1.181 or later. Earlier versions reject the `--ax-screen-reader` flag with `error: unknown option '--ax-screen-reader'`.
+Claude Code has a screen reader mode that replaces its visual terminal interface with plain, linear text. Instead of boxes, progress animations, and in-place redraws, Claude Code prints labeled lines that a screen reader such as VoiceOver or NVDA reads in order. You can hold a full conversation, approve tool permissions, and review output end to end. Screen reader mode is opt-in. If you use a screen magnifier, reduced motion, or a colorblind-friendly theme instead of a screen reader, set `CLAUDE_CODE_ACCESSIBILITY`, `prefersReducedMotion`, or `theme` from the Accessibility settings table. Screen reader mode adapts the terminal interface only, so you don’t need it in the VS Code extension’s chat panel. On Claude Code v2.1.236 or later, the extension [announces conversation activity to your screen reader](</docs/en/vs-code#use-a-screen-reader>) there without any setting. Screen reader mode requires Claude Code v2.1.181 or later. Earlier versions reject the `--ax-screen-reader` flag with `error: unknown option '--ax-screen-reader'`.
##
--- a/admin-setup.md
+++ b/admin-setup.md
@@ -39,7 +39,7 @@
* Claude Code honors a small set of [cross-source lock keys](</docs/en/settings#precedence-within-the-managed-tier>), such as the sandbox allowlist locks, when any admin-controlled source sets them.
* Claude Code [merges the `env` block per key across the admin-controlled sources](</docs/en/server-managed-settings#per-key-exceptions-across-managed-sources>), apart from the telemetry-unit and credential-paired routing exceptions covered there. Only admin-controlled sources contribute to the merge, developer-writable settings can’t, and [`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION=1`](</docs/en/env-vars>) restores the winner-only composition. Requires Claude Code v2.1.223 or later.
-When a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only managed configuration Claude Code reads: the lock-key checks read it alone, and no per-key `env` merge happens.
+When an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output is the only managed configuration Claude Code reads: the lock-key checks read it alone, and no per-key `env` merge happens.
Mechanism| Delivery| Priority| Platforms
---|---|---|---
--- a/amazon-bedrock.md
+++ b/amazon-bedrock.md
@@ -201,7 +201,7 @@
Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Amazon Bedrock, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every account or region. Two selections change which model carries them:
- * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` counts as a selection too, because the built-in Sonnet model may not be enabled in an account that steers its own Opus.
+ * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in an account that steers its own Opus.
* To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your account.
Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default.
@@ -250,7 +250,7 @@
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 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.
+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, for example 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.
##
--- a/artifacts.md
+++ b/artifacts.md
@@ -61,7 +61,7 @@
Share an artifact
-A new artifact is visible only to you. To share it, open the artifact in your browser and use the **Share** control in the page header. The header names you as the artifact’s author, so anyone you share it with can see who published the page. It also links to your gallery at [claude.ai/code/artifacts](<https://claude.ai/code/artifacts>), which lists every artifact you have created. Who you can share with depends on your plan:
+A new artifact is visible only to you. To share it, open the artifact in your browser and use the **Share** control in the page header. The header also links to your gallery at [claude.ai/code/artifacts](<https://claude.ai/code/artifacts>), which lists every artifact you have created. Viewers in your organization can see who published the page: on an artifact shared within your organization, your name is in the title menu, and on a public artifact it’s in the page header for signed-in viewers in your organization. A viewer who opens a public link without signing in, or from outside your organization, sees the label `Content is user-generated and unverified.` instead of your name. Who you can share with depends on your plan:
* **Within your organization** : on Team and Enterprise plans, grant access to specific people in your organization, or to everyone in it. Viewers sign in to claude.ai as members of your organization to see the page.
* **Publicly** : share a link that anyone on the internet can open, with no claude.ai sign-in required. On Pro and Max plans, a public link is the only way to share an artifact. On Team and Enterprise plans, public sharing is off until an Owner enables it for the organization.
@@ -73,6 +73,45 @@
Let someone edit with you
People you share with are viewers by default: they see each version you publish but can’t change the page. On Team and Enterprise plans, you can also make someone an editor. In the share dialog, add a person and switch their role from **viewer** to **editor**. An editor publishes new versions the same way you update the artifact from another session: they give Claude the artifact’s URL in their own session, and Claude pulls the current content and republishes with their changes. Everyone with the page open sees each update live.
+
+##
+
+
+
+Collect comments on an artifact
+
+When you share an artifact within your organization, the people you share it with can leave comments on the page, and you can have Claude read those comments and reply to them. You need Claude Code v2.1.221 or later and a Team or Enterprise plan, because only an artifact you share within your organization takes comments. Claude reads the comments in two cases:
+
+ * **You ask Claude to read them** : give Claude the artifact’s URL and ask for the comments. Claude lists each thread and marks the comments a commenter sent to it.
+ * **A commenter sends a comment to Claude** : in a thread on the page, the commenter mentions `@claude` or uses the thread’s Claude control, where the page offers one. Either gesture activates the thread, and Claude can reply only in a thread someone activated. Viewers see each reply attributed to Claude, via you.
+
+If you share an artifact publicly, viewers can’t comment on it: the page says `Comments aren't available while this Artifact is shared publicly.` To switch an artifact that already has comment threads to a public link, delete the threads first. To ask for the comments yourself, give Claude the URL:
+
+ Read the comments on https://claude.ai/code/artifact/5fbea6f3-... and make the changes the commenters ask for.
+
+If Claude tells you it can’t read comments, check three things:
+
+ * You’re running Claude Code v2.1.221 or later.
+ * You’re not in your first session since you installed Claude Code or upgraded from a version before v2.1.221. In that [first session after an install or upgrade](</docs/en/env-vars#first-session-after-an-install-or-upgrade>), Claude can’t read comments yet; start a new session and ask again.
+ * You haven’t turned feature-flag fetching off. If you set `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK`, also set [`CLAUDE_CODE_ARTIFACT_COMMENTS=1`](</docs/en/env-vars#features-that-need-feature-flag-fetching>) so Claude can read comments without fetching flags.
+
+###
+
+
+
+Let Claude reply to comments on its own
+
+After your session publishes an artifact, Claude Code watches that artifact for comments for as long as the session runs. When a commenter sends a comment to Claude, it reaches your session right away, and Claude can read the thread and reply without you asking. You need Claude Code v2.1.228 or later. If you turned feature-flag fetching off, also set both [`CLAUDE_CODE_ARTIFACT_COMMENTS=1` and `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT=1`](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Your [permission mode](</docs/en/permission-modes>) decides what Claude does when a sent comment arrives:
+
+ * **Claude replies on its own** : when your permission mode lets Claude post the reply without asking you, Claude reads the thread and replies, and edits the artifact when the comment asks for a change. You see `Auto-replied to comment thread on Artifact: <name>` or `Auto-edited Artifact: <name> in response to a comment thread`.
+ * **Claude waits for you** : outside plan mode, when posting the reply would need your approval, you see `Comments are waiting on Artifact: <name>`. Claude then asks you for approval to read the thread, and again to post the reply.
+ * **Claude pauses in plan mode** : you see `Comments are waiting on Artifact: <name>`, and Claude doesn’t reply until you leave plan mode and ask it to read and reply.
+
+Claude also stops replying on its own to an artifact after it handles 60 sent comments or thread activations on that artifact within an hour. You see `Comments are waiting on Artifact: <name>` once, and Claude picks up again as that hour’s comments age out. Run `/tasks` to see each artifact your session is watching, listed as a live-updates task. You can stop Claude from replying on its own in three ways, and each one lasts a different length of time:
+
+ * **Press Ctrl+C once** : Claude stops replying on every artifact your session is watching, and starts again on an artifact when you have your session publish it again.
+ * **Stop the task in`/tasks`**: Claude stops replying on that artifact for the rest of the session. Publishing it again doesn’t start replies again, and if you resume the session later, Claude still doesn’t reply there.
+ * **Press`Ctrl+X Ctrl+K` twice within 3 seconds**: the chord that [stops every running background subagent](</docs/en/interactive-mode#general-controls>) also stops Claude from replying on every artifact for the rest of the session.
##
--- a/authentication.md
+++ b/authentication.md
@@ -148,7 +148,7 @@
`forceLoginMethod` and `forceLoginOrgUUID` are neither, so keep them in both places. The keys also decide whether a session that doesn’t use a login credential can start. See [`forceLoginOrgUUID`](</docs/en/settings#available-settings>) in the settings reference for the full behavior.
- * **`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`**: blocked at startup, since organization membership can’t be verified for an environment credential. Before v2.1.146, the pin applied only to the login flow and didn’t block API-key credentials
+ * **`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`**: blocked at startup, since organization membership can’t be verified for an environment credential
* **Cloud provider sessions such as Amazon Bedrock** : not blocked, because they authenticate against your cloud provider. Restrict those through your cloud IAM policies
* **Anthropic profile or federation credentials** : not blocked, and the keys don’t check which organization the profile belongs to
--- a/auto-mode-config.md
+++ b/auto-mode-config.md
@@ -195,7 +195,7 @@
Route all shell commands through the classifier
-By default, narrow Bash and PowerShell allow rules such as `Bash(npm test)` carry over into auto mode and resolve before the classifier runs. Auto mode suspends only the broad rules that grant arbitrary code execution, such as `Bash(*)` or wildcarded interpreters. This means a narrow rule can still let a destructive argument through without the classifier seeing it, for example a script path or flag the rule’s prefix didn’t anticipate. Set `autoMode.classifyAllShell` to `true` to suspend every Bash and PowerShell allow rule while auto mode is active, so the classifier evaluates every shell command regardless of your allow list.
+By default, narrow Bash and PowerShell allow rules such as `Bash(npm test)` stay in effect in auto mode, and Claude Code resolves them before the classifier runs. Claude Code suspends only the broad rules that grant arbitrary code execution, such as `Bash(*)` or wildcarded interpreters, together with every rule that names [`Monitor`](</docs/en/tools-reference#monitor-tool>), because Monitor commands run through the shell. This means a narrow rule can still let a destructive argument through without the classifier seeing it, for example a script path or flag the rule’s prefix didn’t anticipate. Set `autoMode.classifyAllShell` to `true` to suspend every Bash and PowerShell allow rule while auto mode is active, so the classifier evaluates every shell command regardless of your allow list.
{
"autoMode": {
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,50 @@
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.238
+
+August 20, 2026
+
+ * Added a `keybindingFlavor` setting: set it to `"readline"` to make Ctrl+W in the prompt delete back to the previous whitespace, as in Bash; the default (`"classic"`) is unchanged
+ * Plugin marketplaces: `headersHelper` on a url marketplace or a catalog entry runs a command that mints HTTP headers (e.g. a short-lived token) for catalog and same-origin archive fetches
+ * A catalog entry’s `headersHelper` runs only when you install or update that plugin, after its command is shown; `claude plugin install/update` ask `[y/N]` (or pass `-y`)
+ * Added `claude self-hosted-runner --defer-shutdown-max-min <minutes>`: on SIGTERM, keep serving attached sessions, park what is left after that many minutes, then exit
+ * Added `claude self-hosted-runner --proxy-authorization-command` / `--proxy-authorization-file` for egress proxies that require a freshly issued `Proxy-Authorization` header on every connection
+ * Fixed unbounded memory growth in long interactive sessions: subagent tool results are now released once they leave the recent display window
+ * Fixed custom, project, and plugin output styles drifting back to the default voice mid-session
+ * Fixed `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=true` not keeping prompt suggestions on when your account is near, but not over, its usage limit
+ * Fixed worktree-isolation Bash refusals telling you to remove a redirect when the command had none
+ * Fixed self-hosted runners occasionally being removed by the server after a single slow or lost poll request, handing their healthy session to another runner
+ * Fixed MCP elicitation dialogs showing nothing for URLs longer than 4,096 characters, and permission prompts dropping the “don’t ask again” option when the project path didn’t fit the terminal width
+ * Fixed leftover `/tmp/claude-*-cwd` files when a Bash command is killed, times out, or is interrupted
+ * Fixed held Backspace being ignored on terminals that send Ctrl+H for Backspace when keystrokes arrive in large bursts (slow SSH/mosh links)
+ * Fixed text-wrapping in permission prompt diffs: lines containing wide multi-code-point characters (such as emoji) or tabs are no longer clipped
+ * Fixed killing a suspended (Ctrl+Z) session sometimes leaving the terminal in bracketed-paste mode with the cursor hidden
+ * Fixed stdio MCP servers receiving a `server/discover` request before `initialize`, forcing lazy servers to start their backend on every session open
+ * Fixed a proxy’s refusal of a connection being reported as a generic network error instead of naming the proxy
+ * Fixed the `/model` and `/effort` cache-miss warning appearing when the prompt cache had already expired
+ * Fixed per-task Stop from the Remote Control tasks panel doing nothing on CLI-hosted sessions
+ * Fixed remote sessions exiting when a client delivered a user message without a valid role
+ * Fixed Remote Control sessions started by `claude remote-control` inheriting session-scoped environment variables from the launching shell
+ * Fixed a Remote Control session whose process crashed staying unavailable until `claude remote-control` was restarted; it can now be reused when you next message it
+ * Fixed Remote Control messages sent from the web or Desktop while Claude is mid-turn disappearing from the transcript after the turn finishes
+ * Fixed Remote Control model picks made on a phone or web not updating the model shown in the terminal
+ * Fixed Remote Control disconnecting with “login expired” when a brief network hiccup delays renewing your sign-in; it now retries and stays connected
+ * Fixed Remote Control reporting a failed reconnect on sign-out; signing out now ends the session with a clear message
+ * Fixed `ListAgents`/`SendMessage` reporting “Remote Control is not connected” in sessions run by `claude remote-control` (server mode) or Desktop/IDE hosts; they now list and reach Remote Control peers
+ * Fixed `ListAgents` and `SendMessage` exposing the idle worker that the agent view pre-warms for your next background session; it now appears only once a task claims it
+ * Cross-session messaging: sending to a session on this machine that refuses inbound messages (e.g. `crossSessionInbound: "refuse"`) now reports “refused” to the sender instead of a silent success
+ * Cross-session messaging: a session whose inbox drops your messages (rate limit or full queue) now tells your session, instead of the messages vanishing silently
+ * Improved startup: bare `claude` starts sooner on macOS
+ * Improved Bash tool permission checking for zsh-specific syntax in shell conditionals
+ * Improved Remote Control connection resilience: brief HTTP 403 refusals from a network edge, VPN, or proxy are now tolerated for up to 3 minutes, with the refusing party named when a block persists
+ * Improved startup responsiveness: the automatic update check now runs about 10 seconds after launch instead of competing with startup for CPU
+ * Updated the bundled `claude-api` skill for the Managed Agents Aug 19 release: web search/fetch domain settings and memory stores on self-hosted sandboxes
+ * Changed Ctrl+L and Cmd+K in fullscreen to always just repaint — the double-press `/clear` shortcut was removed, and 1-row nvim terminals no longer trigger automatic `/clear` loops
+ * Changed `claude mcp list` and `claude mcp get` to show disabled servers as `⊘ Disabled` instead of connecting to them for a health check
+ * MCP `headersHelper` in a project `.mcp.json`, and inline MCP servers in project or `--add-dir` agent files, now require that folder’s trust dialog to have been accepted (also under `claude -p`)
+ * MCP `headersHelper` from a project `.mcp.json`, plugin, or agent file runs without inherited credential env vars; user, managed and claude.ai-scope helpers now run from the Claude config dir
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
@@ -257,7 +257,7 @@
Which machines need the opt-in
-Machines that only run Claude Desktop need it. Claude Desktop applies the model list and the disabled-tools list to embedded sessions itself, but the egress allowlist reaches them only as parent settings, in the form of `WebFetch` domain rules and sandbox network rules. Without the opt-in, those sessions run without the egress restriction, and nothing warns you. The gateway still rejects inference requests for models the policy doesn’t grant. Machines where developers sign in through `/login` don’t need it; every Claude Code invocation fetches its policy from the gateway directly. Fleets that configure a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) can’t use it, because the helper’s output replaces every other managed source and parent settings are never merged while a helper is configured.
+Machines that only run Claude Desktop need it. Claude Desktop applies the model list and the disabled-tools list to embedded sessions itself, but the egress allowlist reaches them only as parent settings, in the form of `WebFetch` domain rules and sandbox network rules. Without the opt-in, those sessions run without the egress restriction, and nothing warns you. The gateway still rejects inference requests for models the policy doesn’t grant. Machines where developers sign in through `/login` don’t need it; every Claude Code invocation fetches its policy from the gateway directly. Machines where an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) can’t use it, because Claude Code never merges parent settings into the helper’s output.
####
@@ -335,7 +335,7 @@
Lock behavior across sources
-Setting one lock doesn’t restrict the others; each key is documented in the [settings reference](</docs/en/settings#available-settings>). From an admin source below the winner, the two sandbox locks still apply, and `allowManagedPermissionRulesOnly` still blocks parent-supplied allow rules and `additionalDirectories`. The hooks and MCP server locks, and `allowManagedPermissionRulesOnly`’s effect on the developer’s own rules, need the winning source. On [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) fleets, the locks are read from the helper’s output alone. Each lock makes Claude Code ignore the developer’s own entries for that setting, so include your organization’s allowlists next to the locks. Locking network domains with an empty managed domain list blocks all sandboxed outbound traffic, and locking MCP servers with no managed or parent-supplied `allowedMcpServers` loads every server that `deniedMcpServers` doesn’t block. `allowRead` entries only re-allow paths inside `denyRead` regions, so pair them with a managed `denyRead`.
+Setting one lock doesn’t restrict the others; each key is documented in the [settings reference](</docs/en/settings#available-settings>). From an admin source below the winner, the two sandbox locks still apply, and `allowManagedPermissionRulesOnly` still blocks parent-supplied allow rules and `additionalDirectories`. The hooks and MCP server locks, and `allowManagedPermissionRulesOnly`’s effect on the developer’s own rules, need the winning source. When an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), Claude Code reads the locks from the helper’s output alone. Each lock makes Claude Code ignore the developer’s own entries for that setting, so include your organization’s allowlists next to the locks. Locking network domains with an empty managed domain list blocks all sandboxed outbound traffic, and locking MCP servers with no managed or parent-supplied `allowedMcpServers` loads every server that `deniedMcpServers` doesn’t block. `allowRead` entries only re-allow paths inside `denyRead` regions, so pair them with a managed `denyRead`.
####
--- a/claude-apps-gateway-config.md
+++ b/claude-apps-gateway-config.md
@@ -641,26 +641,25 @@
Precedence with other managed sources
-If a device also has a local `managed-settings.json` or MDM-delivered policy, the managed sources don’t merge, with two per-key exceptions while no [policy helper](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is supplying managed settings, since a helper’s output replaces the managed sources entirely:
+If a device also has a local `managed-settings.json` or MDM-delivered policy, the managed sources don’t merge, with two per-key exceptions:
* The `env` block, in Claude Code v2.1.223 or later
* The [cross-source lock keys](</docs/en/settings#precedence-within-the-managed-tier>)
Both are covered in the list later in this section. The highest-priority source provides all policy settings, ranked in this order with highest priority first:
- 1. The [policy helper](</docs/en/settings#compute-managed-settings-with-a-policy-helper>)
- 2. Gateway-delivered settings
- 3. MDM, via the HKLM registry on Windows or a plist on macOS
- 4. The `managed-settings.json` file
- 5. The HKCU registry, on Windows only
-
-Embedding hosts such as [Claude Desktop](</docs/en/desktop>) can supply policy through the SDK `managedSettings` option. Whether it applies depends on the machine’s managed configuration:
+ 1. Gateway-delivered settings
+ 2. MDM, via the HKLM registry on Windows or a plist on macOS
+ 3. The `managed-settings.json` file
+ 4. The HKCU registry, on Windows only
+
+When an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output replaces that source and neither per-key exception applies. A `policyHelper` in those sources doesn’t run while the gateway delivers a non-empty configuration. Embedding hosts such as [Claude Desktop](</docs/en/desktop>) can supply policy through the SDK `managedSettings` option. Whether it applies depends on the machine’s managed configuration:
* On machines with an admin-deployed managed source, it is ignored unless the highest-priority source opts in with [`parentSettingsBehavior: "merge"`](</docs/en/settings#available-settings>).
- * It is never merged while a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured.
+ * It is never merged when an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>).
* When merged, it passes through a restrictive-only allowlist. [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) lists which allow-direction settings still apply without the `allowManaged*Only` locks.
-The following keys are honored when any admin source above the user-writable HKCU tier sets them, regardless of which source provides the rest of the policy. When a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read:
+The following keys are honored when any admin source above the user-writable HKCU tier sets them, regardless of which source provides the rest of the policy. When an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output is the only source these checks read:
* `sandbox.network.allowManagedDomainsOnly` and `sandbox.filesystem.allowManagedReadPathsOnly`: when locked, the corresponding allowlists are unioned across sources
* [`allowAllClaudeAiMcps`](</docs/en/settings#available-settings>): allow-only override for the claude.ai MCP server allowlist
--- a/claude-code-features.md
+++ b/claude-code-features.md
@@ -61,8 +61,8 @@
Source| What it loads| Location
---|---|---
-`"project"`| Project CLAUDE.md, `.claude/rules/*.md`, project skills, project hooks, project `settings.json`| `<cwd>/.claude/` for `settings.json` and hooks; `<cwd>` and every parent directory for CLAUDE.md and rules; `<cwd>` and every parent directory up to the repository root for skills
-`"user"`| User CLAUDE.md, `~/.claude/rules/*.md`, user skills, user settings| `~/.claude/`
+`"project"`| Project `settings.json` and hooks; project CLAUDE.md and `.claude/rules/*.md`; project skills, commands, and subagents| `<cwd>/.claude/` for `settings.json` and hooks; `<cwd>` and every parent directory for CLAUDE.md and rules; `<cwd>` and every parent directory up to the repository root for skills, commands, and subagents, plus the `.claude/skills/`, `.claude/commands/`, and `.claude/agents/` folders of each directory you pass through the `additionalDirectories` or `add_dirs` option, which the SDK passes to Claude Code as [`--add-dir`](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>)
+`"user"`| User `settings.json`; user CLAUDE.md and `~/.claude/rules/*.md`; user skills, commands, and subagents| `~/.claude/` for `settings.json`, CLAUDE.md, and rules; `~/.claude/skills/`, `~/.claude/commands/`, and `~/.claude/agents/` for skills, commands, and subagents
`"local"`| CLAUDE.local.md, `.claude/settings.local.json`| `<cwd>/.claude/` for `settings.local.json`; `<cwd>` and every parent directory for CLAUDE.local.md
Omitting `settingSources` is equivalent to `["user", "project", "local"]`. The `cwd` option determines where the SDK looks for project-level inputs. Project `settings.json` and hooks load only from `<cwd>/.claude/` with no parent-directory fallback.
--- a/cli-reference.md
+++ b/cli-reference.md
@@ -66,7 +66,7 @@
`--append-system-prompt-file`| Load additional system prompt text from a file and append to the default prompt| `claude --append-system-prompt-file ./extra-rules.txt`
`--autocompact <auto|tokens>`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) for this session without changing your saved settings. Accepts the same values as `/autocompact`; that section covers the value forms and what overrides the flag. Requires Claude Code v2.1.221 or later| `claude --autocompact 500k`
`--ax-screen-reader`| Render screen-reader friendly output: flat text without decorative borders or animations. Forces the classic renderer, so the [`tui`](</docs/en/settings#available-settings>) setting has no effect; attached [background sessions](</docs/en/agent-view>) still render fullscreen. Takes precedence over [`CLAUDE_AX_SCREEN_READER`](</docs/en/env-vars>) and the [`axScreenReader`](</docs/en/settings#available-settings>) setting. Requires Claude Code v2.1.181 or later| `claude --ax-screen-reader`
-`--bare`| Minimal mode: skip auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Claude has access to Bash, file read, and file edit tools. Sets [`CLAUDE_CODE_SIMPLE`](</docs/en/env-vars>). See [bare mode](</docs/en/headless#start-faster-with-bare-mode>)| `claude --bare -p "query"`
+`--bare`| Minimal mode: skip auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Skills in a directory you pass with `--add-dir` still load. Claude has access to Bash, file read, and file edit tools. Sets [`CLAUDE_CODE_SIMPLE`](</docs/en/env-vars>). See [bare mode](</docs/en/headless#start-faster-with-bare-mode>)| `claude --bare -p "query"`
`--betas`| Beta headers to include in API requests (API key users only)| `claude --betas interleaved-thinking`
`--bg`, `--background`| Start the session as a [background agent](</docs/en/agent-view>) and return immediately. Prints the session ID and management commands. Combine with `--exec` to run a shell command as a background job instead of a Claude session, or with `--agent` to run a specific subagent. Cannot be combined with `-p`/`--print`; see the [error reference](</docs/en/errors#command-line-errors>)| `claude --bg "investigate the flaky test"`
`--channels`| (Research preview) MCP servers whose [channel](</docs/en/channels>) notifications Claude should listen for in this session. Space-separated list of `plugin:<name>@<marketplace>` entries. Requires Anthropic authentication through claude.ai or a Console API key| `claude --channels plugin:my-notifier@my-marketplace`
--- a/code-review.md
+++ b/code-review.md
@@ -152,7 +152,7 @@
Code Review reads two files from your repository to guide what it flags. They differ in how strongly they influence the review:
* **`CLAUDE.md`** : shared project instructions that Claude Code uses for all tasks, not just reviews. Code Review reads it as project context and flags newly introduced violations as nits.
- * **`REVIEW.md`** : review-only instructions, injected directly into every agent in the review pipeline as highest priority. Use it to change what gets flagged, at what severity, and how findings are reported.
+ * **`REVIEW.md`** : review-only instructions, given to the agents that find and verify findings and consulted by the agents that rank and report them. Use it to say what your team wants flagged, at what severity, and how findings are reported.
###
@@ -168,7 +168,7 @@
REVIEW.md
-`REVIEW.md` is a file at your repository root that overrides how Code Review behaves on your repo. Its contents are injected into the system prompt of every agent in the review pipeline as the highest-priority instruction block, taking precedence over the default review guidance. Because it’s pasted verbatim, `REVIEW.md` is plain instructions: [`@` import syntax](</docs/en/memory#import-additional-files>) is not expanded, and referenced files are not read into the prompt. Put the rules you want enforced directly in the file.
+`REVIEW.md` is a file at your repository root that tailors Code Review to your repo. The agents in the review pipeline that find and verify findings receive its contents as your repository’s review instructions, alongside Code Review’s default review guidance, and the agents that rank and report findings consult it before settling severity and writing the review. The agents read the file’s text as-is, so `REVIEW.md` is plain instructions: [`@` import syntax](</docs/en/memory#import-additional-files>) is not expanded, and referenced files are not read along with it. Put the rules you want enforced directly in the file.
####
@@ -176,7 +176,7 @@
What you can tune
-`REVIEW.md` is freeform markdown, so anything you can express as a review instruction is in scope. The patterns below have the most impact in practice. **Severity** : redefine what 🔴 Important means for your repo. The default calibration targets production code; a docs repo, a config repo, or a prototype might want a much narrower definition. State explicitly which classes of finding are Important and which are Nit at most. You can also escalate in the other direction, for example treating any `CLAUDE.md` violation as Important rather than the default nit. **Nit volume** : cap how many 🟡 Nit comments a single review posts. Prose and config files can be polished forever. A cap like “report at most five nits, mention the rest as a count in the summary” keeps reviews actionable. **Skip rules** : list paths, branch patterns, and finding categories where Claude should post no findings. Common candidates are generated code, lockfiles, vendored dependencies, and machine-authored branches, along with anything your CI already enforces like linting or spellcheck. For paths that warrant some review but not full scrutiny, set a higher bar instead of skipping entirely: “in `scripts/`, only report if near-certain and severe.” **Repo-specific checks** : add rules you want flagged on every PR, like “new API routes must have an integration test.” Because `REVIEW.md` is injected as highest priority, these land more reliably than the same rules in a long `CLAUDE.md`. **Verification bar** : require evidence before a class of finding is posted. For example, “behavior claims need a `file:line` citation in the source, not an inference from naming” cuts false positives that would otherwise cost the author a round trip. **Re-review convergence** : tell Claude how to behave when a PR has already been reviewed. A rule like “after the first review, suppress new nits and post Important findings only” stops a one-line fix from reaching round seven on style alone. **Summary shape** : ask for the review body to open with a one-line tally such as `2 factual, 4 style`, and to lead with “no factual issues” when that’s the case. The author wants to know the shape of the work before the details.
+`REVIEW.md` is freeform markdown, so anything you can express as a review instruction is in scope. The patterns below have the most impact in practice. **Severity** : redefine what 🔴 Important means for your repo. The default calibration targets production code; a docs repo, a config repo, or a prototype might want a much narrower definition. State explicitly which classes of finding are Important and which are Nit at most. You can also escalate in the other direction, for example treating any `CLAUDE.md` violation as Important rather than the default nit. **Nit volume** : cap how many 🟡 Nit comments a single review posts. Prose and config files can be polished forever. A cap like “report at most five nits, mention the rest as a count in the summary” keeps reviews actionable. **Skip rules** : list paths, branch patterns, and finding categories where Claude should post no findings. Common candidates are generated code, lockfiles, vendored dependencies, and machine-authored branches, along with anything your CI already enforces like linting or spellcheck. For paths that warrant some review but not full scrutiny, set a higher bar instead of skipping entirely: “in `scripts/`, only report if near-certain and severe.” **Repo-specific checks** : add rules you want flagged on every PR, like “new API routes must have an integration test.” Because `REVIEW.md` reaches every finding and verification agent directly, these land more reliably than the same rules in a long `CLAUDE.md`. **Verification bar** : require evidence before a class of finding is posted. For example, “behavior claims need a `file:line` citation in the source, not an inference from naming” cuts false positives that would otherwise cost the author a round trip. **Re-review convergence** : tell Claude how to behave when a PR has already been reviewed. A rule like “after the first review, suppress new nits and post Important findings only” stops a one-line fix from reaching round seven on style alone. **Summary shape** : ask for the review body to open with a one-line tally such as `2 factual, 4 style`, and to lead with “no factual issues” when that’s the case. The author wants to know the shape of the work before the details.
####
@@ -407,3 +407,4 @@
* [GitLab CI/CD](</docs/en/gitlab-ci-cd>): self-hosted Claude integration for GitLab pipelines
* [Memory](</docs/en/memory>): how `CLAUDE.md` files work across Claude Code
* [Analytics](</docs/en/analytics>): track Claude Code usage beyond code review
+ * [How Anthropic secures its AI-native software development lifecycle](<https://claude.com/blog/how-anthropic-secures-its-ai-native-software-development-lifecycle>): how automated review fits as one layer of Anthropic’s secure development process
--- a/commands.md
+++ b/commands.md
@@ -82,7 +82,7 @@
`/mcp [reconnect <server>|enable|disable [<server>|all]]`| Manage MCP server connections and OAuth authentication. Run with no argument to open the interactive list, pass `reconnect <server>` to reconnect one disconnected server, or pass `enable`/`disable` with a server name or `all` to change connection state without opening the dialog. Also available in non-interactive mode (`-p`), where running it with no argument prints a text summary of server status instead of opening the list; requires Claude Code v2.1.205 or later
`/memory`| Edit `CLAUDE.md` files, enable or disable [auto memory](</docs/en/memory#auto-memory>), and view auto memory entries
`/mobile`| Show QR code to download the Claude mobile app. Aliases: `/ios`, `/android`
-`/model [model]`| Switch the AI model and save it as your default for new sessions. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `s` on a row to switch for the current session only. The picker asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context. Once confirmed, the change applies without waiting for the current response to finish. Also available in non-interactive mode (`-p`) with a model argument instead of the picker, where it applies to the current session only and isn’t saved as your default; requires Claude Code v2.1.205 or later
+`/model [model]`| Switch the AI model and save it as your default for new sessions. For models that support it, use left/right arrows to [adjust effort level](</docs/en/model-config#adjust-effort-level>). With no argument, opens a picker; press `s` on a row to switch for the current session only. See [when Claude Code asks you to confirm the switch](</docs/en/prompt-caching#switching-models>). Once confirmed, the change applies without waiting for the current response to finish. Also available in non-interactive mode (`-p`) with a model argument instead of the picker, where it applies to the current session only and isn’t saved as your default; requires Claude Code v2.1.205 or later
`/passes`| Share a free week of Claude Code with friends. Only visible if your account is eligible
`/permissions`| Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review [recent auto mode denials](</docs/en/auto-mode-config#review-denials>). When you run it while Claude is responding, Claude Code opens the dialog immediately and applies your changes starting with Claude’s next tool call in the same turn. Before v2.1.234, Claude Code queued the command until the turn finished. Alias: `/allowed-tools`
`/plan [description]`| Enter plan mode directly from the prompt. Pass an optional description to enter plan mode and immediately start with that task, for example `/plan fix the auth bug`
@@ -101,8 +101,8 @@
`/resume [session]`| Resume a conversation by ID or name, or open the session picker. [Background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`; one that is still running can’t be resumed here, so attach to it from `claude agents` or stop it there first. Alias: `/continue`
`/review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [pr#|branch|path]`| Alias of [`/code-review`](</docs/en/code-review#review-a-diff-locally>): reviews the current diff, or a PR number, branch, or path you pass, such as `/review 1234`, and takes the same effort levels and flags. With no level given, the review reuses the last `low` through `max` level you typed; see [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for the exact rules. For a deep cloud review, use [`/code-review ultra`](</docs/en/ultrareview>). Before v2.1.223, `/review` was a separate command that ran a single-pass, read-only review of a GitHub pull request by number, listing open PRs to pick from when run with no argument; from v2.1.186 through v2.1.201, it ran the same multi-agent engine as `/code-review medium`
`/rewind`| Rewind the conversation and/or code to a previous point, or summarize from a selected message. See [checkpointing](</docs/en/checkpointing>). Aliases: `/checkpoint`, `/undo`
-`/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working, not only passing tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later
-`/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>). Requires Claude Code v2.1.145 or later
+`/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working, not only passing tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>)
+`/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>)
`/sandbox`| Toggle [sandbox mode](</docs/en/sandboxing>). Available on supported platforms only
`/schedule [description]`| Create, update, list, or run [routines](</docs/en/routines>), which execute in the cloud. Claude walks you through the setup conversationally. You can also ask about a [routine’s recent runs](</docs/en/routines#manage-routines-from-the-cli>). Alias: `/routines`
`/scroll-speed`| Adjust mouse wheel [scroll speed](</docs/en/fullscreen#mouse-wheel-scrolling>) interactively, with a ruler you can scroll while the dialog is open to preview the change. Available in [fullscreen rendering](</docs/en/fullscreen>) only and not in the JetBrains IDE terminal
@@ -128,7 +128,7 @@
`/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, or request them from your admin, when you hit a limit. Opens your [usage-credits billing settings](</docs/en/costs#add-usage-credits-to-your-subscription>) in the browser, except that Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI, after confirming in a dialog that the request notifies their admins. When no browser can open the billing page, for example over SSH, the command prints the URL to visit instead; this requires Claude Code v2.1.205 or later, and earlier versions showed nothing in that case. Previously `/extra-usage`
-`/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
+`/verify`| **[Skill](</docs/en/skills#bundled-skills>).** Confirm a code change does what it should by building your project’s app, running it, and observing the result, rather than relying on tests or type checks. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>)
`/vim`| Removed in v2.1.92. To toggle between Vim and Normal editing modes, use `/config` → Editor mode
`/voice [hold|tap|off]`| Toggle [voice dictation](</docs/en/voice-dictation>), or enable it in a specific mode. Requires a Claude.ai account
`/web-setup`| Connect your GitHub account to [Claude Code on the web](</docs/en/web-quickstart#connect-from-your-terminal>) using your local `gh` CLI credentials. `/schedule` prompts for this automatically if GitHub isn’t connected
--- a/costs.md
+++ b/costs.md
@@ -349,6 +349,7 @@
* **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. The lifetime is an hour on a subscription and drops to five minutes once you’re drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>); on an API key or cloud provider, it’s five minutes by default. You can keep the one-hour lifetime while drawing on usage credits by setting [`ENABLE_PROMPT_CACHING_1H=1`](</docs/en/env-vars>). On Pro and Max plans, when you resume a large session after a long break, Claude Code [offers to resume from a summary](</docs/en/sessions#resume-from-a-summary>) so later requests don’t carry the full history
* **Scheduled tasks** : a [scheduled task](</docs/en/scheduled-tasks>) fires on its interval even while the session is idle, sending your full context each time
* **Cross-session messages** : Claude Code delivers a [message from another of your sessions](</docs/en/cross-session-messaging>) as a new turn when this session sits idle, sending your full context each time. To hold inbound messages instead of delivering them, set [`crossSessionInbound`](</docs/en/settings#available-settings>) to `hold`
+ * **Goal check-ins** : while background work keeps an active [goal](</docs/en/goal>) waiting, Claude Code [asks Claude to check on that work](</docs/en/goal#background-work-defers-evaluation>) even when the session sits idle, starting a new turn that sends your full context. To turn check-ins off, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>) to `0`. Idle check-ins require Claude Code v2.1.236 or later
* **Agent teammates** : each active teammate keeps consuming tokens until it exits
* **Compaction** : `/compact` reads the conversation it summarizes, so [compacting a large context](</docs/en/prompt-caching#compacting-the-conversation>) is itself a large request. When you want a fresh start instead of continuity, `/clear` costs nothing
Show diff (126 lines)
--- a/cross-session-messaging.md
+++ b/cross-session-messaging.md
@@ -12,7 +12,7 @@
* **Hand over a finding** : when one session discovers a breaking change or makes a decision, Claude summarizes it for the session working on the affected area, instead of you re-explaining it there.
* **Coordinate parallel worktrees** : when sessions work the same repository in separate [worktrees](</docs/en/worktrees>), Claude can tell the other sessions what landed.
- * **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there.
+ * **Get status from long-running work** : have a migration or test run report back to the session you’re watching, or ask it yourself from there. If that session is on this machine, Claude can also ask it for one notice when it next goes idle or exits.
* **Message across machines** : reach one of your sessions on another machine or on the web.
Use messaging between independent sessions that you start and steer yourself. Claude Code has a dedicated feature for each of the other ways to run or reach multiple sessions, so use the one built for what you’re doing instead:
@@ -49,7 +49,13 @@
Message delivery
-The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Between two ordinary interactive sessions with default settings, Claude Code delivers the message. Delivery isn’t guaranteed in every configuration, though. Claude Code refuses a message over the size cap in the sending session, before it leaves. The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
+The receiving Claude reads the message between tool calls during an active turn, so a running tool is never interrupted. When the receiving session is idle, Claude Code starts a new turn with the message. Claude Code refuses a message in the following cases:
+
+ * The message is over the size cap. Claude Code refuses it in the sending session, before it leaves.
+ * A rapid burst to a session on this machine has reached what that session’s inbox accepts. Claude Code refuses further messages to that session.
+ * The reply target on this machine fails a safety check, such as a symlinked target or an endpoint that isn’t the expected process. [Refusing to send a cross-session message](</docs/en/errors#refusing-to-send-a-cross-session-message>) lists these checks.
+
+The receiving session checks each arriving message against its own inbound controls, and the check ends in one of three outcomes:
* **Delivered** : Claude Code passes the message to the receiving Claude.
* **Held** : Claude Code sets the message aside undelivered. A held message reaches Claude only when you approve it or a later mode or settings change allows it.
@@ -61,16 +67,57 @@
+Get a notice when another session goes idle
+
+Claude can ask one of your sessions on this machine to send back one notice when that session next goes idle or exits. Idle here means the session finished a turn with nothing queued. Use it when you’re waiting on a long task in another session and want to hear when it’s done instead of checking. Requires Claude Code v2.1.236 or later in both sessions.
+
+####
+
+
+
+Ask for a notice
+
+Tell Claude what you’re waiting on. This prompt asks for a notice from the migration session:
+
+ Tell me when the migration session finishes what it's working on
+
+Claude subscribes with the `SendMessage` tool’s `notify_when_idle` input, either attached to a message it’s sending anyway or on its own. On its own, Claude Code subscribes without starting a turn or spending tokens in the watched session, and sends the notice right away if that session is already idle. Attached to a message, Claude Code delivers the message first and sends the notice later.
+
+####
+
+
+
+What each session shows
+
+The watched session shows a line saying another process asked to be told when the session is next idle. The asking session shows the notice as a line naming the watched session. The line can include the time that session’s turn finished and a one-line status from that turn. If the asking session is idle, Claude Code starts a new turn with the notice.
+
+####
+
+
+
+Limits
+
+The notice is one-shot: Claude Code sends it once from the watched session, and neither session polls the other. If no notice arrives within 12 hours, Claude Code drops the subscription and tells Claude, so it doesn’t keep waiting. Each side’s inbound controls apply to a notice like a message:
+
+ * **`refuse` on either side**: nothing arrives. The watched session drops the request without recording or answering it, so the subscription expires unanswered after 12 hours, and an asking session with `refuse` never subscribes.
+ * **`hold` on either side**: the notice arrives with less. The watched session leaves the one-line status out, and the asking session shows the notice in your transcript without delivering it to Claude.
+
+Only the Claude in your main conversation can subscribe, and only to your sessions on this machine. When a subagent or an agent team teammate sets `notify_when_idle`, Claude Code makes no subscription and tells it so. When Claude asks for a notice from any other agent, such as a teammate, a subagent, or a session beyond this machine, Claude Code refuses the whole call, including any message attached to it, and reports the refusal to Claude so it can resend the message without the request.
+
+###
+
+
+
See which sessions Claude can reach
Claude finds a message’s target on its own, so you don’t need to run anything before asking it to send. To see for yourself which sessions Claude can reach, run the `/list-agents` command. It lists each session with the name it answers to, and that name is where Claude addresses a message. The listing covers:
* **Subagents** : agents running inside the current session. [Agent team](</docs/en/agent-teams>) teammates aren’t listed; Claude messages them through the team’s own roster.
- * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket.
+ * **Your other local sessions** : Claude Code sessions running on the same machine, including [background sessions](</docs/en/agent-view>). A session appears only when it binds an inbox socket. The worker process that the [supervisor process](</docs/en/agent-view#the-supervisor-process>) keeps ready for your next background session appears once you dispatch work to it.
* **Your cloud sessions** : your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, shown while this session is connected to [Remote Control](</docs/en/remote-control>). Claude Code labels them `cloud` in the listing.
* **Your Remote Control sessions on other machines** : shown while this session is connected to [Remote Control](</docs/en/remote-control>), and labeled `Remote Control`. Claude Code shows `offline` as the status of a session whose Remote Control connection has dropped.
-Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
+Claude Code reads your cloud and Remote Control session lists newest first and stops after a bounded number of pages for each. If your account has more of those sessions than fit, Claude Code doesn’t list the older ones, and Claude can’t message them by name. When this happens, Claude Code says so in the listing, and Claude sees the same note when it sends a message. Claude addresses a session beyond this machine by name, the same as a local session. See Message sessions on other machines for how those messages travel. A session answers to the name you set with the [`/rename`](</docs/en/commands>) command or the [`--name`](</docs/en/cli-reference#cli-flags>) flag. When you don’t set one, Claude Code names the session itself. For an interactive session, Claude Code derives the name from the working directory’s folder name, such as `my-app-3f` in a `my-app` directory. When you rename a session, or start or resume an interactive one, with a name another live session on this machine already uses, Claude Code leaves the name with the session that already has it and [renames yours to a variant](</docs/en/sessions#name-your-sessions>). Sessions can still share a name, for example when one of them runs an earlier version of Claude Code or the shared name is one Claude Code generated. Claude Code shows each local session’s working directory in the `/list-agents` output, so you can tell same-named sessions apart when they run in different directories. Claude addresses the message in one of two ways, depending on how many live sessions answer to the name:
* **One session answers to the name** : Claude Code delivers the message on the name alone.
* **Several sessions share the name, or Claude Code couldn’t check everywhere your sessions run** : Claude adds a short identifier to each row of its listing and uses the identifier in the address.
@@ -139,9 +186,9 @@
* **Deny** , or dismissing the dialog, drops it.
* When the dialog stays unanswered past the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, Claude Code closes it and drops the message. The deadline defaults to five minutes. While no terminal is attached to a [background session](</docs/en/agent-view>), Claude Code leaves the dialog open past the deadline. After you attach, Claude Code closes the dialog and drops the message only if it stays unanswered for a full deadline period.
* If this session’s permission-mode class changes while messages are held, Claude Code re-applies the inbound rules, delivers the messages they now accept, and shows a notice.
- * If a change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a denial to each sender it can reach.
-
-When the sender runs on the same machine, Claude Code tells the sending session what happened. A notice appears there when the message is held, and a follow-up reports the outcome when the receiver later delivers, denies, or expires it. A message refused on arrival produces no sender-side notice. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
+ * If a settings change makes `refuse` apply while messages are held, Claude Code drops every held message and reports a refusal to each sender it can reach.
+
+When the sender is an interactive session on the same machine, Claude Code shows a notice there when the receiver holds the message, and a follow-up when the receiver later delivers, denies, or expires it. If the receiver refuses it, Claude Code shows a notice there that the receiver isn’t accepting cross-session messages and tells the sender’s Claude not to wait or resend. Claude Code holds at most 100 messages, separately from the delivery queue, and past that drops the oldest.
###
@@ -220,7 +267,7 @@
"crossSessionInbound": "refuse"
}
-With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in other sessions’ listings, so confirm the setting from the session’s configuration.
+With this in place, Claude Code still binds each session’s inbox socket, but drops every message that arrives on it without delivering anything to Claude. Denying `SendMessage` also removes messaging to subagents and agent-team teammates, since the same tool serves both. A refusing session shows no visible change, in its own `/status` or in the listings of other sessions on the same machine, so to confirm it, check the settings files that apply to that session rather than its status.
##
@@ -242,6 +289,7 @@
* **Inbound controls** : the receiving session’s inbound controls can hold or drop what you send it.
* **Cloud session missing** : a cloud session appears only while this session is connected to [Remote Control](</docs/en/remote-control>).
* **Other-machine session missing** : a session on another of your machines appears only when it runs with [Remote Control](</docs/en/remote-control>) and this session is connected as well.
+ * **Older cloud or other-machine session missing** : Claude Code reads those session lists newest first and stops after a bounded number of pages, so Claude can’t message a session that fell past them by name.
* **Starting a conversation** : Message sessions on other machines covers starting a conversation with a session beyond this machine.
In a session with messaging, `/status` also shows a `Peer address` row with the session’s own inbox address.
@@ -256,7 +304,8 @@
* **Plain text only** : Claude sends only plain text across sessions. Structured [agent team](</docs/en/agent-teams>) protocol messages stay within a team.
* **Same-machine message size is capped** : Claude Code refuses a message to a session on this machine once its serialized form passes about a million characters. The refusal [names the exact sizes](</docs/en/errors#message-too-large-for-cross-session-delivery>). Nothing reaches the receiving session.
- * **Message loops are throttled** : Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and caps accepted messages waiting for Claude to read them at 50 per session. A message loop between two sessions therefore stops on its own.
+ * **Rapid bursts to one session are refused at the sender** : once a rapid burst of messages to a session on this machine reaches what that session’s inbox accepts, Claude Code refuses further sends in the sending session. The [refusal names the burst](</docs/en/errors#too-many-messages-to-this-session-just-now>) and tells Claude to batch the rest into one message or wait. Before v2.1.236, Claude Code reported those sends as sent while the receiving session dropped them.
+ * **Message loops are throttled** : in the receiving session, Claude Code rate-limits repeated messages per sender, drops identical repeats arriving within a short window, and queues at most 50 accepted messages for Claude to read. A message loop between two sessions therefore stops on its own. When the rate limit, repeat check, or queue cap drops a message from an interactive session on this machine, Claude Code tells that session which one dropped it and tells its Claude not to resend right away.
##
--- a/custom-tools.md
+++ b/custom-tools.md
@@ -847,14 +847,3 @@
* If your server grows to dozens of tools, see [tool search](</docs/en/agent-sdk/tool-search>) to defer loading them until Claude needs them.
* To connect to external MCP servers (filesystem, GitHub, Slack) instead of building your own, see [Connect MCP servers](</docs/en/agent-sdk/mcp>).
* To control which tools run automatically versus requiring approval, see [Configure permissions](</docs/en/agent-sdk/permissions>).
-
-##
-
-
-
-Related documentation
-
- * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>)
- * [Python SDK Reference](</docs/en/agent-sdk/python>)
- * [MCP Documentation](<https://modelcontextprotocol.io>)
- * [SDK Overview](</docs/en/agent-sdk/overview>)
--- a/deep-links.md
+++ b/deep-links.md
@@ -20,9 +20,7 @@
3. A new terminal window opens with Claude Code running in the directory the link specified, and the link’s prompt text already in the input box.
4. You read the prompt, edit it if you want, and press Enter to send it.
-The link itself can be hosted anywhere, but the session always opens locally on the computer where you clicked. See Registration and supported platforms for which terminal emulator opens on each operating system.
-
-The platform that displays the link must allow custom URL schemes. GitHub-rendered Markdown allows `http` and `https` but strips schemes like `claude-cli://` in READMEs, issues, pull requests, and wikis. Only the link text shows, with no link behind it and the URL hidden. See Troubleshooting for a workaround.
+The link itself can be hosted anywhere, but the session always opens locally on the computer where you clicked. See Registration and supported platforms for which terminal emulator opens on each operating system. The platform that displays the link must allow custom URL schemes. For what GitHub does with them and the workaround, see The link renders as plain text instead of being clickable.
###
--- a/desktop.md
+++ b/desktop.md
@@ -396,7 +396,7 @@
* Before archiving any session, Claude asks you first. You see the approval card in every permission mode, including Auto and Bypass permissions.
* Through this surface, Claude can’t send cross-session messages from a session nobody is watching, such as a scheduled-task run, and can’t deliver messages into one.
- * Claude Code checks each message from this surface against the receiving session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). If you set [`crossSessionInbound`](</docs/en/settings#available-settings>) to `refuse` in the receiving session, Claude Code drops messages from this surface. The check runs even when the receiving session doesn’t have [cross-session messaging](</docs/en/cross-session-messaging#availability>) itself. Before v2.1.234, Claude Code dropped every message from this surface to a receiving session without cross-session messaging.
+ * Claude Code checks each message from this surface against the receiving session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>), even when the receiving session doesn’t have [cross-session messaging](</docs/en/cross-session-messaging#availability>) itself. If you set [`crossSessionInbound`](</docs/en/settings#available-settings>) to `refuse` in the receiving session, Claude Code drops messages from this surface. Claude Code reports the refusal to the Claude desktop app. Before v2.1.234, Claude Code dropped every message from this surface to a receiving session without cross-session messaging.
* Claude Code quotes each incoming message and attributes it to the session that sent it, and Claude still follows the receiving session’s own permission settings when acting on one.
Claude can also suggest new sessions. When it notices something worth fixing that’s out of scope for the current task, it offers the work as a task chip in the chat. Click the chip to start that work in a new session with its own worktree; Claude continues your current session uninterrupted.
--- a/desktop-scheduled-tasks.md
+++ b/desktop-scheduled-tasks.md
@@ -30,7 +30,7 @@
Create a scheduled task
-Click **Routines** in the sidebar, then click **New routine** and choose **Local**. Configure these fields:
+In the [**Code** tab](</docs/en/desktop>), click **Routines** in the sidebar, then click **New routine** and choose **Local**. Configure these fields:
Field| Description
---|---
@@ -87,7 +87,7 @@
Manage scheduled tasks
-Click a task in the **Routines** list to open its detail page. From here you can:
+In the **Code** tab, click a task in the **Routines** list to open its detail page. From here you can:
* **Run now** : start the task immediately without waiting for the next scheduled time
* **Status** : toggle between Active and Paused to pause or resume scheduled runs without deleting the task
--- a/env-vars.md
+++ b/env-vars.md
@@ -186,11 +186,14 @@
`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail
`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>))
`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting
+`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `1` to let Claude read and reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) when feature-flag fetching is off. Set to `0` to turn comment reading and replying off even when fetching is on. Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later
+`CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `1` to let Claude [reply on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) when feature-flag fetching is off, or `0` to turn that off even when fetching is on. Needs comment reading on as well. Requires Claude Code v2.1.228 or later
`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly
`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run
`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting
`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later
`CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead
+`CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>)
`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system`
`CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later
`CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication
@@ -245,8 +248,8 @@
`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections
`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>)
`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7
-`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>)
-`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>)
+`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>)
+`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>)
`CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>)
`CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later
`CLAUDE_CODE_EXIT_AFTER_STOP_DELAY`| Time in milliseconds to wait after the query loop becomes idle before automatically exiting. Useful for automated workflows and scripts using SDK mode
@@ -283,7 +286,7 @@
`CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults it. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later
`CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings
`CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting
-`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen`
+`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. You can also switch with `/tui fullscreen`
`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments
`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set
`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart
@@ -320,7 +323,7 @@
`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
`CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran
-`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>)
+`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>)
`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled
`CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves
`CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later
@@ -345,7 +348,7 @@
`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 any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings
`CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>). Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once a tool command has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later
-`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline
+`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline
`CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>)
`CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>)
`CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>)
@@ -405,12 +408,16 @@
`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5
`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set
`MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret`
-`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception
+`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception
`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt
-`MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later
+`MCP_DISCOVERY_CACHE`| Turns the [MCP discovery cache](</docs/en/mcp#server-status-detail>) on or off. With the cache on, a remote HTTP or SSE server you’ve used before can show the [`cached` status](</docs/en/mcp#server-status-detail>), and Claude Code connects it on its first tool call instead of at startup. The cache is off by default unless a gradual rollout has enabled it for your account. Set to `1` to turn it on, or `0` to keep it off even when the rollout has enabled it. Before v2.1.238, the cache was on by default. The `cached` status requires Claude Code v2.1.221 or later
+`MCP_DISCOVERY_CACHE_MAX_STALE_S`| Maximum age, in seconds, of a [discovery-cache](</docs/en/mcp#server-status-detail>) entry (default: 14400, or 4 hours). At a start where the entry is older than that, Claude Code discards it and connects the server at startup, as it does with the cache off. Claude Code caps the value at 7 days. Before v2.1.238, the default was 86400, or 24 hours, and Claude Code didn’t cap the value
+`MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later
+`MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value
`MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>)
+`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP, claude.ai connector, and stdio servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later
`MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20)
-`MCP_SDK_GENERATION`| Pin which MCP client runtime this process uses, the implementation behind [MCP server connections](</docs/en/mcp>), while Claude Code migrates from its v1 runtime to v2. Set `v1` to stay on the current runtime or `v2` to opt in early. Without the variable, a gradual rollout decides, and defaults to v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later
+`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2 on Claude Code v2.1.232 or later, except where that section says it uses v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later
`MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
`MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds)
`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored
@@ -465,7 +472,9 @@
* Use [the advisor tool](</docs/en/advisor#requirements>)
* Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead
* Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt
+ * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>), unless you set `CLAUDE_CODE_ARTIFACT_COMMENTS=1`; for Claude to reply to sent comments on its own, also set `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT=1`. Neither override helps under `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which [turns artifacts off entirely](</docs/en/artifacts#availability>)
* Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead
+ * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto`
With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review.
Show diff (265 lines)
--- a/errors.md
+++ b/errors.md
@@ -8,7 +8,7 @@
Find your error
-Match the message you see in your terminal to a section below.
+Match the message you see to a section below.
Message| Section
---|---
@@ -28,6 +28,7 @@
`Agent terminated early due to an API error`| Server errors
`You've hit your session limit` / `You've hit your weekly limit`| Usage limits
`Usage credits required for 1M context`| Usage limits
+`the prompt to confirm went unanswered — nothing was sent`| Usage limits
`Server is temporarily limiting requests`| Usage limits
`Request rejected (429)`| Usage limits
`Credit balance is too low`| Usage limits
@@ -50,7 +51,10 @@
`Claude.ai login expired`| Authentication
`Claude.ai login was rejected — run /login, then /remote-control`| Authentication
`OAuth token unavailable — run /login to restore Remote Control`| Authentication
+`Signed out of Claude — run /login, then /remote-control`| Authentication
`signed-in claude.ai account or organization changed on this machine`| Authentication
+`Remote Control stopped — the app running this session is now signed in to a different Claude account`| Authentication
+`Remote Control stopped — the app running this session is signed out of Claude`| Authentication
`OAuth token revoked` / `OAuth token has expired`| Authentication
`API Error: 401 Invalid authentication credentials`| Authentication
`Login expired · Please run /login`| Authentication
@@ -72,6 +76,7 @@
`SSL certificate verification failed`| Network
`SSL certificate error (...)` during login or startup| Network
`403` with `x-deny-reason: host_not_allowed` in a cloud or routine session| Network
+`proxy refused the connection`| Network
`403` with `This GraphQL query is not enabled for this session` in a cloud session| [GitHub proxy](</docs/en/cloud-environments#github-proxy>)
`Couldn't reconnect to your Remote Control session`| Network
`N sessions ended while this machine was offline — the environment was cleaned up on the server and can't be resumed.`| Network
@@ -138,6 +143,9 @@
`Failed to write to <name>'s inbox — nothing was sent`| Tool errors
`Failed to write the plan approval request to the lead's inbox — plan not submitted`| Tool errors
`Message too large for cross-session delivery`| Tool errors
+`Too many messages to this session just now`| Tool errors
+`Refusing to send: reply target is a symlink` / `Refusing to send: cannot vet reply target`| Tool errors
+`Refusing to send: connected endpoint is not the expected process` / `Refusing to send: connected endpoint identity could not be read`| Tool errors
`Can't open MCP settings while no terminal is attached to this background session`| Background session errors
`Can't open MCP settings in a background session`| Background session errors
`blocked because the path is spelled in a form that cannot be safely resolved`| Background session errors
@@ -153,6 +161,7 @@
`Transcript saving is off — CLAUDE_CODE_SKIP_PROMPT_HISTORY is set`| Session saving warnings
`Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker`| Session saving warnings
`Ignoring N permissions.allow entries from ... this workspace has not been trusted`| Configuration warnings
+`headersHelper not run — this workspace has no persisted trust`| Configuration warnings
`... is not matched by file permission checks`| Configuration warnings
`CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced`| Configuration warnings
`[claude-code:unrecognized_model]`| Configuration warnings
@@ -373,7 +382,7 @@
Usage limits
-Most errors in this section mean a quota tied to your account or plan has been reached. Two work differently: `Server is temporarily limiting requests` is a server-side throttle unrelated to your plan quota, and `Usage credits required for 1M context` is an entitlement check rather than an exhausted quota.
+Most errors in this section mean a quota tied to your account or plan has been reached. Three work differently: `Server is temporarily limiting requests` is a server-side throttle unrelated to your plan quota, `Usage credits required for 1M context` is an entitlement check rather than an exhausted quota, and `The prompt to confirm went unanswered` means a usage-credits consent prompt closed unanswered, whether or not a quota was reached.
###
@@ -419,6 +428,25 @@
+The prompt to confirm went unanswered
+
+On plans where Fable 5 usage [bills to usage credits](</docs/en/model-config#fable-5-and-usage-credits>), Claude Code asks you to confirm before a request bills them. When nobody answers that consent prompt in a session that may have no one at its terminal, Claude Code closes the prompt and ends the turn with one of these messages:
+
+ Fable 5 limit reached · continuing on Fable 5 uses usage credits, and the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
+ Fable 5 now uses usage credits · the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
+
+This happens in [Remote Control](</docs/en/remote-control>) sessions, [background sessions](</docs/en/agent-view>), and [agent team](</docs/en/agent-teams>) teammate sessions. Claude Code shows the consent prompt only in the session’s own interactive view: the terminal where it runs, or, for a background session, the [agents view](</docs/en/agent-view>) once you attach. A Remote Control client can’t display it. Claude Code closes the prompt at the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, five minutes by default, or as soon as a new prompt arrives while nobody has typed at that terminal, such as a prompt sent from a Remote Control client. Typing at the terminal where the session runs cancels the deadline, and Claude Code waits for your answer. In a background session’s attached view, typing doesn’t cancel the deadline, so answer before it passes. Claude Code sends nothing and keeps your model, so when you send your next prompt, Claude Code shows the consent prompt again. **What to do:**
+
+ * At the terminal where the session runs, send another prompt and answer the consent prompt when it reappears. For a background session, attach to it from the [agents view](</docs/en/agent-view>) first. Resending from a Remote Control client shows this message again, because the client can’t display the prompt.
+ * Run `/model` to switch to a model that doesn’t bill usage credits
+ * To give yourself more time to reach that terminal, set [`dialogExpiry`](</docs/en/settings#available-settings>) to a longer value or `"never"`
+
+Before v2.1.236, this message didn’t appear: while a Remote Control client was connected, Claude Code waited 60 seconds for an answer and then continued the turn on your default model.
+
+###
+
+
+
Server is temporarily limiting requests
The API applied a short-lived throttle that is unrelated to your plan quota.
@@ -706,7 +734,7 @@
Remote Control couldn’t refresh your login
-Claude Code runs a live [Remote Control](</docs/en/remote-control>) connection on short-lived credentials that it obtains and renews using your saved claude.ai login. When Claude Code can’t produce a login token that claude.ai accepts, whether while connecting or mid-session, it stops Remote Control and shows the reason in a warning and a transcript line that starts with `Remote Control disconnected`. Your local session keeps running without Remote Control.
+Claude Code runs a live [Remote Control](</docs/en/remote-control>) connection on short-lived credentials that it obtains and renews using your saved claude.ai login. When claude.ai stops accepting that login, or Claude Code has no saved login left, Claude Code stops Remote Control and needs you to sign in again. Either failure can happen while Claude Code is still connecting or later, when it renews the credentials. When Claude Code asks the login service to refresh your saved login and gets no answer, it keeps Remote Control running and tries the refresh again while the connection’s current credential is still valid. A refresh gets no answer when Claude Code can’t reach the login service, the request times out, or the service fails without rejecting your login. If the login service still isn’t answering when that credential expires, Claude Code stops Remote Control and reports `OAuth token refresh failed`. When Claude Code stops Remote Control, it shows the reason in a warning and in a transcript line that starts with `Remote Control disconnected`. Your local session keeps running without Remote Control. This section covers these lines:
Remote Control disconnected — Claude.ai login expired — run /login to restore Remote Control
Remote Control disconnected — Claude.ai login expired — run /login, then /remote-control
@@ -714,20 +742,22 @@
Remote Control disconnected — OAuth token unavailable — run /login to restore Remote Control
Remote Control disconnected — OAuth token refresh failed — run /login to re-authenticate
Remote Control disconnected — JWT refresh failed: no OAuth token — run /login
-
-The middle of the message names what failed:
+ Remote Control disconnected — Signed out of Claude — run /login, then /remote-control
+
+Claude Code names the cause in the middle of the message:
* `Claude.ai login expired` and `Claude.ai login was rejected`: claude.ai no longer accepts your saved login token, because it expired or was revoked
* `OAuth token unavailable`: Claude Code had no saved login token when the connection’s credential came due for renewal
- * `OAuth token refresh failed`: Claude Code tried to refresh the saved login and the refresh failed, typically because the OAuth service rejected the stored refresh token
+ * `OAuth token refresh failed`: claude.ai rejected your saved login token while Claude Code was reconnecting, and refreshing the token produced no new one
* `JWT refresh failed: no OAuth token`: Claude Code found no saved login token to renew with
+ * `Signed out of Claude`: you signed out on this machine, for example by running `/logout` in another terminal, so Claude Code has no saved login left to renew the connection with
**What to do:**
* Run `/login` to sign in again
* Run `/remote-control` to reconnect the session. Messages ending `run /login to restore Remote Control` don’t need this step: Claude Code reconnects on its own once you sign in.
-Before v2.1.224, `OAuth token refresh failed — run /login to re-authenticate` read `OAuth token refresh failed — re-authenticate, then re-enable Remote Control`, and `JWT refresh failed: no OAuth token — run /login` read `no OAuth token available for recovery (code <N>)`. The `Claude.ai login expired`, `Claude.ai login was rejected`, and `OAuth token unavailable` messages were added in v2.1.225.
+Before v2.1.224, `OAuth token refresh failed — run /login to re-authenticate` read `OAuth token refresh failed — re-authenticate, then re-enable Remote Control`, and `JWT refresh failed: no OAuth token — run /login` read `no OAuth token available for recovery (code <N>)`. The `Claude.ai login expired`, `Claude.ai login was rejected`, and `OAuth token unavailable` messages were added in v2.1.225. Before v2.1.238, Claude Code reported the cases that now say `Signed out of Claude` as `JWT refresh failed: no OAuth token — run /login`, and stopped Remote Control with `Claude.ai login expired — run /login to restore Remote Control` as soon as one login refresh got no answer.
###
@@ -745,6 +775,24 @@
* To switch back, run `/login` and sign in to the previous account or organization again. Then run `/remote-control`.
Before v2.1.234, Claude Code didn’t notice when you switched to a different account or organization outside the Claude Code session. Claude Code kept the Remote Control session connected until a later request to the Remote Control server failed with `Remote Control server rejected the request (HTTP 404)`. That failure could come hours after the switch.
+
+###
+
+
+
+Remote Control stopped because the app running the session signed out or switched accounts
+
+When the Claude desktop app or an IDE hosts your session, Claude Code gets its login token from that app rather than from `/login`. When claude.ai rejects that token, Claude Code asks the app for a new one. If the app answers that it’s signed out, or that it’s now signed in to a different Claude account, Claude Code ends the [Remote Control](</docs/en/remote-control>) session and sends the app one of these lines:
+
+ Remote Control stopped — the app running this session is now signed in to a different Claude account
+ Remote Control stopped — the app running this session is signed out of Claude. Sign in there, then turn Remote Control back on
+
+Your local session keeps running without Remote Control. **What to do:**
+
+ * If the app is signed out, sign in to it again, then turn Remote Control back on in the app
+ * If the app switched accounts, Claude Code can’t continue the ended session under the new account. Start a new Remote Control session under that account.
+
+Before v2.1.238, Claude Code sent the app the `run /login` messages listed under Remote Control couldn’t refresh your login in both cases.
###
@@ -1033,6 +1081,32 @@
+The proxy refused the connection
+
+You see this message when Claude reads an [artifact](</docs/en/artifacts>) through the proxy you set in `HTTPS_PROXY` or a related [proxy variable](</docs/en/network-config#environment-variables>). Artifact content comes from `*.frame.claudeusercontent.com`, so Claude Code first sends the proxy a `CONNECT` request asking it to open a tunnel to that host. When the proxy refuses, nothing reaches the host, and the message carries the proxy’s HTTP status:
+
+ artifact content fetch failed (proxy refused the connection: HTTP 407)
+ artifact content fetch failed (proxy refused the connection: HTTP 403)
+ the proxy refused the connection to the artifact's content host (HTTP 502)
+
+The status is the proxy’s answer to the `CONNECT`. The host never answered, so each status points at a different fix:
+
+ * `HTTP 407`: the proxy requires credentials it didn’t get. Put them in the proxy URL, as [Basic authentication](</docs/en/network-config#basic-authentication>) shows.
+ * `HTTP 403`: the proxy refuses to tunnel to `*.frame.claudeusercontent.com`. Ask whoever runs the proxy to allow that host, which [Network access requirements](</docs/en/network-config#network-access-requirements>) lists.
+ * Any other status, such as `HTTP 502`: the proxy didn’t open the tunnel for its own reason, such as failing to reach the host. Look the status up in the proxy’s logs.
+ * `unreadable reply` in place of a status: whatever is at the proxy address didn’t answer with an HTTP status line. Check that the address is an HTTP proxy.
+
+**What to do:**
+
+ * Check the address and credentials in the proxy variable, as [Proxy configuration](</docs/en/network-config#proxy-configuration>) describes, then run `curl -x http://proxy.example.com:8080 -I https://api.anthropic.com` from the shell you start Claude Code in, using your own proxy URL. On Windows PowerShell, run `curl.exe`. If this probe fails the same way, fix the proxy setup first. If it succeeds, the refusal is specific to the artifact host.
+ * If your network lets Claude Code reach the artifact host directly, add `.claudeusercontent.com` to [`NO_PROXY`](</docs/en/network-config#environment-variables>).
+
+Before v2.1.238, Claude Code reported a refused tunnel as a generic network error.
+
+###
+
+
+
Couldn’t reconnect to your Remote Control session
Couldn't reconnect to your Remote Control session. Retry, or start a fresh session without --resume.
@@ -1763,7 +1837,7 @@
**What to do:**
- * In a session started without those restrictions, run `/tui fullscreen`, or `/tui default` to switch back. Claude Code saves the [`tui` setting](</docs/en/settings#available-settings>) there and uses it for every later session
+ * In a session started without those restrictions, run `/tui fullscreen`, or `/tui default` to switch back. Claude Code saves the [`tui` setting](</docs/en/settings#available-settings>) there
##
@@ -1968,6 +2042,47 @@
Before v2.1.235, Claude Code reported an oversized message as sent. The receiving session dropped it unread.
+###
+
+
+
+Too many messages to this session just now
+
+Claude sent a rapid burst of [cross-session messages](</docs/en/cross-session-messaging>) to one of your sessions on this machine, and the burst reached what that session’s inbox accepts. Claude Code refused the next send, and the receiving session got nothing from it. The refusal appears in the sending session’s tool result, not as a banner in your terminal:
+
+ Failed to send to api-worker: Too many messages to this session just now: 30 were sent recently and more would be dropped by its rate limit, so this one was not sent. Batch what remains into one message, or wait a little before sending more.
+
+**What to do:**
+
+ * Usually nothing: Claude batches the remaining content into one message, or waits before sending more
+ * If you prompted the burst yourself, ask Claude to combine what’s left into a single message
+
+Before v2.1.236, Claude Code reported these sends as sent. The receiving session dropped them unread.
+
+###
+
+
+
+Refusing to send a cross-session message
+
+Before Claude Code writes a [cross-session message](</docs/en/cross-session-messaging>) to another of your sessions on this machine, it checks that the target session’s inbox socket is the endpoint the message was addressed to. When a check fails, Claude Code refuses the send in the sending session, and the target session receives nothing. For a message Claude sends, the refusal appears in the sending session’s tool result:
+
+ Failed to send to api-worker: Refusing to send: reply target is a symlink
+
+The text after `Refusing to send:` names the check that failed:
+
+ * `reply target is a symlink`: a symbolic link sits at the target session’s socket path. Claude Code doesn’t deliver through it, because a link there could redirect the message to an endpoint the target session didn’t create.
+ * `cannot vet reply target`: Claude Code couldn’t inspect the target path at all, for example because reading it failed with a permission error.
+ * `connected endpoint is not the expected process`: the process holding the socket isn’t the session the message was addressed to, so the address is stale or another process replaced the socket.
+ * `connected endpoint identity could not be read`: Claude Code connected but couldn’t read which process holds the other end, so it couldn’t confirm the target. This can be transient.
+
+**What to do:**
+
+ * Usually nothing: the checks keep a message from reaching an endpoint other than the session it was addressed to, and nothing was sent
+ * Ask Claude to list your sessions again and resend; a refusal caused by a stale address clears once Claude sends to the current one
+ * If `reply target is a symlink` repeats for one session, check what created a link at that session’s socket path, shown in its `/status` under `Peer address`
+ * For `connected endpoint identity could not be read`, resend; the condition can be transient
+
##
@@ -2238,6 +2353,22 @@
* Run `claude` in the directory and accept the trust dialog. [Project allow rules and workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>) says which folder that acceptance covers.
* In [non-interactive mode](</docs/en/headless>) with `-p` no dialog is shown. Set the `hasTrustDialogAccepted` entry in `~/.claude.json` using the exact `projects` key the message prints.
* If the message names `.claude/settings.local.json` and you started Claude Code outside a git repository or in your home directory, update to v2.1.200 or later. Versions 2.1.196 through 2.1.199 treated your own `.claude/settings.local.json` as repository-supplied in those workspaces. On v2.1.207 and later, updating isn’t enough outside a git repository if you haven’t trusted the folder: determining that a folder isn’t inside a repository runs git, and Claude Code runs that check only after you accept the trust dialog, so use the first step. Your home directory and any other [configuration home](</docs/en/permissions#project-allow-rules-and-workspace-trust>) are exempt and don’t wait for the dialog. See [Project allow rules and workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>).
+
+###
+
+
+
+headersHelper not run
+
+Claude Code connected an MCP server with its static `headers` alone and skipped the server’s [`headersHelper`](</docs/en/mcp#use-dynamic-headers-for-custom-authentication>), because the helper is a shell command and the folder has no saved trust. A folder gets saved trust when you set its entry in `~/.claude.json` by hand or, outside your home directory, when you accept the trust dialog for it in an interactive session. See [Trust a folder before its headersHelper runs](</docs/en/mcp#trust-a-folder-before-its-headershelper-runs>) for which servers this check applies to. Claude Code writes this line in [non-interactive mode](</docs/en/headless>) only, once per server. In an interactive session it writes the same refusal to the debug log instead.
+
+ MCP server 'internal-api': headersHelper not run — this workspace has no persisted trust; accept the trust dialog here once interactively, or set projects["/Users/you/project"].hasTrustDialogAccepted in /Users/you/.claude.json.
+
+The `projects` key the message prints is the folder [Project allow rules and workspace trust](</docs/en/permissions#project-allow-rules-and-workspace-trust>) says Claude Code keys the trust on. Accepting the trust dialog for a parent folder doesn’t satisfy the check, and a `-p` or SDK session doesn’t satisfy it either. **What to do:**
+
+ * Run `claude` in the folder the message names, accept the trust dialog, then run your `-p` or SDK command again
+ * Set the `hasTrustDialogAccepted` entry in `~/.claude.json` yourself, using the exact `projects` key the message prints
+ * If you started the session in your home directory, work from a project directory you have trusted. When you accept the trust dialog in your home directory, Claude Code holds that trust for the current session only.
###
--- a/file-checkpointing.md
+++ b/file-checkpointing.md
@@ -15,12 +15,6 @@
When you enable file checkpointing, the SDK creates backups of files before modifying them through the Write, Edit, or NotebookEdit tools. User messages in the response stream include a checkpoint UUID that you can use as a restore point.
File rewinding restores files on disk to a previous state. It does not rewind the conversation itself. The conversation history and context remain intact after calling `rewindFiles()` (TypeScript) or `rewind_files()` (Python).
-
-The checkpoint system tracks:
-
- * Files created during the session
- * Files modified during the session
- * The original content of modified files
When you rewind to a checkpoint, Claude Code deletes the files it created and restores the files it modified to their content at that point. Claude Code skips a tracked path that is a symlink, hard link, or other non-regular file. It also skips a tracked file whose parent directory no longer resolves to its checkpoint-time location, or whose backup it can’t read safely. [`RewindFilesResult`](</docs/en/agent-sdk/typescript#rewindfilesresult>) counts every skipped path in its `skippedLinks` field. Skipping requires Claude Code v2.1.216 or later; before v2.1.216, a rewind wrote and deleted through links at tracked paths.
--- a/fullscreen.md
+++ b/fullscreen.md
@@ -17,7 +17,7 @@
* If you rewound to before your first message, Claude Code relaunches with an empty conversation
* Your [permission mode](</docs/en/permission-modes>) and [effort level](</docs/en/model-config#adjust-effort-level>)
* The model you last picked with [`/model`](</docs/en/model-config#setting-your-model>)
- * Rules you passed with [`--allowed-tools` or `--disallowed-tools`](</docs/en/cli-reference#cli-flags>)
+ * Rules you passed with [`--allowed-tools` or `--disallowed-tools`](</docs/en/cli-reference#cli-flags>), and your `--agent`, `--agents`, and `--append-system-prompt` flags
Claude Code declines to relaunch if the session has a restriction it can’t pass to the restarted process. Restrictions it can’t pass include:
@@ -26,13 +26,13 @@
In that case Claude Code prints [`Cannot switch renderers in this session`](</docs/en/errors#cannot-switch-renderers-in-this-session>) with the reasons. It doesn’t switch or save anything.
-If you first used Claude Code before May 6, 2026 and haven’t saved a `tui` setting, Claude Code may open a dialog at startup offering the switch. If you accept, Claude Code saves the setting and relaunches the same way `/tui fullscreen` does, carrying the same session state.
+If you first used Claude Code before May 6, 2026 and haven’t saved a `tui` setting, Claude Code may open a dialog at startup offering the switch. If you accept, Claude Code relaunches the same way `/tui fullscreen` does, carrying the same session state, and saves the setting once the relaunched session has started successfully.
You can also set the `CLAUDE_CODE_NO_FLICKER` environment variable before starting Claude Code:
CLAUDE_CODE_NO_FLICKER=1 claude
-The `tui` setting and the environment variable are equivalent. The `/tui` command clears `CLAUDE_CODE_NO_FLICKER` from the relaunched process so the setting it writes takes effect.
+Either one turns fullscreen rendering on. After a failed fullscreen start, Claude Code still honors the variable but not the setting. The `/tui` command clears `CLAUDE_CODE_NO_FLICKER` from the relaunched process so the setting it writes takes effect.
##
@@ -160,7 +160,7 @@
Clear the conversation
-Press `Ctrl+L` twice within two seconds to run `/clear` and start a new conversation. The first press redraws the screen and shows a hint; the second press clears the conversation. On macOS, double-pressing `Cmd+K` also runs `/clear`.
+Run `/clear` to start a new conversation. Pressing `Ctrl+L` or `Cmd+K` doesn’t clear the conversation; Claude Code redraws the screen and keeps it. Before v2.1.238, Claude Code ran `/clear` when you pressed `Ctrl+L` or `Cmd+K` twice within two seconds. On iTerm2 and Terminal.app, your terminal handles `Cmd+K` itself and clears its own screen without telling Claude Code. Claude Code detects the cleared screen and repaints the conversation.
##
@@ -222,6 +222,30 @@
On Windows, Claude Code already enables full repaint automatically for background sessions and [agent view](</docs/en/agent-view>), so you only need to set the variable for an interactive fullscreen session you launched directly.
+###
+
+
+
+`Claude Code's fullscreen renderer didn't finish starting last time` appears at startup
+
+If a fullscreen session on this machine crashes before it has started successfully, Claude Code starts your next session in the classic renderer and prints one of two lines. A session has started successfully once it has drawn its first frame and then either stayed up for 10 seconds or you ended it with `/exit`, Ctrl+C, or Ctrl+D. The line you see tells you what Claude Code does after this session:
+
+ * After one failed start, you see `Claude Code's fullscreen renderer didn't finish starting last time on this machine`. Claude Code tries fullscreen rendering again in the next session you start
+ * After two failed starts, you see `Claude Code's fullscreen renderer has repeatedly failed to start on this machine`. Claude Code keeps using the classic renderer until you update Claude Code or run `/tui fullscreen`, and prints nothing in those later sessions
+
+To confirm that a failed start is why you’re in the classic renderer, run `/tui` with no argument. While a failed start is the reason, the `Current renderer` line says so. To keep the classic renderer, run `/tui default`, which saves the `tui` setting without relaunching. To try fullscreen rendering again, run `/tui fullscreen`. If that session doesn’t finish starting either, report the problem. Before v2.1.236, Claude Code kept starting sessions in fullscreen rendering after a failed start.
+
+####
+
+
+
+How Claude Code counts failed starts
+
+ * Sessions that count: only sessions that started in fullscreen rendering because your `tui` setting says so, because you accepted the startup dialog, or because your account renders fullscreen by default
+ * `CLAUDE_CODE_NO_FLICKER=1`: if you set it, Claude Code renders that session fullscreen even after a failed start, and doesn’t count it
+ * Count reset: Claude Code counts failed starts per Claude Code version, and a successful fullscreen start resets the count
+ * Startup dialog: if you accepted the dialog and the relaunched session crashed, Claude Code prints neither line and doesn’t show the dialog again on this Claude Code version
+
##
--- a/glossary.md
+++ b/glossary.md
@@ -60,7 +60,7 @@
Auto mode
-A permission mode where a separate classifier model reviews actions instead of you, so Claude Code runs most of them without asking you. Claude Code still asks you before actions your explicit ask rules match. On Pro, Max, and Team plans, auto mode is the [built-in starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) for interactive terminal and VS Code sessions. The classifier blocks scope escalation, untrusted infrastructure, and prompt injection. It never sees tool results, so injected instructions can’t influence its decisions. Learn more: [Eliminate prompts with auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)
+A permission mode where a separate classifier model reviews actions instead of you, so Claude Code runs most of them without asking you. Claude Code still asks you before actions your explicit ask rules match. On Pro, Max, and Team plans, auto mode is the [built-in starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) for interactive terminal and VS Code sessions. The classifier blocks scope escalation, untrusted infrastructure, and prompt injection. Tool results are stripped from what it sees, so hostile content in a file or web page can’t manipulate it directly. Learn more: [Eliminate prompts with auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)
##
@@ -74,7 +74,7 @@
Bare mode
-With `--bare`, Claude Code starts without loading hooks, skills, plugins, MCP servers, auto memory, or CLAUDE.md. Recommended for CI and scripted calls where you need the same result on every machine. Learn more: [Start faster with bare mode](</docs/en/headless#start-faster-with-bare-mode>)
+With `--bare`, Claude Code starts without loading hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, or CLAUDE.md, apart from skills in a directory you pass with `--add-dir`. Recommended for CI and scripted calls where you need the same result on every machine. Learn more: [Start faster with bare mode](</docs/en/headless#start-faster-with-bare-mode>)
###
@@ -274,7 +274,7 @@
Output style
-A configuration that modifies Claude’s system prompt to change response behavior, tone, or format. Output styles turn off the software-engineering-specific parts of the default system prompt, unlike CLAUDE.md which is delivered as a user message following the system prompt. Built-in styles include Default, Proactive, Explanatory, and Learning. Learn more: [Output styles](</docs/en/output-styles>)
+A configuration that modifies Claude’s system prompt to change response behavior, tone, or format. Unlike CLAUDE.md, which Claude Code delivers as a user message after the system prompt, an output style changes the system prompt itself. Custom styles leave out Claude Code’s built-in software engineering instructions unless you set `keep-coding-instructions` to `true`, and the built-in Default, Proactive, Concise, Explanatory, and Learning styles keep them. Learn more: [Output styles](</docs/en/output-styles>)
##
@@ -328,7 +328,7 @@
Prompt injection
-Hostile instructions embedded in a file, web page, or tool result that attempt to redirect Claude toward actions you never asked for. Claude Code’s defenses include the permission system, command injection detection, and trust verification. Auto mode adds a server-side probe that scans tool results for suspicious content and a classifier that never sees tool results, so injected text cannot influence its approval decisions. Learn more: [Protect against prompt injection](</docs/en/security#protect-against-prompt-injection>)
+Hostile instructions embedded in a file, web page, or tool result that attempt to redirect Claude toward actions you never asked for. Claude Code’s defenses include the permission system, command injection detection, and trust verification. Auto mode adds a server-side probe that scans tool results for suspicious content and a classifier that reviews actions with tool results stripped, so injected text can’t manipulate it directly. Learn more: [Protect against prompt injection](</docs/en/security#protect-against-prompt-injection>)
##
--- a/goal.md
+++ b/goal.md
@@ -15,7 +15,7 @@
Approach| Next turn starts when| Stops when
---|---|---
-`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
+`/goal`| The previous turn finishes, or an idle check-in comes due while background work keeps the goal waiting| A model confirms the condition is met or judges it impossible, or a turn fails on an error you have to fix, or you run `/goal clear`
[`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done
[Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides
@@ -144,7 +144,12 @@
Background work defers evaluation
-If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. When a turn ends and background work has kept the goal waiting for 30 minutes or more, Claude Code asks Claude to check on that work. Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each further 30 minutes of waiting, Claude Code asks again at the next turn end. To change the interval, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>); set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
+If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn. It evaluates at the end of the next turn that finishes with no background work running. When the background work finishes, Claude Code delivers the result to Claude as a new turn, so you don’t have to prompt. Once background work has kept the goal waiting for 30 minutes, a check-in is due. In the check-in, Claude Code lists the running tasks and asks Claude to read their output, keep waiting if they’re progressing, and fix or stop any that are stuck. After each check-in, the 30 minutes start again. Claude Code delivers a due check-in, the first one included, in one of two ways:
+
+ * **When a turn ends** : Claude Code delivers the check-in at the end of the next turn that finishes with the work still running. In a non-interactive session, such as one started with `-p`, this is the only way Claude Code delivers check-ins.
+ * **While the session is idle** : in an interactive session, Claude Code also starts a turn on its own to deliver the check-in instead of waiting for your next prompt. After the first check-in, Claude Code waits twice as long before each later idle check-in, up to four times the interval: with the default, 1 hour after the first check-in, then every 2 hours. If the background work has stopped without reporting a result, Claude Code asks Claude to continue toward the goal. Idle check-ins require Claude Code v2.1.236 or later.
+
+To change the intervals, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>). Claude Code uses your value in place of the 30-minute interval and scales the idle intervals with it. Set it to `0` to turn check-ins off. Check-ins require Claude Code v2.1.234 or later.
###
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -169,7 +169,7 @@
Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them:
- * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` counts as a selection too, because the built-in Sonnet model may not be enabled in a project that steers its own Opus.
+ * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in a project that steers its own Opus.
* To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project.
Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default.
@@ -193,7 +193,7 @@
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 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.
+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, for example 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.
##
--- a/headless.md
+++ b/headless.md
@@ -28,7 +28,7 @@
Start faster with bare mode
-Add `--bare` to reduce startup time by skipping auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. Without it, `claude -p` loads the same [context](</docs/en/how-claude-code-works#the-context-window>) an interactive session would, including anything configured in the working directory or `~/.claude`. Bare mode is useful for CI and scripts where you need the same result on every machine. A hook in a teammate’s `~/.claude` or an MCP server in the project’s `.mcp.json` won’t run, because bare mode never reads them. Without `--bare`, Claude Code runs the hooks in a project’s `.claude/settings.json` even in a folder you’ve never trusted, because a `-p` session shows no workspace trust dialog. It also connects the servers in the project’s `.mcp.json`, because a `-p` session can’t show the per-server approval prompt either. [What runs before you trust a folder](</docs/en/permissions#what-runs-before-you-trust-a-folder>) covers each kind of repository content under `-p` and how to keep it out. This example runs a one-off summarize task in bare mode and pre-approves the Read tool so the call completes without a permission prompt. Set `ANTHROPIC_API_KEY` before running it, because bare mode doesn’t use your subscription login:
+Add `--bare` to reduce startup time by skipping auto-discovery of hooks, skills, custom commands, [subagents](</docs/en/sub-agents>), plugins, MCP servers, auto memory, and CLAUDE.md. Without it, `claude -p` loads the same [context](</docs/en/how-claude-code-works#the-context-window>) an interactive session would, including anything configured in the working directory or `~/.claude`. Bare mode is useful for CI and scripts where you need the same result on every machine. A hook in a teammate’s `~/.claude` or an MCP server in the project’s `.mcp.json` won’t run, because bare mode never reads them. A directory you name with `--add-dir` is a partial exception: bare mode loads skills from its `.claude/skills/` folder, but still skips its `.claude/commands/` and `.claude/agents/` folders. [Skills from additional directories](</docs/en/skills#skills-from-additional-directories>) covers what does and doesn’t load. Without `--bare`, Claude Code runs the hooks in a project’s `.claude/settings.json` even in a folder you’ve never trusted, because a `-p` session shows no workspace trust dialog. It also connects the servers in the project’s `.mcp.json`, because a `-p` session can’t show the per-server approval prompt either. [What runs before you trust a folder](</docs/en/permissions#what-runs-before-you-trust-a-folder>) covers each kind of repository content under `-p` and how to keep it out. This example runs a one-off summarize task in bare mode and pre-approves the Read tool so the call completes without a permission prompt. Set `ANTHROPIC_API_KEY` before running it, because bare mode doesn’t use your subscription login:
claude --bare -p "Summarize README.md" --allowedTools "Read"
@@ -50,7 +50,20 @@
Background tasks at exit
-If Claude starts a [background Bash task](</docs/en/tools-reference#bash-tool-behavior>) during a `claude -p` run, for example a dev server or a watch build, that shell is terminated about five seconds after Claude has returned its final result and stdin has closed. The grace period lets a task that finishes right after the result still deliver its output. Before v2.1.163, a never-exiting background process would hold the `claude -p` invocation open indefinitely. Background [subagents](</docs/en/sub-agents>) and workflows are exempt from the five-second grace because their result is part of the final output, so `claude -p` waits for them to complete. From v2.1.182, that wait is capped at ten minutes by default so a stuck background agent cannot hold the process open indefinitely. Adjust the cap with [`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`](</docs/en/env-vars>), or set it to `0` to wait without a limit. If you stop a `claude -p` run with SIGTERM, for example from `kill`, a process supervisor, or an SDK host closing the session, Claude Code aborts the in-progress turn, terminates the process tree of any running Bash command, runs [`SessionEnd` hooks](</docs/en/hooks#sessionend>), and exits with code 143.
+If Claude starts a [background Bash task](</docs/en/tools-reference#bash-tool-behavior>) during a `claude -p` run, for example a dev server or a watch build, that shell is terminated about five seconds after Claude has returned its final result and stdin has closed. The grace period lets a task that finishes right after the result still deliver its output. Before v2.1.163, a never-exiting background process would hold the `claude -p` invocation open indefinitely. Background [subagents](</docs/en/sub-agents>) and workflows are exempt from the five-second grace because their result is part of the final output, so `claude -p` waits for them to complete. From v2.1.182, that wait is capped at ten minutes by default so a stuck background agent cannot hold the process open indefinitely. Adjust the cap with [`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`](</docs/en/env-vars>), or set it to `0` to wait without a limit.
+
+###
+
+
+
+Stop a run with SIGTERM
+
+If you stop a `claude -p` run with SIGTERM, for example with `kill` or from a process supervisor, Claude Code exits with code 143. Claude Code leaves the turn that was in progress unfinished and records no result for it. To end the turn instead, send SIGINT, or call the Agent SDK’s `interrupt()`, before you stop the process. On SIGTERM, Claude Code terminates the process tree of any Bash command that is still running. Claude Code then runs [`SessionEnd` hooks](</docs/en/hooks#sessionend>) and exits. While exiting, Claude Code starts no new tool call, sends no new model request, and runs no hook other than `SessionEnd`. If the run was in the middle of a command or waiting on a permission prompt when the signal arrived, Claude Code handles that step as follows:
+
+ * **Running a command** : Claude Code records the command as killed in the session.
+ * **Waiting for an answer to a permission prompt** : if you send SIGTERM to the process, Claude Code leaves the prompt unanswered. If your program closes the session through the Agent SDK, the SDK ends Claude Code’s input before sending any signal, and Claude Code cancels the prompt as soon as the input ends.
+
+When you resume the session, Claude Code continues the turn that SIGTERM left unfinished.
##
--- a/hooks.md
+++ b/hooks.md
@@ -228,13 +228,11 @@
Option| Type| Default| Description
---|---|---|---
-`matcher`| `string`| `undefined`| Pattern matched against the event’s filter field, following the [rules for matchers in settings files](</docs/en/hooks#matcher-patterns>). For tool hooks, this is the tool name. Built-in tools include `Bash`, `Read`, `Write`, `Edit`, `Glob`, `Grep`, `WebFetch`, `Agent`, and others (see [Tool Input Types](</docs/en/agent-sdk/typescript#tool-input-types>) for the full list). MCP tools use the pattern `mcp__<server>__<action>`.
+`matcher`| `string`| `undefined`| Pattern matched against the event’s filter field, following the [rules for matchers in settings files](</docs/en/hooks#matcher-patterns>). For tool hooks, this is the tool name. Built-in tools include `Bash`, `Read`, `Write`, `Edit`, `Glob`, `Grep`, `WebFetch`, `Agent`, and others (see [Tool Input Types](</docs/en/agent-sdk/typescript#tool-input-types>) for the full list). MCP tools use the pattern `mcp__<server>__<action>`, where `<server>` is the key you use in the `mcpServers` configuration.
`hooks`| `HookCallback[]`| -| Required. Array of callback functions to execute when the pattern matches
`timeout`| `number`| `undefined`| Timeout in seconds. When omitted, Claude Code applies the event’s default timeout. Your SDK callbacks follow the `command` hook defaults
-Use the `matcher` pattern to target specific tools whenever possible. A matcher with `'Bash'` only runs for Bash commands, while omitting the pattern runs your callbacks for every occurrence of the event.
-
-**Discovering tool names:** See [Tool Input Types](</docs/en/agent-sdk/typescript#tool-input-types>) for the full list of built-in tool names, or add a hook without a matcher to log all tool calls your session makes.**MCP tool naming:** MCP tools always start with `mcp__` followed by the server name and action: `mcp__<server>__<action>`. For example, if you configure a server named `playwright`, its tools are named `mcp__playwright__browser_screenshot`, `mcp__playwright__browser_click`, and so on. The server name comes from the key you use in the `mcpServers` configuration.
+Use the `matcher` pattern to target specific tools whenever possible. A matcher with `'Bash'` only runs for Bash commands, while omitting the pattern runs your callbacks for every occurrence of the event. Omit it on purpose to log every tool call your session makes.
###
@@ -265,7 +263,10 @@
Your callback returns an object with two categories of fields:
* **Top-level fields** are accepted on every event: `systemMessage` shows a message to the user, and `continue` (`continue_` in Python) determines whether the agent keeps running after this hook. Some events discard them or deliver them elsewhere. Each [event’s section](</docs/en/hooks#hook-events>) on the hooks page says where they land.
- * **`hookSpecificOutput`** controls the current operation. The fields inside depend on the hook event type. For `PreToolUse` hooks, this is where you set `permissionDecision` (`"allow"`, `"deny"`, `"ask"`, or `"defer"`), `permissionDecisionReason`, and `updatedInput`. Returning `"defer"` ends the query so you can [resume it later](</docs/en/hooks#defer-a-tool-call-for-later>). For `PostToolUse` hooks, you can set `additionalContext` to append information to the tool result. To replace the tool’s output before Claude sees it, set `updatedToolOutput`, which works for any tool in both SDKs. The older `updatedMCPToolOutput` field replaces MCP tool output only and is deprecated.
+ * **`hookSpecificOutput`** controls the current operation. The fields you set inside depend on the hook event type:
+ * For `PreToolUse` hooks, this is where you set `permissionDecision` (`"allow"`, `"deny"`, `"ask"`, or `"defer"`), `permissionDecisionReason`, and `updatedInput`. If you return `"defer"`, the query ends so you can [resume it later](</docs/en/hooks#defer-a-tool-call-for-later>).
+ * For `PostToolUse` hooks, you can set `additionalContext` to append information to the tool result. To replace the tool’s output before Claude sees it, set `updatedToolOutput`, which works for any tool in both SDKs. The older `updatedMCPToolOutput` field replaces MCP tool output only and is deprecated.
+ * In the TypeScript SDK, a `PostToolUse` callback can also return `classifierContext`, a short note about the tool call’s result for the [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) permission classifier. Because your callback runs in your application’s own process, the classifier may weigh a user statement you relay in the note as user intent. The field requires TypeScript Agent SDK v0.3.236 or later. [Annotate a result for the auto mode classifier](</docs/en/hooks#annotate-a-result-for-the-auto-mode-classifier>) covers the length cap, the synchronous-only rule, and what not to put in the note.
Return `{}` to allow the operation without changes. SDK callback hooks use the same JSON output format as [Claude Code shell command hooks](</docs/en/hooks#json-output>), which documents every field and event-specific option. For the SDK type definitions, see the [TypeScript](</docs/en/agent-sdk/typescript#synchookjsonoutput>) and [Python](</docs/en/agent-sdk/python#synchookjsonoutput>) SDK references.
--- a/hosting.md
+++ b/hosting.md
@@ -279,7 +279,7 @@
* Pass `settingSources: []` in TypeScript or `setting_sources=[]` in Python so no filesystem settings load.
* Set `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` in `env`. [Auto memory](</docs/en/memory#auto-memory>) at `~/.claude/projects/<project>/memory/` loads into the system prompt regardless of `settingSources`. See [What settingSources does not control](</docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control>) for the other inputs that load unconditionally.
- * Point `CLAUDE_CONFIG_DIR` at a per-tenant directory so tenants do not share the `~/.claude.json` global config. When each config directory serves one working directory, you can also set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) in `env` to keep the transcript paths under it short. Requires TypeScript Agent SDK v0.3.234 or later.
+ * Point `CLAUDE_CONFIG_DIR` at a per-tenant directory so tenants do not share the `~/.claude.json` global config. When each config directory serves one working directory and you don’t share a [`SessionStore`](</docs/en/agent-sdk/session-storage>) across tenants, you can also set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) in `env` to keep the transcript paths under it short. Requires TypeScript Agent SDK v0.3.234 or later, or Python Agent SDK v0.2.140 or later.
* Use a per-tenant working directory. Pass `cwd` explicitly on every `query()` call.
* Apply per-tenant egress rules at your proxy, such as distinct outbound IPs, credentials, or domain allowlists, so a compromised tenant cannot exfiltrate data via another tenant’s outbound policy.
--- a/interactive-mode.md
+++ b/interactive-mode.md
@@ -15,10 +15,10 @@
Shortcut| Description| Context
---|---|---
`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+X Ctrl+K`| Stop all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session, and turn off [artifact auto-replies](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) for the rest of it. Press twice within 3 seconds to confirm| Subagent control
`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, keeping input and conversation history. Use this to recover if the display becomes garbled or partially blank. In [fullscreen rendering](</docs/en/fullscreen#clear-the-conversation>), if you press `Ctrl+L` once, Claude Code redraws the screen and also shows a hint that pressing it again runs `/clear`. If you press it twice within two seconds, Claude Code runs `/clear` and starts a new conversation
+`Ctrl+L`| Redraw screen| Forces a full terminal redraw, keeping input and conversation history. 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`
@@ -27,10 +27,11 @@
`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
+`Tab`| Accept an autocomplete suggestion, or add a comment to a permission answer| While autocomplete suggestions are showing in the prompt input, accepts the selected suggestion. On most permission prompts, with **Yes** or **No** focused, opens a comment field on that option, and pressing it again closes the field. See [add a comment when you answer a permission prompt](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>)
`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. While you have messages queued, `Up` from the first row instead takes them back
-`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. If you have messages queued, Claude Code sends them next. When a dialog such as a permission prompt is open, `Esc` closes the dialog rather than interrupting Claude
+`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. If you have messages queued, Claude Code sends them next. When a dialog is open, `Esc` closes the dialog. On a permission prompt, `Esc` declines the action, the same as [**No** without a comment](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>)
`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` 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, when available, `bypassPermissions` and then `auto`. From `auto`, the first press switches to `default`. 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, when available, `bypassPermissions` and then `auto`. From `auto`, the first press switches to `default`. See [permission modes](</docs/en/permission-modes>). On a file permission prompt, the same key closes an open [comment field](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>). With no field open, it selects the option that allows the action for the rest of the session, when the prompt offers that option
`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. 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>)
@@ -47,12 +48,26 @@
`Ctrl+E`| Move cursor to end of current line| In multiline input, moves to the end of the current logical line
`Ctrl+K`| Delete to end of line| Stores deleted text for pasting
`Ctrl+U`| Delete from cursor to line start| Stores deleted text for pasting. Repeat to clear across lines in multiline input. On macOS, terminal emulators including iTerm2 and Terminal.app map `Cmd+Backspace` to this shortcut
-`Ctrl+W`| Delete previous word| Stores deleted text for pasting. On macOS, `Option+Delete` also deletes the previous word, and on Windows, `Ctrl+Backspace` does
+`Ctrl+W`| Delete previous word| Stores deleted text for pasting. On macOS, `Option+Delete` deletes the previous word, and on Windows, `Ctrl+Backspace` does. To make `Ctrl+W` delete back to the previous whitespace instead, set `keybindingFlavor` to `"readline"`
`Ctrl+Y`| Paste deleted text| Paste text deleted with `Ctrl+K`, `Ctrl+U`, or `Ctrl+W`
`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
+
+###
+
+
+
+Make Ctrl+W delete back to whitespace
+
+By default, `Ctrl+W` deletes the previous word, stopping at punctuation such as `/`. Set [`keybindingFlavor`](</docs/en/settings#available-settings>) to `"readline"` to make `Ctrl+W` delete back to the previous whitespace instead, as Bash does. The default value is `"classic"`. Requires Claude Code v2.1.238 or later. Add the setting to `~/.claude/settings.json`:
+
+ {
+ "keybindingFlavor": "readline"
+ }
+
+To confirm, type `fix the bug in src/utils/foo.ts` in the prompt and press `Ctrl+W`. Claude Code removes `src/utils/foo.ts`. Under `"classic"` it removes only `foo.ts`.
###
@@ -420,6 +435,7 @@
* After the first turn of a conversation, in some sessions
* The previous response ended in an error
* While you’re in plan mode
+ * Your account is close to or at its usage limit. To keep suggestions on until you reach the limit, set [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) to `true`. Before v2.1.238, Claude Code skipped them near the limit even with the variable set to `true`
* In an [agent team](</docs/en/agent-teams>), in teammates’ sessions by default. The lead’s session shows suggestions
In print mode, Claude Code doesn’t generate suggestions by default. Pass [`--prompt-suggestions`](</docs/en/cli-reference#cli-flags>) with `-p "<prompt>" --output-format stream-json --verbose` to have Claude Code emit a `prompt_suggestion` message after each turn that generates one. The generator skips very short conversations and cold prompt caches here too, so a single short `-p` query can emit none.
@@ -434,7 +450,7 @@
* Turn off **Prompt suggestions** in `/config`
* Set [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) to `false` in your settings file
- * Set the `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION` environment variable to `false`, which takes precedence over the setting:
+ * Set the [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) environment variable to `false`, which takes precedence over the setting:
export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false
--- a/keybindings.md
+++ b/keybindings.md
@@ -113,9 +113,9 @@
Action| Default| Description
---|---|---
`chat:cancel`| Escape| Cancel current input
-`chat:clearInput`| Ctrl+L| Force a full screen redraw, preserving input. In [fullscreen rendering](</docs/en/fullscreen#clear-the-conversation>), press twice within two seconds to run `/clear`
-`chat:clearScreen`| Cmd+K| In [fullscreen rendering](</docs/en/fullscreen#clear-the-conversation>), press twice within two seconds to run `/clear`
-`chat:killAgents`| Ctrl+X Ctrl+K| Stop all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session
+`chat:clearInput`| Ctrl+L| Force a full screen redraw, preserving input and conversation
+`chat:clearScreen`| Cmd+K| Force a full screen redraw, preserving input and conversation. See [Clear the conversation](</docs/en/fullscreen#clear-the-conversation>) for how Cmd+K behaves on iTerm2 and Terminal.app
+`chat:killAgents`| Ctrl+X Ctrl+K| Stop all running [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in this session and turn off [artifact auto-replies](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) for the rest of it
`chat:cycleMode`| Shift+Tab*| Cycle permission modes
`chat:modelPicker`| Meta+P| Open model picker
`chat:fastMode`| Meta+O| Toggle fast mode
@@ -161,8 +161,10 @@
`confirm:nextField`| Tab| Next field
`confirm:previousField`| (unbound)| Previous field
`confirm:toggle`| Space| Toggle selection
-`confirm:cycleMode`| Shift+Tab| Cycle permission modes
+`confirm:cycleMode`| Shift+Tab*| Cycle permission modes. On a file permission prompt, closes an open [comment field](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>); with no field open, selects the option that allows the action for the rest of the session, when the prompt offers that option
`confirm:toggleExplanation`| Ctrl+E| Toggle a model-generated [explanation of the command](</docs/en/permissions#permission-system>) on Bash and PowerShell permission prompts
+
+*On Windows without VT mode (Node <24.2.0/<22.17.0, Bun <1.2.23), defaults to Meta+M.
###
--- a/llm-gateway-connect.md
+++ b/llm-gateway-connect.md
@@ -505,7 +505,7 @@
`/fast` reports `Fast mode has been disabled by your organization` in a session authenticated with `ANTHROPIC_AUTH_TOKEN`, even though the organization has fast mode enabled| The availability check requires a claude.ai login or an Anthropic API key; with only a bearer token, Claude Code treats fast mode as disabled without sending the check| Set `CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1`; see [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>)
Claude Code asks you to log in even though the curl test succeeds| The CLI has no credential of its own: a reachable base URL isn’t one, and in an interactive session an `env` block in a project’s `.claude/settings.json` or `.claude/settings.local.json` applies only after the first-run wizard and [trust prompt](</docs/en/permissions#what-runs-before-you-trust-a-folder>)| Set `ANTHROPIC_AUTH_TOKEN` somewhere Claude Code reads before first-run setup: a shell export, the `env` block in `~/.claude/settings.json`, or managed settings
`ANTHROPIC_API_KEY` is set but ignored, with no prompt| The key needs a one-time approval in interactive sessions, and a previously declined key is ignored without asking again| Enable it under `/config` with the `Use custom API key` option
-`This machine's managed settings require a first-party login`| Managed settings include `forceLoginMethod` or `forceLoginOrgUUID`, which on Claude Code v2.1.146 and later cannot coexist with `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`| Your administrator must remove `forceLoginMethod` and `forceLoginOrgUUID` from managed settings to use gateway credentials, or remove the gateway credential to use first-party login. The two cannot be combined
+`This machine's managed settings require a first-party login`| Managed settings include `forceLoginMethod` or `forceLoginOrgUUID`, which cannot coexist with `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper`| Your administrator must remove `forceLoginMethod` and `forceLoginOrgUUID` from managed settings to use gateway credentials, or remove the gateway credential to use first-party login. The two cannot be combined
`403` with an HTML body such as `403 Forbidden`, when the gateway’s own logs show no request received| A web application firewall or reverse proxy in front of the gateway blocked the request body before it reached the gateway. Claude Code prompts include XML-style tags and source code that match cross-site-scripting body rules, so a short curl test passes while a real session doesn’t| Exempt the gateway’s `/v1/messages` path from request-body inspection. On AWS WAF this is the `CrossSiteScripting_Body` managed rule; on nginx with ModSecurity it is the equivalent OWASP CRS body rules
Certificate or TLS errors such as `SSL certificate verification failed` or `Self-signed certificate detected`, when the curl test succeeds| Claude Code’s runtime isn’t trusting the same certificate authority that `curl` uses. Common behind corporate TLS-inspection proxies| Set `NODE_EXTRA_CA_CERTS` to the CA bundle path; see [CA certificate store](</docs/en/network-config#ca-certificate-store>)
--- a/llm-gateway-rollout.md
+++ b/llm-gateway-rollout.md
@@ -183,7 +183,7 @@
"apiKeyHelper": "/usr/local/bin/get-gateway-key"
}
-Add the conditional variables from the table to the same `env` block. A managed `ANTHROPIC_BASE_URL` is enforced and cannot be overridden by a developer’s shell export, since Claude Code applies it over the process environment and lower-precedence settings. Do not include `forceLoginMethod` or `forceLoginOrgUUID` in managed settings alongside a gateway credential. On Claude Code v2.1.146 and later, either key, with any value, blocks `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `apiKeyHelper` at startup, so developers see `This machine's managed settings require a first-party login` and cannot proceed. [Server-managed settings](</docs/en/server-managed-settings#platform-availability>) delivery requires a direct connection to `api.anthropic.com`, so it does not reach gateway-routed sessions. Gateway deployments use this file-based managed settings path, which enforces the same keys. For the credential, distribute one [`apiKeyHelper`](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) command in the managed settings file as shown above; the command authenticates to your secrets store as the local developer, so each machine receives its own key. Alternatively, deliver each developer their key through your existing secrets process and have them set `ANTHROPIC_AUTH_TOKEN` themselves. Some environments need separate delivery:
+Add the conditional variables from the table to the same `env` block. A managed `ANTHROPIC_BASE_URL` is enforced and cannot be overridden by a developer’s shell export, since Claude Code applies it over the process environment and lower-precedence settings. Do not include `forceLoginMethod` or `forceLoginOrgUUID` in managed settings alongside a gateway credential. Either key, with any value, blocks `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `apiKeyHelper` at startup, so developers see `This machine's managed settings require a first-party login` and cannot proceed. [Server-managed settings](</docs/en/server-managed-settings#platform-availability>) delivery requires a direct connection to `api.anthropic.com`, so it does not reach gateway-routed sessions. Gateway deployments use this file-based managed settings path, which enforces the same keys. For the credential, distribute one [`apiKeyHelper`](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) command in the managed settings file as shown above; the command authenticates to your secrets store as the local developer, so each machine receives its own key. Alternatively, deliver each developer their key through your existing secrets process and have them set `ANTHROPIC_AUTH_TOKEN` themselves. Some environments need separate delivery:
* The desktop app reads gateway routing from its third-party inference configuration, not from managed settings; deploy that file through MDM alongside managed settings so desktop sessions route through the gateway too. See the [desktop third-party configuration docs](<https://claude.com/docs/third-party/claude-desktop/configuration>) and the [desktop gateway docs](<https://claude.com/docs/third-party/claude-desktop/gateway>)
* CI runners need `ANTHROPIC_BASE_URL` and the credential set in the [runner’s environment](</docs/en/llm-gateway-connect#configure-each-surface>)
--- a/mcp.md
+++ b/mcp.md
@@ -316,11 +316,7 @@
HTTP/SSE servers
-Use HTTP or SSE for cloud-hosted MCP servers and remote APIs:
-
- * In code
-
- * .mcp.json
+Use HTTP or SSE for cloud-hosted MCP servers and remote APIs. For the `.mcp.json` form, use the same fields as the example at HTTP headers for remote servers, with `"type": "sse"` for an SSE server. In code, pass the server’s URL:
TypeScript
@@ -351,18 +347,6 @@
},
allowed_tools=["mcp__remote-api__*"],
)
-
- {
- "mcpServers": {
- "remote-api": {
- "type": "sse",
- "url": "https://api.example.com/mcp/sse",
- "headers": {
- "Authorization": "Bearer ${API_TOKEN}"
- }
- }
- }
- }
For the streamable HTTP transport, use `"type": "http"` instead. In `.mcp.json` and other JSON config files, `"streamable-http"` is accepted as an alias for `"http"`. The programmatic `mcpServers` option accepts only `"http"`.
@@ -892,7 +876,7 @@
Tool output exceeds maximum allowed tokens
-The SDK applies the same MCP output limit as Claude Code. When a tool result is larger than 25,000 tokens, the full output is saved to a file and the tool result is replaced with an error message that names the file path, so the agent can read the output back in portions. Raise the limit with the [`MAX_MCP_OUTPUT_TOKENS`](</docs/en/env-vars>) environment variable. See [MCP output limits and warnings](</docs/en/mcp#mcp-output-limits-and-warnings>) for the full behavior, including how a server can declare a higher per-tool limit.
+The SDK applies the same MCP output limit as Claude Code. When a tool result is larger than 25,000 tokens, the full output is saved to a file and the tool result is replaced with an error message that names the file path, so the agent can read the output back in portions. Raise the limit with the [`MAX_MCP_OUTPUT_TOKENS`](</docs/en/env-vars>) environment variable. See [MCP output limits and warnings](</docs/en/mcp#mcp-output-limits-and-warnings>) for the full behavior, including how a server can declare a higher per-tool limit with the `anthropic/maxResultSizeChars` annotation.
##
@@ -902,7 +886,6 @@
* **[Custom tools guide](</docs/en/agent-sdk/custom-tools>)** : Build your own MCP server that runs in-process with your SDK application
* **[Permissions](</docs/en/agent-sdk/permissions>)** : Control which MCP tools your agent can use with `allowedTools` and `disallowedTools`
- * **[MCP output limits and warnings](</docs/en/mcp#mcp-output-limits-and-warnings>)** : How the SDK handles tool results that exceed `MAX_MCP_OUTPUT_TOKENS`, including the persist-to-disk fallback and the `anthropic/maxResultSizeChars` per-tool annotation
* **[TypeScript SDK reference](</docs/en/agent-sdk/typescript>)** : Full API reference including MCP configuration options
* **[Python SDK reference](</docs/en/agent-sdk/python>)** : Full API reference including MCP configuration options
* **[MCP server directory](<https://github.com/modelcontextprotocol/servers>)** : Browse available MCP servers for databases, APIs, and more
--- a/memory.md
+++ b/memory.md
@@ -112,9 +112,7 @@
# Individual Preferences
- @~/.claude/my-project-instructions.md
-An import in a project-level memory file is external when its path resolves outside your working directory, like the home directory import above. The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files. If you decline, the imports stay disabled and the dialog doesn’t appear again.The dialog protects you from files other people commit to a shared project. Imports in user-scope memory files, such as `~/.claude/CLAUDE.md` and `~/.claude/rules/`, are files you wrote yourself, so they load without the dialog and carry the same trust as the rest of your personal configuration.
-
-For a more structured approach to organizing instructions, see `.claude/rules/`.
+An import in a project-level memory file is external when its path resolves outside your working directory, like the home directory import above. The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files. If you decline, the imports stay disabled and the dialog doesn’t appear again.Claude Code shows the dialog to protect you from files other people commit to a shared project. User-scope memory files, such as `~/.claude/CLAUDE.md` and `~/.claude/rules/`, are files you wrote yourself. Except in [Cowork](<https://claude.com/product/cowork>) sessions on your desktop, Claude Code loads their imports without the dialog and trusts them like the rest of your personal configuration.In Cowork sessions on your desktop, Claude Code skips any import in a user-scope file that resolves to a path outside the session’s working directory and loads the rest of the file. In those sessions it also skips a `~/.claude/CLAUDE.md` that is itself a symlink or hard link, and a symlinked `~/.claude/rules/` directory or rule file that points outside the working directory.
###
--- a/model-config.md
+++ b/model-config.md
@@ -78,7 +78,13 @@
* In the `/model` picker, you keep your current model.
* Mid-session, Claude Code continues the turn on your default model.
-After you choose to continue on Fable 5 using usage credits, Claude Code doesn’t show the prompt again. In [non-interactive mode](</docs/en/headless>) with the `-p` flag and through the Agent SDK, Claude Code never shows the consent prompt. When a Fable 5 request there would bill to usage credits, Claude Code bills it without asking.
+After you choose to continue on Fable 5 using usage credits, Claude Code doesn’t show the prompt again. In a session with [Remote Control](</docs/en/remote-control>) connected, a [background session](</docs/en/agent-view>), or an [agent team](</docs/en/agent-teams>) teammate’s session, nobody may be at the terminal, so Claude Code holds the mid-session consent prompt for the [`dialogExpiry`](</docs/en/settings#available-settings>) deadline, five minutes by default. If nobody has answered by the deadline, Claude Code ends the turn without sending the request and adds a notice to the transcript, which the Remote Control client also shows. Your model selection is unchanged, and Claude Code asks for consent again on your next message. What you can do while the prompt is waiting depends on the session:
+
+ * With Remote Control connected or in a teammate’s session, press any key at the terminal to cancel the deadline, and Claude Code waits for your answer.
+ * In a background session, answer before the deadline.
+ * If you send a new message from the remote client before anyone has typed at the terminal, Claude Code ends the turn the same way, and your new message starts the next turn. After someone types at the terminal, Claude Code keeps waiting for the answer and queues your new message behind it.
+
+In [non-interactive mode](</docs/en/headless>) with the `-p` flag and through the Agent SDK, Claude Code never shows the consent prompt. When a Fable 5 request there would bill to usage credits, Claude Code bills it without asking.
###
@@ -88,7 +94,7 @@
You can configure your model in several ways, listed in order of priority:
- 1. **During session** : use `/model <alias|name>` to switch immediately, or run `/model` with no argument to open the picker. The picker asks for confirmation when the conversation has prior output, since the next response re-reads the full history without cached context
+ 1. **During session** : use `/model <alias|name>` to switch immediately, or run `/model` with no argument to open the picker. See [when Claude Code asks you to confirm the switch](</docs/en/prompt-caching#switching-models>)
2. **At startup** : launch with `claude --model <alias|name>`
3. **Environment variable** : set `ANTHROPIC_MODEL=<alias|name>`
4. **Settings** : configure permanently in your settings file using the `model` field
--- a/output-styles.md
+++ b/output-styles.md
@@ -6,9 +6,10 @@
Built-in output styles
-Claude Code’s **Default** output style is the existing system prompt, designed to help you complete software engineering tasks efficiently. There are three additional built-in output styles:
+Claude Code’s **Default** output style is the existing system prompt, designed to help you complete software engineering tasks efficiently. There are four additional built-in output styles:
* **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This is stronger autonomous-execution guidance than [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) applies, and it works without changing your permission mode, so your permission mode still decides what runs without asking you.
+ * **Concise** : Claude leads with the result, skips preamble and narration, and keeps responses short by default, while doing the engineering work as thoroughly as in the Default style. When you ask for an explanation or more detail, Claude answers in full. Claude always keeps the complete content of error reports, security warnings, and confirmations for destructive actions. Requires Claude Code v2.1.237 or later.
* **Explanatory** : Provides educational “Insights” in between helping you complete software engineering tasks. Helps you understand implementation choices and codebase patterns.
* **Learning** : Collaborative, learn-by-doing mode where Claude will not only share “Insights” while coding, but also ask you to contribute small, strategic pieces of code yourself. Claude Code will add `TODO(human)` markers in your code for you to implement.
@@ -106,7 +107,7 @@
* All output styles trigger reminders for Claude to adhere to the output style instructions during the conversation.
* Custom output styles leave out Claude Code’s built-in software engineering instructions, such as how to scope changes, write comments, and verify work, unless `keep-coding-instructions` is set to `true`.
-Output styles apply to the main conversation only: a [subagent runs its own system prompt](</docs/en/sub-agents#what-loads-at-startup>), so styles don’t change how subagents respond. A [fork](</docs/en/sub-agents#fork-the-current-conversation>) is the exception, because it inherits the parent’s full system prompt. Token usage depends on the style. Adding instructions to the system prompt increases input tokens, though prompt caching reduces this cost after the first request in a session. The built-in Explanatory and Learning styles produce longer responses than Default by design, which increases output tokens. For custom styles, output token usage depends on what your instructions tell Claude to produce.
+Output styles apply to the main conversation only: a [subagent runs its own system prompt](</docs/en/sub-agents#what-loads-at-startup>), so styles don’t change how subagents respond. A [fork](</docs/en/sub-agents#fork-the-current-conversation>) is the exception, because it inherits the parent’s full system prompt. Token usage depends on the style. Adding instructions to the system prompt increases input tokens, though prompt caching reduces this cost after the first request in a session. The built-in Explanatory and Learning styles produce longer responses than Default by design, which increases output tokens, and the Concise style does the opposite by instructing Claude to keep responses short by default. For custom styles, output token usage depends on what your instructions tell Claude to produce.
##
--- a/permission-modes.md
+++ b/permission-modes.md
@@ -387,8 +387,9 @@
* Wildcarded interpreters like `Bash(python*)`
* Package-manager run commands
* `Agent` allow rules
-
-Narrow rules like `Bash(npm test)` carry over. Dropped rules are restored when you leave auto mode.The classifier sees user messages, tool calls, and your CLAUDE.md content. Tool results are stripped, so hostile content in a file or web page cannot manipulate it directly. A separate server-side probe scans incoming tool results and flags suspicious content before Claude reads it. For more on how these layers work together, see the [auto mode announcement](<https://claude.com/blog/auto-mode>) and the [engineering deep dive](<https://www.anthropic.com/engineering/claude-code-auto-mode>).
+ * [`Monitor`](</docs/en/tools-reference#monitor-tool>) allow rules, because Claude Code runs Monitor commands through the shell
+
+Narrow rules like `Bash(npm test)` stay in effect. Claude Code restores the dropped rules when you leave auto mode. Before v2.1.236, Claude Code left `Monitor` allow rules in effect in auto mode, so a rule that matched the whole tool approved Monitor commands without classifier review.Claude Code also runs `git status` itself before a command that would discard uncommitted work, such as `git reset --hard` or `rm -rf`, and shows the classifier whether staged, modified, or untracked work is present. Claude Code reports untracked files in that check even when the repository’s git configuration sets `status.showUntrackedFiles=no`.The classifier sees user messages, tool calls other than read-only lookups such as file reads and searches, and your CLAUDE.md content. Tool results are stripped, so hostile content in a file or web page can’t manipulate it directly. You can annotate a call’s result with a [PostToolUse hook’s `classifierContext` field](</docs/en/hooks#annotate-a-result-for-the-auto-mode-classifier>), which the classifier reads as application-provided context.A separate server-side probe scans incoming tool results and flags suspicious content before Claude reads it. For more on how these layers work together, see the [auto mode announcement](<https://claude.com/blog/auto-mode>) and the [engineering deep dive](<https://www.anthropic.com/engineering/claude-code-auto-mode>).
How auto mode handles subagents
--- a/plugin-hints.md
+++ b/plugin-hints.md
@@ -104,6 +104,7 @@
* **Once per plugin** : after the prompt is shown, Claude Code records the plugin and never prompts for it again, regardless of the user’s answer.
* **Once per session** : across all CLIs on the machine, at most one hint prompt appears per Claude Code session.
+ * **Main interactive session only** : Claude Code shows the prompt only in the terminal session the user is typing into. Claude Code never prompts for a command that a [subagent](</docs/en/sub-agents>) runs, and never prompts when the user runs Claude Code in [non-interactive mode](</docs/en/headless>) with the `-p` flag or through the [Agent SDK](</docs/en/agent-sdk/overview>). Claude Code still strips the hint line from the command output in all of these cases.
* **Telemetry opt-outs** : sessions where analytics are disabled never show hint prompts. This includes sessions with `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` set, and sessions on third-party providers such as Amazon Bedrock or Google Cloud’s Agent Platform where the [automatic telemetry opt-out](</docs/en/data-usage#default-behaviors-by-api-provider>) applies.
Selecting **Yes** installs the plugin to user scope. Selecting **No, and don’t show plugin installation hints again** disables all future hint prompts for the user.
--- a/plugin-marketplaces.md
+++ b/plugin-marketplaces.md
@@ -1206,7 +1206,11 @@
Validate a plugin or a directory without a manifest
-To find skill, agent, and command files whose frontmatter doesn’t parse, run `claude plugin validate` and name the directory that holds them. Claude Code doesn’t look outside the directory you name. Every run except one against a plugin that has a `plugin.json` requires Claude Code v2.1.233 or later. Pick the directory by what you want to check:
+To find skill, agent, and command files whose frontmatter doesn’t parse, run `claude plugin validate` and name the directory that holds them. Claude Code doesn’t look outside the directory you name. Every run except one against a plugin that has a `plugin.json` requires Claude Code v2.1.233 or later.
+
+##### Pick the directory to name
+
+Claude Code checks different files depending on which directory you name. Find what you want to check in the first column, and run that row’s command:
To check| Run| Claude Code checks
---|---|---
@@ -1216,16 +1220,36 @@
A project’s three directories at once| `claude plugin validate .claude`, or the project root when it has no `.claude-plugin/` manifest| `.claude/skills`, `.claude/agents`, and `.claude/commands`
Your user-level directories| `claude plugin validate ~/.claude`| `~/.claude/skills`, `~/.claude/agents`, and `~/.claude/commands`
-A plugin run also warns about a `CLAUDE.md` at the plugin root. For paths you set through the [component path fields](</docs/en/plugins-reference#component-path-fields>) in `plugin.json`, it checks that each path exists but doesn’t read the files there, and it doesn’t check a `SKILL.md` at the plugin root. To check a plugin whose skill is its root `SKILL.md`, run the command twice when the plugin sits in a directory named `skills`: name that `skills` directory to check the root `SKILL.md`, and name the plugin directory to check the rest. When the plugin sits under another name, such as `plugins/`, only the second run is available, and no run checks its root `SKILL.md`. Claude Code doesn’t follow symlinks inside the directory you name. What it does depends on where the link is:
+##### Check a plugin whose skill is its root `SKILL.md`
+
+When you run `claude plugin validate` against a plugin directory, Claude Code doesn’t check a `SKILL.md` at the plugin root. When the plugin sits in a directory named `skills`, run the command twice:
+
+ * Name that `skills` directory to check the plugin’s root `SKILL.md`.
+ * Name the plugin directory to check the rest.
+
+When the plugin sits under another name, such as `plugins/`, the `skills`-directory run isn’t available, and no run checks its root `SKILL.md`.
+
+##### Check files behind symlinks
+
+When you run `claude plugin validate`, Claude Code doesn’t follow symlinks inside the directory you name. What it does depends on where the link is:
* **A linked`skills`, `agents`, or `commands` directory under the plugin or `.claude` root**: Claude Code warns that nothing in it was read.
- * **A linked entry inside a`skills`, `agents`, or `commands` directory**: Claude Code skips it and warns, per directory, how many entries it skipped that a session would load. A plugin whose `skills` directory [links to a sibling plugin’s skills](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>) passes with warnings; to check the linked skills, name the sibling plugin’s directory. The same applies to a [symlinked skill entry](</docs/en/skills#where-skills-live>) in `~/.claude/skills` or `.claude/skills`, which a session does follow; to check it, name a directory called `skills` that holds the real folder.
+ * **A linked entry inside a`skills`, `agents`, or `commands` directory**: Claude Code skips it and warns, per directory, how many entries it skipped that a session would load.
* **The`skills`, `agents`, or `commands` directory you name is itself a symlink, or its parent `.claude` directory is**: Claude Code reports an error and checks nothing in it. Name the real directory instead.
+
+In two skills cases, the run passes with warnings. To check the linked files, run again and name a directory that holds them directly:
+
+ * **A plugin whose`skills` directory [links to a sibling plugin’s skills](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>)**: name the sibling plugin’s directory.
+ * **A[symlinked skill entry](</docs/en/skills#where-skills-live>) in `~/.claude/skills` or `.claude/skills`**: Claude Code follows the entry in a session. To check it, name a directory called `skills` that holds the real folder.
+
+##### Read the validation results
A clean run ends with `Validation passed`. `No manifest found in directory` means Claude Code found no `plugin.json` or `marketplace.json` there, and no skill, agent, or command file in the directories it probes under it. Name the `skills`, `agents`, or `commands` directory that holds your files instead. Two of the errors Claude Code reports from these runs, with the fix for each:
* `YAML frontmatter failed to parse: ...`: fix the YAML in the frontmatter block of the skill, agent, or command file. Until you do, a session reads no frontmatter fields from the file
* `Invalid JSON syntax: ...` on `hooks/hooks.json`: fix the JSON syntax. Until you do, a session loads the plugin without the hooks in that file. Claude Code reports this error only in a plugin run
+
+In a plugin run, Claude Code also warns about a `CLAUDE.md` at the plugin root. For paths you set through the [component path fields](</docs/en/plugins-reference#component-path-fields>) in `plugin.json`, Claude Code checks that each path exists but doesn’t read the files there.
###
--- a/prompt-caching.md
+++ b/prompt-caching.md
@@ -17,7 +17,7 @@
A change to the conversation layer leaves the system prompt and project context cached. A change to the system prompt invalidates everything, because all later content now sits behind a different prefix. The third column gives common triggers rather than an exhaustive list, and the sections below cover the full set, including content such as output style that is fixed at session start. The prefix-match rule explains most of the behaviors on this page. [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) and [skill loading](</docs/en/skills>), for example, append their instructions as conversation messages, so the cached prefix stays intact. Two settings aren’t part of the prompt text at all, so they don’t appear in the layer table, but both are part of the cache key:
* **Model** : each model has its own cache. Switching models recomputes the entire request even when the content is identical. See Switching models below.
- * **Effort level** : each effort level has its own cache for the same model. Changing it mid-session recomputes the entire request, and Claude Code asks you to confirm before applying the change. See Changing effort level below.
+ * **Effort level** : each effort level has its own cache for the same model. Changing effort mid-session recomputes the entire request. See Changing effort level below.
Pick your model and effort level at the top of a session, then save `/compact` for natural breaks between tasks. The fewer changes you make mid-task, the higher your cache hit rate.
@@ -59,7 +59,12 @@
Switching models
-Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable 5 and Opus 5 is also a model switch. When a safety classifier flags a request and the flagged category has a fallback model, Claude Code re-runs the request on that model and the session continues there.
+Each model has its own cache. Switching with [`/model`](</docs/en/model-config#setting-your-model>) means the next request reads the entire conversation history with no cache hits, even though the content is identical. When you run `/model` at the terminal, Claude Code asks you to confirm the switch only while the current cache hasn’t expired. Whether the cache has expired depends on how long it has been since Claude Code last sent a request in this conversation or Claude last responded:
+
+ * **Less than onecache TTL ago**: the cache is still warm.
+ * **One cache TTL or longer ago** : the cache has already expired, so Claude Code switches without asking.
+
+Before v2.1.238, Claude Code didn’t check the cache TTL and asked even after the cache had expired. The [`opusplan` model setting](</docs/en/model-config#opusplan-model-setting>) resolves to Opus during plan mode and Sonnet during execution, so each plan-mode toggle is a model switch and starts a fresh cache. [Automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on Fable 5 and Opus 5 is also a model switch. When a safety classifier flags a request and the flagged category has a fallback model, Claude Code re-runs the request on that model and the session continues there.
###
@@ -67,7 +72,7 @@
Changing effort level
-The cache is keyed by [effort level](</docs/en/model-config#adjust-effort-level>) as well as model, so switching with `/effort` means the next request reads the entire conversation history with no cache hits. Once a conversation has started, Claude Code shows a confirmation dialog before applying an effort change that would invalidate the cache. A change that resolves to the same level already in effect, such as setting the model’s default explicitly, skips the dialog and keeps the cache.
+The cache is keyed by [effort level](</docs/en/model-config#adjust-effort-level>) as well as model, so switching with `/effort` means the next request reads the entire conversation history with no cache hits. Changing effort follows the same confirmation as switching models. When a change resolves to the same level already in effect, such as setting the model’s default explicitly, Claude Code keeps the cache and applies the change without asking.
###
--- a/python.md
+++ b/python.md
@@ -912,7 +912,7 @@
`cwd`| `str | Path | None`| `None`| Current working directory
`cli_path`| `str | Path | None`| `None`| Custom path to the Claude Code CLI executable
`settings`| `str | None`| `None`| Path to settings file
-`add_dirs`| `list[str | Path]`| `[]`| Additional directories Claude can access
+`add_dirs`| `list[str | Path]`| `[]`| Additional directories Claude can access. The SDK passes each entry to Claude Code as `--add-dir`, so with the `project` setting source Claude Code also [loads the directory’s skills, commands, and subagents](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>)
`env`| `dict[str, str]`| `{}`| Environment variables merged on top of the inherited process environment. See [Environment variables](</docs/en/env-vars>) for variables the underlying CLI reads, and Handle slow or stalled API responses for timeout-related variables
`extra_args`| `dict[str, str | None]`| `{}`| Additional CLI arguments to pass directly to the CLI
`max_buffer_size`| `int | None`| `None`| Maximum bytes when buffering CLI stdout
@@ -3031,7 +3031,7 @@
* `TaskUpdate`
* `TaskList`
-On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code.
+On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in.
**Input:**
--- a/remote-control.md
+++ b/remote-control.md
@@ -1,4 +1,4 @@
-Remote Control is in research preview and available on all plans. On Team and Enterprise, it is off by default until an Owner enables the Remote Control toggle in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>).
+Remote Control is available on all plans. On Team and Enterprise, it is off by default until an Owner enables the Remote Control toggle in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>).
Remote Control connects [claude.ai/code](<https://claude.ai/code>) or the Claude app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) and [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>) to a Claude Code session running on your machine. Start a task at your desk, then pick it up from your phone on the couch or a browser on another computer. When you start a Remote Control session on your machine, Claude keeps running locally the entire time, so your code execution and filesystem access stay on your machine. With Remote Control you can:
@@ -19,7 +19,10 @@
* **Subscription** : available on Pro, Max, Team, and Enterprise plans. API keys are not supported. On Team and Enterprise, an Owner must first enable the Remote Control toggle in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>).
* **Authentication** : run `claude` and use `/login` to sign in through claude.ai if you haven’t already. Without an eligible login, `claude remote-control` exits with an error, while `claude --remote-control` still starts an interactive session and shows a Remote Control failure notification shortly after launch.
- * **API endpoint** : not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. As of v2.1.196, Remote Control is also disabled when [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) points at a host other than `api.anthropic.com`, such as an [LLM gateway](</docs/en/llm-gateway>) or proxy. Unset the variable to use Remote Control.
+ * **API endpoint** : not available in any of these configurations:
+ * You use Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry.
+ * You point [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) 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. Before v2.1.196, Claude Code allowed Remote Control with a custom `ANTHROPIC_BASE_URL`.
+ * You sign in through an enterprise [Claude apps gateway](</docs/en/claude-apps-gateway>).
* **Feature-flag evaluation** : [`DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, and `DISABLE_GROWTHBOOK`](</docs/en/env-vars>) each disable the feature-flag evaluation that Remote Control availability depends on. Unset the variable wherever it’s set, in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings#available-settings>), to use Remote Control.
* **Workspace trust** : run `claude` in your project directory at least once to accept the workspace trust dialog. The startup trust dialog never saves trust for your home directory, so start Remote Control from a project directory.
@@ -126,7 +129,7 @@
* **Scan the QR code** shown alongside the session URL to open it directly in the Claude app. With `claude remote-control`, press spacebar to toggle the QR code display.
* **Open[claude.ai/code](<https://claude.ai/code>) or the Claude app** and find the session by name in the session list. In the Claude mobile app, tap **Code** in the navigation to reach the session list. Remote Control sessions show a computer icon with a green status dot when online.
-When you connect, the device shows any subagents and workflows the session already has running in the background. The remote session title is chosen in this order:
+When you connect, the device shows any subagents and workflows the session already has running in the background. Stop one of them from the device, and Claude Code stops that task on your machine. The remote session title is chosen in this order:
1. The name you passed to `--name`, `--remote-control`, or `/remote-control`
2. The title you set with `/rename`
@@ -146,6 +149,8 @@
* **Compaction and`/clear`**: while Claude Code [compacts the conversation](</docs/en/context-window#what-survives-compaction>), connected devices show the progress and then where the conversation was compacted. When you run `/clear`, the conversation resets on connected devices too.
* **Switching conversations with`/resume`**: the connected device doesn’t receive the switched-to conversation’s title or earlier history, but new messages in both directions go to and from whichever conversation is open in your terminal. To work on the original conversation from the device again, run `/resume` in your terminal and switch back to it.
* **Messages from your other sessions** : with [cross-session messaging](</docs/en/cross-session-messaging>), the same connection carries messages between your own sessions on different machines and from your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions, through Anthropic servers like the rest of Remote Control traffic. [Message sessions on other machines](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) covers the delivery rules and [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) covers the inbound controls. Requires Claude Code v2.1.224 or later.
+ * **Prompts you send mid-turn** : when you send a prompt from a connected device before the current turn ends, Claude Code queues it and keeps it in the device’s transcript after that turn finishes.
+ * **Model** : when you pick a [model](</docs/en/model-config>) from a connected device, Claude Code runs the session on that model. The terminal’s `/model` picker, `/status`, and `/config` show that model. A pick from the device’s model control lasts for the current session only. `/model <name>` sent from the device also sets your default for new sessions, the same as typing it in the terminal.
* **Effort level** : when you set the [effort level](</docs/en/model-config#adjust-effort-level>) from a connected device, with `/effort` or the device’s effort control, Claude Code applies it to the session on your machine, and claude.ai/code shows the level the session is using. If you pinned a level with `CLAUDE_CODE_EFFORT_LEVEL`, the session keeps that level, and Claude Code refuses a different pick from the effort control. A level you pick from the effort control applies to the current session only and doesn’t change your saved default. Picking a level from the effort control requires Claude Code v2.1.234 or later on your machine.
* **Reconnecting after a connection failure** : run `/remote-control` to reconnect. If compaction rewrote the conversation or you switched conversations with `/resume` in the meantime, Claude Code archives the server session it was using instead of leaving it in the session list. You can still find it by [filtering for archived sessions](</docs/en/claude-code-on-the-web#archive-sessions>). Switching conversations while a device is still connected doesn’t archive the session.
@@ -308,12 +313,14 @@
Limitations
* **One remote session per interactive process** : outside of server mode, each Claude Code instance supports one remote session at a time. Use server mode to run multiple concurrent sessions from a single process.
- * **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session goes offline until you bring it back. To keep a session running on a remote machine after you disconnect from SSH, start it inside `tmux` or `screen`.
+ * **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session goes offline until you bring it back. Unless Claude is in the middle of a task, claude.ai and the Claude app show the session as offline within seconds after the process exits. To keep a session running on a remote machine after you disconnect from SSH, start it inside `tmux` or `screen`.
+ * **Crashed sessions in server mode** : if a session served by `claude remote-control` crashes, send it a message from a connected device. Claude Code serves it again. You don’t have to restart the server.
+ * **HTTP 403 refusals on a connected session** : once an interactive session is connected, Claude Code keeps retrying for up to three minutes when something between your machine and Anthropic’s servers answers with HTTP 403, as can happen after a VPN or network change. If the refusals last longer, Claude Code disconnects, and the reason names what refused: a network edge, or a proxy, VPN, or firewall on your own network.
* **Extended network outage** : if your machine is awake but can’t reach the network, what you do next depends on the mode:
* **Server mode** : Claude Code gives up after roughly 10 minutes and the `claude remote-control` process exits. Run `claude remote-control` again to start a new session.
* **Interactive session** : keep working locally. Claude Code retries for as long as the outage lasts and reconnects on its own when the network returns.
* **Presence heartbeats failing** : if an interactive session disconnects with `could not reach the Remote Control server for about 30 minutes`, run `/remote-control` to reconnect. Claude Code shows this message only when the session’s presence heartbeats have been failing while the rest of the connection stayed up; it re-registers the session for about 30 minutes before disconnecting.
- * **Forwarded dialogs expire** : Claude Code keeps permission prompts and `AskUserQuestion` questions open until you answer them. When Claude Code forwards another kind of dialog to the remote session, such as the model-choice prompt shown after a safety refusal, it waits five minutes by default, then closes the dialog and continues with the dialog’s no-action default. Set [`dialogExpiry`](</docs/en/settings#available-settings>) to adjust or disable the deadline. Requires Claude Code v2.1.224 or later. The approval dialog for a held cross-session message uses the same deadline. [The held-message expiry rules](</docs/en/cross-session-messaging#control-inbound-messages>) cover the cases where Claude Code keeps the dialog open past it.
+ * **Forwarded dialogs expire** : Claude Code keeps permission prompts and `AskUserQuestion` questions open until you answer them. When Claude Code forwards another kind of dialog to the remote session, such as the model-choice prompt shown after a safety refusal, it waits five minutes by default, then closes the dialog and continues with the dialog’s no-action default. The mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) follows the same deadline but isn’t forwarded: Claude Code shows it only in the terminal where the session runs, and if nobody has answered there by the deadline, it ends the turn without sending the request. Your model selection is unchanged, and Claude Code asks again on your next message. Set [`dialogExpiry`](</docs/en/settings#available-settings>) to adjust or disable the deadline. Requires Claude Code v2.1.224 or later. Claude Code applies the same deadline to the approval dialog for a held cross-session message. [The held-message expiry rules](</docs/en/cross-session-messaging#control-inbound-messages>) cover the cases where Claude Code keeps the dialog open past it.
* **Some commands are local-only** : commands that only run in the terminal interface, such as `/plugin` or `/resume`, work only from the local CLI, whether or not you pass an argument. The following work from mobile and web:
* Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits` (prints the billing URL instead of opening a browser), `/recap`, `/reload-plugins`
* `/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.
@@ -356,9 +363,9 @@
-”Remote Control is not yet enabled for your account”
-
-The Remote Control rollout has not reached your account, or your cached entitlements are out of date. If you recently changed plans, run `claude auth logout` then `claude auth login` to refresh them. Run `claude doctor` to see which individual eligibility check failed. Environment-variable conflicts, unreachable checks, and organization policy each produce their own message, so this error means the rollout gate itself. Before v2.1.154, a variable that disables feature-flag evaluation, such as `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, also produced this message; the “Remote Control requires feature-flag evaluation” entry below covers that configuration.
+”Remote Control isn’t enabled for this account”
+
+Claude Code checked Remote Control availability for the account you’re signed in with and the check came back off. The usual cause is cached entitlements that are out of date after a plan change. Run `claude auth logout` then `claude auth login` to refresh them, and update Claude Code if you’re on an old version. Run `claude doctor` to see which individual eligibility check failed. Environment-variable conflicts, unreachable checks, and your organization’s Remote Control setting each produce their own message, so this error means the account-level check itself. Before v2.1.239, this message read “Remote Control is not yet enabled for your account”. Before v2.1.154, a variable that disables feature-flag evaluation, such as `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, also produced this message; the “Remote Control requires feature-flag evaluation” entry below covers that configuration.
###
--- a/routines.md
+++ b/routines.md
@@ -22,7 +22,7 @@
Create a routine
-Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app, click **Routines** in the sidebar, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services.
+Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Routines** in the sidebar, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker and no approval prompts during a run. The session can run shell commands, use [skills](</docs/en/skills>) committed to the cloned repository, and call any connectors you include. What a routine can reach is determined by the repositories you select, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and they count against your account’s daily run allowance. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services.
###
--- a/sandboxing.md
+++ b/sandboxing.md
@@ -164,7 +164,8 @@
Example rules| Result
---|---
`"denyRead": ["~/"]` with `"allowRead": ["~/projects"]`| `~/projects` is readable and the rest of the home directory stays blocked. The narrower allow re-opens that part of the denied region
-`"allowRead": ["~/"]` with `"denyRead": ["~/.env"]`| `~/.env` stays blocked and the rest of the home directory is readable. An exact deny holds inside a wider allow, so a broad allow can’t silently re-expose a secret
+`"allowRead": ["~/"]` with `"denyRead": ["~/.env"]`| `~/.env` stays blocked and the rest of the home directory is readable. The deny holds inside a wider allow, so a broad allow can’t silently re-expose a secret
+`"allowRead": ["~/"]` with `"denyRead": ["~/**/.env"]`| Every `.env` under the home directory stays blocked and the rest is readable. A [wildcard deny](</docs/en/settings#sandbox-path-prefixes>) holds inside a wider allow the same way an exact path does
The example below blocks reading from the entire home directory while still allowing reads from the current project. Place it in your project’s `.claude/settings.json`, because the relative path `.` resolves to the project root only when the configuration lives in project settings:
@@ -446,7 +447,7 @@
Network access is controlled through a proxy server running outside the sandbox:
- * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval, or in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) sends the request to the classifier. When you’re prompted, choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules.
+ * **Domain restrictions** : Claude Code pre-allows no domains by default. The first time a command needs a new domain, Claude Code prompts for approval, or in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) sends the request to the classifier. If you choose Yes when prompted, Claude Code allows the host for the rest of the current session and doesn’t prompt again for later connections to the same host. If you choose “Yes, and don’t ask again”, Claude Code saves a `WebFetch(domain:...)` allow rule to your [local settings](</docs/en/permissions#permission-system>), so the host stays allowed in future sessions. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. Claude Code also pre-allows domains from `WebFetch` allow rules, as described in Permission rules.
* **Strict allowlist** : if you set [`strictAllowlist`](</docs/en/settings#sandbox-settings>) to `true` in user, managed, or CLI `--settings` settings, Claude Code denies sandboxed commands access to any host outside the allowlist instead of prompting. The allowlist is the same one the sandbox otherwise prompts against: `allowedDomains` plus domains from `WebFetch(domain:...)` allow rules, or only the managed settings entries when `allowManagedDomainsOnly` is set. Claude Code enforces this for sandboxed commands only; in-process tools such as `WebFetch` still follow their permission rules. Setting it in a repository’s `.claude/settings.json` or `.claude/settings.local.json` has no effect. Requires Claude Code v2.1.219 or later.
* **Managed lockdown** : if [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, non-allowed domains are blocked automatically instead of prompting, and only `allowedDomains` and `WebFetch(domain:...)` allow rules from managed settings are honored.
* **Corporate proxy** : when your network requires outbound traffic to go through a corporate proxy, set `HTTPS_PROXY`, `HTTP_PROXY`, and `NO_PROXY` as [proxy configuration](</docs/en/network-config#proxy-configuration>) describes, in the `env` block of your settings so that [background agents](</docs/en/network-config#set-network-variables-in-settings-not-the-shell>) get them too, or in the environment you launch Claude Code from. Claude Code enforces the domain allowlist and then tunnels allowed connections through that upstream proxy.
@@ -461,7 +462,7 @@
IPv6 addresses in domain lists
-The sandbox’s domain lists are `allowedDomains`, `deniedDomains`, and the `WebFetch(domain:...)` rules that feed them. To match an IPv6 address in any of them, write the literal in brackets: `"[::1]"` matches that address on every port, and `"[::1]:443"` matches it on port 443 only. Write the port as a number from 1 to 65535 with no leading zeros. The bracketed form requires Claude Code v2.1.229 or later. Before v2.1.229, when the text after an unbracketed entry’s last colon was a port number, Claude Code read it as one, so `::1:443` named the address `::1` on port 443. An unbracketed entry with two or more colons is ambiguous: `::1:443` is both a complete IPv6 address and an address followed by a port. Claude Code enforces ambiguous spellings conservatively instead of guessing which reading you meant:
+The sandbox’s domain lists are `allowedDomains`, `deniedDomains`, and the `WebFetch(domain:...)` rules that feed them. To match an IPv6 address in any of them, write the literal in brackets: `"[::1]"` matches that address on every port, and `"[::1]:443"` matches it on port 443 only. Write the port as a number from 1 to 65535 with no leading zeros. The bracketed form requires Claude Code v2.1.229 or later. Before v2.1.229, when the text after an unbracketed entry’s last colon was a port number, Claude Code read it as one, so `::1:443` named the address `::1` on port 443. When you choose “Yes, and don’t ask again” at the network approval prompt for an IPv6 address, Claude Code saves the `WebFetch(domain:...)` rule with the address bracketed, so the rule keeps matching the address in future sessions. An unbracketed entry with two or more colons is ambiguous: `::1:443` is both a complete IPv6 address and an address followed by a port. Claude Code enforces ambiguous spellings conservatively instead of guessing which reading you meant:
* **Deny lists** : Claude Code denies every reading the entry parses as, so whichever reading you meant is blocked. For an entry with no parseable reading, Claude Code blocks nothing.
* **Allow lists** : Claude Code never allows more than you wrote. It rewrites an ambiguous entry to its host-and-port reading when that reading parses cleanly, and may drop the entry entirely rather than widen the allowlist.
--- a/security-guidance.md
+++ b/security-guidance.md
@@ -6,7 +6,6 @@
Prerequisites
- * Claude Code CLI version 2.1.144 or later
* Python 3.7 or later on your `PATH`. The agentic commit review needs Python 3.10 or later, as do all model-backed reviews when Claude Code uses a third-party provider such as Amazon Bedrock or Google Cloud’s Agent Platform. The plugin prefers the versioned interpreters `python3.13` through `python3.10`, then falls back to `python3`, `python`, and `py -3`
* A git repository for the directory you work in. The end-of-turn and commit reviews diff against git state and skip silently outside a repository. The per-edit pattern check works anywhere
--- a/self-hosted-environments.md
+++ b/self-hosted-environments.md
@@ -83,18 +83,20 @@
3. The child streams events back over HTTPS while the runner keeps polling; each poll refreshes the lease and doubles as the heartbeat.
4. If the runner stops polling for about 60 seconds, the server requeues the session for another runner.
+The runner gives each poll request 10 seconds. When a request times out or is lost, the runner retries after a second or two instead of waiting for the next scheduled poll. Each further request that times out or is lost doubles the gap before the next retry, up to 20 seconds, and the runner shortens the gap whenever the lease is close to expiring.
+
###
Runner lifecycle
-The first session a runner picks up locks the runner to the account of the user who started that session, and the runner runs up to `--capacity` concurrent sessions for that account. While the runner has active sessions, the runner keeps claiming the locked account’s queued work. What happens once they finish depends on [`--drain-grace-sec`](</docs/en/self-hosted-environments-reference#runner-cli-flags>):
+The first session a runner picks up locks the runner to the account of the user who started that session, and the runner runs up to `--capacity` concurrent sessions for that account. While the runner has active sessions and hasn’t received a shutdown signal or reached its retire time, the runner keeps claiming the locked account’s queued work. What happens once they finish depends on [`--drain-grace-sec`](</docs/en/self-hosted-environments-reference#runner-cli-flags>):
* **At the default of`0`**: the runner exits as soon as its active sessions finish, without polling for more, so the orchestrator you deploy it under, such as Kubernetes, can restart it with a fresh disk, ready to serve any account.
* **At a positive value** : the runner keeps polling the locked account’s queue for that many seconds before exiting.
-This lifecycle isolates each user’s checked-out code without requiring the runner to delete disk state between users. A kill that delivers `SIGTERM` needs no flag: the runner drains as [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) describes. If your infrastructure instead destroys hosts at a known wall-clock time without a signal, or with a grace period too short to drain, such as a sandbox lifetime cap or spot-instance reclamation, pass `--retire-at <epoch-seconds>` set to a few minutes before that time. At the retire time:
+This lifecycle isolates each user’s checked-out code without requiring the runner to delete disk state between users. How your infrastructure stops a runner decides whether you need `--retire-at`. A kill that delivers `SIGTERM` needs no flag: the runner drains as [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) describes, or keeps serving the sessions it already holds when you set [`--defer-shutdown-max-min`](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>). If your infrastructure instead destroys hosts at a known wall-clock time without a signal, or with a grace period too short to drain, such as a sandbox lifetime cap or spot-instance reclamation, pass `--retire-at <epoch-seconds>` set to a few minutes before that time. At the retire time:
1. The runner stops taking new work.
2. The runner releases each active session through the same release path the [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) flag uses, so the session resumes on a fresh runner when the user sends their next message. When the runner releases each session depends on its state:
@@ -117,7 +119,7 @@
* **Git** : the runner clones from and pushes to your git host over HTTPS or SSH, authenticated with credentials your deployment provides; [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>) covers the options, including per-session minted credentials and the [Anthropic git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), which routes git through `api.anthropic.com` instead.
* **Session child** : the child Claude Code process holds the session’s event stream to `api.anthropic.com`, and makes its own outbound calls for model inference and for git commands run during the session. See [Network requirements](</docs/en/self-hosted-environments-deploy#network-requirements>) for the full egress list. The diagram above shows these paths, apart from the optional SCM connector.
-Model inference uses the Anthropic API. The control plane delivers the API endpoint to each session, and the session authenticates with an Anthropic-issued, session-scoped OAuth token, so inference can’t be routed through [Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry](</docs/en/third-party-integrations>), or an [LLM gateway](</docs/en/llm-gateway>) in self-hosted environments. Corporate egress proxies are supported. The runner and the optional [autoscaling orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>) honor the proxy and mTLS environment variables described in [Network configuration](</docs/en/network-config>), such as `HTTPS_PROXY` and `NO_PROXY`; set them in each process’s environment. The variables cover control-plane calls, the orchestrator’s [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) WebSocket, and the built-in clone for HTTPS remotes, and sessions inherit them from the runner. Session streaming uses server-sent events over HTTPS, so a proxy in the path must not buffer responses.
+Model inference uses the Anthropic API. The control plane delivers the API endpoint to each session, and the session authenticates with an Anthropic-issued, session-scoped OAuth token, so inference can’t be routed through [Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry](</docs/en/third-party-integrations>), or an [LLM gateway](</docs/en/llm-gateway>) in self-hosted environments. Corporate egress proxies are supported. The runner and the optional [autoscaling orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>) honor the proxy and mTLS environment variables described in [Network configuration](</docs/en/network-config>), such as `HTTPS_PROXY` and `NO_PROXY`; set them in each process’s environment. The variables cover control-plane calls, the orchestrator’s [SCM connector](</docs/en/self-hosted-environments-reference#scm-connector-flags>) WebSocket, and the built-in clone for HTTPS remotes, and sessions inherit them from the runner. Session streaming uses server-sent events over HTTPS, so a proxy in the path must not buffer responses. If your proxy also requires a `Proxy-Authorization` header, the runner can add it to each connection it opens to the proxy; see [Authenticate to an egress proxy](</docs/en/self-hosted-environments-deploy#authenticate-to-an-egress-proxy>).
##
--- a/self-hosted-environments-configuration.md
+++ b/self-hosted-environments-configuration.md
@@ -124,7 +124,7 @@
* `completed`: a clean exit, including a session archived or deleted while the child was still connected.
* `failed`: a child crash or a setup failure after spawn.
- * `interrupted`: an idle release, startup timeout, server deassign, drain, watchdog kill, or the [`released=false` backstop](</docs/en/self-hosted-environments-reference#session-lifecycle-counter-semantics>).
+ * `interrupted`: an idle release, startup timeout, server deassign, drain, or watchdog kill.
* `abandoned`: reserved for sessions another runner claimed; the hook doesn’t currently fire in that case.
The [session lifecycle counter semantics](</docs/en/self-hosted-environments-reference#session-lifecycle-counter-semantics>) classify an idle release, a startup timeout, and a server deassign as `completed` instead: those are clean handoffs from the session’s perspective even though this hook reports them as `interrupted`. The hook’s exit status never affects the session outcome; a failure is logged and ignored. The runner waits up to `--post-session-hook-timeout-sec`, 60 seconds by default, on every session end including runner shutdown. This example saves uncommitted work to a rescue branch:
@@ -149,6 +149,19 @@
done
The hook pushes with whatever git credentials are available in its own environment on the runner host. Under the [no-credentials-in-the-image posture](</docs/en/self-hosted-environments-deploy#configure-git>), including when the built-in clone goes through the Anthropic git proxy, there are none, so mint a short-lived push credential inside the hook before pushing: exchange the session token the hook receives in `CLAUDE_CODE_SESSION_ACCESS_TOKEN` with your own token service, verifying it as [Verify session identity](</docs/en/self-hosted-environments-identity>) describes. When the hook holds a credential the session didn’t, also pin where it pushes: replace `origin` with an operator-supplied URL and pass `-c credential.helper=` plus your own helper, so repo-local config the session wrote can’t redirect the credentialed push.
+
+####
+
+
+
+Hook timing when the runner releases a session
+
+A released session can resume on another runner. On a runner on v2.1.236 or later, what the session was doing at release decides whether it can resume before this hook finishes:
+
+ * **Idle after a turn, or timed out at startup** : the runner stops the child and runs this hook to completion. Only then does it release the session. A user message sent while the hook runs can’t resume the session on another runner before the hook finishes.
+ * **Waiting for the user to answer a prompt, such as a permission prompt** : the runner releases the session first, then runs this hook. A user message sent while the hook runs can resume the session on another runner before the hook finishes.
+
+A release at the [`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) time follows the same two paths. During a `SIGTERM` drain, the runner holds the session lease until the hook finishes; see [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>). Before v2.1.236, the runner released the session first and then ran this hook on both paths.
###
Show diff (120 lines)
--- a/self-hosted-environments-deploy.md
+++ b/self-hosted-environments-deploy.md
@@ -65,6 +65,51 @@
Default-deny egress
Deploy runner and session containers in a network segment or namespace whose outbound traffic is limited to the hosts in the network requirements table, your git host, and the specific internal services sessions need to reach. The product can’t verify or enforce this, so apply it at your own network boundary on every environment. Session code is model-directed and can attempt connections to arbitrary hosts; default-deny egress at the network layer bounds where those attempts can land. This applies regardless of permission mode: the default pre-approved tool set already includes `Bash`, so shell egress runs without a prompt even without [auto mode](</docs/en/self-hosted-environments-configuration#permissions-and-tool-approval>). For details on which telemetry each session emits and how to turn it off, see [Telemetry](</docs/en/self-hosted-environments-reference#telemetry>).
+
+###
+
+
+
+Authenticate to an egress proxy
+
+Some corporate egress proxies require a `Proxy-Authorization` header on every connection. The token in that header often rotates too fast to write into the proxy URL you set in `HTTPS_PROXY`. Set `HTTPS_PROXY` or `HTTP_PROXY` to your proxy’s URL as usual, then set `--proxy-authorization-command` or `--proxy-authorization-file` to tell the runner where to read the header value from. Both flags require Claude Code v2.1.238 or later.
+
+####
+
+
+
+Choose where the `Proxy-Authorization` value comes from
+
+Pick the flag that matches how you produce the `Proxy-Authorization` token:
+
+ * **[`--proxy-authorization-command<command>`](</docs/en/self-hosted-environments-reference#runner-cli-flags>)**: choose this for a token you generate on demand. The runner runs the shell command and uses its trimmed stdout as the header value, for example `Bearer <token>`.
+ * **[`--proxy-authorization-file<path>`](</docs/en/self-hosted-environments-reference#runner-cli-flags>)**: choose this for a token another process rotates in place. The runner reads the file and uses its trimmed contents as the header value.
+
+####
+
+
+
+Configurations the runner refuses to start with
+
+Each flag also has an environment variable form, listed beside it in the [runner CLI flags reference](</docs/en/self-hosted-environments-reference#runner-cli-flags>). Before the runner contacts your proxy or the control plane, it checks the flags and their variables, and refuses to start in three cases:
+
+ * **Both flags set** : one flag plus the other flag’s environment variable counts as setting both.
+ * **No proxy URL** : neither `HTTPS_PROXY` nor `HTTP_PROXY` holds an `http://` or `https://` URL. The runner reads both variables in upper or lower case, and doesn’t consult `ALL_PROXY`.
+ * **Either flag passed to the orchestrator subcommand** : `self-hosted-runner orchestrator` doesn’t accept the flags or their environment variables. Pass the flag to each runner the orchestrator starts instead.
+
+####
+
+
+
+What the runner changes while a proxy-authorization flag is set
+
+With either flag set, the runner starts a listener of its own and sends proxy traffic from itself, its lifecycle hooks, and its sessions through that listener. The listener adds the `Proxy-Authorization` header on the way to your proxy.
+
+ * **Listener** : the listener is a forward proxy on `127.0.0.1`. The runner starts the listener before registering with the control plane, and exits at startup if the listener can’t start.
+ * **Proxy variables** : the runner rewrites whichever of `HTTPS_PROXY` and `HTTP_PROXY` you set so that it points at the listener. That rewritten value reaches the runner itself, its lifecycle hooks, and every session it runs.
+ * **Token rotation** : a rotated token takes effect without a restart. For each connection the listener opens to your proxy, the runner runs your command or reads your file again and adds the result as the header.
+ * **Session environment** : a session reaches your proxy only through the listener. In each session’s environment the runner removes `ALL_PROXY`, removes any spelling of `HTTPS_PROXY` or `HTTP_PROXY` that you didn’t set, and pins `NO_PROXY` to the runner’s own value.
+ * **Logs** : the runner never logs the header value.
##
@@ -262,10 +307,41 @@
Shutdown timing
-On `SIGTERM`, the runner stops taking new work, waits up to `--drain-wait-sec`, zero by default, for in-flight turns to finish, terminates each child process, and runs the [`post-session` lifecycle hook](</docs/en/self-hosted-environments-configuration#post-session>). The full drain path needs up to `--session-stop-grace-sec` \+ `--drain-wait-sec` \+ `--post-session-hook-timeout-sec`, plus 15 seconds of fixed overhead for process cleanup, plus 30 more seconds when [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) is set. That is 80 seconds at defaults, and the runner logs the total at startup. Sessions drain in parallel under this one budget, so the total doesn’t grow with `--capacity`. At the default `--drain-wait-sec 0`, a rolling restart interrupts in-flight turns; each session resumes on another runner, losing unpushed work as described under Known issues. Set `--drain-wait-sec`, and raise the grace period to match, to let turns finish first. Throughout that whole path, the runner keeps heartbeating to the control plane at zero capacity, so the session lease doesn’t expire and get requeued to another runner while the `post-session` hook is still writing out uncommitted work. The heartbeat stops just before the runner deregisters. Give the runner at least the total it logs at startup before the host stops it. Where you set that depends on how your hosts stop:
+On `SIGTERM`, the runner stops taking new work and, unless you set `--defer-shutdown-max-min`, waits up to `--drain-wait-sec`, zero by default, for in-flight turns to finish, terminates each child process, and runs the [`post-session` lifecycle hook](</docs/en/self-hosted-environments-configuration#post-session>). The full drain path needs up to `--session-stop-grace-sec` \+ `--drain-wait-sec` \+ `--post-session-hook-timeout-sec`, plus 15 seconds of fixed overhead for process cleanup, plus 30 more seconds when [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) is set. That is 80 seconds at defaults, and the runner logs the total at startup. Sessions drain in parallel under this one budget, so the total doesn’t grow with `--capacity`. At the default `--drain-wait-sec 0`, a rolling restart interrupts in-flight turns; each session resumes on another runner, losing unpushed work as described under Known issues. Set `--drain-wait-sec`, and raise the grace period to match, to let turns finish first. Throughout that whole path, the runner keeps heartbeating to the control plane at zero capacity, so the session lease doesn’t expire and get requeued to another runner while the `post-session` hook is still writing out uncommitted work. The heartbeat stops just before the runner deregisters. Give the runner at least the total it logs at startup before the host stops it. Where you set that depends on how your hosts stop:
* **With a`SIGTERM` grace period**: set `terminationGracePeriodSeconds` on Kubernetes, `stop_grace_period` on Docker Compose, or your orchestrator’s equivalent to at least that total. The Kubernetes default of 30 seconds is shorter than the runner’s drain path, so Kubernetes stops the pod before the runner finishes draining.
* **With[`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>)**: size the margin between the retire time and the host’s stop time to cover typical turns, plus the background-task hold that [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>) describes, plus that same total. Compute the retire time at each launch, for example `date +%s` plus the runner’s intended lifetime.
+ * **With`--defer-shutdown-max-min`**: add two more parts to the drain-path total. The first is the minutes you configure. The second is the post-release grace that Defer the drain past the first signal describes, 75 seconds at defaults. With the flag set, the runner also prints the combined figure at startup, after the drain-path total.
+
+###
+
+
+
+Defer the drain past the first signal
+
+Set [`--defer-shutdown-max-min <n>`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) if you want a runner you’re restarting to go on serving the sessions it holds for up to `n` minutes, instead of draining them on the first signal. On the first `SIGTERM` or `SIGINT`, the runner stops taking new work and goes on serving the sessions it holds. It keeps polling so that the control plane doesn’t requeue those sessions. Requires Claude Code v2.1.238 or later.
+
+####
+
+
+
+What happens to the sessions the runner holds after the first signal
+
+In the first two stages that follow the signal, the runner releases sessions, and a released session resumes on a fresh runner when its user sends their next message. Counting from the first signal, the runner moves through three stages:
+
+ * **For the first`n` minutes**: the runner serves its sessions normally and keeps enforcing `--startup-timeout-min` and `--kill-session-after-min`. If you also set [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), the runner releases any session whose user has been idle that long; without it, the runner releases no session early, apart from a startup timeout.
+ * **When the`n` minutes run out**: the runner releases every session it still holds, idle or not. The runner waits for a mid-turn session’s turn to end, and up to 60 seconds more for a turn’s background tasks, before releasing that session.
+ * **When the post-release grace runs out** : the runner drains whatever sessions it still holds, and the control plane requeues each drained session to another runner right away. The post-release grace starts when the `n` minutes run out and is 75 seconds at defaults. If you set `--drain-wait-sec` above 60 seconds, the post-release grace is `--drain-wait-sec` plus 15 seconds instead.
+
+At any stage, the runner exits 0 as soon as it holds no sessions. A second signal cuts the stages short: the runner drains immediately, as it does on the first signal without `--defer-shutdown-max-min`. Once a drain is under way, the next signal force-exits the runner. That holds whether a second signal or the post-release grace running out started the drain.
+
+####
+
+
+
+Size the stop timeout
+
+Give your host’s stop timeout at least the sum of three parts: the `n` minutes you configure, the post-release grace, and the full drain path that Shutdown timing describes. With default settings the post-release grace is 75 seconds and the drain path is 80 seconds, so allow `n` minutes plus 155 seconds. The runner prints this sum at startup whenever `--defer-shutdown-max-min` is set. If the stop timeout runs out before the runner finishes, the host kills the runner. The sessions it still holds get no `post-session` hook. The runner doesn’t deregister, and the control plane requeues the sessions about a minute later. If you can’t give the stop timeout that sum, leave `--defer-shutdown-max-min` unset so the runner drains on the first signal instead.
###
@@ -275,12 +351,12 @@
The `post-session` hook and the Claude session child each run in their own POSIX process group, separate from the runner’s, so stop mechanisms reach them differently:
- * **A second`SIGTERM` to the runner**: force-exits the runner immediately, skipping whatever remains of the drain path. Nothing signals a mid-run `post-session` hook, so on a bare host where an init process adopts orphans, it finishes on its own, but unsupervised: its timeout budget no longer applies, and a write to the closed log pipe can kill it with `SIGPIPE`, so a hook that needs to survive a forced exit there should redirect its own output to a file. In the container recipes on this page the runner is the container’s PID 1 and its exit ends the container, and under systemd’s default `KillMode=control-group` the cgroup kill in the third bullet applies; in both, treat a forced exit as fatal to the hook and rely on the grace period instead.
+ * **A`SIGTERM` while the runner is already draining**: force-exits the runner immediately, skipping whatever remains of the drain path. Without `--defer-shutdown-max-min`, that is the second `SIGTERM` the runner receives. Nothing signals a mid-run `post-session` hook, so on a bare host where an init process adopts orphans, it finishes on its own, but unsupervised: its timeout budget no longer applies, and a write to the closed log pipe can kill it with `SIGPIPE`, so a hook that needs to survive a forced exit there should redirect its own output to a file. In the container recipes on this page the runner is the container’s PID 1 and its exit ends the container, and under systemd’s default `KillMode=control-group` the cgroup-wide kill reaches the hook too, as the **Cgroup-wide kills** entry describes; in both, treat a forced exit as fatal to the hook and rely on the grace period instead.
* **Process-group-wide signals** , such as `kill -- -<pid>` in a wrapper script, shell job control, or a group-wide watchdog: reach the runner and a mid-`checkout`-hook subprocess, which stays group-attached deliberately, but not a mid-run `post-session` hook or the session child.
* **Cgroup-wide kills** , such as systemd’s default `KillMode=control-group` or the `SIGKILL` Kubernetes delivers to the whole container when `terminationGracePeriodSeconds` expires: reach everything, including the hook. Process-group isolation doesn’t protect against these, which is why the grace period must cover the full drain path.
* **The hook’s own timeout** : when a hook exceeds `--post-session-hook-timeout-sec`, the runner sends `SIGTERM` to the hook’s whole process group, then `SIGKILL` two seconds later, so a worker the hook forked, such as tar, rsync, or git, terminates with the wrapper shell instead of surviving as an orphan. The runner’s supervision ends once the hook’s stdio closes: a worker that redirected its own output to a file and outlives the `SIGTERM` stage is past the runner’s reach.
-On the first `SIGTERM`, and again on a forced exit, the runner logs how many `post-session` hooks are still running, so you can tell a quiet drain from one that’s mid-snapshot.
+When the drain starts, and again on a forced exit, the runner logs how many `post-session` hooks are still running, so you can tell a quiet drain from one that’s mid-snapshot.
##
@@ -390,6 +466,7 @@
* **Runner exits at startup with`cannot create or write to base directory`**: the runner can’t create or write to `--base-dir`, which defaults to `/workspace`. Fix the directory’s ownership or point `--base-dir` at a writable path, as described in Keep the base directory and capacity identical across runners. If the runner instead logs `[runner:fatal]` saying the base directory check timed out, the directory is on a hung NFS or CSI mount. Check mount health rather than permissions. The runner prints both of these startup failures to stderr before it opens `--log-file`, so look for them in the terminal or your platform’s container logs rather than the log file. Before v2.1.225, the runner didn’t check the base directory at startup, and this misconfiguration failed sessions after pickup instead.
* **Sessions stay queued** : every online runner may be locked to a different account. Check each runner’s `claude_code_self_hosted_runner_locked_account` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) or its `Picked up session` log lines to see which account holds it. Add replicas, or wait for an existing runner to drain and restart. If the environment uses on-demand runners, check the orchestrator instead; see [On-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>).
* **Sessions fail immediately after pickup** : open the session in claude.ai/code to see the error. The most common causes are missing git credentials in the runner image and build tools that aren’t installed. An unwritable base directory stops the runner at startup instead of failing sessions. See the **Runner exits at startup with`cannot create or write to base directory`** entry in this list.
+ * **Sessions can’t reach the network through an authenticating egress proxy** : when the source you set with `--proxy-authorization-command` or `--proxy-authorization-file` fails, times out after 30 seconds, or yields an empty value, the runner answers that connection `502 Bad Gateway` and logs why. The runner redacts the command’s stderr in that log and never logs the header value. With `--proxy-authorization-command`, run the command yourself on the host to confirm it prints the whole header value on stdout. If the runner instead exits at startup with `could not start the proxy-authorization listener`, it couldn’t open its loopback listener.
* **A session’s branch no longer exists on the remote** : for a git source the session only reads from, the runner skips that source and continues on the remaining ones. For the source the session pushes results to, a deleted branch, typically because it was merged and auto-deleted, fails the session with an error naming the repository and branch and asking you to restore the branch and retry. The runner fails the session with the same error when skipping would leave it with no repository at all. Before v2.1.228, such a session started in an empty directory.
* **Sessions take minutes to start** : the initial clone usually dominates. Watch the `claude_code_self_hosted_runner_session_init_duration_seconds` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) to confirm, and cut the clone with a pre-warmed checkout or a smaller `CLAUDE_RUNNER_FETCH_DEPTH`.
* **Pod is killed mid-drain** : raise `terminationGracePeriodSeconds` to at least the value the runner logs at startup. See Shutdown timing.
--- a/self-hosted-environments-reference.md
+++ b/self-hosted-environments-reference.md
@@ -18,8 +18,9 @@
`--configure-git`| `SELF_HOSTED_RUNNER_CONFIGURE_GIT=1`| off| Write global git identity and enable Anthropic commit signing at startup. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>).
`--confine-repo-settings <mode>`| `SELF_HOSTED_RUNNER_CONFINE_REPO_SETTINGS`| `warn`| Sets the mode of the guard that flags a session when a repository’s committed settings try to grant write or read access outside that session’s own workspace, set environment variables, or override the operator’s sandbox or hooks posture, such as `sandbox.enabled: false` or `disableAllHooks`. The default `warn` logs the violation and still starts the session, `enforce` refuses the session, and `off` disables the scan. See [Harden your deployment](</docs/en/self-hosted-environments-deploy#harden-your-deployment>).
`--debug-token-dir <path>`| `SELF_HOSTED_RUNNER_DEBUG_TOKEN_DIR`| unset| Write live tokens to disk for inspection. Debug only; don’t use in production.
-`--drain-grace-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_GRACE_MS`| `0`| Controls when the runner exits after its active sessions finish: `0` exits immediately without polling for more, and a positive value keeps the runner alive and re-polling the locked account’s queue for that many seconds first, at the cost of the per-session container isolation described in the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>)
-`--drain-wait-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_WAIT_MS`| `0`| On `SIGTERM`, wait up to N seconds for each session’s in-flight turn and background tasks to finish before terminating the child. During this wait, the runner counts a background task that has just finished as still running until the follow-up turn that reads its result starts, for at most the `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS` window.
+`--defer-shutdown-max-min <n>`| `SELF_HOSTED_RUNNER_DEFER_SHUTDOWN_MAX_MS`| `0`| On the first `SIGTERM` or `SIGINT`, keep serving the sessions already attached instead of draining them, then release whatever is still attached N minutes later and exit. Raise your host’s stop timeout before you set this. See [Defer the drain past the first signal](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>). `0` disables. Requires Claude Code v2.1.238 or later.
+`--drain-grace-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_GRACE_MS`| `0`| Until the runner receives a shutdown signal or reaches its retire time, controls when the runner exits after its active sessions finish: `0` exits immediately without polling for more, and a positive value keeps the runner alive and re-polling the locked account’s queue for that many seconds first, at the cost of the per-session container isolation described in the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>). After a first signal you deferred with [`--defer-shutdown-max-min`](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>), the runner exits as soon as it holds no sessions, whatever you set here.
+`--drain-wait-sec <n>`| `SELF_HOSTED_RUNNER_DRAIN_WAIT_MS`| `0`| Once the drain starts, which is on `SIGTERM` unless you set [`--defer-shutdown-max-min`](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>), wait up to N seconds for each session’s in-flight turn and background tasks to finish before terminating the child. During this wait, the runner counts a background task that has just finished as still running until the follow-up turn that reads its result starts, for at most the `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS` window.
`--environment-secret-file <path>`| `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET`| required| Path to a file containing the environment secret, or, for runners spawned by the [orchestrator](</docs/en/self-hosted-environments-configuration#on-demand-runners>), the single-use work-order JWT. `SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET` carries the secret value directly, not a file path. The older `--pool-secret-file` flag and `SELF_HOSTED_RUNNER_POOL_SECRET` variable still work and print a deprecation notice to stderr; preview-program runner builds older than 2.1.216 only recognize those older names.
`--exec-path <path>`| `SELF_HOSTED_RUNNER_EXEC_PATH`| own binary| Binary or wrapper script to spawn for each session. See [Wrapper scripts](</docs/en/self-hosted-environments-configuration#wrapper-scripts>).
`--exit-if-unused-min <n>`| `SELF_HOSTED_RUNNER_IDLE_SHUTDOWN_MS`| `0`| Exit after N minutes of polling with no work ever assigned, for autoscaler scale-down. `0` disables.
@@ -32,8 +33,10 @@
`--log-file <path>`| `SELF_HOSTED_RUNNER_LOG_FILE`| unset| Mirror runner logs to a file in addition to stdout and stderr, created with `0600` permissions. Required for `self-hosted-runner doctor` to tail logs locally.
`--log-level <level>`| none| `info`| `info` or `debug`
`--post-session-hook-timeout-sec <n>`| `SELF_HOSTED_RUNNER_POST_SESSION_HOOK_TIMEOUT_MS`| `60`| Budget for the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) on every session end, including runner shutdown
+`--proxy-authorization-command <command>`| `SELF_HOSTED_RUNNER_PROXY_AUTHORIZATION_COMMAND`| unset| Shell command the runner runs for every connection to your egress proxy, using its trimmed stdout as the `Proxy-Authorization` header value. Requires `HTTPS_PROXY` or `HTTP_PROXY`, and can’t be combined with `--proxy-authorization-file`. See [Authenticate to an egress proxy](</docs/en/self-hosted-environments-deploy#authenticate-to-an-egress-proxy>). Requires Claude Code v2.1.238 or later.
+`--proxy-authorization-file <path>`| `SELF_HOSTED_RUNNER_PROXY_AUTHORIZATION_FILE`| unset| File the runner reads for every connection to your egress proxy, using its trimmed contents as the `Proxy-Authorization` header value. Use this flag for a token another process rotates in place. Carries the same requirements as `--proxy-authorization-command`, and can’t be combined with it. See [Authenticate to an egress proxy](</docs/en/self-hosted-environments-deploy#authenticate-to-an-egress-proxy>). Requires Claude Code v2.1.238 or later.
`--push-outcome-on-release`| `SELF_HOSTED_RUNNER_PUSH_OUTCOME_ON_RELEASE`| off| On a runner-initiated session end such as a drain or idle release, push tracked outcome branches to `origin` before deleting the workspace, so in-flight commits survive a restart. Best-effort; adds 30 seconds to the shutdown budget, and requires git 2.29 or newer to resume from the pushed branch. Restrict push access to `claude/*` refs before enabling; see [Resumed sessions lose unpushed work](</docs/en/self-hosted-environments-deploy#additional-limitations>). Repositories checked out via a `checkout` lifecycle hook aren’t pushed; snapshot those from the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) instead.
-`--release-idle-session-min <n>`| `SELF_HOSTED_RUNNER_SESSION_IDLE_MS`| `0`| Release a session slot after N minutes of inactivity once a turn finishes or the session waits for the user’s action. A session that’s still mid-turn, including one holding a never-finishing background task or an approval requested from inside a running tool call, doesn’t count as idle; pair with `--kill-session-after-min` as the hard backstop. After a session’s background task finishes, the runner considers the session busy until the follow-up turn that reads the result starts, for at most the `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS` window. A release that leaves the runner with no active sessions starts the same exit path as a normal drain, governed by `--drain-grace-sec`. `0` disables.
+`--release-idle-session-min <n>`| `SELF_HOSTED_RUNNER_SESSION_IDLE_MS`| `0`| Release a session slot after N minutes of inactivity once a turn finishes or the session waits for the user’s action. A session that’s still mid-turn, including one holding a never-finishing background task or an approval requested from inside a running tool call, doesn’t count as idle; pair with `--kill-session-after-min` as the hard backstop. After a session’s background task finishes, the runner considers the session busy until the follow-up turn that reads the result starts, for at most the `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS` window. Until the runner receives a shutdown signal or reaches its retire time, a release that leaves the runner with no active sessions starts the same exit path as a normal drain, governed by `--drain-grace-sec`. After a first signal you deferred with [`--defer-shutdown-max-min`](</docs/en/self-hosted-environments-deploy#defer-the-drain-past-the-first-signal>), the runner exits as soon as a release leaves it holding no sessions. `0` disables.
`--retire-at <epoch-seconds>`| `SELF_HOSTED_RUNNER_RETIRE_AT`| unset| Retire the runner at an absolute Unix timestamp in seconds, for infrastructure that kills the runner at a known time; [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>) describes the release sequence and how to size the margin. Values before 2001 or after the year 5138 are rejected by the flag and ignored by the environment variable.
`--session-stop-grace-sec <n>`| `SELF_HOSTED_RUNNER_SESSION_STOP_GRACE_MS`| `5`| How long to wait for the Claude process to exit cleanly after a session ends, before force-killing it. Raise the value if the child’s own `SessionEnd` hooks need more time.
`--startup-timeout-min <n>`| `SELF_HOSTED_RUNNER_STARTUP_TIMEOUT_MS`| `15`| Release a session slot if the child hasn’t signaled that it initialized within N minutes of spawn. Cleared by the child’s init signal on the [activity channel](</docs/en/self-hosted-environments-configuration#keep-stdin-and-file-descriptor-3-attached>), not by ordinary output, after which `--release-idle-session-min` takes over. `0` disables.
@@ -294,7 +297,7 @@
* `completed`: the session ended cleanly. This covers the child exiting on its own with code `0`, the session being archived or deleted while the child was still connected, and the runner releasing the slot as a clean handoff: an idle release, a startup timeout, or a server-side deassign the poll loop noticed before the child exited. Increments `sessions_completed_total`.
* `failed`: the child exited on its own with a non-zero code, either a crash or a setup failure after spawn. Increments `sessions_failed_total`.
- * `interrupted`: the runner terminated the child for an operational reason that’s neither a session success nor a runner fault, such as a drain, for example a Kubernetes rolling restart sending `SIGTERM`, the max-lifetime watchdog `--kill-session-after-min`, or the `released=false` backstop: the runner terminates the child after the control plane declines three consecutive idle-release requests, each because a user message was still waiting to be processed. Increments `sessions_interrupted_total`.
+ * `interrupted`: the runner terminated the child for an operational reason that’s neither a session success nor a runner fault, such as a drain or the max-lifetime watchdog `--kill-session-after-min`. A Kubernetes rolling restart sending `SIGTERM` is one example of a drain. Increments `sessions_interrupted_total`.
The [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>)’s `CLAUDE_RUNNER_EXIT_REASON` doesn’t use this classification for clean handoffs. The hook reports an idle release, a startup timeout, and a server deassign as `interrupted`, since from the hook’s perspective the runner killed the child, while the counters above record those same events as `completed`, since nothing went wrong and the slot was handed back cleanly. If you reconcile hook receipts against `sessions_completed_total` directly, you undercount completions. Use the hook for per-session guarantees and the counters for aggregate rates. On a one-shot environment, `--capacity 1` with the default `--drain-grace-sec 0`, each runner process exits moments after its one session ends. `sessions_completed_total`, `sessions_failed_total`, and `sessions_interrupted_total` increment only at session end, right before that exit, so a Prometheus scrape every 15 to 60 seconds rarely catches the increment before the runner’s series disappears; these three end-of-session counters are the terminal counters the rest of this section refers to. `sessions_started_total` increments at spawn and stays visible for the life of the session, so it reliably shows up, but on a one-shot environment it reads closer to “sessions currently running” than a cumulative count. Use the series in this table for the corresponding goal instead of the terminal counters:
--- a/server-managed-settings.md
+++ b/server-managed-settings.md
@@ -136,7 +136,7 @@
Settings precedence
-Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments, apart from the [exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>). Within the managed tier, a configured [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) preempts every other managed source, including server-managed settings: its output becomes the only managed configuration for the run. Otherwise, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Apart from the exception keys covered next, sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch. Run `/status` to see which managed source is active.
+Server-managed settings and [endpoint-managed settings](</docs/en/settings#settings-files>) both occupy the highest tier in the Claude Code [settings hierarchy](</docs/en/settings#settings-precedence>). No other settings level can override them, including command line arguments, apart from the [exceptions to managed settings precedence](</docs/en/settings#exceptions-to-managed-settings-precedence>). Within the managed tier, Claude Code uses the first source that delivers a non-empty configuration. Server-managed settings are checked first, then endpoint-managed settings. Apart from the exception keys covered next, sources don’t merge: if server-managed settings deliver any keys at all, other endpoint-managed settings are ignored. If server-managed settings deliver nothing, endpoint-managed settings apply. If the winning source is an MDM or file-based source that configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output replaces it as the only managed configuration for the run. A `policyHelper` configured in MDM or file-based settings is not consulted while server-managed settings deliver a non-empty configuration. If you clear your server-managed configuration in the admin console with the intent of falling back to an endpoint-managed plist or registry policy, be aware that cached settings persist on client machines until the next successful fetch. Run `/status` to see which managed source is active.
###
@@ -146,7 +146,7 @@
Two kinds of keys are exceptions to the no-merge rule:
- * **Cross-source lock keys** : a small set of keys, such as the sandbox allowlist locks, [listed in the settings reference](</docs/en/settings#precedence-within-the-managed-tier>). They are honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output is the only source these checks read.
+ * **Cross-source lock keys** : a small set of keys, such as the sandbox allowlist locks, [listed in the settings reference](</docs/en/settings#precedence-within-the-managed-tier>). They are honored when any admin-controlled managed source sets them; the user-writable HKCU registry tier is excluded, and when an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output is the only source these checks read.
* **The`env` block**: apart from the telemetry unit and routing variables paired with a credential key, both covered below, it merges per key across the admin-controlled sources. For each environment variable, the highest-priority source defining it wins, and lower admin sources fill in variables the higher sources leave unset. An endpoint-managed `env` entry therefore applies whenever the server-managed configuration leaves that variable unset, or while a cached server value for it is withheld pending server confirmation. Requires Claude Code v2.1.223 or later. Before v2.1.223, Claude Code applies the winning source’s whole `env` block only.
* **Telemetry unit** : the `OTEL_EXPORTER_OTLP_*` exporter keys, the `OTEL_LOG_*` content-capture toggles, `OTEL_LOGS_EXPORTER`, and the beta tracing variables `ENABLE_BETA_TRACING_DETAILED` and `BETA_TRACING_ENDPOINT` follow the highest source that sets any of them as a unit. A source that delivers the `otelHeadersHelper` credential key claims the unit too, but lands these variables only when it is the winning source: a non-winning source that delivers the key contributes none of them and still blocks lower sources from filling them in. Either way, an exporter endpoint from one source can never pair with credentials from another.
* **Credential-paired routing** : a source that pairs routing variables with a winner-only credential key, such as `apiKeyHelper` or `otelHeadersHelper`, contributes those routing variables only when it wins the slot.
@@ -205,7 +205,7 @@
"forceRemoteSettingsRefresh": true
}
-You can also set this key in an [endpoint-managed](</docs/en/settings#settings-files>) MDM profile or system `managed-settings.json` file to enforce fail-closed behavior on first launch, before any server payload has been delivered. As of v2.1.191, this flag is an exception to the precedence rule above: it is honored when set in any admin-controlled managed source even if a cached server-managed payload is also present, so an MDM-delivered value is not ignored when server-managed settings exist. When a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured, its output replaces every other managed source, this key included. The settings fetch also sends a `Cache-Control: no-cache` header so intermediate HTTP proxies don’t serve a stale response. Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code. The `claude auth` subcommands such as `claude auth login` are exempt from this check, so users can re-authenticate when expired credentials are the reason the settings fetch fails.
+You can also set this key in an [endpoint-managed](</docs/en/settings#settings-files>) MDM profile or system `managed-settings.json` file to enforce fail-closed behavior on first launch, before any server payload has been delivered. As of v2.1.191, this flag is an exception to the precedence rule above: it is honored when set in any admin-controlled managed source even if a cached server-managed payload is also present, so an MDM-delivered value is not ignored when server-managed settings exist. When an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>), the helper’s output replaces every other managed source, this key included. The settings fetch also sends a `Cache-Control: no-cache` header so intermediate HTTP proxies don’t serve a stale response. Before enabling this setting, ensure your network policies allow connectivity to `api.anthropic.com`. If that endpoint is unreachable, the CLI exits at startup and users cannot start Claude Code. The `claude auth` subcommands such as `claude auth login` are exempt from this check, so users can re-authenticate when expired credentials are the reason the settings fetch fails.
###
@@ -239,7 +239,7 @@
* If you sign out and back in, or switch to another organization and later return, Claude Code doesn’t show the dialog again while those settings are unchanged, unless another account approved them for that organization in the same configuration directory in between.
* If you sign in to the same organization with a different account, Claude Code shows the dialog again even when the settings are unchanged. That account’s approval replaces the previous one, so when you switch back, Claude Code shows the dialog once more.
-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.
+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. If an error closes the dialog before you answer, Claude Code doesn’t apply the delivered settings and keeps the last-approved settings; Claude Code shows the dialog again in the next session that can show it.
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.
--- a/session-storage.md
+++ b/session-storage.md
@@ -78,7 +78,7 @@
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. Because `projectKey` encodes the working directory, resume or continue from the store from a working directory matching the original run’s. In TypeScript, if you set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) beside `CLAUDE_CONFIG_DIR` in a query’s [`env` option](</docs/en/agent-sdk/typescript#options>), the SDK keys that query’s entries, and its `resume` and `continue` lookups, by that name instead. Requires Agent SDK v0.3.234 or later. 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.
+`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. Because `projectKey` encodes the working directory, resume or continue from the store from a working directory matching the original run’s. In TypeScript, if you set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) beside `CLAUDE_CONFIG_DIR` in a query’s [`env` option](</docs/en/agent-sdk/typescript#options>), the SDK keys that query’s entries, and its `resume` and `continue` lookups, by that name instead. Because standalone helpers such as `listSessions` and `deleteSession` take no `env` and read the process environment, set `CLAUDE_CONFIG_DIR` and the same name in the host process environment too. Requires Agent SDK v0.3.234 or later. 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
---|---|---
--- a/sessions.md
+++ b/sessions.md
@@ -267,7 +267,7 @@
You should see a response that builds on the earlier analysis instead of starting fresh. That confirms the agent resumed the session with its prior context intact.
-Claude Code stores sessions under `~/.claude/projects/<encoded-cwd>/*.jsonl`. If you set the `CLAUDE_CONFIG_DIR` environment variable, look under `$CLAUDE_CONFIG_DIR/projects/` instead.To find your session’s directory, replace every non-alphanumeric character in the absolute working directory with `-`: `/Users/me/proj` becomes `-Users-me-proj`. For a working directory whose converted name exceeds 200 characters, Claude Code [truncates the name and appends a hash](</docs/en/sessions#where-transcripts-are-stored>), so match the first 200 characters of the converted name when you list `projects/`.If you set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) beside `CLAUDE_CONFIG_DIR`, look under that name in `projects/` instead. Requires TypeScript Agent SDK v0.3.234 or later.You can resume from any working directory:
+Claude Code stores sessions under `~/.claude/projects/<encoded-cwd>/*.jsonl`. If you set the `CLAUDE_CONFIG_DIR` environment variable, look under `$CLAUDE_CONFIG_DIR/projects/` instead.To find your session’s directory, replace every non-alphanumeric character in the absolute working directory with `-`: `/Users/me/proj` becomes `-Users-me-proj`. For a working directory whose converted name exceeds 200 characters, Claude Code [truncates the name and appends a hash](</docs/en/sessions#where-transcripts-are-stored>), so match the first 200 characters of the converted name when you list `projects/`.If you set [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>) beside `CLAUDE_CONFIG_DIR`, look under that name in `projects/` instead. Requires TypeScript Agent SDK v0.3.234 or later, or Python Agent SDK v0.2.140 or later.You can resume from any working directory:
* **Cross-directory lookup** : Claude Code searches beyond the current project directory to find the ID; see [Resume a session](</docs/en/sessions#resume-a-session>) for the exact lookup order and how duplicate copies are handled.
* **Same machine only** : the session file still needs to exist on the current machine.
--- a/settings.md
+++ b/settings.md
@@ -290,6 +290,7 @@
`includeGitInstructions`| **Default** : `true`. Include built-in commit and PR workflow instructions and the git status snapshot in Claude’s system prompt. Set to `false` to remove both, for example when using your own git workflow skills. The `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS` environment variable takes precedence over this setting when set| `false`
`inputNeededNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, send a push notification to your phone when a permission prompt or question is waiting for your input. Appears in `/config` as **Push when actions required**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>)| `true`
`isolatePeerMachines`| Require your explicit approval before Claude’s `SendMessage` reaches one of your sessions beyond this machine; see [cross-session messaging](</docs/en/cross-session-messaging#require-approval-for-cross-machine-messages>). The approval prompt appears even in [`bypassPermissions` mode](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>). A `true` from any settings scope applies, so a checked-in project file can turn the requirement on but not off. The cross-machine `SendMessage` approval requires Claude Code v2.1.224 or later| `true`
+`keybindingFlavor`| **Default** : `"classic"`. Set to `"readline"` to make `Ctrl+W` delete back to the previous whitespace, as Bash does, instead of only the previous word. See [Make Ctrl+W delete back to whitespace](</docs/en/interactive-mode#make-ctrl-w-delete-back-to-whitespace>). Requires Claude Code v2.1.238 or later| `"readline"`
`language`| Configure Claude’s preferred response language (e.g., `"japanese"`, `"spanish"`, `"french"`). Claude will respond in this language by default. Also sets the language for [voice dictation](</docs/en/voice-dictation#change-the-dictation-language>) and auto-generated session titles. As of v2.1.176, when not set, session titles match the language of your conversation| `"japanese"`
`minimumVersion`| Floor that prevents background auto-updates and `claude update` from installing a version below this one. Switching from the `"latest"` channel to `"stable"` via `/config` prompts you to stay on the current version or allow the downgrade. Choosing to stay sets this value. Also useful in [managed settings](</docs/en/permissions#managed-settings>) to pin an organization-wide minimum. For a hard floor that blocks startup entirely, see `requiredMinimumVersion`| `"2.1.100"`
`model`| Override the default model to use for Claude Code. `--model` and [`ANTHROPIC_MODEL`](</docs/en/model-config#environment-variables>) override this for one session| `"claude-sonnet-5"`
@@ -433,7 +434,7 @@
`filesystem.allowWrite`| Additional paths where sandboxed commands can write. Arrays are merged across all settings scopes: user, project, and managed paths are combined, not replaced. Also merged with paths from `Edit(...)` allow permission rules. See path prefixes below.| `["/tmp/build", "~/.kube"]`
`filesystem.denyWrite`| Paths where sandboxed commands cannot write. Arrays are merged across all settings scopes. Also merged with paths from `Edit(...)` deny permission rules.| `["/etc", "/usr/local/bin"]`
`filesystem.denyRead`| Paths where sandboxed commands cannot read. Arrays are merged across all settings scopes. Also merged with paths from `Read(...)` deny permission rules.| `["~/.aws/credentials"]`
-`filesystem.allowRead`| Paths to re-allow reading within `denyRead` regions. An `allowRead` path re-opens reading inside a broader `denyRead` region, and an exact path in `denyRead` stays blocked inside a broader `allowRead`; see the [overlap table](</docs/en/sandboxing#configure-sandboxing>) for examples. Arrays are merged across all settings scopes. Use this to create workspace-only read access patterns.| `["."]`
+`filesystem.allowRead`| Paths to re-allow reading within `denyRead` regions. An `allowRead` path re-opens reading inside a broader `denyRead` region. Claude Code keeps an exact or wildcard `denyRead` entry blocked inside a broader `allowRead`, as the [overlap table](</docs/en/sandboxing#configure-sandboxing>) shows. Arrays are merged across all settings scopes. Use this to create workspace-only read access patterns.| `["."]`
`filesystem.allowManagedReadPathsOnly`| (Managed settings only) Only `filesystem.allowRead` paths from managed settings are respected. `denyRead` still merges from all sources. Default: false| `true`
`filesystem.disabled`| Skip filesystem isolation while keeping network isolation: sandboxed commands get unrestricted read and write access to the host filesystem, and network egress stays confined to `network.allowedDomains`. Only honored from user, managed, or CLI `--settings` settings. Default: false. Requires Claude Code v2.1.216 or later. See [Disable filesystem isolation](</docs/en/sandboxing#disable-filesystem-isolation>) for which sources can set it and what changes when isolation is off| `true`
`credentials.files`| Credential files or directories to [protect from sandboxed commands](</docs/en/sandboxing#protect-credentials>). Each entry has a `path` and a `mode`. `deny` blocks reads inside the sandbox, the same read block as `filesystem.denyRead`, and requires Claude Code v2.1.187 or later. `mask` shows sandboxed commands a sentinel copy of the file on Linux and WSL2, while the sandbox proxy substitutes the real value on outbound requests to that entry’s `injectHosts`; on macOS the file is unreadable inside the sandbox instead. It requires `network.tlsTerminate` and Claude Code v2.1.221 or later. [Mask credential files](</docs/en/sandboxing#mask-credential-files>) covers which settings sources are honored and when an entry falls back to `deny`. Paths use the same prefixes as `filesystem.*` settings. Arrays are merged across all settings scopes.| `[{ "path": "~/.aws/credentials", "mode": "deny" }]`
@@ -489,7 +490,7 @@
* **`allowWrite` and `denyWrite`**: on macOS, wildcards work. On Linux and WSL2, the sandbox mounts concrete paths, so Claude Code skips an entry that contains `*`, `?`, or `[` once the trailing `/**` is removed, and that entry has no effect. Claude Code adds the paths from your `Edit` permission rules to these lists, so the same limit applies to them, and the **Config** tab of `/sandbox` lists the `Edit` rules Claude Code skipped.
* **`denyRead` and `allowRead`**: wildcards work on every platform. On Linux and WSL2, Claude Code expands a read entry to the concrete paths it matches, which it doesn’t do for the write lists.
-This syntax differs from [Read and Edit permission rules](</docs/en/permissions#read-and-edit>), which use `//path` for absolute and `/path` for project-relative. Sandbox filesystem paths use standard conventions: `/tmp/build` is an absolute path. **Configuration example:**
+Claude Code blocks reads of the paths a wildcard `denyRead` entry such as `~/**/.env` matches, even inside a broader `allowRead` entry. When the wildcard matches a directory, Claude Code blocks reads of its contents as well. Before v2.1.236 on macOS, Claude Code re-opened the paths a wildcard `denyRead` entry matched wherever a broader `allowRead` entry covered them. On those macOS versions, Claude Code also left a matched directory’s contents readable. This syntax differs from [Read and Edit permission rules](</docs/en/permissions#read-and-edit>), which use `//path` for absolute and `/path` for project-relative. Sandbox filesystem paths use standard conventions: `/tmp/build` is an absolute path. **Configuration example:**
{
"sandbox": {
@@ -668,7 +669,7 @@
"appendSystemPrompt": "Always cite the internal style guide."
}
-When the helper emits `managedSettings`, that object becomes the only managed settings source for the run: Claude Code ignores remote, MDM, and file-based sources, reads the cross-source keys from the helper’s output alone, and never merges parent settings. A helper that exits 0 without emitting `managedSettings` contributes no managed settings, and the other sources apply as usual. When the helper exits non-zero at startup, Claude Code prints the error and refuses to start, so a helper that needs outage resilience should serve from its own cache and exit `0`.
+Claude Code reads `policyHelper` only from the source that wins precedence within the managed tier, so a helper configured in MDM or a managed settings file does not run while server-managed settings deliver a non-empty configuration. When the helper runs and emits `managedSettings`, that object becomes the only managed settings source for the run: Claude Code ignores the MDM and file-based sources, reads the cross-source keys from the helper’s output alone, and never merges parent settings. A helper that exits 0 without emitting `managedSettings` contributes no managed settings, and the other sources apply as usual. When the helper exits non-zero at startup, Claude Code prints the error and refuses to start, so a helper that needs outage resilience should serve from its own cache and exit `0`.
###
@@ -721,7 +722,7 @@
Precedence within the managed tier
-A `policyHelper` can replace every source in this list; that section says when. Otherwise, apart from the cross-source keys listed after the ranking, Claude Code uses the first of these sources that delivers a non-empty configuration and ignores the rest rather than merging them:
+Apart from the cross-source keys listed after the ranking, Claude Code uses the first of these sources that delivers a non-empty configuration and ignores the rest rather than merging them. When that winning source is an MDM policy or managed settings file that configures a `policyHelper`, the helper’s output then replaces it; that section says how. Claude Code checks the sources in this order:
1. Remote settings, delivered from claude.ai as [server-managed settings](</docs/en/server-managed-settings>) or by a [Claude apps gateway](</docs/en/claude-apps-gateway>)
2. MDM or OS-level policies
--- a/skills.md
+++ b/skills.md
@@ -17,7 +17,7 @@
Unlike subagents, which you can define in the [`agents` option](</docs/en/agent-sdk/subagents#programmatic-definition-recommended>), you create skills as files on disk. The SDK doesn’t provide a programmatic API for registering them.
-Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. If you set `settingSources` explicitly, include `'user'` or `'project'` to keep skill discovery, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
+Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. The project source also covers `<dir>/.claude/skills/` in each directory you pass through `additionalDirectories` (TypeScript) or `add_dirs` (Python), because the SDK passes those directories to Claude Code as [`--add-dir`](</docs/en/skills#skills-from-additional-directories>). If you set `settingSources` explicitly, include `'project'` to keep project and added-directory skills and `'user'` to keep your personal skills, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
##
--- a/sub-agents.md
+++ b/sub-agents.md
@@ -259,7 +259,11 @@
* **A`name` but no `description`**: Claude Code skips the file and writes the reason to the debug log.
* **YAML that doesn’t parse** : Claude Code reads no fields from the file, skips it, and writes the parse error to the debug log.
-To see the debug log, run Claude Code with `--debug`. A [plugin subagent](</docs/en/plugins-reference#agents>) whose frontmatter has no `name` or doesn’t parse still loads, under its filename. To find files in an `agents` directory whose frontmatter doesn’t parse, run `claude plugin validate` against the directory, for example `.claude/agents` or `~/.claude/agents`. Claude Code checks only [the directory you name](</docs/en/plugin-marketplaces#validate-a-plugin-or-a-directory-without-a-manifest>), and doesn’t flag a file whose frontmatter parses but has no `name`. Requires Claude Code v2.1.233 or later.
+To see the debug log, run Claude Code with `--debug`. A [plugin subagent](</docs/en/plugins-reference#agents>) whose frontmatter has no `name` or doesn’t parse still loads, under its filename.
+
+##### Check an `agents` directory before a session
+
+To find files in an `agents` directory whose frontmatter doesn’t parse, run `claude plugin validate` against the directory, for example `.claude/agents` or `~/.claude/agents`. Claude Code checks only [the directory you name](</docs/en/plugin-marketplaces#validate-a-plugin-or-a-directory-without-a-manifest>), and doesn’t flag a file whose frontmatter parses but has no `name`. Requires Claude Code v2.1.233 or later.
###
@@ -366,14 +370,14 @@
Scope MCP servers to a subagent
-Use the `mcpServers` field to give a subagent access to [MCP](</docs/en/mcp>) servers that aren’t available in the main conversation. Inline servers defined here are connected when the subagent starts and disconnected when it finishes. String references share the parent session’s connection.
+Use the `mcpServers` field to give a subagent access to [MCP](</docs/en/mcp>) servers that aren’t available in the main conversation. Inline servers defined here are connected when the subagent starts, subject to the trust rule for the agent file’s folder, and disconnected when it finishes. String references share the parent session’s connection.
The `mcpServers` field applies in both contexts where an agent file can run:
* As a subagent, spawned through the Agent tool or an @-mention
* As the main session, launched with `--agent` or the `agent` setting
-When the agent is the main session, inline server definitions connect at startup alongside servers from [`.mcp.json`](</docs/en/mcp>) and settings files. In `/mcp`, a remote (HTTP or SSE) server you’ve used before can show the [`cached` status](</docs/en/mcp#managing-your-servers>) instead; Claude Code connects it when Claude first calls one of its tools.
+When the agent is the main session, inline server definitions connect at startup alongside servers from [`.mcp.json`](</docs/en/mcp>) and settings files, under the same trust rule for the agent file’s folder. In `/mcp`, a remote (HTTP or SSE) server you’ve used before can show the [`cached` status](</docs/en/mcp#managing-your-servers>) instead; Claude Code connects it when Claude first calls one of its tools.
Each entry in the list is either an inline server definition or a string referencing an MCP server already configured in your session:
@@ -392,7 +396,18 @@
Use the Playwright tools to navigate, screenshot, and interact with pages.
-Inline definitions use the same schema as `.mcp.json` server entries, keyed by the server name, and support the `stdio`, `http`, `sse`, and `ws` types. To keep an MCP server out of the main conversation entirely and avoid its tool descriptions consuming context there, define it inline here rather than in `.mcp.json`. The subagent gets the tools; the parent conversation doesn’t. As of v2.1.153, the MCP restrictions that apply to the main session also cover servers declared in subagent frontmatter:
+Inline definitions use the same schema as `.mcp.json` server entries, keyed by the server name, and support the `stdio`, `http`, `sse`, and `ws` types. To keep an MCP server out of the main conversation entirely and avoid its tool descriptions consuming context there, define it inline here rather than in `.mcp.json`. The subagent gets the tools; the parent conversation doesn’t. Claude Code loads an inline server from an agent file in your project’s `.claude/agents/` directory, or in an `--add-dir` directory’s `.claude/agents/`, only after you [trust the folder the agent file came from](</docs/en/permissions#what-runs-before-you-trust-a-folder>). Before v2.1.238, Claude Code loaded these servers without checking trust.
+
+ * **Trust that doesn’t count** : a parent folder’s trust, and the automatic trust a `-p` or SDK session gets for [hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>)
+ * **Until then** : Claude Code skips every inline server in that agent file and writes the exact `projects["<path>"].hasTrustDialogAccepted` key for `~/.claude.json` to the debug log
+ * **`--add-dir` directories**: a directory outside your trusted workspace’s repository needs its own trust entry, since its `.claude/agents/` files don’t inherit your workspace’s trust
+
+Claude Code loads two kinds of server without checking trust for the folder the agent file came from:
+
+ * A name that references a server you already configured
+ * An inline server in an agent file from `~/.claude/agents/`, in one you pass with `--agents` or the SDK `agents` option, or in one that managed settings supplies
+
+As of v2.1.153, the MCP restrictions that apply to the main session also cover servers declared in subagent frontmatter:
* [`--strict-mcp-config`](</docs/en/cli-reference>) and [`--bare`](</docs/en/cli-reference>)
* [Enterprise managed MCP configuration](</docs/en/managed-mcp>)
--- a/subagents.md
+++ b/subagents.md
@@ -20,37 +20,12 @@
Benefits of using subagents
-###
-
-
-
-Context isolation
-
-Each subagent runs in its own fresh conversation. Intermediate tool calls and results stay inside the subagent; only its final message returns to the parent. See What subagents inherit for exactly what’s in the subagent’s context. **Example:** a `research-assistant` subagent can explore dozens of files without any of that content accumulating in the main conversation. The parent receives a concise summary, not every file the subagent read.
-
-###
-
-
-
-Parallelization
-
-Multiple subagents can run concurrently, so independent subtasks finish in the time of the slowest one rather than the sum of all of them. **Example:** during a code review, you can run `style-checker`, `security-scanner`, and `test-coverage` subagents simultaneously instead of sequentially.
-
-###
-
-
-
-Specialized instructions and knowledge
-
-Each subagent can have tailored system prompts with specific expertise, best practices, and constraints. **Example:** a `database-migration` subagent can have detailed knowledge about SQL best practices, rollback strategies, and data integrity checks that would be unnecessary noise in the main agent’s instructions.
-
-###
-
-
-
-Tool restrictions
-
-Subagents can be limited to specific tools, reducing the risk of unintended actions. **Example:** a `doc-reviewer` subagent might only have access to Read and Grep tools, ensuring it can analyze but never accidentally modify your documentation files.
+Because subagents are separate agent instances, delegating work to them gives you four benefits:
+
+ * **Context isolation** : each subagent runs in its own conversation, which starts fresh unless the subagent is a [fork](</docs/en/sub-agents#fork-the-current-conversation>). Either way, intermediate tool calls and results stay inside the subagent; only its final message returns to the parent. A `research-assistant` subagent can explore dozens of files without any of that content accumulating in the main conversation. The parent receives a concise summary, not every file the subagent read. See What subagents inherit for exactly what’s in the subagent’s context.
+ * **Parallelization** : multiple subagents can run concurrently, so independent subtasks finish in the time of the slowest one rather than the sum of all of them. During a code review, you can run `style-checker`, `security-scanner`, and `test-coverage` subagents simultaneously instead of sequentially.
+ * **Specialized instructions and knowledge** : each subagent can have a tailored system prompt with specific expertise, best practices, and constraints. A `database-migration` subagent can have detailed knowledge about SQL best practices, rollback strategies, and data integrity checks that would be unnecessary noise in the main agent’s instructions.
+ * **Tool restrictions** : subagents can be limited to specific tools, reducing the risk of unintended actions. A `doc-reviewer` subagent might only have access to Read and Grep tools, ensuring it can analyze but never accidentally modify your documentation files.
##
@@ -209,7 +184,7 @@
What subagents inherit
-A subagent’s context window starts fresh, with no parent conversation, but isn’t empty. The only content you pass from parent to subagent is the Agent tool’s prompt string, so include any file paths, error messages, or decisions the subagent needs directly in that prompt. A subagent that has the [`SendMessage`](</docs/en/tools-reference>) tool starts with a list of the other named agents running in the session, so it knows which names it can send messages to. Claude Code adds the list to the subagent’s first turn automatically. A [fork](</docs/en/sub-agents#fork-the-current-conversation>) doesn’t get the list because it inherits the parent conversation instead. The list requires Claude Code v2.1.206 or later.
+Unless the subagent is a [fork](</docs/en/sub-agents#fork-the-current-conversation>), its context window starts fresh, with no parent conversation, but isn’t empty. The only content you pass from parent to subagent is the Agent tool’s prompt string, so include any file paths, error messages, or decisions the subagent needs directly in that prompt. A subagent that has the [`SendMessage`](</docs/en/tools-reference>) tool starts with a list of the other named agents running in the session, so it knows which names it can send messages to. Claude Code adds the list to the subagent’s first turn automatically. A [fork](</docs/en/sub-agents#fork-the-current-conversation>) doesn’t get the list because it inherits the parent conversation instead. The list requires Claude Code v2.1.206 or later. The table below lists what a non-fork subagent’s context contains and what it leaves out.
The subagent receives| The subagent doesn’t receive
---|---
--- a/terminal-config.md
+++ b/terminal-config.md
@@ -4,6 +4,7 @@
* Option-key shortcuts do nothing on macOS
* No sound or alert when Claude finishes
* You run Claude Code inside tmux
+ * Backspace deletes a whole word on Windows
* Display flickers or scrollback jumps
* You want Vim keys in the prompt
@@ -112,6 +113,14 @@
set -as terminal-features 'xterm*:extkeys'
The `allow-passthrough` line lets notifications and progress updates reach the outer terminal instead of being swallowed by tmux. The `extended-keys` lines let tmux distinguish Shift+Enter from plain Enter so the newline shortcut works.
+
+##
+
+
+
+Fix Backspace deleting a whole word on Windows
+
+On Windows, Claude Code reads a Backspace that arrives as `^H` as Ctrl+Backspace, which [deletes the previous word](</docs/en/interactive-mode#text-editing>), except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`. On macOS and Linux, Claude Code reads it as plain Backspace. If each press of Backspace deletes a whole word, your terminal sends `^H` for plain Backspace. Set [`CLAUDE_CODE_BS_AS_CTRL_BACKSPACE=0`](</docs/en/env-vars>). Backspace and Ctrl+H then erase one character each. If Ctrl+Backspace erases only one character on macOS or Linux because your terminal sends `^H` for it, set the variable to `1` instead.
##
@@ -291,7 +300,7 @@
Switch to fullscreen rendering
-In [screen reader mode](</docs/en/accessibility>), this section doesn’t apply. Claude Code always renders as plain scrolling text except in attached [background sessions](</docs/en/agent-view>), and if you run `/tui fullscreen` in any other session, Claude Code prints an explanation instead of switching. If the display flickers or the scroll position jumps while Claude is working, switch to [fullscreen rendering mode](</docs/en/fullscreen>). In this mode you scroll with the mouse or PageUp inside Claude Code rather than with your terminal’s native scrollback; see the [fullscreen page](</docs/en/fullscreen#search-and-review-the-conversation>) for how to search and copy. If flicker is the only problem and your terminal supports synchronized output but isn’t auto-detected, such as Emacs `eat`, set [`CLAUDE_CODE_FORCE_SYNC_OUTPUT=1`](</docs/en/env-vars>) to stop the flicker without changing renderers. Run `/tui fullscreen` to switch and save the preference. Your conversation relaunches intact and future sessions start in fullscreen. You can also set the `CLAUDE_CODE_NO_FLICKER` environment variable before starting Claude Code:
+In [screen reader mode](</docs/en/accessibility>), this section doesn’t apply. Claude Code always renders as plain scrolling text except in attached [background sessions](</docs/en/agent-view>), and if you run `/tui fullscreen` in any other session, Claude Code prints an explanation instead of switching. If the display flickers or the scroll position jumps while Claude is working, switch to [fullscreen rendering mode](</docs/en/fullscreen>). In this mode you scroll with the mouse or PageUp inside Claude Code rather than with your terminal’s native scrollback; see the [fullscreen page](</docs/en/fullscreen#search-and-review-the-conversation>) for how to search and copy. If flicker is the only problem and your terminal supports synchronized output but isn’t auto-detected, such as Emacs `eat`, set [`CLAUDE_CODE_FORCE_SYNC_OUTPUT=1`](</docs/en/env-vars>) to stop the flicker without changing renderers. Run `/tui fullscreen` to switch and save the preference. Your conversation relaunches intact and future sessions start in fullscreen unless a [fullscreen start fails](</docs/en/fullscreen#fullscreen-renderer-didnt-finish-starting>). You can also set the `CLAUDE_CODE_NO_FLICKER` environment variable before starting Claude Code:
Bash and Zsh
Show diff (601 lines)
--- a/todo-tracking.md
+++ b/todo-tracking.md
@@ -1,4 +1,10 @@
-The Claude Agent SDK includes built-in todo functionality that helps organize complex workflows and keep users informed about task progression.
+On the models listed under Model availability, Claude tracks multi-step work without a written todo list, and Claude Code leaves the [task-tracking tools](</docs/en/tools-reference#task-tool-availability>) out of sessions by default. You don’t need anything on this page for Claude to work through multi-step tasks on those models. In a session that has the task-tracking tools, Claude keeps a written todo list, updating each item’s status as it works. You see each change in the message stream as a structured tool call. Opt a session in only when your application reads those tool calls, whether to log task activity or to render its own progress display.
+
+##
+
+
+
+Model availability
On TypeScript Agent SDK 0.3.233 and later, or Python Agent SDK 0.2.139 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in:
@@ -10,23 +16,17 @@
On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.
-###
-
-
-
-Model availability
-
-On the [models that don’t get the task-tracking tools](</docs/en/tools-reference#task-tool-availability>), you see no `tool_use` blocks for them in the message stream unless you opt in. If you point `cli_path` in Python or `pathToClaudeCodeExecutable` in TypeScript at your own Claude Code install, you get whichever tools that install provides. To get the same tools as on other models, do one of the following:
-
- * Name one of the tools in the [`allowedTools`](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) option, `allowed_tools` in Python
+On the listed models, unless you opt a session in, you see no `tool_use` blocks for the tools in the message stream. The Agent SDK applies these defaults through the Claude Code binary that it bundles. If you point `pathToClaudeCodeExecutable` (TypeScript) or `cli_path` (Python) at your own Claude Code install, you get whichever tools that install provides, under its own defaults. To see the exact set in a running session, [check which tools are available](</docs/en/tools-reference#check-which-tools-are-available>). To opt a session in, do one of the following:
+
+ * Name one of the tools in the [`allowedTools`](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) (TypeScript) or `allowed_tools` (Python) option
* List the tools in the `tools` option, which restricts the session’s built-in tools to the ones it names. Include the tools you want alongside the other built-in tools you use
* Set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` in the `env` option, as the examples on this page do. In TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables. In Python, `env` is merged on top of the inherited environment
-###
-
-
-
-Todo Lifecycle
+##
+
+
+
+Todo lifecycle
Claude moves each todo through a predictable lifecycle:
@@ -35,243 +35,42 @@
3. **Completed** : Claude marks it completed when the task finishes successfully
4. **Removed** : Claude deletes a todo it no longer needs by setting `status: "deleted"` in a `TaskUpdate` call
+##
+
+
+
+When Claude creates todos
+
+In a session that has the task-tracking tools, Claude creates todos for most multi-step work, such as:
+
+ * **Complex multi-step tasks** requiring three or more distinct actions
+ * **User-provided task lists** when multiple items are mentioned
+ * **Longer operations** that benefit from progress tracking
+ * **Explicit requests** when users ask for todo organization
+
+Claude may skip todos for very short or single-step requests.
+
+##
+
+
+
+Examples
+
+Before running these examples, install the Claude Agent SDK by following the [quickstart](</docs/en/agent-sdk/quickstart>). Every example on this page shares the same permission setup and exit behavior:
+
+ * **Permission mode** : the example prompts ask Claude to do real work on a project, so each example sets `permissionMode: "acceptEdits"` (TypeScript) or `permission_mode="acceptEdits"` (Python) to auto-approve the file edits that work produces. See [Permission modes](</docs/en/agent-sdk/permissions#permission-modes>) for the alternatives.
+ * **Turn limit** : each example runs until the agent finishes and yields its final result message. If a session reaches its turn limit first, that result message has the `error_max_turns` subtype. Check `subtype` to detect that ending.
+ * **Error handling** : these examples use single-shot `query()` calls. After yielding an `error_max_turns` result, `query()` raises an error that includes `Reached maximum number of turns`. Each example wraps its loop in a try block to exit cleanly when that happens. See [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>) for the result subtypes.
+
+The task system messages, [`SDKTaskNotificationMessage`](</docs/en/agent-sdk/typescript#sdktasknotificationmessage>) (TypeScript) or [`TaskNotificationMessage`](</docs/en/agent-sdk/python#tasknotificationmessage>) (Python) among them, report background tasks such as backgrounded commands and subagents. In the message stream, you see todo activity as `tool_use` blocks in the assistant messages.
+
###
-When Todos Are Used
-
-In a session that has the task-tracking tools, Claude creates todos for most multi-step work, such as:
-
- * **Complex multi-step tasks** requiring 3 or more distinct actions
- * **User-provided task lists** when multiple items are mentioned
- * **Non-trivial operations** that benefit from progress tracking
- * **Explicit requests** when users ask for todo organization
-
-It may skip todos for very short or single-step requests.
-
-##
-
-
-
-Examples
-
-Before running these examples, install the Claude Agent SDK by following the [quickstart](</docs/en/agent-sdk/quickstart>). Each example runs until the agent finishes and yields its final result message. If a session reaches its turn limit first, that result message has the `error_max_turns` subtype. Check `subtype` to detect that ending. These examples use single-shot `query()` calls. After yielding an `error_max_turns` result, `query()` raises an error that includes `Reached maximum number of turns`. Each example wraps its loop in a try block to exit cleanly when that happens. See [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>) for the result subtypes.
-
-###
-
-
-
-Monitoring Todo Changes
-
-TypeScript
-
-Python
-
- import { query } from "@anthropic-ai/claude-agent-sdk";
-
- try {
- for await (const message of query({
- prompt: "Optimize my React app performance and track progress with todos",
- // Re-enable TodoWrite, which this example monitors. Without it, the SDK uses
- // Task tools instead and these tool_use blocks never appear. ENABLE_TODO_TOOLS
- // keeps the tools on models where Claude Code otherwise doesn't provide them.
- options: { maxTurns: 15, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0", CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } }
- })) {
- // Todo updates are reflected in the message stream
- if (message.type === "assistant") {
- for (const block of message.message.content) {
- if (block.type === "tool_use" && block.name === "TodoWrite") {
- const todos = block.input.todos;
-
- console.log("Todo Status Update:");
- todos.forEach((todo, index) => {
- const status =
- todo.status === "completed" ? "✅" : todo.status === "in_progress" ? "🔧" : "❌";
- console.log(`${index + 1}. ${status} ${todo.content}`);
- });
- }
- }
- }
- }
- } catch (error) {
- // A single-shot query() throws after yielding an error result,
- // such as when the maxTurns limit is hit.
- console.log(`Session ended with an error: ${error}`);
- }
-
- import asyncio
-
- from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ToolUseBlock
-
- async def main():
- try:
- async for message in query(
- prompt="Optimize my React app performance and track progress with todos",
- # Re-enable TodoWrite, which this example monitors. Without it, the SDK uses
- # Task tools instead and these tool_use blocks never appear. ENABLE_TODO_TOOLS
- # keeps the tools on models where Claude Code otherwise doesn't provide them.
- options=ClaudeAgentOptions(max_turns=15, env={"CLAUDE_CODE_ENABLE_TASKS": "0", "CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}),
- ):
- # Todo updates are reflected in the message stream
- if isinstance(message, AssistantMessage):
- for block in message.content:
- if isinstance(block, ToolUseBlock) and block.name == "TodoWrite":
- todos = block.input["todos"]
-
- print("Todo Status Update:")
- for i, todo in enumerate(todos):
- status = (
- "✅"
- if todo["status"] == "completed"
- else "🔧"
- if todo["status"] == "in_progress"
- else "❌"
- )
- print(f"{i + 1}. {status} {todo['content']}")
- except Exception as error:
- # A single-shot query() raises after yielding an error result,
- # such as when the max_turns limit is hit.
- print(f"Session ended with an error: {error}")
-
- asyncio.run(main())
-
-###
-
-
-
-Real-time Progress Display
-
-TypeScript
-
-Python
-
- import { query } from "@anthropic-ai/claude-agent-sdk";
-
- class TodoTracker {
- private todos: any[] = [];
-
- displayProgress() {
- if (this.todos.length === 0) return;
-
- const completed = this.todos.filter((t) => t.status === "completed").length;
- const inProgress = this.todos.filter((t) => t.status === "in_progress").length;
- const total = this.todos.length;
-
- console.log(`\nProgress: ${completed}/${total} completed`);
- console.log(`Currently working on: ${inProgress} task(s)\n`);
-
- this.todos.forEach((todo, index) => {
- const icon =
- todo.status === "completed" ? "✅" : todo.status === "in_progress" ? "🔧" : "❌";
- const text = todo.status === "in_progress" ? todo.activeForm : todo.content;
- console.log(`${index + 1}. ${icon} ${text}`);
- });
- }
-
- async trackQuery(prompt: string) {
- try {
- for await (const message of query({
- prompt,
- // On every model, re-enable TodoWrite, which this tracker watches for.
- options: { maxTurns: 20, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0", CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } }
- })) {
- if (message.type === "assistant") {
- for (const block of message.message.content) {
- if (block.type === "tool_use" && block.name === "TodoWrite") {
- this.todos = block.input.todos;
- this.displayProgress();
- }
- }
- }
- }
- } catch (error) {
- // A single-shot query() throws after yielding an error result,
- // such as when the maxTurns limit is hit.
- console.log(`Session ended with an error: ${error}`);
- }
- }
- }
-
- // Usage
- const tracker = new TodoTracker();
- await tracker.trackQuery("Build a complete authentication system with todos");
-
- import asyncio
-
- from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ToolUseBlock
- from typing import List, Dict
-
- class TodoTracker:
- def __init__(self):
- self.todos: List[Dict] = []
-
- def display_progress(self):
- if not self.todos:
- return
-
- completed = len([t for t in self.todos if t["status"] == "completed"])
- in_progress = len([t for t in self.todos if t["status"] == "in_progress"])
- total = len(self.todos)
-
- print(f"\nProgress: {completed}/{total} completed")
- print(f"Currently working on: {in_progress} task(s)\n")
-
- for i, todo in enumerate(self.todos):
- icon = (
- "✅"
- if todo["status"] == "completed"
- else "🔧"
- if todo["status"] == "in_progress"
- else "❌"
- )
- text = (
- todo["activeForm"]
- if todo["status"] == "in_progress"
- else todo["content"]
- )
- print(f"{i + 1}. {icon} {text}")
-
- async def track_query(self, prompt: str):
- try:
- async for message in query(
- prompt=prompt,
- # On every model, re-enable TodoWrite, which this tracker watches for.
- options=ClaudeAgentOptions(max_turns=20, env={"CLAUDE_CODE_ENABLE_TASKS": "0", "CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}),
- ):
- if isinstance(message, AssistantMessage):
- for block in message.content:
- if isinstance(block, ToolUseBlock) and block.name == "TodoWrite":
- self.todos = block.input["todos"]
- self.display_progress()
- except Exception as error:
- # A single-shot query() raises after yielding an error result,
- # such as when the max_turns limit is hit.
- print(f"Session ended with an error: {error}")
-
- # Usage
- async def main():
- tracker = TodoTracker()
- await tracker.track_query("Build a complete authentication system with todos")
-
- asyncio.run(main())
-
-##
-
-
-
-Migrate to Task tools
-
-The Task tools split the single `TodoWrite` call into `TaskCreate` for each new item and `TaskUpdate` for each status change, with `TaskList` and `TaskGet` available for the model to read back the current list. Your monitoring code still inspects `tool_use` blocks in the assistant stream, but maintains a map keyed by task ID instead of replacing the whole list on every call.
-
-With `TodoWrite`| With Task tools
----|---
-One tool call rewrites the full `todos` array| `TaskCreate` adds one item, `TaskUpdate` patches one item by `taskId`
-Match `block.name === "TodoWrite"`| Match `block.name === "TaskCreate"` or `"TaskUpdate"`
-Item shape: `{ content, status, activeForm }`| `TaskCreate` input: `{ subject, description, activeForm?, metadata? }`. `TaskUpdate` input: `{ taskId, status?, subject?, description?, activeForm?, addBlocks?, addBlockedBy?, owner?, metadata? }`. `status` is `"pending"`, `"in_progress"`, or `"completed"`; set `status: "deleted"` to delete
-Render `block.input.todos` directly| Accumulate items across calls, or read a snapshot from a `TaskList` tool result
-
-The assigned task ID is not in the `TaskCreate` input. It comes back in the matching `tool_result` as `{ task: { id, subject } }`, so capture it from the result block to key your map. The following example shows the minimal change to the Monitoring Todo Changes loop. It leaves `CLAUDE_CODE_ENABLE_TASKS` unset, because the Task tools are the default, and sets only `CLAUDE_CODE_ENABLE_TODO_TOOLS=1`, the opt-in for the models that otherwise don’t get the tools. It reads only `tool_use` inputs and skips capturing IDs from `tool_result` blocks. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map. The streamed `tool_use` input is the raw shape the model emitted. Claude Code repairs some close-but-incorrect key names before execution, mapping `id` or `task_id` to `taskId` and `active_form` to `activeForm`, but that repair is not reflected in the stream. Read `TaskUpdate` input fields defensively, as the samples below do, rather than assuming the canonical name is always present.
+Monitor todo changes
+
+The following example watches the assistant stream for `TaskCreate` and `TaskUpdate` `tool_use` blocks and prints a `+` line with each new task’s subject and an update line with each status change’s task ID and new status. Use this shape when you want a log of task activity rather than a rendered display. The `+` lines don’t include the assigned IDs, so this log can’t match updates back to their creates. To keep that correlation, capture the IDs as Display progress in real time does. The streamed `tool_use` input is the raw shape the model emitted. Claude Code repairs some close-but-incorrect key names before execution, mapping `id` or `task_id` to `taskId` and `active_form` to `activeForm`, but that repair is not reflected in the stream. Read `TaskUpdate` input fields defensively, as both examples on this page do, rather than assuming the canonical name is always present.
TypeScript
@@ -283,7 +82,7 @@
for await (const message of query({
prompt: "Optimize my React app performance and track progress with todos",
// Keeps the Task tools on models where Claude Code otherwise doesn't provide them.
- options: { maxTurns: 15, env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } },
+ options: { maxTurns: 15, permissionMode: "acceptEdits", env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } },
})) {
if (message.type !== "assistant") continue;
for (const block of message.message.content) {
@@ -317,7 +116,7 @@
async for message in query(
prompt="Optimize my React app performance and track progress with todos",
# Keeps the Task tools on models where Claude Code otherwise doesn't provide them.
- options=ClaudeAgentOptions(max_turns=15, env={"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}),
+ options=ClaudeAgentOptions(max_turns=15, permission_mode="acceptEdits", env={"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}),
):
if not isinstance(message, AssistantMessage):
continue
@@ -325,7 +124,7 @@
if not isinstance(block, ToolUseBlock):
continue
if block.name == "TaskCreate":
- print(f"+ {block.input['subject']}")
+ print(f"+ {block.input.get('subject', '')}")
elif block.name == "TaskUpdate" and block.input.get("status"):
task_id = (
block.input.get("taskId")
@@ -340,13 +139,241 @@
asyncio.run(main())
-##
-
-
-
-Related Documentation
-
- * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>)
- * [Python SDK Reference](</docs/en/agent-sdk/python>)
- * [Streaming vs Single Mode](</docs/en/agent-sdk/streaming-vs-single-mode>)
- * [Custom Tools](</docs/en/agent-sdk/custom-tools>)
+###
+
+
+
+Display progress in real time
+
+The following example watches the assistant stream for `TaskCreate` and `TaskUpdate` `tool_use` blocks and keeps a map of tasks keyed by task ID in a `TaskTracker` class, rerendering a progress summary on every change. The summary counts completed and in-progress tasks and shows each active item’s `activeForm` label in place of its `subject`. Use this shape when your application maintains a progress display instead of logging each event. The assigned task ID isn’t in the `TaskCreate` input. Claude Code delivers each tool’s structured output on the user message that carries its `tool_result` block, in the `tool_use_result` field. For `TaskCreate`, that object is documented for TypeScript as `TaskCreateOutput` under [Tool Output Types](</docs/en/agent-sdk/typescript#tool-output-types>), and in Python the field is a plain dict of the same shape. The tracker pairs each `tool_result` block with its `tool_use` call by `tool_use_id` and reads `task.id` from the paired message’s `tool_use_result`. Claude can read the list back with `TaskList` and one task’s full details with `TaskGet`.
+
+TypeScript
+
+Python
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ type Task = { subject: string; activeForm?: string; status: string };
+
+ class TaskTracker {
+ private tasks = new Map<string, Task>();
+ private pendingCreates = new Map<string, { subject: string; activeForm?: string }>();
+
+ displayProgress() {
+ if (this.tasks.size === 0) {
+ console.log("\nProgress: no open tasks\n");
+ return;
+ }
+
+ const items = [...this.tasks.values()];
+ const completed = items.filter((t) => t.status === "completed").length;
+ const inProgress = items.filter((t) => t.status === "in_progress").length;
+
+ console.log(`\nProgress: ${completed}/${this.tasks.size} completed`);
+ console.log(`Currently working on: ${inProgress} task(s)\n`);
+
+ for (const [id, task] of this.tasks) {
+ const icon =
+ task.status === "completed" ? "✅" : task.status === "in_progress" ? "🔧" : "❌";
+ const text = task.status === "in_progress" && task.activeForm ? task.activeForm : task.subject;
+ console.log(`${id}. ${icon} ${text}`);
+ }
+ }
+
+ handleToolUse(block: { id: string; name: string; input: unknown }) {
+ if (block.name === "TaskCreate") {
+ const input = block.input as { subject: string; activeForm?: string; active_form?: string };
+ this.pendingCreates.set(block.id, {
+ subject: input.subject,
+ activeForm: input.activeForm ?? input.active_form,
+ });
+ } else if (block.name === "TaskUpdate") {
+ const input = block.input as {
+ taskId?: string;
+ id?: string;
+ task_id?: string;
+ status?: string;
+ activeForm?: string;
+ active_form?: string;
+ };
+ const taskId = input.taskId ?? input.id ?? input.task_id;
+ if (!taskId) return;
+ if (input.status === "deleted") {
+ this.tasks.delete(taskId);
+ this.displayProgress();
+ return;
+ }
+ const task = this.tasks.get(taskId);
+ if (!task) return;
+ if (input.status) task.status = input.status;
+ const active = input.activeForm ?? input.active_form;
+ if (active) task.activeForm = active;
+ this.displayProgress();
+ }
+ }
+
+ handleToolResult(block: { tool_use_id: string; is_error?: boolean }, result: unknown) {
+ const create = this.pendingCreates.get(block.tool_use_id);
+ if (!create) return;
+ this.pendingCreates.delete(block.tool_use_id);
+ if (block.is_error) return;
+ // The result's user message carries the tool's structured output as
+ // tool_use_result; for TaskCreate that's TaskCreateOutput,
+ // { task: { id, subject } }.
+ const out = result as { task?: { id: string } };
+ if (!out?.task?.id) return;
+ this.tasks.set(out.task.id, { ...create, status: "pending" });
+ this.displayProgress();
+ }
+
+ async trackQuery(prompt: string) {
+ try {
+ for await (const message of query({
+ prompt,
+ options: { maxTurns: 20, permissionMode: "acceptEdits", env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } },
+ })) {
+ if (message.type === "assistant") {
+ for (const block of message.message.content) {
+ if (block.type === "tool_use") this.handleToolUse(block);
+ }
+ }
+ if (message.type === "user" && Array.isArray(message.message.content)) {
+ for (const block of message.message.content) {
+ if (block.type === "tool_result") this.handleToolResult(block, message.tool_use_result);
+ }
+ }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result,
+ // such as when the maxTurns limit is hit.
+ console.log(`Session ended with an error: ${error}`);
+ }
+ }
+ }
+
+ // Usage
+ const tracker = new TaskTracker();
+ await tracker.trackQuery("Build a complete authentication system with todos");
+
+ import asyncio
+
+ from claude_agent_sdk import (
+ query,
+ ClaudeAgentOptions,
+ AssistantMessage,
+ UserMessage,
+ ToolUseBlock,
+ ToolResultBlock,
+ )
+
+ class TaskTracker:
+ def __init__(self):
+ self.tasks: dict[str, dict] = {}
+ self.pending_creates: dict[str, dict] = {}
+
+ def display_progress(self):
+ if not self.tasks:
+ print("\nProgress: no open tasks\n")
+ return
+
+ completed = len([t for t in self.tasks.values() if t["status"] == "completed"])
+ in_progress = len([t for t in self.tasks.values() if t["status"] == "in_progress"])
+
+ print(f"\nProgress: {completed}/{len(self.tasks)} completed")
+ print(f"Currently working on: {in_progress} task(s)\n")
+
+ for task_id, task in self.tasks.items():
+ icon = (
+ "✅"
+ if task["status"] == "completed"
+ else "🔧"
+ if task["status"] == "in_progress"
+ else "❌"
+ )
+ text = (
+ task["activeForm"]
+ if task["status"] == "in_progress" and task.get("activeForm")
+ else task["subject"]
+ )
+ print(f"{task_id}. {icon} {text}")
+
+ def handle_tool_use(self, block: ToolUseBlock):
+ if block.name == "TaskCreate":
+ self.pending_creates[block.id] = {
+ "subject": block.input.get("subject", ""),
+ "activeForm": block.input.get("activeForm") or block.input.get("active_form"),
+ }
+ elif block.name == "TaskUpdate":
+ task_id = (
+ block.input.get("taskId")
+ or block.input.get("id")
+ or block.input.get("task_id")
+ )
+ if not task_id:
+ return
+ if block.input.get("status") == "deleted":
+ self.tasks.pop(task_id, None)
+ self.display_progress()
+ return
+ task = self.tasks.get(task_id)
+ if not task:
+ return
+ if block.input.get("status"):
+ task["status"] = block.input["status"]
+ active = block.input.get("activeForm") or block.input.get("active_form")
+ if active:
+ task["activeForm"] = active
+ self.display_progress()
+
+ def handle_tool_result(self, block: ToolResultBlock, tool_use_result):
+ create = self.pending_creates.pop(block.tool_use_id, None)
+ if create is None or block.is_error:
+ return
+ # The result's user message carries the tool's structured output as
+ # tool_use_result; for TaskCreate that's {"task": {"id": ..., "subject": ...}}.
+ task = (tool_use_result or {}).get("task") or {}
+ if not task.get("id"):
+ return
+ self.tasks[task["id"]] = {**create, "status": "pending"}
+ self.display_progress()
+
+ async def track_query(self, prompt: str):
+ try:
+ async for message in query(
+ prompt=prompt,
+ options=ClaudeAgentOptions(
+ max_turns=20,
+ permission_mode="acceptEdits",
+ env={"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"},
+ ),
+ ):
+ if isinstance(message, AssistantMessage):
+ for block in message.content:
+ if isinstance(block, ToolUseBlock):
+ self.handle_tool_use(block)
+ if isinstance(message, UserMessage) and isinstance(message.content, list):
+ for block in message.content:
+ if isinstance(block, ToolResultBlock):
+ self.handle_tool_result(block, message.tool_use_result)
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result,
+ # such as when the max_turns limit is hit.
+ print(f"Session ended with an error: {error}")
+
+ # Usage
+ async def main():
+ tracker = TaskTracker()
+ await tracker.track_query("Build a complete authentication system with todos")
+
+ asyncio.run(main())
+
+##
+
+
+
+Related documentation
+
+ * [Agent SDK reference - TypeScript](</docs/en/agent-sdk/typescript>): the options, types, and tool schemas for the TypeScript SDK, including the Task tool input and output types
+ * [Agent SDK reference - Python](</docs/en/agent-sdk/python>): the options, types, and tool documentation for the Python SDK
+ * [Streaming Input](</docs/en/agent-sdk/streaming-vs-single-mode>): the two input modes, and when to use streaming input instead of the single-shot calls these examples use
+ * [Give Claude custom tools](</docs/en/agent-sdk/custom-tools>): define your own tools with the SDK’s in-process MCP server
--- a/tools-reference.md
+++ b/tools-reference.md
@@ -31,7 +31,7 @@
`RemoteTrigger`| Creates, updates, runs, and lists [Routines](</docs/en/routines>) on claude.ai. Backs the `/schedule` command. The [`RemoteTrigger` input reference](</docs/en/agent-sdk/typescript#remotetrigger>) documents every action and the organization policies that remove the tool. Routines live on claude.ai and require a Pro, Max, Team, or Enterprise plan, so this tool is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>)| No
`ReportFindings`| Reports code-review findings as a structured list, with a file, summary, and failure scenario per finding, so Claude Code can render them instead of printing them as text. Claude calls it when active code-review instructions tell it to. Requires Claude Code v2.1.196 or later. As of v2.1.199, a finding can also carry an optional `category` slug, such as `correctness` or `test-coverage`, shown next to the file location in the rendered list| No
`ScheduleWakeup`| Reschedules the next iteration of a [self-paced `/loop`](</docs/en/scheduled-tasks#let-claude-choose-the-interval>). Claude calls this at the end of each iteration to pick when the next one runs, between one minute and one hour out; you don’t call it directly. To end the loop instead, Claude calls it with `stop: true`, which cancels the pending wakeup. The `stop` field requires Claude Code v2.1.202 or later. The pending wakeup appears in `session_crons` in [Stop hook input](</docs/en/hooks#stop-input>). Not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, where a `/loop` prompt with no interval runs on a fixed schedule instead. The same happens when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>)| No
-`SendMessage`| Sends a message to another agent: an [agent team](</docs/en/agent-teams>) teammate, a [subagent it resumes](</docs/en/sub-agents#resume-subagents>) by agent ID or name, or one of your other Claude Code sessions, on this machine or beyond it. Messaging other sessions requires Claude Code v2.1.224 or later; [cross-session messaging](</docs/en/cross-session-messaging>) covers which sessions Claude can reach and each case’s requirements. A receiver never treats a message from another agent as your consent or approval. Claude can include an optional `summary` input, typically 5-10 words, that Claude Code shows as a one-line preview. When Claude omits it on a [plain-text message](</docs/en/cross-session-messaging#limitations>), Claude Code uses the first line of the message as the summary. Claude Code truncates a summary longer than 200 characters with an ellipsis| No
+`SendMessage`| Sends a message to another agent: an [agent team](</docs/en/agent-teams>) teammate, a [subagent it resumes](</docs/en/sub-agents#resume-subagents>) by agent ID or name, or one of your other Claude Code sessions, on this machine or beyond it. Messaging other sessions requires Claude Code v2.1.224 or later; [cross-session messaging](</docs/en/cross-session-messaging>) covers which sessions Claude can reach and each case’s requirements. A receiver never treats a message from another agent as your consent or approval. Claude can include an optional `summary` input, typically 5-10 words, that Claude Code shows as a one-line preview. When Claude omits it on a [plain-text message](</docs/en/cross-session-messaging#limitations>), Claude Code uses the first line of the message as the summary. Claude Code truncates a summary longer than 200 characters with an ellipsis. With the `notify_when_idle` input, Claude can ask one of your other sessions on this machine to [send one notice when it next goes idle or exits](</docs/en/cross-session-messaging#get-a-notice-when-another-session-goes-idle>). Requires Claude Code v2.1.236 or later in both sessions| No
`SendUserFile`| Sends files from the session to you with an optional caption, so a generated report, diagram, screenshot, or built artifact reaches your device instead of only being mentioned in the transcript. As of v2.1.196, the optional `display` input controls presentation: `render` opens the file inline in the client, `attach` shows a download card only, and when unset the client decides by file type. Available when a [Remote Control](</docs/en/remote-control>) client is connected or the session runs in a managed cloud environment such as [Claude Code on the web](</docs/en/claude-code-on-the-web>). Delivery runs through Anthropic-hosted infrastructure, so the tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No
`ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Pro, Max, Team, and Enterprise plans| Yes
`Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation| Yes
@@ -292,7 +292,7 @@
* Track output from any long-running script you point it at
* Connect to a WebSocket feed and report each message as it arrives
-For most watches, Claude writes a small script, runs it in the background, and receives each output line as it arrives. For a server that already pushes events, Claude can open a WebSocket instead of running a script. You keep working in the same session and Claude interjects when an event arrives. Stop a monitor by asking Claude to cancel it or by ending the session. When Monitor runs a command, it uses the same [permission rules as Bash](</docs/en/permissions#tool-specific-permission-rules>), so `allow` and `deny` patterns you have set for Bash apply here too. The WebSocket source has its own approval prompt, which the classifier decides in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). The tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. It is also not available when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. Plugins can declare monitors that start automatically when the plugin is active, instead of asking Claude to start them. See [plugin monitors](</docs/en/plugins-reference#monitors>).
+For most watches, Claude writes a small script, runs it in the background, and receives each output line as it arrives. For a server that already pushes events, Claude can open a WebSocket instead of running a script. You keep working in the same session and Claude interjects when an event arrives. Stop a monitor by asking Claude to cancel it or by ending the session. When Monitor runs a command, it uses the same [permission rules as Bash](</docs/en/permissions#tool-specific-permission-rules>), so `allow` and `deny` patterns you have set for Bash apply here too. While [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) is active, Claude Code sets aside allow rules that name `Monitor` itself, along with the other [broad allow rules it drops](</docs/en/permission-modes#how-the-classifier-evaluates-actions>), so the classifier reviews Monitor commands the same way it reviews Bash commands. The WebSocket source has its own approval prompt, which the classifier also decides in auto mode. The tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. It is also not available when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. Plugins can declare monitors that start automatically when the plugin is active, instead of asking Claude to start them. See [plugin monitors](</docs/en/plugins-reference#monitors>).
###
Show diff (117 lines)
--- a/typescript.md
+++ b/typescript.md
@@ -489,7 +489,7 @@
Property| Type| Default| Description
---|---|---|---
`abortController`| `AbortController`| `new AbortController()`| Controller for cancelling operations
-`additionalDirectories`| `string[]`| `[]`| Additional directories Claude can access
+`additionalDirectories`| `string[]`| `[]`| Additional directories Claude can access. The SDK passes each entry to Claude Code as `--add-dir`, so with the `project` setting source Claude Code also [loads the directory’s skills, commands, and subagents](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>)
`agent`| `string`| `undefined`| Agent name for the main thread. The agent must be defined in the `agents` option or in settings
`agents`| `Record<string, [`AgentDefinition`](#agentdefinition)>`| `undefined`| Programmatically define subagents
`agentProgressSummaries`| `boolean`| `false`| When `true`, generate one-line progress summaries for subagents and forward them on `task_progress` events via the `summary` field. Applies to foreground and background subagents
@@ -515,7 +515,7 @@
`includeHookEvents`| `boolean`| `false`| Include hook lifecycle events in the message stream as `SDKHookStartedMessage`, `SDKHookProgressMessage`, and `SDKHookResponseMessage`. Lifecycle events for `SessionStart` and `Setup` hooks are always included and don’t need this option. Some hook events, such as `Notification`, `SessionEnd`, `PreCompact`, and `PostCompact`, never produce an `SDKHookStartedMessage`, even with this option. For those events, Claude Code still emits an `SDKHookProgressMessage` while a command hook that runs for more than a second produces output, and emits an `SDKHookResponseMessage` only when a hook [that runs in the background](</docs/en/hooks#run-hooks-in-the-background>) finishes
`includePartialMessages`| `boolean`| `false`| Include partial message events
`loadTimeoutMs`| `number`| `60000`| _Alpha._ Timeout in milliseconds for each `sessionStore.load()` and `sessionStore.listSubkeys()` call during resume materialization. If the adapter doesn’t settle within this window, the query fails instead of hanging. Ignored when `sessionStore` is not set
-`managedSettings`| `Settings`| `undefined`| Policy-tier settings your host process supplies to the spawned session. On machines with admin-deployed managed settings, Claude Code ignores these unless the admin’s highest-priority managed source sets `parentSettingsBehavior: 'merge'`, and never merges them while a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>) is configured. Merged values pass through a restrictive-only filter; [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) covers what the filter admits and the `allowManaged*Only` locks
+`managedSettings`| `Settings`| `undefined`| Policy-tier settings your host process supplies to the spawned session. On machines with admin-deployed managed settings, Claude Code ignores these unless the admin’s highest-priority managed source sets `parentSettingsBehavior: 'merge'`, and never merges them when an MDM or file-based source wins and configures a [`policyHelper`](</docs/en/settings#compute-managed-settings-with-a-policy-helper>). Merged values pass through a restrictive-only filter; [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) covers what the filter admits and the `allowManaged*Only` locks
`maxBudgetUsd`| `number`| `undefined`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`; see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats
`maxThinkingTokens`| `number`| `undefined`| _Deprecated:_ Use `thinking` instead. Maximum tokens for thinking process
`maxTurns`| `number`| `undefined`| Maximum agentic turns (tool-use round trips)
@@ -530,7 +530,7 @@
`persistSession`| `boolean`| `true`| When `false`, disables session persistence to disk. Sessions cannot be resumed later
`planModeInstructions`| `string`| `undefined`| Custom workflow instructions for plan mode. When `permissionMode` is `'plan'`, this string replaces the default plan-mode workflow body. The CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer
`plugins`| `SdkPluginConfig``[]`| `[]`| Load custom plugins from local paths. See [Plugins](</docs/en/agent-sdk/plugins>) for details
-`promptSuggestions`| `boolean`| `false`| Enable prompt suggestions. Emits a `prompt_suggestion` message after each turn with a predicted next user prompt
+`promptSuggestions`| `boolean`| `false`| Enable prompt suggestions. After a turn, Claude Code emits a `prompt_suggestion` message carrying a predicted next user prompt. Claude Code generates no suggestion for some turns, such as while your account is close to or at its usage limit. See [When Claude Code skips suggestions](</docs/en/interactive-mode#when-claude-code-skips-suggestions>)
`resume`| `string`| `undefined`| Session ID to resume
`resumeDropsTurn`| `string`| `undefined`| With `resumeSessionAt`: the prompt UUID of the turn the truncating resume intends to discard. Claude Code refuses the resume when the discarded range contains anything not attributable to that turn, such as absorbed queued messages or task notifications, and names the `--resume-drops-turn` flag in the rejection message. Only the Agent SDK and print-mode resumes read the pair. Requires Claude Code v2.1.223 or later
`resumeSessionAt`| `string`| `undefined`| Resume session at a specific message UUID
@@ -716,9 +716,15 @@
account: AccountInfo;
fast_mode_state?: "off" | "cooldown" | "on";
fast_mode_disabled_reason?: FastModeDisabledReason;
- };
-
-The response always reports `fast_mode_state`, and when something blocks [fast mode](</docs/en/fast-mode>), `fast_mode_disabled_reason` carries the reason code alongside it, so you can explain the blocked state instead of re-deriving availability. Both behaviors require Claude Code v2.1.219 or later. Before v2.1.219, the response omitted `fast_mode_state` when fast mode wasn’t available and never carried a reason. For the reason codes and their meanings, see `fast_mode_disabled_reason` on the result message. When a client sends `initialize` to a session that is already running, the control-response wrapper also carries an optional `pending_permission_requests` array. The field is on the response wrapper itself, not in the `SDKControlInitializeResponse` payload above. Each entry is a complete `control_request` message with the same `{ type: "control_request", request_id, request }` shape the session streams for permission requests while running. These are requests that were issued before the client connected and are still awaiting a reply. The SDK reads the array for you and dispatches each entry to your `canUseTool` callback, the same redelivery that `reinitialize()` triggers after a transport gap. Handle repeated request IDs idempotently, because an entry can repeat a request the callback already received before the connection dropped.
+ hooks_applied?: boolean;
+ };
+
+`hooks_applied` reports whether Claude Code registered the `hooks` that the `initialize` request carried. The SDK sends that request once when the session starts and again on each `reinitialize()` call. The field requires Agent SDK v0.3.238 or later. Claude Code omits the field when the request carried no hooks. When the request carried hooks, the value depends on whether the request is the session’s first initialize and, for a repeated one, on how it reached the session:
+
+ * `true`: Claude Code registered the hooks. A session’s first initialize returns this value. So does a repeated initialize sent over the CLI’s stdin. In that case the hooks in the new request replace the hooks registered earlier.
+ * `false`: Claude Code ignored the hooks. A repeated initialize sent to a remote session returns this value, so a second client that joins a session can’t replace the hooks the first client registered.
+
+Before Agent SDK v0.3.238, the response never carried the field, and Claude Code ignored `hooks` on every repeated initialize. The response always reports `fast_mode_state`, and when something blocks [fast mode](</docs/en/fast-mode>), `fast_mode_disabled_reason` carries the reason code alongside it, so you can explain the blocked state instead of re-deriving availability. Both behaviors require Claude Code v2.1.219 or later. Before v2.1.219, the response omitted `fast_mode_state` when fast mode wasn’t available and never carried a reason. For the reason codes and their meanings, see `fast_mode_disabled_reason` on the result message. When a client sends `initialize` to a session that is already running, the control-response wrapper also carries an optional `pending_permission_requests` array. The field is on the response wrapper itself, not in the `SDKControlInitializeResponse` payload above. Each entry is a complete `control_request` message with the same `{ type: "control_request", request_id, request }` shape the session streams for permission requests while running. These are requests that were issued before the client connected and are still awaiting a reply. The SDK reads the array for you and dispatches each entry to your `canUseTool` callback, the same redelivery that `reinitialize()` triggers after a transport gap. Handle repeated request IDs idempotently, because an entry can repeat a request the callback already received before the connection dropped.
###
@@ -2431,6 +2437,13 @@
| {
hookEventName: "PostToolUse";
additionalContext?: string;
+ /**
+ * Short note about this tool call's result for the auto mode
+ * permission classifier. Capped at 2000 characters, shared across
+ * all hooks that respond to the same call; honored on synchronous
+ * hook responses only. Don't copy untrusted tool output into it.
+ */
+ classifierContext?: string;
updatedToolOutput?: unknown;
/** @deprecated Use `updatedToolOutput`, which works for all tools. */
updatedMCPToolOutput?: unknown;
@@ -2875,7 +2888,7 @@
* `TaskUpdate`
* `TaskList`
-On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code.
+On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in.
###
@@ -3855,7 +3868,7 @@
* `TaskUpdate`
* `TaskList`
-On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code.
+On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in.
###
@@ -4999,7 +5012,7 @@
`SDKTaskStartedMessage`
-Emitted when a background task begins. The `task_type` field is `"local_bash"` for background Bash commands and Monitor watches, `"local_agent"` for subagents, or `"remote_agent"`.
+Emitted when a task begins. The `task_type` field is `"local_bash"` for Bash commands and Monitor watches, `"local_agent"` for subagents, or `"remote_agent"`.
type SDKTaskStartedMessage = {
type: "system";
@@ -5008,9 +5021,18 @@
tool_use_id?: string;
description: string;
task_type?: string;
+ is_backgrounded?: boolean;
+ spawn_depth?: number;
uuid: UUID;
session_id: string;
};
+
+`is_backgrounded` and `spawn_depth` describe how Claude Code started the task. Both fields require Agent SDK v0.3.238 or later.
+
+ * `is_backgrounded`: Claude Code sets it on `"local_agent"` and `"local_bash"` tasks. `true` means the task runs in the background. `false` means the task runs in the foreground, and the tool call that started it stays blocked until the task finishes or moves to the background.
+ * `spawn_depth`: Claude Code sets it on `"local_agent"` tasks only. A subagent that the main thread spawned has depth `1`. A subagent that a depth `1` subagent spawned has depth `2`, and so on.
+
+A [resumed subagent](</docs/en/agent-sdk/subagents#resume-subagents>) always reports `is_backgrounded: true`, because Claude Code runs every resumed subagent in the background. When a foreground task moves to the background later, Claude Code reports the new `is_backgrounded` value in a `task_updated` message rather than sending a second `task_started`.
###
@@ -5179,7 +5201,7 @@
`SDKPromptSuggestionMessage`
-Emitted after each turn when `promptSuggestions` is enabled. Contains a predicted next user prompt.
+Emitted after a turn when `promptSuggestions` is enabled and Claude Code generated a suggestion for that turn. Contains the predicted next user prompt. For the turns that get none, see [When Claude Code skips suggestions](</docs/en/interactive-mode#when-claude-code-skips-suggestions>).
type SDKPromptSuggestionMessage = {
type: "prompt_suggestion";
--- a/vs-code.md
+++ b/vs-code.md
@@ -373,6 +373,21 @@
+Use a screen reader
+
+The extension’s chat panel works with screen readers. You don’t need to turn anything on: the extension announces conversation activity for every user, with no visual change. This is separate from the CLI’s opt-in [screen reader mode](</docs/en/accessibility>), which adapts the terminal interface. Screen reader support in the chat panel requires Claude Code v2.1.236 or later. During a conversation, the extension announces:
+
+ * **Claude’s replies** : the extension announces each reply once, when it’s complete, and stays silent while text streams in. Your screen reader reads code blocks as a line-count summary, reads links by their label, and reads tables cell by cell; the full reply stays readable in the transcript.
+ * **Permission requests and questions** : the extension announces a request when its permission prompt appears, naming the tool Claude wants to use. It announces in the same way when Claude asks you a question and when Claude finishes a plan and waits for your review.
+ * **Status changes** : the extension announces when Claude starts working, when Claude is ready for your input, and when Claude Code starts compacting the conversation.
+ * **Errors and model prompts** : the extension announces errors in the conversation, and announces when the [usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) or the [flagged-request prompt](</docs/en/model-config#ask-before-switching>) appears.
+
+Each turn in the transcript starts with a visually hidden heading labeled with the prompt that started the turn, so you can jump between turns with your screen reader’s heading navigation. You can also move focus to the transcript itself with `Tab`, since the extension exposes it as a labeled region, and read it at your own pace. While Claude works, your screen reader reads a text label in place of the progress spinner’s animation. When you reopen a session or switch to another one, the extension announces nothing: restored history, pending permission prompts, and in-progress status stay silent until something new happens.
+
+##
+
+
+
VS Code extension vs. Claude Code CLI
Claude Code is available as both a VS Code extension (graphical panel) and a CLI (command-line interface in the terminal). Some features are only available in the CLI. If you need a CLI-only feature, run `claude` in VS Code’s integrated terminal. This requires the [standalone CLI install](</docs/en/setup>): the extension does not add `claude` to your PATH. See Run CLI in VS Code.
--- a/workflows.md
+++ b/workflows.md
@@ -81,11 +81,7 @@
Watch the run
-Workflows run in the background, so the session stays responsive while agents work. Run `/workflows` at any time to list running and completed workflows, then select one to open its progress view.
-
- /workflows
-
-The progress view shows each phase with its agent counts, token totals, and elapsed time. The footer lists the key for each action:
+Workflows run in the background, so the session stays responsive while agents work. Run `/workflows` at any time to list running and completed workflows, then select one to open its progress view. The progress view shows each phase with its agent counts, token totals, and elapsed time. The footer lists the key for each action:
Key| Action
---|---
--- a/worktrees.md
+++ b/worktrees.md
@@ -33,6 +33,11 @@
Ask Claude to create a worktree
You can also ask Claude to “work in a worktree” during a session, and it creates 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. When Claude enters a path outside the repository’s `.claude/worktrees/` directory, Claude Code asks for your approval first, because the move takes 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.
+
+**Hook paths don’t follow the worktree.** After Claude enters a worktree, Claude Code keeps `${CLAUDE_PROJECT_DIR}` in your [hooks](</docs/en/hooks#reference-scripts-by-path>) where it was and passes the worktree path to them a different way:
+
+ * **`${CLAUDE_PROJECT_DIR}` stays put**: it still points at the project root where the session started, so a hook command such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/check-style.sh` still runs the script in the main checkout.
+ * **`cwd` follows Claude**: the `cwd` field in the hook’s [input JSON](</docs/en/hooks#common-input-fields>) is the worktree root, and it moves again when Claude runs `cd`. Read it when a hook needs the worktree path.
##
@@ -74,7 +79,7 @@
* **File edits** : Claude Code blocks an `Edit`, `Write`, or `NotebookEdit` that targets a path in the main checkout.
* **Command working directory** : Claude Code blocks a Bash, PowerShell, or Monitor command whose working directory resolves to the main checkout, or whose working directory it can’t verify stays outside it.
* **Git redirects** : Claude Code blocks a Bash or Monitor command that redirects git into the main checkout. The redirect can come through `git -C`, `--git-dir`, a `GIT_DIR` or `GIT_WORK_TREE` variable, or a `cd` into the main checkout before running git.
- * **Command shape** : Claude Code blocks a Bash or Monitor command it can’t verify stays inside the worktree. The block applies even when the command runs no git at all. Claude Code refuses shell constructs it can’t statically trace, such as brace expansion and heredocs with unquoted delimiters. It tells Claude to break the command into plain, separate commands. You can’t turn this check off.
+ * **Command shape** : Claude Code blocks a Bash or Monitor command it can’t verify stays inside the worktree, even when the command runs no git at all. Claude Code refuses shell constructs it can’t trace without running them, such as brace expansion and heredocs with unquoted delimiters. Claude Code tells Claude how to rewrite the refused command, such as splitting it into plain, separate commands. You can’t turn this check off.
The checks apply to the repository you launched Claude Code from. They also cover the main checkout a linked worktree is linked from. For PowerShell commands, Claude Code applies only the working-directory check. Claude sees each refusal as a tool error that names the worktree and says how to proceed.