modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -84,7 +84,7 @@ [Plugin marketplace control](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>)| Restrict which marketplace sources users can add and install from, reject the CLI flags that sideload plugins, agents, and MCP servers for a single run, and allowlist which marketplaces’ plugins can be suggested| `strictKnownMarketplaces`, `blockedMarketplaces`, `disableSideloadFlags`, `pluginSuggestionMarketplaces` [Customization lockdown](</docs/en/settings#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings| `strictPluginOnlyCustomization` [Hook restrictions](</docs/en/settings#hook-configuration>)| Only managed hooks load; restrict HTTP hook URLs| `allowManagedHooksOnly`, `allowedHttpHookUrls` -[Login enforcement](</docs/en/settings#available-settings>)| Restrict login to a specific method or Anthropic organization. The method restriction is enforced across the terminal, VS Code extension, Agent SDK, `claude setup-token`, and `/install-github-app`; the organization restriction covers the terminal, VS Code extension, and Agent SDK, except [gateway](</docs/en/claude-apps-gateway>) sign-in, which doesn’t authenticate against an Anthropic organization. Before v2.1.212, only terminal logins enforced either key. When set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren’t affected| `forceLoginMethod`, `forceLoginOrgUUID` +[Login enforcement](</docs/en/settings#available-settings>)| Restrict login to a specific method or Anthropic organization. The method restriction applies across the terminal, VS Code extension, Agent SDK, `claude setup-token`, and `/install-github-app`; Claude Code verifies the organization for claude.ai account logins in the terminal, VS Code extension, and Agent SDK, and doesn’t check it for Claude Console logins or for [gateway](</docs/en/claude-apps-gateway>) sign-in. Before v2.1.212, only terminal logins applied either key. When set, sessions authenticated by `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` are blocked at startup; cloud provider sessions aren’t affected| `forceLoginMethod`, `forceLoginOrgUUID` [Disable agent view](</docs/en/agent-view#how-background-sessions-are-hosted>)| Turn off `claude agents`, `--bg`, `/background`, and the on-demand supervisor| `disableAgentView` [Configure the corporate launcher](</docs/en/corporate-launcher>)| Prefix the [background-agent supervisor](</docs/en/agent-view#how-background-sessions-are-hosted>), its workers, and the [other covered background processes](</docs/en/corporate-launcher#what-the-launcher-covers>) with a required corporate launcher instead of turning agent view off| `processWrapper` [Model restrictions](</docs/en/model-config#restrict-model-selection>)| `availableModels` filters which models appear in the picker. Adding `enforceAvailableModels` also constrains the auto-selected default model. See [surface coverage](</docs/en/model-config#surface-coverage>) for how this setting reaches the CLI, web, and IDE| `availableModels`, `enforceAvailableModels`
modified Escalate hard decisions with the advisor tool View current →
--- a/advisor.md +++ b/advisor.md @@ -23,8 +23,6 @@ * **`--advisor` flag**: set the advisor for a single session at launch If any of these sets an advisor model, the advisor is enabled for sessions whose main model supports it, and an `Advisor Tool (experimental) is on and may use more tokens · /advisor` notification appears after the session starts. To stop using it, see Turn the advisor off. - -Claude Code doesn’t offer Fable 5 as the advisor. For organizations with [Fable 5 access](</docs/en/model-config#work-with-fable-5>), the `/advisor` picker lists it as a dimmed, unselectable row labeled `Fable 5 (temporarily unavailable)`, and Claude Code rejects `/advisor fable` and `--advisor fable`. Fable 5 as the main model isn’t affected.A remotely configured rollout controls when Fable 5 returns as an advisor option. ### @@ -68,7 +66,7 @@ Choose an advisor model -The advisor must be at least as capable as the main model. Fable 5 satisfies the capability check but isn’t offered as the advisor, so the Fable entries in the following table apply once the rollout returns it as an option. The accepted advisors for each main model are: +The advisor must be at least as capable as the main model. The accepted advisors for each main model are: Main model| Accepted advisors| Notes ---|---|--- @@ -77,9 +75,9 @@ Sonnet 5| Fable, Opus, Sonnet 5| A Sonnet 4.6 advisor is rejected Opus 4.6| Fable, Opus, Sonnet 5| Sonnet 5 and Opus 4.6 are ranked as equally capable, so an Opus 4.6 main accepts a Sonnet 5 advisor Opus 4.7 or later| Fable, and Opus 4.7 or later| Opus 4.7 and later Opus models are ranked as equally capable, so any of them accepts another as an advisor. An Opus 4.7 main with an Opus 4.6 or Sonnet 5 advisor is rejected -Fable 5 (v2.1.170+)| Fable| An Opus or Sonnet advisor is rejected. Fable isn’t offered as the advisor, so a Fable 5 main model runs without one +Fable 5 (v2.1.170+)| Fable| An Opus or Sonnet advisor is rejected -Fable 5 requires Claude Code v2.1.170 or later and Fable 5 access, whether it acts as the main model or the advisor. Set the advisor as `opus` or `sonnet`, or as `fable` once the rollout returns it as an option. These aliases resolve to Claude Code’s built-in default version for each model family, which advances with new Claude Code releases. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request: +Fable 5 requires Claude Code v2.1.170 or later and [Fable 5 access](</docs/en/model-config#work-with-fable-5>), whether it acts as the main model or the advisor. Set the advisor as `fable`, `opus`, or `sonnet`. These aliases resolve to Claude Code’s built-in default version for each model family, which advances with new Claude Code releases. You can also pass a full model ID such as `claude-opus-5`. Subagents inherit the configured advisor and apply the same pairing check against their own model. Claude Code validates the pairing before sending a request: * If the advisor is less capable than the main model, the advisor is not attached to the main model’s requests. The `/advisor` command output and a notification show this. Subagents whose own model satisfies the pairing may still use the advisor. * If the main model or the advisor is a model Claude Code does not recognize, the advisor is not attached. @@ -90,7 +88,7 @@ Common model pairings -Any accepted pairing works. Pairings that use Fable 5 as the advisor apply once Fable 5 returns as an advisor option. These combinations balance cost against capability in different ways: +Any accepted pairing works. These combinations balance cost against capability in different ways: Pairing| When to use ---|--- @@ -142,7 +140,8 @@ The advisor tool requires all of the following: * **Anthropic API only** : the advisor is a server-executed tool. It is not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry. Through an [LLM gateway](</docs/en/llm-gateway>) configured with `ANTHROPIC_BASE_URL`, availability depends on whether the gateway forwards the request intact to the Anthropic API. - * **Supported main model** : Opus 4.6 or later, Sonnet 4.6 or later, or Haiku 4.5. Fable 5 also qualifies on Claude Code v2.1.170 or later, but a Fable 5 main accepts only a Fable advisor and Fable isn’t offered as the advisor, so a Fable 5 session runs without one until the rollout returns it as an option. + * **Supported main model** : Opus 4.6 or later, Sonnet 4.6 or later, or Haiku 4.5. Fable 5 also qualifies on Claude Code v2.1.170 or later, and a Fable 5 main accepts only a Fable advisor. + * **Feature-flag fetching** : Claude Code turns the advisor on through a feature flag it fetches from Anthropic. In a session where a variable that turns flag fetching off is set, such as `DISABLE_TELEMETRY`, the advisor stays off. See [Features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ##
modified How the agent loop works View current →
--- a/agent-loop.md +++ b/agent-loop.md @@ -277,7 +277,7 @@ * **Summarization instructions in CLAUDE.md:** The compactor reads your CLAUDE.md like any other context, so you can include a section telling it what to preserve when summarizing. The section header is free-form (not a magic string); the compactor matches on intent. * **`PreCompact` hook:** Run custom logic before compaction occurs, for example to archive the full transcript. The hook receives a `trigger` field (`manual` or `auto`). See [hooks](</docs/en/agent-sdk/hooks>). - * **Manual compaction:** Send `/compact` as a prompt string to trigger compaction on demand. Commands sent this way are SDK inputs, not CLI-only shortcuts. See [commands in the SDK](</docs/en/agent-sdk/slash-commands>). + * **Manual compaction:** Send `/compact` as a prompt string to trigger compaction on demand. Commands sent this way are ordinary SDK inputs. See [commands in the SDK](</docs/en/agent-sdk/slash-commands>). Example: Summarization instructions in CLAUDE.md @@ -314,7 +314,7 @@ Sessions and continuity -Each interaction with the SDK creates or continues a session. Capture the session ID from `ResultMessage.session_id` (available in both SDKs) to resume later. The TypeScript SDK also exposes it as a direct field on the init `SystemMessage`; in Python it’s nested in `SystemMessage.data`. When you resume, the full context from previous turns is restored: files that were read, analysis that was performed, and actions that were taken. You can also fork a session to branch into a different approach without modifying the original. See [Session management](</docs/en/agent-sdk/sessions>) for the full guide on resume, continue, and fork patterns. To resume sessions across stateless containers or serverless hosts, pass a [`session_store` / `sessionStore` adapter](</docs/en/agent-sdk/session-storage>) so the SDK mirrors transcripts to your own backend and any host can resume them. The Claude Code subprocess still writes to local disk first. See [Dual-write architecture](</docs/en/agent-sdk/session-storage#dual-write-architecture>) for which copy outlives a fresh session versus a run resumed from the store, and how to keep the local copy ephemeral. +Each interaction with the SDK creates or continues a session. Capture the session ID from `ResultMessage.session_id` (available in both SDKs) to resume later. The TypeScript SDK also exposes it as a direct field on the init `SystemMessage`; in Python it’s nested in `SystemMessage.data`. When you resume, the full context from previous turns is restored: files that were read, analysis that was performed, and actions that were taken. You can also fork a session to branch into a different approach without modifying the original. See [Session management](</docs/en/agent-sdk/sessions>) for the full guide on resume, continue, and fork patterns. To resume sessions across stateless containers or serverless hosts, pass a [`session_store` / `sessionStore` adapter](</docs/en/agent-sdk/session-storage>) so the SDK mirrors transcripts to your own backend and another host can resume them. The Claude Code subprocess still writes to local disk first. See [Dual-write architecture](</docs/en/agent-sdk/session-storage#dual-write-architecture>) for which copy outlives a fresh session versus a run resumed from the store, and how to keep the local copy ephemeral. In Python, `ClaudeSDKClient` handles session IDs automatically across multiple calls. See the [Python SDK reference](</docs/en/agent-sdk/python#choosing-between-query-and-claudesdkclient>) for details.
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -734,6 +734,7 @@ Version| Change ---|--- +v2.1.227| Deleting a session keeps the session and its worktree while another live Claude Code session is running inside that worktree directory. Agent view shows `not deleted` on the row and the reason in the footer, and `claude rm` prints `kept <id>` with the reason, which names the other session’s process ID. Before this release, deleting the session removed the worktree while the other session was still working in it. v2.1.225| `claude agents` in a directory you haven’t trusted shows the same [workspace trust dialog](</docs/en/permissions#project-allow-rules-and-workspace-trust>) that `claude` shows on startup, before agent view opens. Accepting saves trust for that workspace; declining exits without opening agent view. Before this release, `claude agents` opened without asking, so sessions you dispatched from it ran in a directory you’d never been asked to trust. With the list grouped by directory, hovering the mouse over a row highlights it without changing the dispatch target; selecting a row with the arrow keys or a click still changes the target. Before this release, moving the mouse over a session in another project silently changed the directory the next dispatched session started in.
modified Authentication View current →
--- a/authentication.md +++ b/authentication.md @@ -14,7 +14,7 @@ * **Cloud providers** : if your organization uses [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>), set the required environment variables before running `claude`, or select **3rd-party platform** at the login prompt, which launches an interactive setup wizard for Bedrock and Vertex AI. No browser login is needed. * **Cloud gateway** : if your organization runs a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>), sign in with corporate SSO through `/login`. The gateway-issued token is the session’s only credential. -Admins can restrict which login methods and organizations are accepted; see Restrict login to your organization. To log out and re-authenticate, type `/logout` at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run `claude` it walks you through login and setup again. If you’re having trouble logging in, see [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>). +Admins can direct which login method developers use and require claude.ai logins to belong to a specific organization; see Restrict login to your organization. To log out and re-authenticate, type `/logout` at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run `claude` it walks you through login and setup again. If you’re having trouble logging in, see [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>). ## @@ -135,9 +135,9 @@ Restrict login to your organization -To require that developer sessions authenticate into a specific Anthropic organization, set [`forceLoginMethod` and `forceLoginOrgUUID`](</docs/en/settings#available-settings>) in [managed settings](</docs/en/settings#settings-files>). Set `forceLoginOrgUUID` to your organization ID, shown in [claude.ai admin settings](<https://claude.ai/admin-settings/organization>) for Claude for Teams or Enterprise organizations, or at [platform.claude.com/settings/organization](<https://platform.claude.com/settings/organization>) for Console organizations. With both keys set, Claude Code restricts login to the listed organization and exits at startup if the active credential belongs to a different one. Developers can log in from several paths: the terminal `/login` flow, the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, `/install-github-app`, and [gateway](</docs/en/claude-apps-gateway>) sign-in for organizations that route through a cloud gateway. On Claude Code v2.1.212 or later, every path enforces `forceLoginMethod`; before v2.1.212, only terminal logins enforced either key. The paths differ on `forceLoginOrgUUID`: - - * **Terminal, VS Code extension, and Agent SDK logins** : enforce both keys +To require that developers’ claude.ai logins belong to a specific Anthropic organization, set [`forceLoginMethod` and `forceLoginOrgUUID`](</docs/en/settings#available-settings>) in [managed settings](</docs/en/settings#settings-files>). Set `forceLoginOrgUUID` to your organization ID, shown in [claude.ai admin settings](<https://claude.ai/admin-settings/organization>) for Claude for Teams or Enterprise organizations. Claude Code reports an error for a claude.ai login to any other organization and exits at startup if the claude.ai credential in use belongs to an organization that isn’t listed. For Claude Console logins, Claude Code uses `forceLoginOrgUUID` only to pre-select the organization on the Console sign-in page when you set it to a single Console organization ID, shown at [platform.claude.com/settings/organization](<https://platform.claude.com/settings/organization>). It doesn’t check which organization the resulting Console credential belongs to, at login or at startup, and a developer who logged in with a Console account before you deployed the keys stays logged in. To direct developers to claude.ai sign-in instead, set `forceLoginMethod` to `"claudeai"`. Developers can log in from several paths: the terminal `/login` flow, the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, `/install-github-app`, and [gateway](</docs/en/claude-apps-gateway>) sign-in for organizations that route through a cloud gateway. On Claude Code v2.1.212 or later, every path applies `forceLoginMethod`; before v2.1.212, only terminal logins applied either key. In the interactive `/login` flow, Claude Code pre-selects a `claudeai` or `console` method without enforcing it, so even with `forceLoginMethod` set to `"claudeai"`, a developer can still complete a Console login there. The paths differ on `forceLoginOrgUUID`: + + * **Terminal, VS Code extension, and Agent SDK logins** : verify `forceLoginOrgUUID` for claude.ai account logins * **`claude setup-token` and `/install-github-app`**: enforce only `forceLoginMethod`, so they can mint a token in a different organization * **[Gateway](</docs/en/claude-apps-gateway>) sign-in**: selected by `forceLoginMethod: "gateway"` rather than restricted by it, and doesn’t authenticate against an Anthropic organization, so `forceLoginOrgUUID` doesn’t apply; use your gateway identity provider to restrict access
modified Best practices for Claude Code View current →
--- a/best-practices.md +++ b/best-practices.md @@ -547,7 +547,7 @@ claude --permission-mode auto -p "fix all lint errors" -For non-interactive runs with the `-p` flag, auto mode aborts if the classifier repeatedly blocks actions, since there is no user to fall back to. See [when auto mode falls back](</docs/en/permission-modes#when-auto-mode-falls-back>) for thresholds. +When the classifier repeatedly blocks actions in a non-interactive run with the `-p` flag, Claude Code doesn’t stop the run. See [when auto mode falls back](</docs/en/permission-modes#when-auto-mode-falls-back>) for what happens instead and for the thresholds. ###
modified Claude Code changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,51 @@ 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.231 + +August 13, 2026 + + * Fixed MCP OAuth sign-in failing with a redirect URI mismatch for servers that use a pre-registered OAuth client, such as Slack + +​ + +2.1.229 + +August 12, 2026 + + * Documented `claude remote-control --continue` for resuming the most recent Remote Control session + * Added server-supplied Claude Code hook support for self-hosted runner sessions, matching managed-environment behavior + * Added SSE keepalive pings to gateway streaming responses during long thinking pauses, preventing idle-timeout disconnects on Vertex and Bedrock upstreams + * Added plugin marketplace `command` sources: a local command (e.g. an IDE) prints the plugin directory, which is re-resolved each session and applied without a restart; `mode: "link"` uses it in place + * `ListAgents` now marks disconnected Remote Control sessions as `offline` and labels your cloud sessions as `cloud` + * Fixed long responses partly disappearing while streaming and being printed twice in the terminal + * Fixed a crash to the error screen (including on `--resume` of the affected session) when a tool call had a non-string `glob`, `file_path`, or `command` value + * Fixed a RangeError crash when a progress bar or markdown table rendered in a very narrow terminal window (could also crash `claude --continue`/`--resume` at startup) + * Fixed a crash on Windows when a tool call or message referenced a file by an extended-length (`\\?\`) or UNC path + * Fixed auto mode failing on every tool call for users who disable the attribution header via `CLAUDE_CODE_ATTRIBUTION_HEADER` (direct Anthropic API connections) + * Fixed `/model` rejecting Sonnet/Opus 1M for claude.ai subscribers using a custom `ANTHROPIC_BASE_URL` gateway + * Fixed MCP OAuth with strict authorization servers by using `127.0.0.1` instead of `localhost` in the redirect URI + * Fixed Remote Control clients showing a stuck working spinner after a slash command typed in the laptop terminal + * Fixed the Claude Code Review workflow generated by `/install-github-app` completing without posting its review on the pull request + * Fixed multi-second UI stalls after editing a file with thousands of IDE diagnostics while the IDE extension is connected + * Fixed one-shot `claude plugin` commands leaving a stray liveness file that could prevent cleanup of outdated plugin versions + * Fixed dynamic workflows inside CPU-limited containers using the host machine’s core count instead of the container’s CPU limit + * Fixed a file-watcher handle leak after atomic file replacements, and an uncaught error on Windows when the scheduled-tasks watcher failed on a network or virtual filesystem + * Fixed SDK and `--input-format stream-json` sessions getting a 400 API error when a whitespace-only message was submitted + * Fixed conversations whose messages alone exceed the API’s 32 MB request limit retrying compaction when no images or documents can be stripped; they now fail once with a clear message + * Fixed OpenTelemetry export from Claude Desktop sessions being rejected by the Desktop-managed gateway when that gateway is also the telemetry endpoint + * Fixed self-hosted runner and other remote sessions exiting at startup when `managed-mcp.json` is deployed and the server delivers MCP servers; those servers are now skipped with a warning + * Fixed self-hosted runner repository preparation hanging on a Git Credential Manager prompt; git now fails fast when credentials are missing + * Improved workflow fan-outs to stagger same-prefix sibling agents so subsequent agents read the cached prompt prefix instead of re-paying it (`CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS=0` disables) + * Improved “prompt is too long” errors to explain why automatic compaction could not recover instead of only suggesting `/compact` + * Improved sandbox: IPv6 literals in network domain lists are now bracketed (`[::1]:443`), and ambiguous spellings are enforced fail-closed and flagged by `/doctor` + * Updated `/login` to repeat the `CLAUDE_CODE_OAUTH_TOKEN` override warning after a successful login + * Changed `/commit-push-pr` so git/gh commands with dangerous flags (`--force`, `--amend`, `--no-verify`, etc.) are no longer auto-approved + * Changed self-hosted runner Windows startup to require an explicit `--base-dir`; there is no default checkout directory on Windows + * [VSCode] “Report a problem” and `/bug` now open the built-in feedback dialog instead of a retired survey link + * [VSCode] Made the `/btw` side-question panel resizable by dragging its boundary, in both side-docked and stacked layouts + * [VSCode] Added session groups in the sidebar — right-click to create, rename, or delete; Cmd/Ctrl- or Shift-click to move several sessions at once ​
modified Checkpointing View current →
--- a/checkpointing.md +++ b/checkpointing.md @@ -120,8 +120,6 @@ Checkpointing doesn’t rewind symlinked or hard-linked files. When you pick **Restore code** or **Restore code and conversation** from the `/rewind` menu, Claude Code skips any tracked path that is a symlink or hard link and shows a `Restored the code, but skipped N files` warning. The skipped files keep their current contents. To undo the session’s changes to one of them, ask Claude to reverse the edit or edit the file yourself. Config files a dotfile manager symlinks into your project and files pnpm hard-links into place both fall into this category. To see which paths a restore skips, turn on debug logging with `/debug` before you restore: the debug log at `~/.claude/debug/<session-id>.txt` names each skipped path. For every skip reason and the recovery steps, see [the skipped-files entry in the error reference](</docs/en/errors#restored-the-code-but-skipped-files>). -Before v2.1.216, `/rewind` wrote and deleted through links at tracked paths without a warning. - ### ​
modified Claude apps gateway configuration View current →
--- a/claude-apps-gateway-config.md +++ b/claude-apps-gateway-config.md @@ -480,7 +480,10 @@ * **Deny-lists and hook arrays** : `permissions.deny`, `permissions.ask`, `disabledMcpjsonServers`, `deniedMcpServers`, `blockedMarketplaces`, and every `hooks` event-type array. These take the union of base and policy, so an org-wide deny or audit hook can’t be accidentally dropped by a per-role override. * **Record-typed keys** : `env`, `modelOverrides`, and `skillOverrides`. These shallow-merge, so a per-role `env` block overrides keys it sets and inherits the rest from the base. -`availableModels` is also enforced server-side at `/v1/messages`, so a denied model returns `400` regardless of what the client sends. When a request’s `model` value isn’t a string, the gateway rejects the request with a `400` and the message `model must be a string`, so a malformed value never reaches an upstream. Requires a gateway running Claude Code v2.1.221 or later. +`availableModels` is also enforced server-side at `/v1/messages`, so a denied model returns `400` regardless of what the client sends. The gateway validates the `model` value itself before it relays a request, so a malformed value never reaches an upstream. It rejects the request with a `400` in two cases: + + * When the value is missing or empty, the gateway rejects the request with the message `model is required`. That check requires a gateway running Claude Code v2.1.228 or later. + * When the value is present but isn’t a string, the gateway rejects the request with the message `model must be a string`. Requires a gateway running Claude Code v2.1.221 or later. Matcher| Behavior ---|--- @@ -584,13 +587,15 @@ Key| Effect ---|--- `modelDiscoveryEnabled`| Whether Claude Desktop fetches `/v1/models` for its picker. Set `false` to rely solely on the policy’s model list. -`coworkTabEnabled`, `isClaudeCodeForDesktopEnabled`| Show or hide individual tabs +`coworkTabEnabled`, `isClaudeCodeForDesktopEnabled`| Show or hide the Cowork and Code tabs. Both show unless set `false` +`chatTabEnabled`| Show or hide the Chat tab. Hidden unless set `true` +`chatAdvancedFileAnalysisEnabled`| Let Claude run code in a local sandbox from the Chat tab to analyze attached files it can’t read natively, such as spreadsheets and presentations. Off unless set `true`. Has no effect when the policy’s `permissions.deny` disables `Bash` `isDesktopExtensionEnabled`, `isDesktopExtensionSignatureRequired`| Desktop extension loading and signature checks `isLocalDevMcpEnabled`| Allow locally defined MCP servers `disableAutoUpdates`, `autoUpdaterEnforcementHours`| Auto-update policy `banner`| Persistent banner at the top of the app: `enabled`, `text`, `backgroundColor`, `textColor`, `linkUrl` -Every key is optional; Claude Desktop applies its own default for any key you omit. The gateway rejects unknown keys at boot. If you don’t deploy Claude Desktop, leave `desktop` out of your policies entirely; `/user/bootstrap` then returns 404 for every user. +`chatTabEnabled` and `chatAdvancedFileAnalysisEnabled` require Claude Code v2.1.227 or later on the gateway server. Earlier releases reject them at boot. Every key is optional; Claude Desktop applies its own default for any key you omit. The gateway rejects unknown keys at boot. If you don’t deploy Claude Desktop, leave `desktop` out of your policies entirely; `/user/bootstrap` then returns 404 for every user. ####
modified Claude apps gateway deployment and operations View current →
--- a/claude-apps-gateway-deploy.md +++ b/claude-apps-gateway-deploy.md @@ -244,7 +244,7 @@ Compliance posture * **Data residency** : the gateway’s own data plane sends nothing to Anthropic unless the Anthropic API is a configured upstream; when it is, your existing data-handling agreement applies to the inference path. Telemetry, audit, identity, and settings go only to the destinations you configure. - * **Host-process traffic** : the host process is the Claude Code CLI, which can send startup analytics and update checks to Anthropic. For strict-egress deployments, set `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` in the gateway’s container environment. + * **Host-process traffic** : the host process is the Claude Code CLI. `claude gateway` runs under the same third-party rules as Amazon Bedrock and Google Cloud’s Agent Platform deployments and sends nothing to Anthropic. Before v2.1.227, the host process sent startup telemetry such as product version and platform, which setting `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` in the container environment turned off. Those releases also sent one `HEAD` request at boot, with no body or credentials, to `/api/hello` on `https://api.anthropic.com`, or on `ANTHROPIC_BASE_URL` when the environment set it, unless the environment also set a proxy variable such as `HTTPS_PROXY` or an mTLS client certificate. They ignored the response, so blocking that request at the egress firewall didn’t affect the gateway. * **Client analytics** : the CLI disables its own usage analytics while signed in to a gateway, and error reporting is off by default on third-party API surfaces. * **Client machines** : developers’ CLIs still send WebFetch hostname checks and version checks to Anthropic unless `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` and `skipWebFetchPreflight: true` are set. See [data usage](</docs/en/data-usage>). * **Survey ratings** : the gateway credential disables the Anthropic-bound rating sink, so ratings aren’t sent to Anthropic.
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -123,7 +123,12 @@ `usage-data/`| `report.html` and timestamped report copies written by [`/insights`](</docs/en/costs#analyze-your-usage-patterns>), plus cached per-session analysis data used to build them `todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory. -`sessions/` holds one small file per running session, used to detect concurrent sessions and crashes. It isn’t part of the age-based sweep: Claude Code removes each file when its session exits and clears crash leftovers on the next launch. When you run `claude -p` with [`--bare`](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t run the sweep in that session. If Claude Code can’t safely determine the retention period, it pauses the retention cleanup sweep; the [`retention_sweep` event](</docs/en/monitoring-usage#retention-sweep-event>) lists each configuration that pauses it. When the cause is a settings file that can’t be read or parsed, or settings errors with `cleanupPeriodDays` explicitly set, Claude Code also shows a warning in `/status` until you fix the settings errors. When [managed settings](</docs/en/server-managed-settings>) provide `cleanupPeriodDays`, Claude Code runs the sweep at the managed value in either case. +Claude Code makes four exceptions to this sweep: + + * **`sessions/`** : holds one small file per running session, used to detect concurrent sessions and crashes. It isn’t part of the age-based sweep: Claude Code removes each file when its session exits and clears crash leftovers on the next launch. + * **Auto memory** : Claude Code excludes a project’s [auto memory](</docs/en/memory#auto-memory>) directory, `projects/<project>/memory/`, from this sweep, and removes the directory itself only after it has been empty for the whole retention period. Before v2.1.228, the sweep treated folders inside the memory directory as session data and could delete old files beneath it. + * **Bare mode** : when you run `claude -p` with [`--bare`](</docs/en/headless#start-faster-with-bare-mode>), Claude Code doesn’t run the sweep in that session. + * **Paused sweep** : if Claude Code can’t safely determine the retention period, it pauses the retention cleanup sweep; the [`retention_sweep` event](</docs/en/monitoring-usage#retention-sweep-event>) lists each configuration that pauses it. When the cause is a settings file that can’t be read or parsed, or settings errors with `cleanupPeriodDays` explicitly set, Claude Code also shows a warning in `/status` until you fix the settings errors. When [managed settings](</docs/en/server-managed-settings>) provide `cleanupPeriodDays`, Claude Code runs the sweep at the managed value in either case. ### @@ -199,7 +204,7 @@ Delete| You lose ---|--- -`~/.claude/projects/`| Resume, continue, and rewind for past sessions +`~/.claude/projects/`| Resume, continue, and rewind for past sessions, and auto memory for every project `~/.claude/history.jsonl`| Up-arrow prompt recall `~/.claude/paste-cache/`| Pasted text in recalled prompts; see [paste large content](</docs/en/terminal-config#paste-large-content>) `~/.claude/file-history/`| Checkpoint restore for past sessions
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -28,7 +28,7 @@ `claude daemon status`| Print the background-session [supervisor’s](</docs/en/agent-view#the-supervisor-process>) state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn’t running| `claude daemon status` `claude daemon stop --any`| Stop the background-session [supervisor](</docs/en/agent-view#the-supervisor-process>) and the sessions it hosts. Pass `--keep-workers` to leave background sessions running so the next supervisor reconnects to them. `--any` confirms stopping an on-demand supervisor, which is the default. Use this to recover from an [unresponsive supervisor](</docs/en/agent-view#agent-view-says-the-background-service-did-not-respond>)| `claude daemon stop --any --keep-workers` `claude doctor`| Print read-only installation and settings diagnostics from the terminal without starting a session, including install health, settings-file validation errors, and Remote Control eligibility. For the in-session setup checkup that can also apply fixes, run [`/doctor`](</docs/en/commands#all-commands>)| `claude doctor` -`claude import [codex|gemini]`| Start an interactive session that runs [`/import`](</docs/en/commands#all-commands>) to bring configuration from other coding agents into Claude Code. Accepts the same `--dry-run` and `--yes` options as the command. Requires Claude Code v2.1.213 or later| `claude import codex --dry-run` +`claude import [codex|gemini]`| Start an interactive session that runs [`/import`](</docs/en/commands#all-commands>) to bring configuration from other coding agents into Claude Code. Accepts the same `--dry-run` and `--yes` options as the command. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later| `claude import codex --dry-run` `claude logs <id>`| Print recent output from a [background session](</docs/en/agent-view#manage-sessions-from-the-shell>)| `claude logs 7c5dcf5d` `claude mcp`| Configure Model Context Protocol (MCP) servers| See the [Claude Code MCP documentation](</docs/en/mcp>). `claude mcp login <name>`| Run a configured MCP server’s OAuth flow without opening the interactive `/mcp` panel. Works for HTTP, SSE, and claude.ai connector servers. Add `--no-browser` over SSH to print the authorization URL instead of opening a browser, then paste the redirect URL back at the prompt. Requires Claude Code v2.1.186 or later. See [Authenticate from the command line](</docs/en/mcp#authenticate-from-the-command-line>)| `claude mcp login sentry` @@ -56,7 +56,7 @@ Flag| Description| Example ---|---|--- `--add-dir`| Add additional working directories for Claude to read and edit files. Grants file access; most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from these directories. Validates each path exists as a directory. To persist these directories across sessions, set [`permissions.additionalDirectories`](</docs/en/settings#permission-settings>) in settings| `claude --add-dir ../apps ../lib` -`--advisor <model>`| Enable the server-side [advisor tool](</docs/en/advisor>) for this session with a model alias, `opus` or `sonnet`, or a full model ID. Takes precedence over the `advisorModel` setting for the session. [Claude Code doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>): `claude --advisor fable` exits with an error| `claude --advisor opus` +`--advisor <model>`| Enable the server-side [advisor tool](</docs/en/advisor>) for this session with a model alias, `fable`, `opus`, or `sonnet`, or a full model ID. Takes precedence over the `advisorModel` setting for the session. `fable` requires [Fable 5 access](</docs/en/advisor#choose-an-advisor-model>)| `claude --advisor opus` `--agent`| Specify an agent for the current session (overrides the `agent` setting)| `claude --agent my-custom-agent` `--agents`| Define custom subagents dynamically via JSON. Uses the same field names as subagent [frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>), plus a `prompt` field for the agent’s instructions| `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'` `--allow-dangerously-skip-permissions`| Add `bypassPermissions` to the `Shift+Tab` mode cycle without starting in it. Lets you begin in a different mode like `plan` and switch to `bypassPermissions` later. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>)| `claude --permission-mode plan --allow-dangerously-skip-permissions` @@ -120,7 +120,7 @@ `--remote-control-session-name-prefix <prefix>`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is set. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. Set `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX` for the same effect| `claude remote-control --remote-control-session-name-prefix dev-box` `--replay-user-messages`| Re-emit user messages from stdin back on stdout for acknowledgment. Requires `--input-format stream-json` and `--output-format stream-json`| `claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages` `--resume`, `-r`| Resume a specific session by ID or name, or show an interactive picker to choose a session. The picker and name search include sessions that added this directory with `/add-dir`. When you pass a session ID, Claude Code searches the current project directory and its git worktrees, then every other project on this machine. Before v2.1.223, the ID search covered only the current project directory and its git worktrees. [Background sessions](</docs/en/agent-view>) appear in the picker marked with `bg`| `claude --resume auth-refactor` -`--safe-mode`| Start with all customizations disabled to troubleshoot a broken configuration: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load. Authentication, model selection, built-in tools, and permissions work normally, which differs from [`--bare`](</docs/en/headless#start-faster-with-bare-mode>). Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Useful for checking whether a customization is what triggers [automatic model fallback](</docs/en/model-config#automatic-model-fallback>). Sets [`CLAUDE_CODE_SAFE_MODE`](</docs/en/env-vars>)| `claude --safe-mode` +`--safe-mode`| Start with all customizations disabled to troubleshoot a broken configuration: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load. Authentication, model selection, built-in tools, and permissions work normally, which differs from [`--bare`](</docs/en/headless#start-faster-with-bare-mode>). Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Useful for checking whether a customization is what triggers [automatic model fallback](</docs/en/model-config#automatic-model-fallback>). Sets [`CLAUDE_CODE_SAFE_MODE`](</docs/en/env-vars>)| `claude --safe-mode` `--session-id`| Use a specific session ID for the conversation (must be a valid UUID)| `claude --session-id "550e8400-e29b-41d4-a716-446655440000"` `--setting-sources`| Comma-separated list of setting sources to load (`user`, `project`, `local`)| `claude --setting-sources user,project` `--settings`| Path to a settings JSON file or an inline JSON string. Values you set here override the same keys in your `settings.json` files for this session. Keys you omit keep their file-based values. The file must be a regular file no larger than 2 MiB. See [settings precedence](</docs/en/settings#settings-precedence>)| `claude --settings ./settings.json`
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -28,7 +28,7 @@ Command| Purpose ---|--- `/add-dir <path>`| Add a working directory for file access during the current session. Type a partial path to see matching directory suggestions; press `Tab` to accept one. Most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from the added directory. A successful add runs your [`DirectoryAdded` hooks](</docs/en/hooks#directoryadded>) -`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `opus`, `sonnet`, or a full model ID. Claude Code [doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>) and rejects `/advisor fable`. Without an argument, opens a picker +`/advisor [model|off]`| Enable or disable the [advisor tool](</docs/en/advisor>), which consults a second model for guidance at key moments during a task. Accepts `fable`, `opus`, `sonnet`, or a full model ID. `fable` requires [Fable 5 access](</docs/en/advisor#choose-an-advisor-model>). Without an argument, opens a picker `/agents`| As of v2.1.198, running `/agents` prints a reminder to ask Claude to create or manage [subagents](</docs/en/sub-agents>), or to edit `.claude/agents/` or `~/.claude/agents/` directly. On v2.1.197 and earlier, opens an interactive interface for creating and managing subagent configurations `/autocompact [auto|<tokens>]`| Set the auto-compact window: how full the context window gets before Claude Code compacts automatically. Pass a size such as `500k`, or `auto` to return to the window tuned for your model. Claude Code saves the value to user settings and applies it to the current session. See [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) for accepted values and what overrides it. Without an argument, opens a dialog that shows the current window. Requires Claude Code v2.1.221 or later `/autofix-pr [prompt]`| Spawn a [Claude Code on the web](</docs/en/claude-code-on-the-web#auto-fix-pull-requests>) session that watches the current branch’s PR and pushes fixes when CI fails or reviewers leave comments. Detects the open PR from your checked-out branch with `gh pr view`; to watch a different PR, check out its branch first. By default the cloud session is told to fix every CI failure and review comment; pass a prompt to give it different instructions, for example `/autofix-pr only fix lint and type errors`. Requires the `gh` CLI and access to [Claude Code on the web](</docs/en/claude-code-on-the-web>) @@ -69,7 +69,7 @@ `/help`| Show help and available commands `/hooks`| View [hook](</docs/en/hooks>) configurations for tool events `/ide`| Manage IDE integrations and show status -`/import [codex|gemini] [--dry-run] [--yes]`| Bring configuration from other coding agents on your machine, currently OpenAI Codex and Google Gemini CLI, into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Requires Claude Code v2.1.213 or later +`/import [codex|gemini] [--dry-run] [--yes]`| Bring configuration from other coding agents on your machine, currently OpenAI Codex and Google Gemini CLI, into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later `/init`| Initialize project with a `CLAUDE.md` guide. Set `CLAUDE_CODE_NEW_INIT=1` for an interactive flow that also walks through skills, hooks, and personal memory files. If `/init` finds configuration from a coding agent that `/import` supports, it offers to carry it over with `/import` `/insights`| Generate an HTML report analyzing your recent sessions on this machine: which projects you work in, how you use Claude Code, where things go wrong, and features to try. Not available in [cloud sessions](</docs/en/claude-code-on-the-web>). See [Analyze your usage patterns](</docs/en/costs#analyze-your-usage-patterns>) for the report location, retention, and cost `/install-github-app`| Install the Claude GitHub App for a repository, with an optional step to set up [GitHub Actions](</docs/en/github-actions>) workflows and secrets. Walks you through selecting a repo and configuring the integration @@ -78,7 +78,7 @@ `/list-agents`| List the subagents and other Claude Code sessions Claude can message, with the name to use for each; [agent team](</docs/en/agent-teams>) teammates aren’t listed, since Claude reaches them through the team’s roster. See [cross-session messaging](</docs/en/cross-session-messaging>). Also available as `/peers`. Requires Claude Code v2.1.224 or later; earlier versions report `Unknown command: /list-agents`. Available only in sessions where [cross-session messaging is enabled](</docs/en/cross-session-messaging#availability>) `/login`| Sign in to your Anthropic account `/logout`| Sign out from your Anthropic account -`/loop [interval] [prompt]`| **[Skill](</docs/en/skills#bundled-skills>).** Run a prompt repeatedly while the session stays open. Omit the interval and Claude self-paces between iterations. Omit the prompt and, [where available](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), Claude runs an autonomous maintenance check or the prompt in `.claude/loop.md`. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>). Alias: `/proactive` +`/loop [interval] [prompt]`| **[Skill](</docs/en/skills#bundled-skills>).** Run a prompt repeatedly while the session stays open. Omit the interval and, [where available](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), Claude self-paces between iterations. Omit the prompt and, [where available](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), Claude runs an autonomous maintenance check or the prompt in `.claude/loop.md`. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>). Alias: `/proactive` `/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`
modified Track cost and usage View current →
--- a/cost-tracking.md +++ b/cost-tracking.md @@ -109,6 +109,8 @@ print(f"Session ended with an error: {error}") asyncio.run(main()) + +To bound how much subagents can add to `total_cost_usd`, set the [depth, concurrency, and spend limits](</docs/en/agent-sdk/subagents#cap-subagent-depth-concurrency-and-spend>) on the query. ##
modified Message your other Claude Code sessions View current →
--- a/cross-session-messaging.md +++ b/cross-session-messaging.md @@ -82,7 +82,7 @@ On another of your machines| Through Anthropic servers, arriving over that machine’s [Remote Control](</docs/en/remote-control>) connection On [Claude Code on the web](</docs/en/claude-code-on-the-web>)| Through Anthropic servers, straight to the cloud session -Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). A reply needs a reply address, and almost every message carries one. A message to a session beyond this machine, sent while the sending session isn’t connected to Remote Control, still goes through as a direct request to Anthropic servers, but it arrives without a reply address, so the receiver can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`. +Starting a conversation with a session on another of your machines requires Claude Code v2.1.225 or later and a target that appears in the listing. Before v2.1.225, Claude could only reply to a message that arrived from one. Same-machine delivery works wherever the feature is enabled. Each session registers itself in files on disk and binds its inbox socket there. When Claude lists or messages your local sessions, Claude Code reads those files to find them, so two sessions can reach each other only when they can see the same files. A container has its own filesystem, so a session inside it and a session on the host can’t reach each other. Two sessions inside the same container can still message each other, including on a [self-hosted runner](</docs/en/self-hosted-environments>). While this session is connected to Remote Control, when you message a session on another of your machines, Claude Code shows the message in that session’s conversation under this session’s Remote Control name. The Claude on that machine can reply to that name. For example, when this session is connected to Remote Control as `laptop-graceful-unicorn` and you message your desktop, you see the message in the desktop session under `laptop-graceful-unicorn`. If this session isn’t connected to Remote Control when Claude sends to a session beyond this machine, the message still goes through, but without a reply address, so the receiving Claude can’t answer it. Claude is told as much when it sends. To require your approval before any message goes beyond this machine, set `isolatePeerMachines`. ## @@ -103,7 +103,7 @@ What a message looks like -When the message arrives, it appears in the conversation with its sender, queued while Claude is mid-turn or starting a new turn right away when the session is idle. Once Claude has read it, Claude Code collapses it to a one-line `Message from` row, which `Ctrl+O` expands. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it: +When the message arrives, it appears in the conversation under the sender’s session name and stays there. Claude Code queues it while Claude is mid-turn, or starts a new turn with it right away when the session is idle. A message is a piece of text one Claude writes to another. Claude receives it with the sender’s name and a reply address, except for a one-way cross-machine message, which carries no reply address. You see the name and the text, and the receiving session gets only that text, never the sender’s conversation history or files. This example is a message one Claude wrote to another, as the receiving session sees it: Schema migration finished: the new column is tenant_id, and rebasing on main is safe now. @@ -158,11 +158,17 @@ Read this section when a session you expect isn’t in the agent list, when you want a script or hook to post into a session, or when a sandboxed command can’t reach the socket. Claude Code binds an inbox socket for each session with cross-session messaging enabled, where other sessions on the machine deliver messages. It restricts the socket to your operating-system user, so on a shared machine another user’s sessions can’t reach it. For which session kinds bind one, see Non-interactive sessions. You can find the path in two places: * `/status` shows it in the `Peer address` row. The path is prefixed with `uds:`. - * Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable. The export happens before any hook runs, including `SessionStart`. Each session exports its own socket, never one inherited from a parent session. - -Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite: - - * **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket. On Linux, including inside WSL 2, it can verify even for a child that has already exited, while on macOS it can verify only while the posting process is still running, and in containers where Claude Code runs as process ID 1 it can’t verify at all. Whenever it can’t verify, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval. + * Claude Code exports it to [hooks](</docs/en/hooks>) and Bash commands as the [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) environment variable: + * In a session that starts with messaging on, Claude Code exports the variable before any hook runs, including `SessionStart`. + * When a session starts before Claude Code has fetched the feature flag that turns messaging on, such as the first session after you install Claude Code or upgrade from a version without messaging, Claude Code binds the inbox and exports the variable as soon as the fetch completes. Hooks and processes that started before that point keep the variable unset, while later hooks and Bash commands see it. + * Each session exports its own socket, never one inherited from a parent session. + +Alongside the path, Claude Code exports a per-session token as [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>). A script posting to its own session’s socket can send `{"type":"auth","token":"<token>"}` as the first line of its connection. The own-child rules below say when Claude Code consults the token and how it treats a message it can’t verify. Claude Code runs messages arriving on the socket through the same inbound controls as any other peer message, with one exception and one prerequisite: + + * **Own-child messages** : when no `crossSessionInbound` value applies, Claude Code delivers a message it verifies came from the session’s own child processes, such as a hook or Bash command posting back to its own session’s socket. + * On Linux, including inside WSL 2, Claude Code can verify by process evidence even for a child that has already exited. On macOS it can verify that way only while the posting process is still running, and in a container where Claude Code runs as process ID 1 it has no process evidence at all. + * Where that process evidence is missing, on macOS after the posting process has exited and in containers where Claude Code runs as process ID 1, Claude Code verifies a child that sent the session’s exported [`CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>) as its first-line auth frame. + * When Claude Code can verify neither way, it treats the message like any other that asserts no permission class, so a session that bypasses permission prompts holds it for your approval. * **Sandboxed sessions** : control whether a Bash command can reach the socket from inside the [sandbox](</docs/en/sandboxing>) with the sandbox’s Unix-socket settings, [`sandbox.network.allowAllUnixSockets` and `sandbox.network.allowUnixSockets`](</docs/en/settings#sandbox-settings>). ##
modified Development containers View current →
--- a/devcontainer.md +++ b/devcontainer.md @@ -95,7 +95,7 @@ "DISABLE_AUTOUPDATER": "1" } -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) depend on, so sessions in the container can’t use either. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist. +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) depend on, so sessions in the container can’t use them. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist. ##
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -357,7 +357,7 @@ /reload-plugins -When the reload would invalidate the prompt cache, the command warns and skips until you rerun it with `--force`. Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. The skills count covers only each plugin’s `commands/` directory, not its `skills/` directory, so the summary can report `0 skills` even when the plugin’s skills reloaded. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. In that case `/reload-plugins` shows a warning and does not apply the reload; pass `--force` to apply anyway. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details. +When the reload would invalidate the prompt cache, the command warns and skips until you rerun it with `--force`. Claude Code reloads all active plugins and shows counts for plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. The skills count covers only each plugin’s `commands/` directory, not its `skills/` directory, so the summary can report `0 skills` even when the plugin’s skills reloaded. Reloading has a token cost on the next request: newly loaded components announce themselves in content appended to the conversation, while the existing history still reads from the prompt cache. A plugin that provides MCP servers costs more when its tools aren’t deferred by [tool search](</docs/en/mcp#scale-with-mcp-tool-search>): the change invalidates the cache and the next request re-reads the entire conversation. See [enabling or disabling a plugin](</docs/en/prompt-caching#enabling-or-disabling-a-plugin>) for details. ## @@ -417,8 +417,6 @@ export DISABLE_AUTOUPDATER=1 export FORCE_AUTOUPDATE_PLUGINS=1 - -This is useful when you want to manage Claude Code updates manually but still receive automatic plugin updates. ##
modified Environment variables View current →
Show diff (117 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -3,6 +3,7 @@ * Set environment variables in your shell or in a settings file * Check which value applies when a behavior can be set more than one way * Look up the variables Claude Code reads + * See which features stop working when a variable turns feature-flag fetching off ## @@ -210,7 +211,7 @@ `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting -`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files +`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/settings#settings-files>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later @@ -221,7 +222,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -272,7 +273,8 @@ `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout -`CLAUDE_CODE_MESSAGING_SOCKET`| 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 that socket’s path to hooks and Bash commands before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later +`CLAUDE_CODE_MESSAGING_SOCKET`| 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 that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later +`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` @@ -304,7 +306,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later -`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable +`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget @@ -327,9 +329,9 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` before the first query and resync every 10 minutes. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background -`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background +`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later @@ -363,7 +365,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -374,10 +376,10 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead @@ -440,6 +442,35 @@ ​ +Features that need feature-flag fetching + +Claude Code turns some features on through feature flags it fetches from Anthropic. `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` all turn flag fetching off when set to a value that disables them, and each variable’s row says which values do that. A session running with fetching off can’t use: + + * [Remote Control](</docs/en/remote-control#requirements>) + * [Cross-session messaging](</docs/en/cross-session-messaging#availability>) + * [`claude import` and the `/import` command](</docs/en/cli-reference#cli-commands>) + * [The `/schedule` command](</docs/en/routines#troubleshooting>) for creating routines from the CLI + * [The advisor tool](</docs/en/advisor#requirements>) + * [`/loop` self-pacing](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), so a `/loop` prompt with no interval runs on the fixed 10-minute schedule instead + * [The built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), so `/loop` with no prompt shows the usage message instead + +In such a session 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. + +### + +​ + +First session after an install or upgrade + +A feature in this list can be missing from your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features work differently in that first session: + + * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. + * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again. + +## + +​ + See also * [Settings](</docs/en/settings>): all `settings.json` configuration, including the `env` key
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -307,20 +307,32 @@ Auto mode could not evaluate this action and is blocking it for safety — a safety check separate from auto mode blocked this request because of earlier conversation content — it isn't about the action itself — run with --debug for details -Claude Code denies the action but tells Claude this isn’t a judgment that the action is unsafe, and to continue with other tasks rather than retry. These denials don’t count toward [auto mode’s pause thresholds](</docs/en/permission-modes#when-auto-mode-falls-back>). In [non-interactive mode](</docs/en/headless>) the run aborts with `Agent aborted: auto mode classifier request refused by the safety safeguard in headless mode`, since there is no user to prompt and the refusal repeats on every retry. Before v2.1.225, Claude Code counted these refusals toward the pause thresholds and returned the same rejection message as a genuine classifier block. **What to do:** +Claude Code denies the action but tells Claude this isn’t a judgment that the action is unsafe, and to continue with other tasks rather than retry. These denials don’t count toward [auto mode’s pause thresholds](</docs/en/permission-modes#when-auto-mode-falls-back>). In a [non-interactive](</docs/en/headless>) `-p` run, Claude Code doesn’t stop the run. What Claude receives depends on where it requested the action: + + * To a [background subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in a `-p` run without `--input-format stream-json`, Claude Code returns an error result containing `Agent aborted: auto mode classifier request refused by the safety safeguard in headless mode` + * Everywhere else, including interactive sessions and the main conversation of a `-p` run, Claude Code returns that denial to Claude + +Before v2.1.225, Claude Code counted these refusals toward the pause thresholds and returned the same rejection message as a genuine classifier block. **What to do:** * This is not a decision about your action. Content already in your conversation triggered a safety filter on the API when auto mode sent the conversation to the classifier * Retrying will not help; the same conversation content will trigger the filter again - * Switch to a different [permission mode](</docs/en/permission-modes>) so you can approve the action when prompted, or start a fresh conversation without the triggering content + * In an interactive session, switch to a different [permission mode](</docs/en/permission-modes>) so you can approve the action when prompted + * Start a fresh conversation without the triggering content When the conversation has grown larger than the classifier’s context window: Auto mode classifier transcript exceeded context window — falling back to manual approval (try /compact to reduce conversation size) -In an interactive session, auto mode falls back to a normal permission prompt for that action so you can approve or deny it manually. In [non-interactive mode](</docs/en/headless>) the run aborts because the transcript only grows and retrying can’t succeed. **What to do:** - - * Approve or deny the action in the prompt that appears - * Run `/compact` to reduce the conversation size so subsequent actions fit within the classifier window again +What happens to the action depends on where Claude requested it: + + * In an interactive session, auto mode falls back to a normal permission prompt for that action so you can approve or deny it manually + * To a [background subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in a [non-interactive](</docs/en/headless>) `-p` run without `--input-format stream-json`, Claude Code returns an error result containing `Agent aborted: auto mode classifier transcript exceeded context window in headless mode`, and the run continues + * Elsewhere in a `-p` run without a [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>), there is no prompt to fall back to, so the action doesn’t run and the run continues + +**What to do:** + + * In an interactive session, approve or deny the action in the prompt that appears + * In an interactive session, run `/compact` to reduce the conversation size so subsequent actions fit within the classifier window again ###
modified Fullscreen rendering View current →
--- a/fullscreen.md +++ b/fullscreen.md @@ -10,7 +10,7 @@ Enable fullscreen rendering -Run `/tui fullscreen` inside any Claude Code conversation. The CLI saves the [`tui` setting](</docs/en/settings#available-settings>) and relaunches into fullscreen with your conversation intact, so you can switch mid-session without losing context. Run `/tui default` to switch back to the classic renderer, or `/tui` with no argument to print which renderer is active. In [screen reader mode](</docs/en/accessibility>), Claude Code always uses the classic renderer except in attached [background sessions](</docs/en/agent-view>), which still render fullscreen. If you run `/tui fullscreen` in any other session, Claude Code prints an explanation instead of switching and doesn’t change the saved `tui` setting. The relaunched session keeps the conversation as it appears on screen. If you ran [`/rewind`](</docs/en/checkpointing#rewind-and-summarize>) earlier in the session, the relaunch resumes from the rewound point rather than the longer transcript saved on disk. If you rewound to before your first message, the relaunched session starts empty. You can also set the `CLAUDE_CODE_NO_FLICKER` environment variable before starting Claude Code: +Run `/tui fullscreen` inside any Claude Code conversation. The CLI saves the [`tui` setting](</docs/en/settings#available-settings>) and relaunches into fullscreen with your conversation intact, so you can switch mid-session without losing context. Run `/tui default` to switch back to the classic renderer, or `/tui` with no argument to print which renderer is active. In [screen reader mode](</docs/en/accessibility>), Claude Code always uses the classic renderer except in attached [background sessions](</docs/en/agent-view>), which still render fullscreen. If you run `/tui fullscreen` in any other session, Claude Code prints an explanation instead of switching and doesn’t change the saved `tui` setting. The relaunched session keeps the conversation as it appears on screen. Claude Code also carries over the model you last picked with [`/model`](</docs/en/model-config#setting-your-model>). If you ran [`/rewind`](</docs/en/checkpointing#rewind-and-summarize>) earlier in the session, the relaunch resumes from the rewound point rather than the longer transcript saved on disk. If you rewound to before your first message, the relaunched session starts empty. You can also set the `CLAUDE_CODE_NO_FLICKER` environment variable before starting Claude Code: CLAUDE_CODE_NO_FLICKER=1 claude
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -236,7 +236,7 @@ claude -p "Run the test suite and fix any failures" \ --allowedTools "Bash,Read,Edit" -To set a baseline for the whole session instead of listing individual tools, pass a [permission mode](</docs/en/permission-modes>). `dontAsk` denies anything not in your `permissions.allow` rules or the [read-only command set](</docs/en/permissions#read-only-commands>), which is useful for locked-down CI runs. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) are denied even when an allow rule matches. `acceptEdits` lets Claude write files without prompting and also auto-approves common filesystem commands such as `mkdir`, `touch`, `mv`, and `cp`. Other shell commands and network requests still need an `--allowedTools` entry or a `permissions.allow` rule, otherwise the run aborts when one is attempted: +To set a baseline for the whole session instead of listing individual tools, pass a [permission mode](</docs/en/permission-modes>). `dontAsk` denies anything not in your `permissions.allow` rules or the [read-only command set](</docs/en/permissions#read-only-commands>), which is useful for locked-down CI runs. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) are denied even when an allow rule matches. `acceptEdits` lets Claude write files without prompting and also auto-approves common filesystem commands such as `mkdir`, `touch`, `mv`, and `cp`. Apart from the [read-only command set](</docs/en/permissions#read-only-commands>), other shell commands and network requests still need an `--allowedTools` entry or a `permissions.allow` rule. See [what `acceptEdits` auto-approves](</docs/en/permission-modes#auto-approve-file-edits-with-acceptedits-mode>) for the full list. This example applies lint fixes with `acceptEdits` as the baseline: claude -p "Apply the lint fixes" --permission-mode acceptEdits
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -707,8 +707,6 @@ } } -For full matcher syntax, see the [Hooks reference](</docs/en/hooks#configuration>). - #### ​
modified Connect to external tools with MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -157,7 +157,7 @@ * Set [`MCP_CONNECTION_NONBLOCKING`](</docs/en/env-vars>) to `0` to block on the whole connection batch. Claude Code caps that wait at 5 seconds by default. Adjust the cap with the [`MCP_CONNECT_TIMEOUT_MS`](</docs/en/env-vars>) environment variable, in milliseconds. Servers still pending at that deadline keep connecting in the background. * Set `alwaysLoad: true` on a server’s config to make its tools available at their full schemas on the first turn, [exempt from tool search deferral](</docs/en/mcp#exempt-a-server-from-deferral>). Claude Code waits at startup for that server’s tools, capped at the same deadline, while other servers keep connecting in the background; a remote server with a cached tool list supplies them without connecting, per the table above. -The `system` message with subtype `init` reports each server’s status at the moment it’s emitted. Check for status `failed` or `needs-auth` when you want to detect servers that won’t be usable, rather than treating every status other than `connected` as a failure; see Error handling for the full status check. +The `system` message with subtype `init` reports each server’s status at the moment it’s emitted; see Error handling for reading those statuses. ## @@ -221,7 +221,7 @@ Discover available tools -To see what tools an MCP server provides, check the server’s documentation or inspect the `tools` array in the `system` init message. MCP tool names start with `mcp__`. Claude Code emits the init message after the first-turn connection wait for servers passed in `options.mcpServers`, so the `tools` array lists the `mcp__` tools of each such server that connected within the wait. A server with a cached tool list shows `pending` with its `mcp__` tools already listed and a connection made on first use. Any other server that hasn’t connected when the message is emitted, including settings-file servers that don’t get the full wait, shows its current status, such as `pending`, `failed`, or `needs-auth`, with its tools absent; see Error handling for the full status set. This filter prints the MCP tool names: +To see what tools an MCP server provides, check the server’s documentation or inspect the `tools` array in the `system` init message. MCP tool names start with `mcp__`. Claude Code emits the init message after the first-turn connection wait for servers passed in `options.mcpServers`, so the `tools` array lists the `mcp__` tools of each server that has connected by then, plus those of servers with a cached tool list, which connect on first use. Tools of any other server that hasn’t connected are absent; see Error handling for reading each server’s status. This filter prints the MCP tool names: TypeScript @@ -278,11 +278,7 @@ stdio servers -Local processes that communicate via stdin/stdout. Use this for MCP servers you run on the same machine: - - * In code - - * .mcp.json +Local processes that communicate via stdin/stdout. Use this for MCP servers you run on the same machine. For the `.mcp.json` form, use the same fields shown at From a config file. In code, pass the command and its arguments: TypeScript @@ -313,15 +309,6 @@ }, allowed_tools=["mcp__filesystem__read_file", "mcp__filesystem__list_directory"], ) - - { - "mcpServers": { - "filesystem": { - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"] - } - } - } ### @@ -893,7 +880,7 @@ Connection timeouts -MCP server connections time out after 30 seconds by default. If your server takes longer to start, the connection fails. Raise the limit with the [`MCP_TIMEOUT`](</docs/en/env-vars>) environment variable, in milliseconds. For servers that need more startup time, also consider: +MCP server connections time out after 30 seconds by default. Claude Code applies that limit to the connection attempt only; to change how long a running tool call may take, set [`MCP_TOOL_TIMEOUT`](</docs/en/env-vars>). If your server takes longer to start, the connection fails. Raise the connection limit with the [`MCP_TIMEOUT`](</docs/en/env-vars>) environment variable, in milliseconds. For servers that need more startup time, also consider: * Using a lighter-weight server if available * Pre-warming the server before starting your agent
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -293,7 +293,7 @@ Block specific tools, commands, or file paths| Managed settings: `permissions.deny` Enforce sandbox isolation| Managed settings: `sandbox.enabled` Environment variables and API provider routing| Managed settings: `env` -Authentication method and organization lock| Managed settings: `forceLoginMethod`, `forceLoginOrgUUID` +Login method and organization restrictions| Managed settings: `forceLoginMethod`, `forceLoginOrgUUID` Code style and quality guidelines| Managed CLAUDE.md Data handling and compliance reminders| Managed CLAUDE.md Behavioral instructions for Claude| Managed CLAUDE.md @@ -359,7 +359,7 @@ ├── api-conventions.md # API design decisions └── ... # Any other topic files Claude creates -`MEMORY.md` acts as an index of the memory directory. Claude reads and writes files in this directory throughout your session, using `MEMORY.md` to keep track of what’s stored where. Auto memory is machine-local. All worktrees and subdirectories within the same git repository share one auto memory directory. Files are not shared across machines or cloud environments. +`MEMORY.md` acts as an index of the memory directory. Claude reads and writes files in this directory throughout your session, using `MEMORY.md` to keep track of what’s stored where. Auto memory is machine-local. All worktrees and subdirectories within the same git repository share one auto memory directory. Files are not shared across machines or cloud environments. Claude Code deletes old session transcripts after the [`cleanupPeriodDays`](</docs/en/settings#available-settings>) retention period, but excludes the files in the memory directory from that [retention sweep](</docs/en/claude-directory#cleaned-up-automatically>). `MEMORY.md` and topic files stay until you or Claude edits or deletes them. ###
modified Modifying system prompts View current →
--- a/modifying-system-prompts.md +++ b/modifying-system-prompts.md @@ -50,7 +50,7 @@ CLAUDE.md files for project-level instructions -CLAUDE.md files give Claude persistent project context and instructions. The SDK injects their content into the conversation, not into the system prompt, so they work with any system prompt configuration. For what to put in CLAUDE.md, where to place it, and how to write effective instructions, see [How Claude remembers your project](</docs/en/memory>). This section covers what’s specific to the SDK: how CLAUDE.md loads. The SDK reads CLAUDE.md when the matching setting source is enabled: `'project'` loads `CLAUDE.md` or `.claude/CLAUDE.md` from the working directory, and `'user'` loads `~/.claude/CLAUDE.md`. Default `query()` options enable both sources, so CLAUDE.md loads automatically. If you set `settingSources` in TypeScript or `setting_sources` in Python explicitly, include the sources you need. CLAUDE.md loading is controlled by setting sources, not by the `claude_code` preset. +CLAUDE.md files give Claude persistent project context and instructions. The SDK injects their content into the conversation and leaves the system prompt untouched, so they work with any system prompt configuration. For what to put in CLAUDE.md, where to place it, and how to write effective instructions, see [When to add to CLAUDE.md](</docs/en/memory#when-to-add-to-claude-md>) and the rest of [How Claude remembers your project](</docs/en/memory>). This section covers what’s specific to the SDK: how CLAUDE.md loads. The SDK reads CLAUDE.md when the matching setting source is enabled: `'project'` loads `CLAUDE.md` or `.claude/CLAUDE.md` from the working directory, and `'user'` loads `~/.claude/CLAUDE.md`. Default `query()` options enable both sources, so CLAUDE.md loads automatically. If you set `settingSources` in TypeScript or `setting_sources` in Python explicitly, include the sources you need. CLAUDE.md loading is controlled by setting sources, not by the `claude_code` preset. #### @@ -217,7 +217,7 @@ Improve prompt caching across users and machines -By default, two sessions that use the same `claude_code` preset and `append` text still cannot share a prompt cache entry if they run from different working directories. This is because the preset embeds per-session context in the system prompt ahead of your `append` text: the working directory, whether it’s a git repository, the platform, the active shell, the OS version, and auto-memory paths. Any difference in that context produces a different system prompt and a cache miss. CLAUDE.md content doesn’t affect the system prompt cache because the SDK injects it into the conversation, not the system prompt. To make the system prompt identical across sessions, set `excludeDynamicSections: true` in TypeScript or `"exclude_dynamic_sections": True` in Python. The per-session context moves into the first user message, leaving only the static preset and your `append` text in the system prompt so identical configurations share a cache entry across users and machines. +By default, two sessions that use the same `claude_code` preset and `append` text still cannot share a prompt cache entry if they run from different working directories. This is because the preset embeds per-session context in the system prompt ahead of your `append` text: the working directory, whether it’s a git repository, the platform, the active shell, the OS version, and auto memory paths. Any difference in that context produces a different system prompt and a cache miss. CLAUDE.md content doesn’t affect the system prompt cache because the SDK injects it into the conversation, not the system prompt. To make the system prompt identical across sessions, set `excludeDynamicSections: true` in TypeScript or `"exclude_dynamic_sections": True` in Python. The per-session context moves into the first user message, leaving only the static preset and your `append` text in the system prompt so identical configurations share a cache entry across users and machines. `excludeDynamicSections` requires `@anthropic-ai/claude-agent-sdk` v0.2.98 or later, or `claude-agent-sdk` v0.1.58 or later for Python. It applies only to the preset object form and has no effect when `systemPrompt` is a string. @@ -263,7 +263,7 @@ asyncio.run(main()) -**Tradeoffs:** the working directory, the git-repo flag, the platform, the active shell, the OS version, and auto-memory paths still reach Claude, but as part of the first user message rather than the system prompt. Instructions in the user message carry marginally less weight than the same text in the system prompt, so Claude may rely on them less strongly when reasoning about the current directory or auto-memory paths. Enable this option when cross-session cache reuse matters more than maximally authoritative environment context. For the equivalent flag in non-interactive CLI mode, see [`--exclude-dynamic-system-prompt-sections`](</docs/en/cli-reference>). +**Tradeoffs:** the working directory, the git-repo flag, the platform, the active shell, the OS version, and auto memory paths still reach Claude, but as part of the first user message rather than the system prompt. Instructions in the user message carry marginally less weight than the same text in the system prompt, so Claude may rely on them less strongly when reasoning about the current directory or auto memory paths. Enable this option when cross-session cache reuse matters more than maximally authoritative environment context. For the equivalent flag in non-interactive CLI mode, see [`--exclude-dynamic-system-prompt-sections`](</docs/en/cli-reference>). ### @@ -349,67 +349,6 @@ **Scope**| Project-specific| User or project| Code session| Code session “With append” means using `systemPrompt: { type: "preset", preset: "claude_code", append: "..." }` in TypeScript or `system_prompt={"type": "preset", "preset": "claude_code", "append": "..."}` in Python. CLAUDE.md doesn’t change the system prompt itself: the SDK injects its content into the conversation as project context. - -## - -​ - -Use cases and best practices - -### - -​ - -When to use CLAUDE.md - -Use CLAUDE.md for instructions that should apply to every session in a project, regardless of which system prompt the session uses: coding standards, common commands, architecture context, and team conventions. CLAUDE.md is committed to your repository, so it stays in sync with the code it describes. See [When to add to CLAUDE.md](</docs/en/memory#when-to-add-to-claude-md>) for full guidance. - -### - -​ - -When to use output styles - -Output styles are for personas you want to reuse across the CLI and SDK without changing application code. Because they live as files in `.claude/output-styles`, the same persona is available from `/config` in the CLI and from any SDK session that loads the matching setting source. **Best for:** - - * Persistent behavior changes across sessions - * Team-shared configurations - * Specialized assistants like a code reviewer, data scientist, or DevOps assistant - * Complex prompt modifications that need versioning - -**Examples:** - - * Creating a dedicated SQL optimization assistant - * Building a security-focused code reviewer - * Developing a teaching assistant with specific pedagogy - -### - -​ - -When to use `systemPrompt` with append - -Use `append` when the `claude_code` preset already fits your product and you only need to layer in extra instructions. You keep the preset’s tool guidance, safety rules, and coding conventions without reimplementing them. **Best for:** - - * Adding specific coding standards or preferences - * Customizing output formatting - * Adding domain-specific knowledge - * Modifying response verbosity - * Enhancing Claude Code’s default behavior without losing tool instructions - -### - -​ - -When to use custom `systemPrompt` - -Use a custom prompt when your agent’s surface, identity, or permission model differs from Claude Code’s, as described in Decide on a starting point. You define the full instruction set, including any tool guidance and safety rules your agent needs. **Best for:** - - * Complete control over Claude’s behavior - * Specialized single-session tasks - * Testing new prompt strategies - * Situations where default tools aren’t needed - * Building specialized agents with unique behavior ##
modified Choose a permission mode View current →
--- a/permission-modes.md +++ b/permission-modes.md @@ -194,7 +194,7 @@ * Modifying shared infrastructure * Irreversibly destroying files that existed before the session * Force push - * Committing or pushing a change that would send secrets or sensitive data outside the repository when it runs, or widen what a deploy exposes. This covers a CI workflow or deploy configuration that hands a secret to a destination that doesn’t already receive it, a script or setup step that reads a secret store and sends the data out, and a config change that widens what a deploy publishes, such as a registry, visibility, artifact, or sourcemap setting. The check applies on any branch, applies even when the repository is public, and fires when the change lands, whether or not that landing triggers the pipeline; clearing it requires naming the execution effect, not only the commit or push. Before v2.1.211, this check was scoped to the default branch instead: a push there was blocked when it carried sensitive content, changes concealed or misdescribed relative to what you asked for, content ported in from outside the repository, or routed around a review you asked for, and before v2.1.203 any direct push to the default branch was blocked + * Committing or pushing a change that would send secrets or sensitive data outside the repository when it runs, or widen what a deploy exposes. This covers a CI workflow or deploy configuration that hands a secret to a destination that doesn’t already receive it, a script or setup step that reads a secret store and sends the data out, and a config change that widens what a deploy publishes, such as a registry, visibility, artifact, or sourcemap setting. The check applies on any branch, applies even when the repository is public, and fires when the change lands, whether or not that landing triggers the pipeline; clearing it requires naming the execution effect, not only the commit or push. Before v2.1.211, this check was scoped to the default branch instead: a push there was blocked when it carried sensitive content, changes concealed or misdescribed relative to what you asked for, content ported in from outside the repository, or routed around a review you asked for * `git reset --hard`, `git checkout -- .`, `git restore .`, `git clean -fd`, `git stash drop`, or `git stash clear`, which the classifier presumes would discard uncommitted changes * `git commit --amend` when the commit at HEAD was not created in this session * From v2.1.198, `git commit --amend` when the commit at HEAD has already been pushed. A message-only reword is not blocked: `--amend -m` with nothing newly staged, on a commit that Claude created during this session
modified Constrain plugin dependency versions View current →
--- a/plugin-dependencies.md +++ b/plugin-dependencies.md @@ -14,7 +14,7 @@ Declare a dependency with a version constraint -List dependencies in the `dependencies` array of your plugin’s `.claude-plugin/plugin.json`. Each entry is either a plugin name or an object with a version constraint. The following manifest declares one unversioned dependency and one constrained dependency: +List dependencies in the `dependencies` array of your plugin’s `.claude-plugin/plugin.json`. The following manifest declares one unversioned dependency and one constrained dependency: .claude-plugin/plugin.json
modified Create and distribute a plugin marketplace View current →
--- a/plugin-marketplaces.md +++ b/plugin-marketplaces.md @@ -836,16 +836,9 @@ Version resolution and release channels -Plugin versions determine cache paths and update detection: if the resolved version matches what a user already has, `/plugin update` and auto-update skip the plugin. Claude Code resolves a plugin’s version from the first of these that is set: - - 1. `version` in the plugin’s `plugin.json` - 2. `version` in the plugin’s marketplace entry - 3. The git commit SHA of the plugin’s source - 4. For `archive` sources, the `sha256` pin in the marketplace entry, or the digest of the downloaded file when you set no pin - -For the git-based source types `github`, `url`, `git-subdir`, and relative paths inside a git-hosted marketplace, you can omit `version` entirely. This is the simplest setup for internal or actively-developed plugins. - -Setting `version` pins the plugin. If you declare `"version": "1.0.0"` in `plugin.json` and push new commits without changing that string, existing users keep the cached copy, because Claude Code sees the same version. Bump the field on every release, or omit it to fall back to the resolved version above.Avoid setting `version` in both `plugin.json` and the marketplace entry. Claude Code always uses the `plugin.json` value without warning, so a stale manifest version can mask a version you set in `marketplace.json`. +Plugin versions determine cache paths and update detection: if the resolved version matches what a user already has, `/plugin update` and auto-update skip the plugin. For git-based sources, if you omit `version`, Claude Code uses the source’s resolved commit SHA, so users get an update whenever that commit changes; this is the simplest setup for internal or actively developed plugins. See [Version management](</docs/en/plugins-reference#version-management>) for the full resolution order, including `archive` sources. + +Setting `version` pins the plugin. If you declare `"version": "1.0.0"` in `plugin.json` and push new commits without changing that string, existing users keep the cached copy, because Claude Code sees the same version. Bump the field on every release, or omit it to fall back to the resolved version.Avoid setting `version` in both `plugin.json` and the marketplace entry. Claude Code always uses the `plugin.json` value without warning, so a stale manifest version can mask a version you set in `marketplace.json`. #### @@ -1187,7 +1180,7 @@ export CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1 -With this variable set, Claude Code retains the stale marketplace clone on `git pull` failure and continues using the last-known-good state. For fully offline deployments where the repository will never be reachable, use `CLAUDE_CODE_PLUGIN_SEED_DIR` to pre-populate the plugins directory at build time instead. +For fully offline deployments where the repository will never be reachable, use `CLAUDE_CODE_PLUGIN_SEED_DIR` to pre-populate the plugins directory at build time instead. ###
modified Plugins in the SDK View current →
--- a/plugins.md +++ b/plugins.md @@ -1,19 +1,9 @@ -Plugins allow you to extend Claude Code with custom functionality that can be shared across projects. Through the Agent SDK, you can programmatically load plugins from local directories to add skills, agents, hooks, and MCP servers to your agent sessions. - -## - -​ - -What are plugins? - -Plugins are packages of Claude Code extensions that can include: - - * **Skills** : Model-invoked capabilities that Claude uses autonomously (can also be invoked with `/skill-name`) - * **Agents** : Specialized subagents for specific tasks - * **Hooks** : Event handlers that respond to tool use and other events - * **MCP servers** : External tool integrations via Model Context Protocol - -The `commands/` directory is a legacy format. Use `skills/` for new plugins. Claude Code continues to support both formats for backward compatibility. +Plugins allow you to extend Claude Code with custom functionality that can be shared across projects. Through the Agent SDK, you can programmatically load plugins from local directories to add capabilities to your agent sessions. A plugin can include: + + * **Skills** : capabilities Claude invokes autonomously when relevant. You can also invoke a plugin skill directly with `/plugin-name:skill-name`. + * **Agents** : specialized subagents for specific tasks + * **Hooks** : event handlers that respond to tool use and other events + * **MCP servers** : external tool integrations via Model Context Protocol For complete information on plugin structure and how to create plugins, see [Plugins](</docs/en/plugins>). @@ -69,10 +59,10 @@ Plugin paths can be: - * **Relative paths** : Resolved relative to your current working directory (for example, `"./plugins/my-plugin"`) - * **Absolute paths** : Full file system paths (for example, `"/home/user/plugins/my-plugin"`) - -The path should point to the plugin’s root directory: the parent of `skills/`, `agents/`, `hooks/`, `commands/` (legacy), or `.claude-plugin/`, not a subdirectory. + * **Relative paths** : resolved relative to your current working directory (for example, `"./plugins/my-plugin"`) + * **Absolute paths** : full file system paths (for example, `"/home/user/plugins/my-plugin"`) + +The path should point to the plugin’s root directory: the parent of `skills/`, `agents/`, `hooks/`, `commands/`, or `.claude-plugin/`. ## @@ -275,10 +265,10 @@ my-plugin/ ├── .claude-plugin/ │ └── plugin.json # Plugin manifest (optional, components auto-discovered without it) - ├── skills/ # Agent Skills (invoked autonomously or via /skill-name) + ├── skills/ # Agent Skills (invoked autonomously or via /plugin-name:skill-name) │ └── my-skill/ │ └── SKILL.md - ├── commands/ # Legacy: use skills/ instead + ├── commands/ # Skills as flat .md files │ └── custom-cmd.md ├── agents/ # Custom agents │ └── specialist.md @@ -286,6 +276,8 @@ │ └── hooks.json └── .mcp.json # MCP server definitions +The `commands/` directory holds skills as flat Markdown files. Use `skills/` for new plugins. Claude Code supports both locations. + ## ​ @@ -321,7 +313,7 @@ If your plugin doesn’t appear in the init message: - 1. **Check the path** : ensure the path points to the plugin root directory, the parent of `skills/`, `agents/`, `hooks/`, `commands/` (legacy), or `.claude-plugin/` + 1. **Check the path** : ensure the path points to the plugin root directory, the parent of `skills/`, `agents/`, `hooks/`, `commands/`, or `.claude-plugin/` 2. **Validate plugin.json** : if your plugin includes a manifest, ensure it has valid JSON syntax 3. **Check file permissions** : ensure the plugin directory is readable 4. **Confirm the directory exists** : the SDK skips a nonexistent path, and the plugin doesn’t appear in the init message’s `plugins` list
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -156,13 +156,7 @@ Looking to use LSP plugins? Install them from the official marketplace: search for “lsp” in the `/plugin` Discover tab. This section documents how to create LSP plugins for languages not covered by the official marketplace. -Plugins can provide [Language Server Protocol](<https://microsoft.github.io/language-server-protocol/>) (LSP) servers to give Claude real-time code intelligence while working on your codebase. LSP integration provides: - - * **Instant diagnostics** : Claude sees errors and warnings immediately after each edit - * **Code navigation** : go to definition, find references, and hover information - * **Language awareness** : type information and documentation for code symbols - -**Location** : `.lsp.json` in plugin root, or inline in `plugin.json` **Format** : JSON configuration mapping language server names to their configurations **`.lsp.json` file format**: +Plugins can provide [Language Server Protocol](<https://microsoft.github.io/language-server-protocol/>) (LSP) servers to give Claude [real-time code intelligence](</docs/en/discover-plugins#code-intelligence>) while working on your codebase. **Location** : `.lsp.json` in plugin root, or inline in `plugin.json` **Format** : JSON configuration mapping language server names to their configurations **`.lsp.json` file format**: { "go": { @@ -262,7 +256,7 @@ ---|--- `when`| Controls when the monitor starts. `"always"` starts it at session start and on plugin reload, and is the default. `"on-skill-invoke:<skill-name>"` starts it the first time the named skill in this plugin is dispatched -The `command` value supports the path substitutions `${CLAUDE_PLUGIN_ROOT}`, `${CLAUDE_PLUGIN_DATA}`, and `${CLAUDE_PROJECT_DIR}`, plus any `${ENV_VAR}` from the environment. Prefix the command with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs to run from the plugin’s own directory. A monitor `command` can’t reference `${user_config.*}` values. The command runs through a shell, so Claude Code rejects the monitor with an [error](</docs/en/errors#plugin-command-references-user-config>) instead of substituting the value. Monitor processes don’t receive `CLAUDE_PLUGIN_OPTION_<KEY>` environment variables, so have the monitor script read the value from a config file it owns. Before v2.1.207, monitor commands substituted `${user_config.*}` values. If you disable a plugin mid-session, Claude Code doesn’t stop monitors that are already running; they stop when the session ends. +The `command` value supports the path substitutions `${CLAUDE_PLUGIN_ROOT}`, `${CLAUDE_PLUGIN_DATA}`, and `${CLAUDE_PROJECT_DIR}`, plus any `${ENV_VAR}` from the environment. Prefix the command with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs to run from the plugin’s own directory. A monitor `command` can’t reference `${user_config.*}` values. The command runs through a shell, so Claude Code rejects the monitor with an [error](</docs/en/errors#plugin-command-references-user-config>) instead of substituting the value. Monitor processes don’t receive `CLAUDE_PLUGIN_OPTION_<KEY>` environment variables, so have the monitor script read the value from a config file it owns. If you disable a plugin mid-session, Claude Code doesn’t stop monitors that are already running; they stop when the session ends. ### @@ -358,7 +352,7 @@ Plugin manifest schema -The `.claude-plugin/plugin.json` file defines your plugin’s metadata and configuration. This section documents all supported fields and options. The manifest is optional. If omitted, Claude Code auto-discovers components in default locations and derives the plugin name from the directory name. Use a manifest when you need to provide metadata or custom component paths. +The `.claude-plugin/plugin.json` file defines your plugin’s metadata and configuration. The manifest is optional. If omitted, Claude Code auto-discovers components in default locations and derives the plugin name from the directory name. Use a manifest when you need to provide metadata or custom component paths. ### @@ -586,7 +580,7 @@ * **Adds to the default** : `skills`. The default `skills/` directory is always scanned, and directories listed in `skills` are loaded alongside it. Exception: for a [marketplace entry whose `source` resolves to the marketplace root](</docs/en/plugin-marketplaces#advanced-plugin-entries>), declaring specific subdirectories replaces the default `skills/` scan * **Own merge rules** : hooks, MCP servers, and LSP servers. See each section for how multiple sources combine -When a plugin has both a default folder and the matching manifest key, Claude Code v2.1.140 and later warns about the ignored folder in `claude plugin list` and the `/plugin` detail view. The plugin still loads using the manifest paths. Claude Code doesn’t warn when the manifest key points into the default folder, for example `"commands": ["./commands/deploy.md"]`, because that path names the folder explicitly. For all path fields: +When a plugin has both a default folder and the matching manifest key, Claude Code warns about the ignored folder in `claude plugin list` and the `/plugin` detail view. The plugin still loads using the manifest paths. Claude Code doesn’t warn when the manifest key points into the default folder, for example `"commands": ["./commands/deploy.md"]`, because that path names the folder explicitly. For all path fields: * All paths must be relative to the plugin root and start with `./`, except that the `skills` field also accepts `"."` * Both `"."` and `"./"` denote the plugin root itself @@ -705,7 +699,7 @@ * Through `claude --plugin-dir` or `claude --plugin-url`, for the duration of a session. * Through a marketplace, installed for future sessions. -For security and verification purposes, Claude Code copies _marketplace_ plugins to the user’s local **plugin cache** (`~/.claude/plugins/cache`) rather than using them in-place. Each installed version is a separate directory in the cache, grouped by marketplace and plugin and named for the resolved version, with its own copy of the plugin’s files and Node.js package dependencies. A dependency resolved from a [release tag](</docs/en/plugin-dependencies#tag-plugin-releases-for-version-resolution>) gets a directory name with a commit-SHA suffix. When you update or uninstall a plugin, Claude Code marks the previous version directory as orphaned and removes it in a background sweep roughly 14 days later. The grace period lets concurrent Claude Code sessions that already loaded the old version keep running without errors. Claude Code runs the sweep only while at least one plugin is installed; after you uninstall your last plugin, orphaned directories stay on disk until you install a plugin again. Claude’s Glob and Grep tools skip orphaned version directories during searches, so file results don’t include outdated plugin code. +For security and verification purposes, Claude Code copies _marketplace_ plugins to the user’s local **plugin cache** (`~/.claude/plugins/cache`) rather than using them in-place. Each installed version is a separate directory in the cache, grouped by marketplace and plugin and named for the resolved version, with its own copy of the plugin’s files and Node.js package dependencies. A dependency resolved from a [release tag](</docs/en/plugin-dependencies#tag-plugin-releases-for-version-resolution>) gets a directory name with a commit-SHA suffix. When you update or uninstall a plugin, Claude Code marks the previous version directory as orphaned and removes it in a background sweep roughly 14 days later. The grace period lets concurrent Claude Code sessions that already loaded the old version keep running without errors. Claude Code runs the sweep only while at least one plugin is installed; after you uninstall your last plugin, orphaned directories stay on disk until you install a plugin again. Claude Code removes a plugin or marketplace folder from the cache only when it no longer contains any directory or symlink. If you symlink a development checkout into the cache as a plugin’s version entry, Claude Code never marks the link as orphaned and never removes it or the folders that hold it. Claude Code also never writes its version-tracking files inside the linked checkout. Claude’s Glob and Grep tools skip orphaned version directories during searches, so file results don’t include outdated plugin code. ###
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -237,7 +237,7 @@ Cache scope -In Claude Code, the cache is effectively scoped to one machine and directory. The system prompt embeds the working directory, platform, shell, OS version, and auto-memory paths, so two sessions in different directories build different prefixes and miss each other’s cache. That includes worktrees of the same repository, since each worktree has its own working directory. Sessions you run in parallel in the same directory build matching prefixes and read each other’s cache. Sequential sessions share the prefix only when the git status snapshot at startup matches, since the system prompt also captures branch and recent commits. The underlying API cache is broader. Caches are isolated between organizations, and on some providers, [between workspaces within an organization](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#cache-storage-and-sharing>). Within those boundaries, any two requests with the same model and prefix read the same cache. For Agent SDK callers running fleets of automated processes, see [improve prompt caching across users and machines](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) to suppress the per-machine sections of the system prompt and share the cache across machines. +In Claude Code, the cache is effectively scoped to one machine and directory. The system prompt embeds the working directory, platform, shell, OS version, and auto memory paths, so two sessions in different directories build different prefixes and miss each other’s cache. That includes worktrees of the same repository, since each worktree has its own working directory. Sessions you run in parallel in the same directory build matching prefixes and read each other’s cache. Sequential sessions share the prefix only when the git status snapshot at startup matches, since the system prompt also captures branch and recent commits. The underlying API cache is broader. Caches are isolated between organizations, and on some providers, [between workspaces within an organization](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching#cache-storage-and-sharing>). Within those boundaries, any two requests with the same model and prefix read the same cache. For Agent SDK callers running fleets of automated processes, see [improve prompt caching across users and machines](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) to suppress the per-machine sections of the system prompt and share the cache across machines. ##
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -928,7 +928,7 @@ `max_thinking_tokens`| `int | None`| `None`| _Deprecated_ \- Maximum tokens for thinking blocks. Use `thinking` instead `thinking`| `ThinkingConfig` ` | None`| `None`| Controls extended thinking behavior. Takes precedence over `max_thinking_tokens` `effort`| `EffortLevel` ` | None`| `None`| Effort level for thinking depth. See [adjust the effort level](</docs/en/model-config#adjust-effort-level>) -`session_store`| [`SessionStore`](</docs/en/agent-sdk/session-storage#the-sessionstore-interface>) ` | None`| `None`| Mirror session transcripts to an external backend so any host can resume them. See [Persist sessions to external storage](</docs/en/agent-sdk/session-storage>) +`session_store`| [`SessionStore`](</docs/en/agent-sdk/session-storage#the-sessionstore-interface>) ` | None`| `None`| Mirror session transcripts to an external backend so another host can resume them. See [Persist sessions to external storage](</docs/en/agent-sdk/session-storage>) `session_store_flush`| `Literal["batched", "eager"]`| `"batched"`| When to flush mirrored transcript entries to `session_store`. `"batched"` flushes once per turn or when the buffer fills; `"eager"` triggers a background flush after every frame. Ignored when `session_store` is `None` `load_timeout_ms`| `int`| `60000`| Per-call timeout for `session_store.load()` and `list_subkeys()` during resume materialization, in milliseconds `task_budget`| `TaskBudget | None`| `None`| API-side token budget. Sent as `output_config.task_budget` with the `task-budgets-2026-03-13` beta header. Pass `{"total": <int>}`. @@ -994,7 +994,7 @@ `type`| Yes| Must be `"preset"` to use a preset system prompt `preset`| Yes| Must be `"claude_code"` to use Claude Code’s system prompt `append`| No| Additional instructions to append to the preset system prompt -`exclude_dynamic_sections`| No| Move per-session context such as working directory, the git-repo flag, and auto-memory paths from the system prompt into the first user message. Improves prompt-cache reuse across users and machines. See [Modify system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) +`exclude_dynamic_sections`| No| Move per-session context such as working directory, the git-repo flag, and auto memory paths from the system prompt into the first user message. Improves prompt-cache reuse across users and machines. See [Modify system prompts](</docs/en/agent-sdk/modifying-system-prompts#improve-prompt-caching-across-users-and-machines>) ### @@ -2625,6 +2625,7 @@ "inference_geo": str | None, "speed": str | None, "iterations": Any | None, + "output_tokens_details": {"thinking_tokens": int | None} | None, }, "toolStats": { # Aggregate tool activity for the run "readCount": int, @@ -2637,8 +2638,8 @@ "frameCount": int | None, } | None, "prompt": str, # The prompt the agent ran - "worktreePath": str | None, # Present for worktree-isolated runs - "worktreeBranch": str | None, # Present for worktree-isolated runs + "worktreePath": str | None, # Present when Claude Code kept the subagent's worktree + "worktreeBranch": str | None, # Present when Claude Code created that worktree with git } **Output (status:`"async_launched"`):** @@ -2666,7 +2667,7 @@ "outputFile": str, # File path where the agent's output is written } -Returns the result from the subagent. The output is discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. Worktree-isolated runs include `worktreePath` and `worktreeBranch` on the `completed` variant. On the `completed` variant, `resolvedModel` names the model the subagent started on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On the `async_launched` variant, `resolvedModel` names the model in use when the agent moved to the background, so a swap that happened before backgrounding is reflected there. The `modelsUsed` field on both variants lists the models used in order, with consecutive repeats collapsed; it’s set only when the model was swapped mid-run. `modelsUsed` and the backgrounding-time `resolvedModel` behavior require Claude Code v2.1.212 or later. +Returns the result from the subagent. The output is discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. If Claude Code [kept the subagent’s isolated worktree](</docs/en/worktrees#isolate-subagents-with-worktrees>), `worktreePath` on the `completed` variant is where to find it, and `worktreeBranch` is its branch when Claude Code created the worktree with git. On the `completed` variant, `resolvedModel` names the model the subagent started on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On the `async_launched` variant, `resolvedModel` names the model in use when the agent moved to the background, so a swap that happened before backgrounding is reflected there. The `modelsUsed` field on both variants lists the models used in order, with consecutive repeats collapsed; it’s set only when the model was swapped mid-run. `modelsUsed` and the backgrounding-time `resolvedModel` behavior require Claude Code v2.1.212 or later. Claude Code fills `usage` and `totalTokens` from the subagent’s final API request, not from the whole run. When present, `thinking_tokens` under `output_tokens_details` in `usage` is the number of that request’s output tokens that were thinking tokens. The `output_tokens_details` key requires Python SDK v0.2.136 or later, which bundles Claude Code v2.1.228. ### @@ -3652,7 +3653,7 @@ ---|---|---|--- `allowedDomains`| `list[str]`| `[]`| Domain names that sandboxed processes can access `deniedDomains`| `list[str]`| `[]`| Domain names that sandboxed processes cannot access. Takes precedence over `allowedDomains` -`allowManagedDomainsOnly`| `bool`| `False`| Managed-settings only: when set in managed settings, ignore `allowedDomains` from non-managed settings sources. Has no effect when set via SDK options +`allowManagedDomainsOnly`| `bool`| `False`| Managed-settings only: when set in managed settings, ignore `allowedDomains` and `WebFetch(domain:...)` allow rules from non-managed settings sources. Has no effect when set via SDK options `allowUnixSockets`| `list[str]`| `[]`| Unix socket paths that processes can access (e.g., Docker socket) `allowAllUnixSockets`| `bool`| `False`| Allow access to all Unix sockets `allowLocalBinding`| `bool`| `False`| Allow processes to bind to local ports (e.g., for dev servers)
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -129,7 +129,20 @@ 3. The last meaningful message in existing conversation history 4. An auto-generated name like `myhost-graceful-unicorn`, where `myhost` is your machine’s hostname or the prefix you set with `--remote-control-session-name-prefix` -If you didn’t set an explicit name, Claude Code updates the title to reflect your prompt once you send one. Claude Code matches auto-generated titles to the language of your conversation, or to the [`language`](</docs/en/settings#available-settings>) setting if one is configured; the language matching requires Claude Code v2.1.176 or later. When you rename a session from claude.ai or the Claude app, Claude Code also updates the local title shown in `claude --resume`. Claude Code applies the same rename to the session name shown on the prompt bar, and in the `claude agents` listing when the session [runs in the background](</docs/en/agent-view>). Before v2.1.221, renaming from the session list at claude.ai or in the Claude app updated only the title, and the CLI kept its previous session name; `/rename`, which runs in the CLI itself, set the name on any version. When Claude Code stops using a session, it archives the session instead of leaving it in the session list. This happens, for example, when [compaction](</docs/en/context-window#what-survives-compaction>) rewrites the conversation while Remote Control is disconnected, or when you switch to a different conversation with `/resume`. The session stays available when you [filter for archived sessions](</docs/en/claude-code-on-the-web#archive-sessions>). If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). +If you didn’t set an explicit name, Claude Code updates the title to reflect your prompt once you send one. Claude Code matches auto-generated titles to the language of your conversation, or to the [`language`](</docs/en/settings#available-settings>) setting if one is configured; the language matching requires Claude Code v2.1.176 or later. When you rename a session from claude.ai or the Claude app, Claude Code also updates the local title shown in `claude --resume`. Claude Code applies the same rename to the session name shown on the prompt bar, and in the `claude agents` listing when the session [runs in the background](</docs/en/agent-view>). Before v2.1.221, renaming from the session list at claude.ai or in the Claude app updated only the title, and the CLI kept its previous session name; `/rename`, which runs in the CLI itself, set the name on any version. If the environment already has an active session, you’ll be asked whether to continue it or start a new one. If you don’t have the Claude app yet, use the `/mobile` command inside Claude Code to display a download QR code for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>). + +### + +​ + +What connected devices see + +A connected device shows the conversation in your terminal as it happens. These cases go beyond ordinary messages: + + * **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. + * **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. ### @@ -156,7 +169,7 @@ Connection and security -Your local Claude Code session makes outbound HTTPS requests only and never opens inbound ports on your machine. When you start Remote Control, it registers with the Anthropic API and polls for work. When you connect from another device, the server routes messages between the web or mobile client and your local session over a streaming connection. All traffic travels through the Anthropic API over TLS, the same transport security as any Claude Code session. The connection uses multiple short-lived credentials, each scoped to a single purpose and expiring independently. While Remote Control is connected, the session transcript, including your messages, Claude’s responses, and tool activity, is stored on Anthropic servers. The stored transcript keeps the conversation in sync across your devices and lets the session reconnect after a network drop. Execution and filesystem access stay on your machine, and stored transcripts are retained under the [Data usage](</docs/en/data-usage>) policy. Context changes stay in sync too. While Claude Code [compacts the conversation](</docs/en/context-window#what-survives-compaction>), connected devices show compaction progress and, once compaction finishes, where the conversation was compacted. When you run `/clear`, the conversation resets on connected devices. With [cross-session messaging](</docs/en/cross-session-messaging>), the Remote Control connection also carries messages between your own Claude Code sessions on different machines, and messages arriving from your [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. These messages travel 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 cross-machine delivery rules and the `isolatePeerMachines` approval requirement, and [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) covers the inbound controls. Cross-session messaging requires Claude Code v2.1.224 or later. To turn Remote Control off entirely, use the [`disableRemoteControl`](</docs/en/settings#available-settings>) setting. Organizations with compliance requirements such as Zero Data Retention can’t enable Remote Control. +Your local Claude Code session makes outbound HTTPS requests only and never opens inbound ports on your machine. When you start Remote Control, it registers with the Anthropic API and polls for work. When you connect from another device, the server routes messages between the web or mobile client and your local session over a streaming connection. All traffic travels through the Anthropic API over TLS, the same transport security as any Claude Code session. The connection uses multiple short-lived credentials, each scoped to a single purpose and expiring independently. While Remote Control is connected, the session transcript, including your messages, Claude’s responses, and tool activity, is stored on Anthropic servers. The stored transcript keeps the conversation in sync across your devices and lets the session reconnect after a network drop. Execution and filesystem access stay on your machine, and stored transcripts are retained under the [Data usage](</docs/en/data-usage>) policy. To turn Remote Control off entirely, use the [`disableRemoteControl`](</docs/en/settings#available-settings>) setting. Organizations with compliance requirements such as Zero Data Retention can’t enable Remote Control. ##
modified Choose a sandbox environment View current →
--- a/sandbox-environments.md +++ b/sandbox-environments.md @@ -155,7 +155,7 @@ Virtual machine -A dedicated virtual machine provides the strongest separation, with its own kernel and, in cloud or microVM deployments, its own virtualized hardware. Options include cloud instances, local hypervisors, and microVMs such as Firecracker. Use this approach when you are evaluating untrusted code, when your security policy requires kernel-level separation between the agent and the host, or when no host-level approach meets your compliance requirements. Docker Desktop’s [sandboxes feature](<https://docs.docker.com/ai/sandboxes/>) provides a microVM with its own Docker daemon and workspace sync, which can run Claude Code on hosts that already have Docker Desktop. +A dedicated virtual machine provides the strongest separation, with its own kernel and, in cloud or microVM deployments, its own virtualized hardware. Options include cloud instances, local hypervisors, and microVMs such as Firecracker. Use this approach when you are evaluating untrusted code, when your security policy requires kernel-level separation between the agent and the host, or when no host-level approach meets your compliance requirements. [Docker Sandboxes](<https://docs.docker.com/ai/sandboxes/>) provides a microVM with its own Docker daemon and workspace sync, which can run Claude Code on any host with Docker Sandboxes installed. It is a free, standalone product from Docker that does not require Docker Desktop. ##
modified Configure the sandboxed Bash tool View current →
--- a/sandboxing.md +++ b/sandboxing.md @@ -461,7 +461,7 @@ * **Linux** : uses [bubblewrap](<https://github.com/containers/bubblewrap>) for isolation * **WSL2** : uses bubblewrap, same as Linux -WSL1 is not supported because bubblewrap requires kernel features only available in WSL2. These OS-level restrictions ensure that all child processes spawned by Claude Code’s commands inherit the same security boundaries. These same primitives are available as the standalone [`@anthropic-ai/sandbox-runtime`](<https://github.com/anthropic-experimental/sandbox-runtime>) package, which the [Sandbox environments](</docs/en/sandbox-environments#sandbox-runtime>) page covers as a separate approach for wrapping the entire Claude Code process. +WSL1 is not supported because bubblewrap requires kernel features only available in WSL2. These same primitives are available as the standalone [`@anthropic-ai/sandbox-runtime`](<https://github.com/anthropic-experimental/sandbox-runtime>) package, which the [Sandbox environments](</docs/en/sandbox-environments#sandbox-runtime>) page covers as a separate approach for wrapping the entire Claude Code process. ## @@ -489,7 +489,7 @@ `sandbox.filesystem.allowWrite`| Grants subprocess write access to paths outside the working directory `sandbox.filesystem.denyWrite` and `sandbox.filesystem.denyRead`| Block subprocess access to specific paths `sandbox.filesystem.allowRead`| Re-allows reading specific paths within a `denyRead` region -`sandbox.filesystem.disabled`| Turns the filesystem layer off entirely while keeping network isolation; requires Claude Code v2.1.216 or later +`sandbox.filesystem.disabled`| Turns the filesystem layer off entirely while keeping network isolation `Edit` allow rules| Grant write access to specific paths, the same way `sandbox.filesystem.allowWrite` does `Read` and `Edit` deny rules| Block access to specific files or directories `WebFetch` allow and deny rules| Control domain access
modified Run prompts on a schedule View current →
--- a/scheduled-tasks.md +++ b/scheduled-tasks.md @@ -67,7 +67,7 @@ When you ask for a dynamic `/loop` schedule, Claude may use the [Monitor tool](</docs/en/tools-reference#monitor-tool>) directly. Monitor runs a background script and streams each output line back, which avoids polling altogether and is often more token-efficient and responsive than re-running a prompt on an interval. A dynamically scheduled loop appears in your scheduled task list like any other task, so you can list or cancel it the same way. The jitter rules don’t apply to it, but the seven-day expiry does: the loop ends automatically seven days after you start it. -On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, a prompt with no interval runs on a fixed 10-minute schedule instead. +On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, a prompt with no interval runs on a fixed 10-minute schedule instead. Claude Code also uses that fixed schedule when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ### @@ -87,7 +87,7 @@ A bare `/loop` runs this prompt at a dynamically chosen interval. Add an interval, for example `/loop 15m`, to run it on a fixed schedule instead. To replace the built-in prompt with your own default, see Customize the default prompt with loop.md. -On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, `/loop` with no prompt prints the usage message instead of running the maintenance prompt. +On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, `/loop` with no prompt prints the usage message instead of running the maintenance prompt. The same happens when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ### @@ -113,7 +113,7 @@ Edits to `loop.md` take effect on the next iteration, so you can refine the instructions while a loop is running. When no `loop.md` exists in either location, the loop falls back to the built-in maintenance prompt. Keep the file concise: content beyond 25,000 bytes is truncated. -On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, `loop.md` isn’t read and `/loop` with no prompt prints the usage message instead. +On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, `loop.md` isn’t read and `/loop` with no prompt prints the usage message instead. The same happens when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ###
modified Catch security issues as Claude writes code View current →
--- a/security-guidance.md +++ b/security-guidance.md @@ -255,7 +255,7 @@ On pull request| [Code Review](</docs/en/code-review>), Team and Enterprise plans| Multi-agent correctness and security review with full codebase context In CI| Your existing static analysis and dependency scanners| Language-specific rules, supply-chain checks, and policy enforcement the plugin does not attempt -Each later stage catches what earlier ones miss. The plugin’s value is reducing the volume that reaches them, not eliminating the need for them. To find security issues in code you already have, rather than in changes Claude is writing, ask Claude in a session to review a specific file or directory for vulnerabilities, or use the [Claude Security plugin](</docs/en/claude-security>) for a deeper multi-agent scan of the whole repository; [`/security-review`](</docs/en/commands#all-commands>) covers only the changes on your current branch. Either way, the review reads the source code in your checkout, not a running site or deployed service. +To find security issues in code you already have, rather than in changes Claude is writing, ask Claude in a session to review a specific file or directory for vulnerabilities, or use the [Claude Security plugin](</docs/en/claude-security>) for a deeper multi-agent scan of the whole repository; [`/security-review`](</docs/en/commands#all-commands>) covers only the changes on your current branch. Either way, the review reads the source code in your checkout, not a running site or deployed service. ##
modified Self-hosted environments View current →
--- a/self-hosted-environments.md +++ b/self-hosted-environments.md @@ -97,7 +97,9 @@ This lifecycle isolates each user’s checked-out code without requiring the runner to delete disk state between users. A kill that delivers `SIGTERM` needs no flag: the runner drains as [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) describes. If your infrastructure instead destroys hosts at a known wall-clock time without a signal, or with a grace period too short to drain, such as a sandbox lifetime cap or spot-instance reclamation, pass `--retire-at <epoch-seconds>` set to a few minutes before that time. At the retire time: 1. The runner stops taking new work. - 2. The runner releases each active session through the same release path the [`--release-idle-session-min`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) flag uses, so the session resumes on a fresh runner when the user sends their next message. A session that’s mid-turn is released as soon as that turn finishes; a session whose finished turn left background tasks running gets up to 60 seconds of grace before releasing anyway. + 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: + * The runner releases a session that’s mid-turn as soon as that turn finishes. + * When a turn finishes and leaves background tasks running, the runner waits up to 60 seconds for them, then releases the session even if they’re still running. If the tasks have finished but the follow-up turn that reads their results hasn’t run yet, the runner keeps the session until that turn finishes, and waits no longer than [`SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS`](</docs/en/self-hosted-environments-reference#environment-variable-only-settings>) for that turn to start. 3. The runner exits 0 once all its sessions are released. A turn that outlives the kill is still lost; [Shutdown timing](</docs/en/self-hosted-environments-deploy#shutdown-timing>) covers sizing the margin. Without `--retire-at`, a signal-less host kill is indistinguishable from a crash: the control plane records a lost worker rather than a clean release, and the session requeues to another runner. @@ -123,7 +125,7 @@ What stays on your infrastructure -Repository checkouts, build artifacts, secrets, and any files a session creates or modifies stay on the machines you provision. The conversation itself, including prompts, responses, and tool results, goes to `api.anthropic.com` for model inference, and Anthropic stores the session transcript so you can resume the session from another supported surface. Session orchestration, queueing, and the claude.ai interface remain Anthropic-hosted: a self-hosted environment moves session execution into your network, not the control plane. +Repository checkouts, build artifacts, secrets, and any files a session creates or modifies stay on the machines you provision. The conversation itself, including prompts, responses, and tool results, goes to `api.anthropic.com` for model inference, and Anthropic stores the session transcript so you can resume the session from another supported surface. A self-hosted environment moves session execution into your network. The control plane remains Anthropic-hosted: session orchestration, queueing, and the claude.ai interface continue to run on Anthropic’s infrastructure. ##
modified Customize sessions in self-hosted environments View current →
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -175,7 +175,7 @@ The spawn-runner hook -The orchestrator runs `${hooks-dir}/spawn-runner` once per spawn request. The hook must submit work asynchronously and return within `--hook-timeout`, 60 seconds by default. It must not wait for the runner to boot. The hook receives: +The orchestrator runs `${hooks-dir}/spawn-runner` once per spawn request. The hook must submit work asynchronously, without waiting for the runner to boot, and return within `--hook-timeout`, 60 seconds by default. The hook receives: Variable| Description ---|--- @@ -220,7 +220,7 @@ RUN claude mcp add --scope user sidecar -- /usr/local/bin/mcp-sidecar RUN claude mcp add --scope user --transport http internal http://mcp-gateway.svc.cluster.local:8080 -The runner snapshots the host’s config once at startup. The snapshot captures the `mcpServers` key from the host’s `.claude.json`, which lives next to rather than inside `~/.claude/`, and the runner seeds only that key into each session’s isolated config; account state and project history are dropped. To confirm the servers reached sessions, start a session on the environment and ask Claude to list its MCP tools; the runner also logs a startup warning for any captured entry whose `type` it doesn’t recognize and drops the entry, so the drop is visible instead of the server silently failing to load. When `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` is set, the runner reads `.claude.json` from that directory instead, so pointing the variable at an empty directory disables MCP seeding too. Two other sources work as well: +The runner snapshots the host’s config once at startup. The snapshot captures the `mcpServers` key from the host’s `.claude.json`, which lives next to rather than inside `~/.claude/`, and the runner seeds only that key into each session’s isolated config; account state and project history are dropped. To confirm the servers reached sessions, start a session on the environment and ask Claude to list its MCP tools; the runner also logs a startup warning for any captured entry whose `type` it doesn’t recognize and drops the entry, so you can see why that server is missing from sessions. When `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR` is set, the runner reads `.claude.json` from that directory instead, so pointing the variable at an empty directory disables MCP seeding too. Two other sources work as well: * The enterprise-scope [managed MCP file](</docs/en/managed-mcp>) at its standard system path: `/etc/claude-code/managed-mcp.json` on Linux runner hosts, `/Library/Application Support/ClaudeCode/managed-mcp.json` on macOS hosts. Use it for locked-down fleets where only administrator-listed servers may load; see [exclusive control with managed-mcp.json](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) for the precedence rules. * `<repo>/.mcp.json`: project scope. Commit the file to the repository; its servers are auto-approved in cloud sessions.
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -10,7 +10,7 @@ A self-hosted runner executes arbitrary, model-directed code on your infrastructure on behalf of any member of your Anthropic organization. Work through each item before you connect an environment to production systems: - * **Ephemeral, per-session containers** : run each runner process in a fresh container or VM that’s destroyed when the process exits, with `--capacity 1` and the default `--drain-grace-sec 0` so each container serves exactly one session. At a higher capacity, or with a positive drain grace, one container serves multiple sessions from the same locked account instead of one session each; see [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>). Don’t reuse a filesystem between runner restarts, except in the deliberate pre-warmed checkout setup, and never across accounts. + * **Ephemeral, per-session containers** : run each runner process in a fresh container or VM that’s destroyed when the process exits, with `--capacity 1` and the default `--drain-grace-sec 0` so each container serves exactly one session. At a higher capacity, or with a positive drain grace, one container serves multiple sessions from the same locked account; see [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>). Don’t reuse a filesystem between runner restarts, except in the deliberate pre-warmed checkout setup, and never across accounts. * **No broad credentials in the image** : don’t include long-lived SSH keys, cloud-provider credentials, or personal access tokens that grant more than a session needs. Mint credentials used during a session, such as push or API tokens, per session from your [wrapper script](</docs/en/self-hosted-environments-configuration#wrapper-scripts>). For the initial clone, which happens before the wrapper runs, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) or `--use-anthropic-git-proxy`; see Configure git. * **Keep the environment secret off session-running hosts** : the environment secret can register runners and pick up any org member’s queued sessions. On a fixed fleet it lives on every runner host, where any session’s code can read the secret file. Prefer [on-demand runners](</docs/en/self-hosted-environments-configuration#on-demand-runners>), where the secret stays on the orchestrator host, which never runs user code, and each runner receives a single-use work order that registers exactly one runner. On a fixed fleet, treat the environment-secret file as readable by every session and rotate the secret after any suspected session compromise. * **Default-deny network egress** : restrict runner and session container outbound traffic at your own network boundary on every environment; Default-deny egress covers what to allow and why. @@ -21,7 +21,7 @@ * An explicit deny for `169.254.169.254` in the session container’s network namespace The block applies to your wrapper script and lifecycle hooks too, since they share the container. Authenticate any token exchange with the [session JWT](</docs/en/self-hosted-environments-identity>) against your own token service over allowlisted egress, or use a file-based web identity such as IAM Roles for Service Accounts (IRSA) on Amazon EKS. * **Per-runner filesystem isolation** : each runner process gets its own working directory that no other process on the host can read or write. Make `--hooks-dir`, the wrapper script, and the host’s `~/.claude/` read-only to the session, either built into the image or mounted read-only. - * **Dispatch is organization-wide** : any member of your Anthropic organization can dispatch a session to any of its environments, and there’s no per-environment access control on dispatch. Treat every runner host as reachable for code execution by every org member, and don’t place data or credentials on a runner host that any org member shouldn’t be able to read. [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) bounds which account’s sessions a given host executes, but dispatch into the environment itself stays organization-wide. To make self-hosted environments the only picker option, an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) can hide Anthropic-hosted environments for the whole organization from the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>). + * **Dispatch is organization-wide** : any member of your Anthropic organization can dispatch a session to any of its environments, and there’s no per-environment access control on dispatch. Treat every runner host as reachable for code execution by every org member, and place data or credentials on a runner host only if every org member is allowed to read them. [`--lock-to-account`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) bounds which account’s sessions a given host executes, but dispatch into the environment itself stays organization-wide. To make self-hosted environments the only picker option, an [Owner or admin](</docs/en/cloud-environments#organization-shared-environments>) can hide Anthropic-hosted environments for the whole organization from the [**Cloud environments** page](<https://claude.ai/admin-settings/cloud-environments>). * **Enforce the repo-settings guard** : choose the guard mode with [`--confine-repo-settings`](</docs/en/self-hosted-environments-reference#runner-cli-flags>). The default `warn` logs a violation and still spawns the session, `enforce` refuses the session, and `off` disables the scan. The runner scans each repository’s committed settings for: * A grant that resolves outside that session’s own workspace: an `additionalDirectories` entry, an `Edit`, `Write`, or `NotebookEdit` rule in `permissions.allow`, or a `sandbox.filesystem.allowWrite` or `allowRead` entry * A non-empty `env` block @@ -255,7 +255,10 @@ Shutdown timing -On `SIGTERM`, the runner stops taking new work, waits up to `--drain-wait-sec`, zero by default, for in-flight turns to finish, terminates each child process, and runs the [`post-session` lifecycle hook](</docs/en/self-hosted-environments-configuration#post-session>). The full drain path needs up to `--session-stop-grace-sec` \+ `--drain-wait-sec` \+ `--post-session-hook-timeout-sec`, plus 15 seconds of fixed overhead for process cleanup, plus 30 more seconds when [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) is set. That is 80 seconds at defaults, and the runner logs the total at startup. Sessions drain in parallel under this one budget, so the total doesn’t grow with `--capacity`. At the default `--drain-wait-sec 0`, a rolling restart interrupts in-flight turns; each session resumes on another runner, losing unpushed work as described under Known issues. Set `--drain-wait-sec`, and raise the grace period to match, to let turns finish first. Throughout that whole path, the runner keeps heartbeating to the control plane at zero capacity, so the session lease doesn’t expire and get requeued to another runner while the `post-session` hook is still writing out uncommitted work. The heartbeat stops just before the runner deregisters. Set `terminationGracePeriodSeconds` on Kubernetes, `stop_grace_period` on Docker Compose, or your orchestrator’s equivalent to at least the total the runner logs, so a container-wide kill never lands while a `post-session` hook is mid-run. If your hosts die at a known wall-clock time and you pass [`--retire-at`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), size the margin between the retire time and the kill to cover typical turns plus this same budget, and compute the value at each launch, for example `date +%s` plus the runner’s intended lifetime, rather than baking a static value into a restartable manifest. The Kubernetes default of 30 seconds is shorter than the runner’s drain path and will kill the pod mid-cleanup. For the flags that control each phase, see the [runner CLI reference](</docs/en/self-hosted-environments-reference#runner-cli-flags>). +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: + + * **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. ###
modified Self-hosted environments reference View current →
--- a/self-hosted-environments-reference.md +++ b/self-hosted-environments-reference.md @@ -16,10 +16,10 @@ `--base-dir <path>`| `SELF_HOSTED_RUNNER_BASE_DIR`| `/workspace`| Directory for repository checkouts and per-session working directories. The runner needs write access to this path or its parent. The runner creates the directory at startup and exits with `cannot create or write to base directory` when it can’t create or write to it. Before v2.1.225, the runner created the directory when the first session started, so an unusable path failed sessions rather than startup. Use the same value on every runner in an environment. See [Keep the base directory and capacity identical across runners](</docs/en/self-hosted-environments-deploy#keep-the-base-directory-and-capacity-identical-across-runners>). `--capacity <n>`| none| `1`| Maximum concurrent sessions this runner handles. All sessions belong to the same locked account. Use the same value on every runner in an environment; see [Keep the base directory and capacity identical across runners](</docs/en/self-hosted-environments-deploy#keep-the-base-directory-and-capacity-identical-across-runners>). `--configure-git`| `SELF_HOSTED_RUNNER_CONFIGURE_GIT=1`| off| Write global git identity and enable Anthropic commit signing at startup. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>). -`--confine-repo-settings <mode>`| `SELF_HOSTED_RUNNER_CONFINE_REPO_SETTINGS`| `warn`| Warn without refusing (`warn`, the default), enforce (`enforce`), or disable (`off`) the guard that flags a session when a repository’s committed settings try to grant write or read access outside that session’s own workspace, set environment variables, or override the operator’s sandbox or hooks posture, such as `sandbox.enabled: false` or `disableAllHooks`. See [Harden your deployment](</docs/en/self-hosted-environments-deploy#harden-your-deployment>). +`--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 +`--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. `--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. @@ -33,7 +33,7 @@ `--log-level <level>`| none| `info`| `info` or `debug` `--post-session-hook-timeout-sec <n>`| `SELF_HOSTED_RUNNER_POST_SESSION_HOOK_TIMEOUT_MS`| `60`| Budget for the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) on every session end, including runner shutdown `--push-outcome-on-release`| `SELF_HOSTED_RUNNER_PUSH_OUTCOME_ON_RELEASE`| off| On a runner-initiated session end such as a drain or idle release, push tracked outcome branches to `origin` before deleting the workspace, so in-flight commits survive a restart. Best-effort; adds 30 seconds to the shutdown budget, and requires git 2.29 or newer to resume from the pushed branch. Restrict push access to `claude/*` refs before enabling; see [Resumed sessions lose unpushed work](</docs/en/self-hosted-environments-deploy#additional-limitations>). Repositories checked out via a `checkout` lifecycle hook aren’t pushed; snapshot those from the [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>) instead. -`--release-idle-session-min <n>`| `SELF_HOSTED_RUNNER_SESSION_IDLE_MS`| `0`| Release a session slot after N minutes of inactivity once a turn finishes or the session waits for the user’s action. A session that’s still mid-turn, including one holding a never-finishing background task or an approval requested from inside a running tool call, doesn’t count as idle; pair with `--kill-session-after-min` as the hard backstop. A release that leaves the runner with no active sessions starts the same exit path as a normal drain, governed by `--drain-grace-sec`. `0` disables. +`--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. `--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. @@ -89,6 +89,7 @@ Env var| Default| Description ---|---|--- +`SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS`| `30000`| How long the runner considers a session busy after a background task finishes while the follow-up turn that reads the result hasn’t started. The `--drain-wait-sec` and `--release-idle-session-min` rows describe where the hold applies on drain and idle release, and [Runner lifecycle](</docs/en/self-hosted-environments#runner-lifecycle>) describes where it applies on `--retire-at` retirement. `0` or an unusable value falls back to the default, so the hold can’t be turned off. Requires Claude Code v2.1.228 or later. `SELF_HOSTED_RUNNER_HOST_CONFIG_DIR`| `~/.claude`| Directory captured into the runner’s startup snapshot and seeded into each session’s `CLAUDE_CONFIG_DIR`; changes on disk apply after a runner restart. Setting the variable also moves where the runner reads `.claude.json` for [MCP seeding](</docs/en/self-hosted-environments-configuration#mcp-servers>), so setting it, including to its own default, relocates that lookup; point at an empty directory to disable seeding entirely. `SELF_HOSTED_RUNNER_MAX_LIFETIME_GRACE_MS`| `900000`| Bounds how long a `--kill-session-after-min` kill is deferred while waiting for an in-flight turn to finish `SELF_HOSTED_RUNNER_SIGKILL_GRACE_MS`| `30000`| How long the runner waits for the OS to deliver `SIGKILL` to a child stuck in uninterruptible I/O before exiting itself. Floored at `--post-session-hook-timeout-sec` plus 15 seconds, and 30 more when `--push-outcome-on-release` is set, so the effective minimum is 75 seconds at defaults.
modified Persist sessions to external storage View current →
--- a/session-storage.md +++ b/session-storage.md @@ -1,6 +1,6 @@ -By default, the SDK writes session transcripts to JSONL files under `~/.claude/projects/` on the local filesystem. A `SessionStore` adapter lets you mirror those transcripts to your own backend, such as S3, Redis, or a database, so a session created on one host can be resumed on another. Common reasons to use a session store: - - * **Multi-host deployments.** Serverless functions, autoscaled workers, and CI runners don’t share a filesystem. A shared store lets any replica resume any session. +By default, the SDK writes session transcripts to JSONL files under `~/.claude/projects/` on the local filesystem. A `SessionStore` adapter lets you mirror those transcripts to your own backend, such as S3, Redis, or a database, so a session created on one host can be resumed on another host running from a matching working directory. Common reasons to use a session store: + + * **Multi-host deployments.** Serverless functions, autoscaled workers, and CI runners don’t share a filesystem. A shared store lets replicas resume each other’s sessions. * **Durability.** Local containers are ephemeral. A store backed by S3 or a database survives restarts and redeploys. * **Compliance and audit.** Keep transcripts in storage you already govern, with your own retention rules, encryption, and access controls. @@ -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. 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. 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 ---|---|---
modified Work with sessions View current →
--- a/sessions.md +++ b/sessions.md @@ -390,8 +390,9 @@ Resume across hosts -Session files are local to the machine that created them. To resume a session on a different host (CI workers, ephemeral containers, serverless), you have two options: - +Session files are local to the machine that created them. To resume a session on a different host (CI workers, ephemeral containers, serverless), pick the approach that fits: + + * **Pass a session store.** Attach a [`sessionStore` / `session_store` adapter](</docs/en/agent-sdk/session-storage>) so the SDK mirrors transcripts to your own backend and another host can resume them. The store lookup key derives from the working directory, so resume from a `cwd` matching the original run’s. * **Move the session file.** Persist `~/.claude/projects/<encoded-cwd>/<session-id>.jsonl` from the first run and restore it inside any directory under `~/.claude/projects/` on the new host before calling `resume`. 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. Before v2.1.223, the lookup was scoped to the current project directory and its git worktrees; SDK versions that bundle an older CLI still behave this way. * **Don’t rely on session resume.** Capture the results you need (analysis output, decisions, file diffs) as application state and pass them into a fresh session’s prompt. This is often more robust than shipping transcript files around.
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -116,7 +116,7 @@ The legacy Windows path `C:\ProgramData\ClaudeCode\managed-settings.json` is no longer supported as of v2.1.75. Administrators who deployed settings to that location must migrate files to `C:\Program Files\ClaudeCode\managed-settings.json`. -File-based managed settings also support a drop-in directory at `managed-settings.d/` in the same system directory alongside `managed-settings.json`. This lets separate teams deploy independent policy fragments without coordinating edits to a single file. Following the systemd convention, `managed-settings.json` is merged first as the base, then all `*.json` files in the drop-in directory are sorted alphabetically and merged on top. Later files override earlier ones for scalar values, arrays are concatenated and de-duplicated, and objects are deep-merged. Hidden files starting with `.` are ignored. Use numeric prefixes to control merge order, for example `10-telemetry.json` and `20-security.json`. +File-based managed settings also support a drop-in directory at `managed-settings.d/` in the same system directory alongside `managed-settings.json`. This lets separate teams deploy independent policy fragments without coordinating edits to a single file. Following the systemd convention, Claude Code merges `managed-settings.json` first as the base, then sorts all `*.json` files in the drop-in directory alphabetically and merges them on top. For scalar values, Claude Code lets later files override earlier ones; it concatenates and de-duplicates arrays and deep-merges objects. A later file’s `fallbackModel` chain replaces an earlier one instead of merging with it, and a later file’s `extraKnownMarketplaces` entry replaces an earlier file’s same-name entry whole. Claude Code ignores hidden files starting with `.`. Use numeric prefixes to control merge order, for example `10-telemetry.json` and `20-security.json`. See [managed settings](</docs/en/permissions#managed-only-settings>) and [Managed MCP configuration](</docs/en/managed-mcp>) for details. This [repository](<https://github.com/anthropics/claude-code/tree/main/examples/mdm>) includes starter deployment templates for Jamf, Iru (Kandji), Intune, and Group Policy. Use these as starting points and adjust them to fit your needs. Managed deployments can also restrict **plugin marketplace additions** using `strictKnownMarketplaces`. For more information, see [Managed marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>). @@ -210,7 +210,7 @@ Key| Description| Example ---|---|--- -`advisorModel`| Model for the server-side [advisor tool](</docs/en/advisor>). Accepts the model aliases `"opus"` and `"sonnet"`, or a full model ID. Written automatically when you run `/advisor`. Unset to disable the advisor. [Claude Code doesn’t offer Fable 5 as the advisor](</docs/en/advisor#enable-the-advisor>): a saved `"fable"` value attaches no advisor and raises no error.| `"opus"` +`advisorModel`| Model for the server-side [advisor tool](</docs/en/advisor>). Accepts the model aliases `"fable"`, `"opus"`, and `"sonnet"`, or a full model ID. `"fable"` requires [Fable 5 access](</docs/en/advisor#choose-an-advisor-model>). Written automatically when you run `/advisor`. Unset to disable the advisor.| `"opus"` `agent`| Run the main thread as a named subagent, and set the default agent for sessions dispatched from `claude agents`. Applies that subagent’s system prompt, tool restrictions, and model. See [Invoke subagents explicitly](</docs/en/sub-agents#invoke-subagents-explicitly>)| `"code-reviewer"` `agentPushNotifEnabled`| **Default** : `false`. When [Remote Control](</docs/en/remote-control>) is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Appears in `/config` as **Push when Claude decides**. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>)| `true` `allowAllClaudeAiMcps`| (Managed settings only) Load claude.ai connectors alongside a deployed `managed-mcp.json`, which otherwise takes exclusive control and suppresses them. See [Managed MCP configuration](</docs/en/managed-mcp>)| `true` @@ -269,7 +269,7 @@ `enableArtifact`| Enable or disable the [Artifact](</docs/en/artifacts>) tool for this user. When unset, the default follows the feature’s [availability](</docs/en/artifacts#availability>) for your account. The **Artifacts** row in `/config` writes this key. A managed `disableArtifact` and your organization’s [admin setting](</docs/en/artifacts#manage-artifacts-for-your-organization>) take precedence, and the key is ignored in project and local settings (`.claude/settings.json`, `.claude/settings.local.json`), which a repository could otherwise commit. Requires Claude Code v2.1.196 or later| `true` `enabledMcpjsonServers`| List of specific MCP servers from `.mcp.json` files to approve. As of v2.1.196, `claude mcp list` and `claude mcp get` honor this key in an untrusted folder only from [settings files that aren’t checked into the repository](</docs/en/mcp#managing-your-servers>)| `["memory", "github"]` `enforceAvailableModels`| Extend the `availableModels` allowlist to the Default model. When `true` in managed settings and `availableModels` is a non-empty array, the Default option falls back to the first allowlisted entry that is available, but only when the model Default would resolve to (the [organization default](</docs/en/model-config#organization-default-model>) when one applies, otherwise the account-type default) is not in the allowlist; an allowlisted default is kept as-is. Has no effect when `availableModels` is unset or empty. See [Enforce the allowlist for the Default model](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>). Requires Claude Code v2.1.175 or later| `true` -`env`| Environment variables applied to every session and to subprocesses Claude Code spawns from it. Set a variable to `""` to override a shell export with an empty string, which Claude Code treats as unset for provider selection. Subprocesses still inherit the empty value. `NO_COLOR` and `FORCE_COLOR` set here reach only subprocesses; to change Claude Code’s own interface colors, set them in your shell before launching `claude`. As of v2.1.195, identity variables that Claude Code’s hosting environments set, for example `CLAUDE_CODE_REMOTE` and `CLAUDE_CODE_ACCOUNT_UUID`, are ignored when set here. [`CLAUDE_CODE_MESSAGING_SOCKET`](</docs/en/env-vars#variables>) is also ignored here, because Claude Code exports its own per-session value; ignoring it requires Claude Code v2.1.224 or later| `{"FOO": "bar"}` +`env`| Environment variables applied to every session and to subprocesses Claude Code spawns from it. Set a variable to `""` to override a shell export with an empty string, which Claude Code treats as unset for provider selection. Subprocesses still inherit the empty value. `NO_COLOR` and `FORCE_COLOR` set here reach only subprocesses; to change Claude Code’s own interface colors, set them in your shell before launching `claude`. Claude Code ignores identity variables set here that its hosting environments own, such as `CLAUDE_CODE_REMOTE` and `CLAUDE_CODE_ACCOUNT_UUID`. It also ignores [`CLAUDE_CODE_MESSAGING_SOCKET` and `CLAUDE_CODE_MESSAGING_TOKEN`](</docs/en/env-vars#variables>), which it exports itself. Ignoring the socket variable requires Claude Code v2.1.224 or later, and ignoring the token requires v2.1.228 or later| `{"FOO": "bar"}` `fallbackModel`| Fallback model(s) to try in order when the primary model is overloaded or unavailable. Claude Code switches to the next available model in the chain for the rest of the turn and shows a notice. `"default"` expands to the default model. Chains are capped at three models; extra entries are ignored. Unlike most array settings, this key does not merge across settings files: the highest-precedence file that defines it supplies the entire chain. The [`--fallback-model`](</docs/en/cli-reference#cli-flags>) flag overrides this for one session. See [Fallback model chains](</docs/en/model-config#fallback-model-chains>)| `["claude-sonnet-5", "claude-haiku-4-5"]` `fastMode`| Turn [fast mode](</docs/en/fast-mode>) on for sessions where it’s available. Toggling with `/fast` writes `true` here in user settings and removes the key when you turn fast mode off| `true` `fastModePerSessionOptIn`| When `true`, fast mode does not persist across sessions. Each session starts with fast mode off, requiring users to enable it with `/fast`. The user’s fast mode preference is still saved. See [Require per-session opt-in](</docs/en/fast-mode#require-per-session-opt-in>)| `true` @@ -277,9 +277,9 @@ `fileCheckpointingEnabled`| **Default** : `true`. Snapshot files before each edit so [`/rewind`](</docs/en/checkpointing>) can restore them. Appears in `/config` as **Rewind code (checkpoints)**. To disable via environment variable, set [`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`](</docs/en/env-vars>) in `env`| `false` `fileSuggestion`| Configure a custom script for `@` file autocomplete. See File suggestion settings| `{"type": "command", "command": "~/.claude/file-suggestion.sh"}` `footerLinksRegexes`| Render extra clickable badges in the footer when a regex matches turn output. Each entry has a `pattern`, a `url` template with `{name}` placeholders filled from named capture groups, and an optional `label`. Read from user, `--settings` flag, and managed settings only. See Footer link badges for URL constraints, scheme allowlist, and limits. Requires Claude Code v2.1.176 or later| `[{"type": "regex", "pattern": "\\b(?<key>PROJ-\\d+)\\b", "url": "https://issues.example.com/browse/{key}", "label": "{key}"}]` -`forceLoginMethod`| Use `claudeai` to restrict login to Claude.ai accounts, `console` to restrict login to Claude Console accounts, or `gateway` to restrict login to a cloud gateway; see [Claude apps gateway](</docs/en/claude-apps-gateway>). On Claude Code v2.1.212 or later, every first-party login path enforces the restriction, including the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, and `/install-github-app`; before v2.1.212, only terminal logins enforced it. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for how each login path, environment credentials, and third-party providers are handled| `claudeai` +`forceLoginMethod`| Use `claudeai` to restrict login to claude.ai accounts, `console` to restrict login to Claude Console accounts, or `gateway` to restrict login to a cloud gateway; see [Claude apps gateway](</docs/en/claude-apps-gateway>). On Claude Code v2.1.212 or later, every first-party login path applies the restriction, including the [VS Code extension](</docs/en/vs-code>), the Agent SDK, `claude setup-token`, and `/install-github-app`; before v2.1.212, only terminal logins applied it. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for how each login path, environment credentials, and third-party providers are handled| `claudeai` `forceLoginGatewayUrl`| Pre-fills and locks the gateway URL on the `/login` Cloud gateway screen. Either this key or `forceLoginMethod: "gateway"` surfaces that screen; set both so the URL is filled in. Honored only at the managed policy tier; ignored in user and project settings. See [Claude apps gateway](</docs/en/claude-apps-gateway#set-the-gateway-url>)| `"https://claude-gateway.example.com"` -`forceLoginOrgUUID`| Require login to belong to a specific Anthropic organization. Accepts a single UUID string, which also pre-selects that organization during login, or an array of UUIDs where any listed organization is accepted without pre-selection. An empty array fails closed and blocks login with a misconfiguration message. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for which login paths and credentials enforce the check| `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` or `["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"]` +`forceLoginOrgUUID`| Require claude.ai account logins to belong to a specific Anthropic organization. Accepts a single UUID string, which also pre-selects that organization during a claude.ai or Claude Console login, or an array of UUIDs where any listed organization is accepted without pre-selection. An empty array fails closed and blocks login with a misconfiguration message. See [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>) for how Claude Code treats Claude Console logins, the other login paths, and environment credentials| `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` or `["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"]` `forceRemoteSettingsRefresh`| (Managed settings only) Block CLI startup until remote managed settings are freshly fetched from the server. If the fetch fails, the CLI exits rather than continuing with cached or no settings. When not set, startup continues without waiting for remote settings. See [fail-closed enforcement](</docs/en/server-managed-settings#enforce-fail-closed-startup>)| `true` `gcpAuthRefresh`| Custom script that refreshes GCP Application Default Credentials when they expire or cannot be loaded. See [advanced credential configuration](</docs/en/google-vertex-ai#advanced-credential-configuration>)| `gcloud auth application-default login` `hooks`| Configure custom commands to run at lifecycle events. See [hooks documentation](</docs/en/hooks>) for format| See [hooks](</docs/en/hooks>) @@ -478,7 +478,7 @@ `~/`| Relative to home directory| `~/.kube` becomes `$HOME/.kube` `./` or no prefix| Relative to the project root for project settings, or to `~/.claude` for user settings| `./output` in `.claude/settings.json` resolves to `<project-root>/output` -The older `//path` prefix for absolute paths still works. If you previously used single-slash `/path` expecting project-relative resolution, switch to `./path`. Claude Code strips a trailing slash from a directory path, so `~/.aws` and `~/.aws/` match the same directory. Before v2.1.224, Claude Code passed the trailing slash through to the sandbox, and a `denyRead` or `denyWrite` entry written with one didn’t block its path. Claude Code also removes a trailing `/**`, so `~/build/**` and `~/build` cover the same directory. For the four `filesystem` lists, whether a wildcard such as `*` works depends on which list the entry is in and on the platform: +The older `//path` prefix for absolute paths still works. If you previously used single-slash `/path` expecting project-relative resolution, switch to `./path`. Claude Code strips a trailing slash from a directory path, so `~/.aws` and `~/.aws/` match the same directory. Before v2.1.224, Claude Code passed the trailing slash through to the sandbox, and Claude could still read or write paths under a `denyRead` or `denyWrite` entry written with one. Claude Code also removes a trailing `/**`, so `~/build/**` and `~/build` cover the same directory. For the four `filesystem` lists, whether a wildcard such as `*` works depends on which list the entry is in and on the platform: * **`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. @@ -893,7 +893,7 @@ * `hostPattern`: regex pattern to match marketplace hosts (uses `hostPattern`) * `settings`: inline marketplace declared directly in settings.json without a separate hosted repository (uses `name` and `plugins`) -The `git` source type works with any git hosting service, including self-hosted GitLab and Bitbucket. Claude Code clones the repository with the same authentication that `git clone` would use on that machine: configured credential helpers or SSH keys. A provider token such as `GITHUB_TOKEN` takes effect only through a credential helper that reads it. See [Private repositories](</docs/en/plugin-marketplaces#private-repositories>) for setup details. For `github` and `git` sources, set `"skipLfs": true` inside the `source` object (alongside `repo` or `url`) to skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later. Each marketplace entry also accepts an optional `autoUpdate` Boolean. Set `"autoUpdate": true` alongside `source` to make Claude Code refresh that marketplace and update its installed plugins in the background after startup. When omitted, official Anthropic marketplaces default to `true` and all other marketplaces default to `false`. See [Configure auto-updates](</docs/en/discover-plugins#configure-auto-updates>). Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`. +The `git` source type works with any git hosting service, including self-hosted GitLab and Bitbucket. Claude Code clones the repository with the same authentication that `git clone` would use on that machine: configured credential helpers or SSH keys. A provider token such as `GITHUB_TOKEN` takes effect only through a credential helper that reads it. See [Private repositories](</docs/en/plugin-marketplaces#private-repositories>) for setup details. For `github` and `git` sources, set `"skipLfs": true` inside the `source` object (alongside `repo` or `url`) to skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later. Each marketplace entry also accepts an optional `autoUpdate` Boolean. Set `"autoUpdate": true` alongside `source` to make Claude Code refresh that marketplace and update its installed plugins in the background after startup. When omitted, official Anthropic marketplaces default to `true` and all other marketplaces default to `false`. See [Configure auto-updates](</docs/en/discover-plugins#configure-auto-updates>). When more than one settings file defines a marketplace entry under the same name, Claude Code uses the entry from the highest-precedence file whole. That entry replaces the lower-precedence entry and inherits none of its fields, so a redefinition can’t combine one file’s `source.headers` credential with a URL another file controls. Before v2.1.228, Claude Code merged same-name entries field by field, so an entry in a higher-precedence file could inherit fields it didn’t set, including another file’s `headers`. Use `source: 'settings'` to declare a small set of plugins inline without setting up a hosted marketplace repository. Plugins listed here must reference external sources such as GitHub or npm. You still need to enable each plugin separately in `enabledPlugins`. { "extraKnownMarketplaces": {
modified Agent Skills in the SDK View current →
--- a/skills.md +++ b/skills.md @@ -104,8 +104,8 @@ For complete guidance on creating Skills, including SKILL.md structure, multi-file Skills, and examples, see: - * [Agent Skills in Claude Code](</docs/en/skills>): Complete guide with examples - * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines and naming conventions + * [Agent Skills in Claude Code](</docs/en/skills>): complete guide with examples + * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines and naming conventions ## @@ -311,10 +311,10 @@ Skills Guides - * [Agent Skills in Claude Code](</docs/en/skills>): Complete Skills guide with creation, examples, and troubleshooting - * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): Conceptual overview, benefits, and architecture - * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines for effective Skills - * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): Example Skills and templates + * [Agent Skills in Claude Code](</docs/en/skills>): complete Skills guide with creation, examples, and troubleshooting + * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): conceptual overview, benefits, and architecture + * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines for effective Skills + * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): example Skills and templates ### @@ -322,8 +322,8 @@ SDK Resources - * [Subagents in the SDK](</docs/en/agent-sdk/subagents>): Similar filesystem-based agents with programmatic options - * [Slash Commands in the SDK](</docs/en/agent-sdk/slash-commands>): User-invoked commands - * [SDK Overview](</docs/en/agent-sdk/overview>): General SDK concepts - * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): Complete API documentation - * [Python SDK Reference](</docs/en/agent-sdk/python>): Complete API documentation + * [Subagents in the SDK](</docs/en/agent-sdk/subagents>): similar filesystem-based agents with programmatic options + * [Commands in the SDK](</docs/en/agent-sdk/slash-commands>): user-invoked commands + * [SDK Overview](</docs/en/agent-sdk/overview>): general SDK concepts + * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): complete API documentation + * [Python SDK Reference](</docs/en/agent-sdk/python>): complete API documentation
modified Slash Commands in the SDK View current →
--- a/slash-commands.md +++ b/slash-commands.md @@ -211,7 +211,7 @@ In addition to using built-in slash commands, you can create your own custom commands that are available through the SDK. You define custom commands as markdown files in specific directories, the same way you configure subagents. -The `.claude/commands/` directory is the legacy format. The recommended format is `.claude/skills/<name>/SKILL.md`, which supports the same slash-command invocation (`/name`) plus autonomous invocation by Claude. See [Skills](</docs/en/agent-sdk/skills>) for the current format. The CLI continues to support both formats, and the examples below remain accurate for `.claude/commands/`. +Custom commands have been merged into skills. A file in `.claude/commands/` and a skill at `.claude/skills/<name>/SKILL.md` both create `/name` and work the same way. For new work, prefer skills, which add features like a directory for supporting files; see [Skills](</docs/en/agent-sdk/skills>) for SDK usage. The CLI supports both locations, and the examples below remain accurate for `.claude/commands/`. ### @@ -221,8 +221,8 @@ Save custom slash commands in one of these directories, depending on their scope: - * **Project commands** : `.claude/commands/` \- Available only in the current project (legacy; prefer `.claude/skills/`) - * **Personal commands** : `~/.claude/commands/` \- Available across all your projects (legacy; prefer `~/.claude/skills/`) + * **Project commands** : `.claude/commands/` \- Available only in the current project. For new work, prefer `.claude/skills/`. + * **Personal commands** : `~/.claude/commands/` \- Available across all your projects. For new work, prefer `~/.claude/skills/`. ###
modified Subagents in the SDK View current →
Show diff (111 lines)
--- a/subagents.md +++ b/subagents.md @@ -191,7 +191,7 @@ * Subagents run in the background by default. An Agent tool call that omits the [`run_in_background`](</docs/en/agent-sdk/typescript>) input launches a background subagent, and Claude sets `run_in_background: false` when it needs the result before continuing. Before v2.1.198, omitting `run_in_background` ran the subagent synchronously. Set the `background` field to `true` to force background execution for a specific agent regardless of what Claude requests. * A subagent inherits the main session’s extended thinking configuration. -By default, subagents can spawn subagents of their own, up to three layers below the main conversation. To change the limit, set [`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`](</docs/en/env-vars>) to the number of subagent layers you want below your main conversation, or `1` to turn nesting off; see [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>). +Subagents can also spawn subagents of their own. To limit how deep that nesting goes, how many subagents run at once, and how much a query spends, see Cap subagent depth, concurrency, and spend. ### @@ -628,6 +628,99 @@ ​ +Cap subagent depth, concurrency, and spend + +This section describes TypeScript SDK v0.3.219 and Python SDK v0.2.127 and later, the releases that bundle Claude Code v2.1.219 or later. On earlier releases, some of these limits are missing or default differently, so upgrade before you rely on them to bound a run. The [environment variable reference](</docs/en/env-vars>) and [turns and budget](</docs/en/agent-sdk/agent-loop#turns-and-budget>) record the Claude Code version that added each variable and the spend cap’s subagent enforcement. + +Once you include `Agent` in `allowedTools`, Claude decides on its own when to spawn a subagent and how many to spawn. Each subagent makes its own API requests, which count toward the query’s `total_cost_usd`, and a subagent can spawn subagents of its own, so one prompt can grow into a tree of agents. You can cap that growth in three ways: how deeply subagents nest, how many run at once, and how much the whole query spends. Set the depth and concurrency limits as environment variables through the [`env`](</docs/en/agent-sdk/typescript#options>) option, and the spend limit as a query option: + +Limit| Set it with| Default| What Claude Code does at the limit +---|---|---|--- +Depth| [`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`](</docs/en/env-vars>)| `3` layers of subagents below your main agent. `1` stops your subagents from spawning any of their own| Leaves a subagent at the bottom layer unable to spawn, so it does its delegated work itself. See [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) +Concurrency| [`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`](</docs/en/env-vars>)| `20` subagents running at once, counting every subagent Claude spawns with the Agent tool| Refuses to spawn another subagent, returning `Concurrent subagent limit reached`, until the running count drops below the limit. Sessions with [ultracode](</docs/en/model-config#adjust-effort-level>) active are never refused. See the [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) +Spend| `maxBudgetUsd` in TypeScript, `max_budget_usd` in Python| No limit. Compared against `total_cost_usd`, so subagent requests count| Enforces the cap in three ways: refuses to spawn more subagents, returning `Budget limit reached`, stops background subagents that are still running, and ends the query with the `error_max_budget_usd` result subtype. See [turns and budget](</docs/en/agent-sdk/agent-loop#turns-and-budget>) + +The two SDKs treat the `env` option differently: the TypeScript SDK replaces the subprocess environment with it, so spread `process.env` into it to keep variables like `PATH`, while the Python SDK merges it into the inherited environment. This example turns nesting off, allows at most five subagents at a time, and stops the query once the estimated spend reaches $5: + +Python + +TypeScript + + import asyncio + from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage + + async def main(): + try: + async for message in query( + prompt="Audit every service in this repo for unhandled promise rejections", + options=ClaudeAgentOptions( + allowed_tools=["Read", "Grep", "Glob", "Agent"], + # env is merged on top of the inherited environment + env={ + "CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH": "1", + "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS": "5", + }, + max_budget_usd=5.0, + ), + ): + if isinstance(message, ResultMessage): + print(f"{message.subtype}: ${message.total_cost_usd}") + except Exception as error: + # A single-shot query() raises after yielding an error result, + # so the budget-capped result has already been printed above. + print(f"Session ended with an error: {error}") + + asyncio.run(main()) + + import { query } from "@anthropic-ai/claude-agent-sdk"; + + try { + for await (const message of query({ + prompt: "Audit every service in this repo for unhandled promise rejections", + options: { + allowedTools: ["Read", "Grep", "Glob", "Agent"], + // env replaces the subprocess environment, so spread process.env to keep PATH + env: { + ...process.env, + CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH: "1", + CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS: "5", + }, + maxBudgetUsd: 5, + }, + })) { + if (message.type === "result") { + console.log(`${message.subtype}: $${message.total_cost_usd}`); + } + } + } catch (error) { + // A single-shot query() throws after yielding an error result, + // so the budget-capped result has already been logged above. + console.error(`Session ended with an error: ${error}`); + } + +What you see depends on which limit, if any, the query reaches: + + * **Under the spend cap** : you see `success` and the estimated cost. + * **At the spend cap** : you see `error_max_budget_usd` with a cost at or above `5`, and then your error handler runs. + * **At the concurrency limit** : you see a `tool_result` block in the message stream carrying `Concurrent subagent limit reached`. Claude receives the same block as the Agent tool’s result. + +### + +​ + +Run Opus 5 with subagents + +Claude Opus 5 delegates to subagents more readily than earlier models, so the depth, concurrency, and spend limits matter most on queries that run Opus 5. The [Opus 5 prompting guide](<https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5#controlling-subagent-spawning>) has a delegation instruction you can add to any prompt. Whether Claude Code adds an instruction of its own depends on which [system prompt](</docs/en/agent-sdk/modifying-system-prompts#how-system-prompts-work>) you use: + + * **`claude_code` preset**: when the model is Opus 5, Claude Code adds a line to its system prompt telling Claude not to call the Agent tool unless it’s asked to. The Agent tool stays available. + * **A custom prompt, or no`systemPrompt`**: Claude Code doesn’t build its system prompt, so that line is absent. Add the prompting guide’s delegation instruction to your own prompt. + +Either instruction only steers Claude, so set the limits as well. Claude Code enforces them however Claude decides to delegate. + +## + +​ + Scale up with dynamic workflows Subagents work well for a few delegated tasks per turn. For runs that coordinate dozens to hundreds of agents, use the `Workflow` tool, which moves the orchestration into a script the runtime executes outside the conversation context. See [dynamic workflows](</docs/en/workflows>) for how workflows differ from turn-by-turn subagent delegation. The `Workflow` tool is available in the TypeScript Agent SDK v0.3.149 and later. Include `Workflow` in `allowedTools` to auto-approve workflow runs. The tool input and output schemas are listed in the [TypeScript reference](</docs/en/agent-sdk/typescript#workflow>).
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -28,9 +28,9 @@ `PushNotification`| Sends a desktop notification, and a phone push when [Remote Control](</docs/en/remote-control>) is connected, so a long-running task or [scheduled task](</docs/en/scheduled-tasks>) can reach you when you step away. Push delivery runs through Anthropic-hosted infrastructure, which is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No `Read`| Reads the contents of files. See Read tool behavior| No `ReadMcpResourceTool`| Reads a specific MCP resource by URI| No -`RemoteTrigger`| Creates, updates, runs, and lists [Routines](</docs/en/routines>) on claude.ai. Backs the `/schedule` command. 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| No +`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| 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 `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
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -563,7 +563,12 @@ Claude Code on Windows requires either Git for Windows (for bash) or PowerShell -Git for Windows is optional. Claude Code uses the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) when Git Bash is absent, so this error means neither shell was found. **If PowerShell is missing from your PATH** , its default location is `C:\Windows\System32\WindowsPowerShell\v1.0\`. Add that directory to your `PATH`, or install [PowerShell 7](<https://aka.ms/powershell>), which provides `pwsh`. **To install Git for Windows instead** , download it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. Installing it enables the Bash tool, useful when working with Bash-based scripts and tooling. **If Git is already installed** but Claude Code can’t find it, set the path in your [settings.json file](</docs/en/settings>): +Git for Windows is optional. Claude Code uses the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) when Git Bash is absent, so this error means neither shell was found. **If PowerShell is missing from your PATH** , its default location is `C:\Windows\System32\WindowsPowerShell\v1.0\`. Add that directory to your `PATH`, or install [PowerShell 7](<https://aka.ms/powershell>), which provides `pwsh`. **To install Git for Windows instead** , download it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. Installing it enables the Bash tool, useful when working with Bash-based scripts and tooling. **If Git is already installed** but Claude Code can’t find it, compare its location against the places Claude Code checks. When `CLAUDE_CODE_GIT_BASH_PATH` isn’t set, Claude Code looks for `bash.exe` in this order: + + 1. The default install locations `C:\Program Files\Git` and `C:\Program Files (x86)\Git`. + 2. The `git` on your `PATH`, using the `bin\bash.exe` from that Git installation. + +In step 2, Claude Code skips a `git` that sits in the folder you launched Claude Code from, or below it in a path that contains `node_modules` or a virtual-environment folder such as `.venv` or `env`, for example `C:\dev\env\myproject\Git` when you launched from `C:\dev\env\myproject`. This keeps Claude Code from running an executable that a project placed there. If your Git is in a location like that, point `CLAUDE_CODE_GIT_BASH_PATH` at it. **To point Claude Code at a specific Git installation** , find it by running `where.exe git` in PowerShell, then set the `bin\bash.exe` path from that installation as `CLAUDE_CODE_GIT_BASH_PATH` in your [settings.json file](</docs/en/settings>): { "env": { @@ -571,7 +576,7 @@ } } -If your Git is installed somewhere else, find the path by running `where.exe git` in PowerShell and use the `bin\bash.exe` path from that directory. **If the path is correct and the file exists** but Claude Code still doesn’t use it, check the file’s name first. Claude Code accepts only a file named `bash.exe`, `sh.exe`, `bash`, or `sh`; with any other name, such as Git for Windows’ `git-bash.exe` launcher, it ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. A path that doesn’t exist gets the same fallback and warning. Before v2.1.219, Claude Code used any existing file as the shell without checking its name, and exited at startup with `Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path` when the path didn’t exist. If the file’s name is right, endpoint security software such as AppLocker, Group Policy software restriction policies, or EDR agents may be interfering. Ask your IT team to allowlist `claude.exe` and the processes it spawns, including `cmd.exe` and `bash.exe`, in your endpoint protection policy. +**If`CLAUDE_CODE_GIT_BASH_PATH` is set to the correct path and the file exists** but Claude Code still doesn’t use it, check the file’s name first. Claude Code accepts only a file named `bash.exe`, `sh.exe`, `bash`, or `sh`; with any other name, such as Git for Windows’ `git-bash.exe` launcher, it ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. A path that doesn’t exist gets the same fallback and warning. Before v2.1.219, Claude Code used any existing file as the shell without checking its name, and exited at startup with `Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path` when the path didn’t exist. If the file’s name is right, endpoint security software such as AppLocker, Group Policy software restriction policies, or EDR agents may be interfering. Ask your IT team to allowlist `claude.exe` and the processes it spawns, including `cmd.exe` and `bash.exe`, in your endpoint protection policy. ###
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -536,7 +536,7 @@ `resumeSessionAt`| `string`| `undefined`| Resume session at a specific message UUID `sandbox`| `SandboxSettings`| `undefined`| Configure sandbox behavior programmatically. See Sandbox settings for details `sessionId`| `string`| Auto-generated| Use a specific UUID for the session instead of auto-generating one -`sessionStore`| [`SessionStore`](</docs/en/agent-sdk/session-storage#the-sessionstore-interface>)| `undefined`| Mirror session transcripts to an external backend so any host can resume them. See [Persist sessions to external storage](</docs/en/agent-sdk/session-storage>) +`sessionStore`| [`SessionStore`](</docs/en/agent-sdk/session-storage#the-sessionstore-interface>)| `undefined`| Mirror session transcripts to an external backend so another host can resume them. See [Persist sessions to external storage](</docs/en/agent-sdk/session-storage>) `sessionStoreFlush`| `'batched' | 'eager'`| `'batched'`| _Alpha._ Flush mode for `sessionStore`. Ignored when `sessionStore` is not set `settings`| `string | Settings`| `undefined`| Inline [settings](</docs/en/settings>) object or path to a settings file. Populates the flag-settings layer in the [precedence order](</docs/en/settings#settings-precedence>). Change at runtime with `applyFlagSettings()` `settingSources`| `SettingSource``[]`| CLI defaults (all sources)| Control which filesystem settings to load. Pass `[]` to disable user, project, and local settings. [Endpoint-managed policy](</docs/en/settings#settings-files>) loads regardless; server-managed settings are fetched when the session authenticates with an organization credential on an [eligible configuration](</docs/en/server-managed-settings#platform-availability>). See [Use Claude Code features](</docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control>) @@ -2959,7 +2959,7 @@ stop?: boolean; }; -Schedules a one-shot wake-up that fires the given prompt after a delay. This tool backs the self-paced `/loop` command. The runtime clamps `delaySeconds` to between 60 and 3600 seconds. The `delaySeconds`, `reason`, and `prompt` fields are required unless `stop` is true. Setting `stop: true` cancels the pending wakeup and ends the self-paced `/loop`. The `stop` field requires Claude Code v2.1.202 or later. See the [ScheduleWakeup row in the tools reference](</docs/en/tools-reference>) for provider availability; it isn’t available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry. +Schedules a one-shot wake-up that fires the given prompt after a delay. This tool backs the self-paced `/loop` command. The runtime clamps `delaySeconds` to between 60 and 3600 seconds. The `delaySeconds`, `reason`, and `prompt` fields are required unless `stop` is true. Setting `stop: true` cancels the pending wakeup and ends the self-paced `/loop`. The `stop` field requires Claude Code v2.1.202 or later. See the [ScheduleWakeup row in the tools reference](</docs/en/tools-reference>) for availability; it isn’t available on Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, nor when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ### @@ -2987,7 +2987,7 @@ }; }; -Manages [Routines](</docs/en/routines>), the scheduled and triggered Claude Code runs hosted in the cloud. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, `run`, and `list_runs` actions. `body` is required for `create`, `update`, and `create_webhook_trigger`, and optional for `run`. `create_webhook_trigger` attaches an event source to an existing routine, such as a [GitHub event](</docs/en/routines#add-a-github-trigger>) that fires it. The `body` names the source, the events, and the routine to fire. Requires Claude Code v2.1.225 or later. `list_runs` lists a routine’s recent runs, and `get_run_log` reads one run’s log. `session_id` names the run to read, from a `list_runs` result, and `cursor` pages through either action’s results. Both actions require Claude Code v2.1.227 or later. This tool is available only when the session is authenticated with a claude.ai account on a plan with Routines enabled, and is absent when your organization’s policy disables [Claude Code on the web](</docs/en/claude-code-on-the-web>). On Claude Code v2.1.227 or later, the tool is also absent when an Owner has [turned off routines for the organization](</docs/en/routines#routines-are-disabled-by-your-organizations-policy>). Before v2.1.227, a session with only the routines toggle turned off still showed the tool, and the server denied its calls. +Manages [Routines](</docs/en/routines>), the scheduled and triggered Claude Code runs hosted in the cloud. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, `run`, and `list_runs` actions. `body` is required for `create`, `update`, and `create_webhook_trigger`, and optional for `run`. `create_webhook_trigger` attaches an event source to an existing routine, such as a [GitHub event](</docs/en/routines#add-a-github-trigger>) that fires it. The `body` names the source, the events, and the routine to fire. Requires Claude Code v2.1.225 or later. `list_runs` lists a routine’s recent runs, and `get_run_log` reads one run’s log. `session_id` names the run to read, from a `list_runs` result, and `cursor` pages through either action’s results. Both actions require Claude Code v2.1.227 or later. This tool is available only when the session is authenticated with a claude.ai account on a plan with Routines enabled, and is absent when your organization’s policy disables [Claude Code on the web](</docs/en/claude-code-on-the-web>) or when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). On Claude Code v2.1.227 or later, the tool is also absent when an Owner has [turned off routines for the organization](</docs/en/routines#routines-are-disabled-by-your-organizations-policy>). Before v2.1.227, a session with only the routines toggle turned off still showed the tool, and the server denied its calls. ### @@ -3253,6 +3253,9 @@ inference_geo?: string | null; speed?: string | null; iterations?: unknown; + output_tokens_details?: { + thinking_tokens?: number | null; + } | null; }; toolStats?: { readCount: number; @@ -3288,7 +3291,7 @@ outputFile: string; }; -Returns the result from the subagent. Discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. On the `completed` variant, `resolvedModel` names the model the subagent started on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On `async_launched`, it names the model in use when the task moved to the background. `modelsUsed` lists the models the subagent used, in order. The field is present only when a mid-run swap happened, and a model appears again when the run swapped back to it. On `async_launched`, the list covers the models used before backgrounding. Both `modelsUsed` and the backgrounding behavior of `resolvedModel` require Claude Code v2.1.212 or later. On the `completed` variant, `worktreePath` is set when the subagent ran in an isolated git worktree, and `worktreeBranch` names that worktree’s branch when Claude Code created it. `usage.service_tier` carries the service tier string the API reported for the subagent’s requests. Before v2.1.207, the published type was narrower. It omitted `worktreePath`, `worktreeBranch`, `citations`, `toolStats.frameCount`, and the `inference_geo`, `speed`, and `iterations` usage fields, and it typed `service_tier` as `"standard" | "priority" | "batch"`. Fields the type marks optional can be absent on results recorded by earlier versions. +Returns the result from the subagent. Discriminated on the `status` field: `"completed"` for finished tasks, `"async_launched"` for background tasks, and `"remote_launched"` for tasks Claude Code dispatched to a remote cloud session, where `sessionUrl` links to that session and `taskId` identifies it. On the `completed` variant, `resolvedModel` names the model the subagent started on, which can differ from the requested `model` input when [`availableModels`](</docs/en/model-config#restrict-model-selection>) or another override applies. This field requires Claude Code v2.1.174 or later. On `async_launched`, it names the model in use when the task moved to the background. `modelsUsed` lists the models the subagent used, in order. The field is present only when a mid-run swap happened, and a model appears again when the run swapped back to it. On `async_launched`, the list covers the models used before backgrounding. Both `modelsUsed` and the backgrounding behavior of `resolvedModel` require Claude Code v2.1.212 or later. If Claude Code [kept the subagent’s isolated worktree](</docs/en/worktrees#isolate-subagents-with-worktrees>), `worktreePath` on the `completed` result is where to find it. `worktreeBranch` is its branch, present when Claude Code created the worktree with git. Claude Code fills `usage` and `totalTokens` from the subagent’s final API request, not from the whole run, so `usage.service_tier` is the service tier string the API reported on that request. When present, `usage.output_tokens_details.thinking_tokens` is the number of that request’s output tokens that were thinking tokens. The `output_tokens_details` field requires TypeScript SDK v0.3.228 or later, which bundles Claude Code v2.1.228. Before v2.1.207, the published type was narrower. It omitted `worktreePath`, `worktreeBranch`, `citations`, `toolStats.frameCount`, and the `inference_geo`, `speed`, and `iterations` usage fields, and it typed `service_tier` as `"standard" | "priority" | "batch"`. Fields the type marks optional can be absent on results recorded by earlier versions. ### @@ -4978,7 +4981,7 @@ `SDKLocalCommandOutputMessage` -Output from a local slash command (for example, `/voice` or `/usage`). Displayed as assistant-style text in the transcript. +Output from a local command such as `/voice` or `/usage`. Displayed as assistant-style text in the transcript. type SDKLocalCommandOutputMessage = { type: "system"; @@ -5143,8 +5146,8 @@ ---|---|---|--- `allowedDomains`| `string[]`| `[]`| Domain names that sandboxed processes can access `deniedDomains`| `string[]`| `[]`| Domain names that sandboxed processes cannot access. Takes precedence over `allowedDomains` -`strictAllowlist`| `boolean`| `false`| Deny sandboxed commands access to hosts not in `allowedDomains` instead of prompting. Enforced for sandboxed commands only; in-process tools such as WebFetch aren’t gated by it. Only honored from user, managed, or CLI `--settings` settings; project settings are ignored. Requires Claude Code v2.1.219 or later -`allowManagedDomainsOnly`| `boolean`| `false`| Managed-settings only. When set in [managed settings](</docs/en/permissions#managed-settings>), only `allowedDomains` entries from managed settings are honored and entries from user, project, or local settings are ignored. Has no effect when set via SDK options +`strictAllowlist`| `boolean`| `false`| Deny sandboxed commands access to hosts outside the [network allowlist](</docs/en/sandboxing#network-isolation>) instead of prompting. Enforced for sandboxed commands only; in-process tools such as WebFetch aren’t gated by it. Only honored from user, managed, or CLI `--settings` settings; project settings are ignored. Requires Claude Code v2.1.219 or later +`allowManagedDomainsOnly`| `boolean`| `false`| Managed-settings only. When set in [managed settings](</docs/en/permissions#managed-settings>), only `allowedDomains` entries and `WebFetch(domain:...)` allow rules from managed settings are honored, and allow entries from user, project, or local settings are ignored. Has no effect when set via SDK options `allowLocalBinding`| `boolean`| `false`| Allow processes to bind to local ports (e.g., for dev servers) `allowUnixSockets`| `string[]`| `[]`| Unix socket paths that processes can access (e.g., Docker socket) `allowAllUnixSockets`| `boolean`| `false`| Allow access to all Unix sockets
modified Find bugs with ultrareview View current →
--- a/ultrareview.md +++ b/ultrareview.md @@ -98,7 +98,7 @@ Team and Enterprise| none| billed as [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) * **Free runs** : the three Pro and Max runs are a one-time allotment per account and don’t refresh. - * **Cost per review** : after you use the free runs, or after the free-run period ends, typically $5 to $25 in usage credits depending on the size of the change, matching the estimate the launch dialog shows before each run. + * **Cost per review** : after you use the free runs, typically $5 to $25 in usage credits depending on the size of the change, matching the estimate the launch dialog shows before each run. * **When a run counts** : once the cloud session starts. A review you stop early or that fails to complete still uses a free run; a paid review bills only for the portion that ran. Because ultrareview always bills as usage credits outside the free runs, your account or organization must have usage credits turned on before you can launch a paid review. If usage credits aren’t turned on, Claude Code blocks the launch, and how you turn them on depends on your billing access:
modified Zero data retention View current →
--- a/zero-data-retention.md +++ b/zero-data-retention.md @@ -27,7 +27,7 @@ Route Claude Code traffic to your ZDR organization -ZDR applies to requests that authenticate into a ZDR-enabled organization. If a developer signs in to Claude Code with a personal account or with an API key from a different organization, those sessions are not covered. To restrict login to your ZDR organization, deploy the `forceLoginMethod` and `forceLoginOrgUUID` managed settings; see [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>). +ZDR applies to requests that authenticate into a ZDR-enabled organization. If a developer signs in to Claude Code with a personal account or with an API key from a different organization, those sessions are not covered. To require that developers’ claude.ai logins belong to your ZDR organization, deploy the `forceLoginMethod` and `forceLoginOrgUUID` managed settings; see [Restrict login to your organization](</docs/en/authentication#restrict-login-to-your-organization>), which also explains how these keys treat Claude Console logins. ###