modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -146,7 +146,7 @@ * [Quickstart](</docs/en/quickstart>): first-session walkthrough from install to working with a project * [Common workflows](</docs/en/common-workflows>): patterns for everyday tasks like code review, refactoring, and debugging - * [Claude 101](<https://anthropic.skilljar.com/claude-101>) and [Claude Code in Action](<https://anthropic.skilljar.com/claude-code-in-action>): self-paced Anthropic Academy courses + * [Claude Code 101](<https://academy.claude.com/courses/claude-code-101>) and [Claude Code in Action](<https://academy.claude.com/courses/claude-code-in-action>): free self-paced courses on [Claude Academy](<https://academy.claude.com/>) For login issues, point developers to [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>). The most common fixes are:
modified Escalate hard decisions with the advisor tool View current →
--- a/advisor.md +++ b/advisor.md @@ -40,7 +40,7 @@ * Run `/advisor` with a model, such as `/advisor opus`, to set it. * Run `/advisor off` to turn it off. -Claude Code doesn’t invoke a saved advisor that your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes. To use the advisor, pick an allowed model with `/advisor`. Claude Code still saves an advisor that your current main model doesn’t support. That advisor activates after you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>). On some plans, Fable as the advisor also needs your one-time [consent to bill Fable usage to usage credits](</docs/en/model-config#fable-and-usage-credits>). For what `/advisor fable` does before you have given that consent, see Fable advisor and usage credits. +Claude Code doesn’t invoke a saved advisor that your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes. To use the advisor, pick an allowed model with `/advisor`. Claude Code still saves an advisor that your current main model doesn’t support. That advisor activates after you switch to a compatible main model with [`/model`](</docs/en/model-config#setting-your-model>). If the API already refused the saved advisor in the current conversation, it stays off until `/clear` or `/compact`, even after you switch models. On some plans, Fable as the advisor also needs your one-time [consent to bill Fable usage to usage credits](</docs/en/model-config#fable-and-usage-credits>). For what `/advisor fable` does before you have given that consent, see Fable advisor and usage credits. ### @@ -85,17 +85,17 @@ ---|---|--- Haiku 4.5| Fable, Opus, Sonnet| Haiku can call the advisor but cannot act as one Sonnet 4.6| Fable, Opus, Sonnet| -Sonnet 5| Fable, Opus 4.7 or later, Sonnet 5| A Sonnet 4.6 advisor is rejected, and requests with an Opus 4.6 advisor fail with an API error +Sonnet 5| Fable, Opus 4.7 or later, Sonnet 5| A Sonnet 4.6 advisor is rejected, and the API refuses an Opus 4.6 advisor Opus 4.6| Fable, Opus, Sonnet 5| A Sonnet 4.6 advisor is rejected Opus 4.7 or Opus 4.8| Fable, and Opus 4.7 or later| An Opus 4.6 or Sonnet advisor is rejected -Opus 5| Fable, Opus 5| An Opus 4.6 or Sonnet advisor is rejected, and requests with an Opus 4.7 or Opus 4.8 advisor fail with an API error +Opus 5| Fable, Opus 5| An Opus 4.6 or Sonnet advisor is rejected, and the API refuses an Opus 4.7 or Opus 4.8 advisor Fable 5| Fable 5.1 or Fable 5| An Opus or Sonnet advisor is rejected -Fable 5.1| Fable 5.1| An Opus or Sonnet advisor is rejected, and requests with a Fable 5 advisor fail with an API error +Fable 5.1| Fable 5.1| An Opus or Sonnet advisor is rejected, and the API refuses a Fable 5 advisor Fable 5.1 requires Claude Code v2.1.257 or later. Both Fable models require [Fable access](</docs/en/model-config#work-with-fable>). 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, and the API validates it again: * For an advisor the table lists as rejected, Claude Code doesn’t attach it 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. - * For an advisor the table lists as failing with an API error, Claude Code attaches it and the API refuses it. Every request fails with `'<advisor model>' cannot be used as an advisor when the request model is '<main model>'` until you change the advisor with `/advisor` or turn it off. + * For an advisor the table lists as refused by the API, Claude Code attaches it and the API refuses it. Claude Code then resends that request without the advisor, and the rest of the conversation runs without one, so you see no error and get no advisor calls. Pick an accepted advisor with `/advisor`; the change takes effect after `/clear` or `/compact` and in new sessions. * If the main model or the advisor is a model Claude Code does not recognize, the advisor is not attached. ###
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,8 +1,6 @@ Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. You can also talk to any teammate directly without going through the lead. Before you set up a team, check whether a lighter option does the job. [Subagents](</docs/en/sub-agents>) work within a single session, and with [cross-session messaging](</docs/en/cross-session-messaging>) Claude can pass findings between the sessions you run yourself. - -This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. ##
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -289,7 +289,7 @@ Constraint| Effect ---|--- -External requests| The page can load typefaces from Google Fonts, and scripts from four public CDN hosts: cdnjs, the Tailwind and jQuery CDNs, and selected paths on jsDelivr such as `/npm/`. The CSP blocks every external image and all other external scripts, stylesheets, and fonts, and lets `fetch`, XHR, and WebSocket calls reach only the page’s own origin and the Google Fonts hosts. Claude therefore loads any library the page needs from one of those CDNs, inlines all other CSS and JavaScript, and embeds images as data URIs. Connector calls go through claude.ai, which makes the network call itself. +External requests| The page can load typefaces from Google Fonts, and scripts from five public CDN hosts: cdnjs, unpkg, the Tailwind and jQuery CDNs, and selected paths on jsDelivr such as `/npm/`. The CSP blocks every external image and all other external scripts, stylesheets, and fonts, and lets `fetch`, XHR, and WebSocket calls reach only the page’s own origin and the Google Fonts hosts. Claude therefore loads any library the page needs from one of those CDNs, inlines all other CSS and JavaScript, and embeds images as data URIs. Connector calls go through claude.ai, which makes the network call itself. No backend| An artifact is a static page. It can’t authenticate viewers itself. Downloads| The page can’t start a download itself. To let viewers save a file the page generates, Claude declares the downloads capability. See Offer a file download. Single page| Relative links do not resolve, because nothing is deployed alongside the page. For multi-section content, Claude uses in-page anchors rather than separate files. @@ -316,7 +316,7 @@ Authentication| The session is backed by a claude.ai account: sign in with `/login` in the CLI or desktop app. Claude Tag sessions are signed in through the agent’s identity, so no step is needed there. Sessions using an API key, [gateway token](</docs/en/llm-gateway>), or cloud-provider credential cannot publish. Model provider| Anthropic API. Not available on [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>). Organization policy| Customer-managed encryption keys (CMEK), HIPAA, and [Zero Data Retention](</docs/en/zero-data-retention>) are not enabled for the organization. -Surface| Claude Code CLI version 2.1.183 or later, or the Claude desktop app version 1.13576.0 or later. [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions can also publish artifacts when both Claude Tag and artifacts are enabled for the organization. Off by default in [Agent SDK](</docs/en/agent-sdk/overview>), GitHub Action, and MCP-server contexts, and when [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`](</docs/en/env-vars>) is set. +Surface| Claude Code CLI, or the Claude desktop app version 1.13576.0 or later. [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions can also publish artifacts when both Claude Tag and artifacts are enabled for the organization. Off by default in [Agent SDK](</docs/en/agent-sdk/overview>), GitHub Action, and MCP-server contexts, and when [`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`](</docs/en/env-vars>) is set. ## @@ -389,7 +389,7 @@ Allowlist the viewer domain -The viewer on claude.ai loads each artifact from a sandboxed `*.claudeusercontent.com` origin. If your organization restricts outbound network access, add that domain to your allowlist alongside `claude.ai`. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the full list. An artifact that loads a typeface from Google Fonts also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, and `code.jquery.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. +The viewer on claude.ai loads each artifact from a sandboxed `*.claudeusercontent.com` origin. If your organization restricts outbound network access, add that domain to your allowlist alongside `claude.ai`. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the full list. An artifact that loads a typeface from Google Fonts also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, `code.jquery.com`, and `unpkg.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. ###
modified Authentication View current →
--- a/authentication.md +++ b/authentication.md @@ -39,8 +39,8 @@ [Claude for Teams](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=authentication_teams#team-&-enterprise>) and [Claude for Enterprise](<https://anthropic.com/contact-sales?utm_source=claude_code&utm_medium=docs&utm_content=authentication_enterprise>) provide the best experience for organizations using Claude Code. Team members get access to both Claude Code and Claude on the web with centralized billing and team management. - * **Claude for Teams** : self-service plan with collaboration features, admin tools, and billing management. Best for smaller teams. - * **Claude for Enterprise** : adds SSO, domain capture, role-based permissions, compliance API, and managed policy settings for organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements. + * **Claude for Teams** : self-service plan with collaboration features, admin tools, SSO, billing management, and [server-managed settings](</docs/en/server-managed-settings>) for organization-wide Claude Code configuration. Best for smaller teams. + * **Claude for Enterprise** : adds domain capture, role-based permissions, and the compliance API. Best for larger organizations with security and compliance requirements. 1
modified Claude apps gateway for Amazon Bedrock, Claude Platform on AWS, Google Cloud, and Microsoft Foundry View current →
--- a/claude-apps-gateway.md +++ b/claude-apps-gateway.md @@ -160,7 +160,7 @@ volumes: ["pgdata:/var/lib/postgresql/data"] volumes: { pgdata: } -The gateway is a single Linux binary that reads the config, connects to Postgres and applies its schema migrations, runs OIDC discovery against your IdP, builds upstream clients, and starts listening. Boot is fail-closed for the config, the Postgres connection with a 5-second timeout, OIDC discovery, and upstream client construction. If any of those is unreachable or misconfigured, the gateway exits with an error rather than serving traffic in a degraded state.A successful boot doesn’t validate the inference path, because Amazon Bedrock and Google Cloud’s Agent Platform instance credentials resolve on the first request, not at boot.Watch stderr for the boot sequence. Log lines use the format `[gateway] <timestamp> <level> <message>`, audit events are single-line JSON with an `evt` field, and a startup banner, omitted below, prints between the migration and listening lines. A fresh database prints one `migration N applied` line per schema migration; an already-migrated database prints none. You should see, in order: +The gateway is a single Linux binary that reads the config, connects to Postgres and applies its schema migrations, runs OIDC discovery against your IdP, builds upstream clients, and starts listening.Boot is fail-closed for the config, the Postgres connection, OIDC discovery, and upstream client construction. If any of those is unreachable or misconfigured, the gateway exits with an error rather than serving traffic in a degraded state.A successful boot doesn’t validate the inference path, because Amazon Bedrock and Google Cloud’s Agent Platform instance credentials resolve on the first request, not at boot.Watch stderr for the boot sequence. Log lines use the format `[gateway] <timestamp> <level> <message>`, audit events are single-line JSON with an `evt` field, and a startup banner, omitted below, prints between the migration and listening lines. A fresh database prints one `migration N applied` line per schema migration; an already-migrated database prints none. You should see, in order: {"ts":"2026-06-10T17:03:21.114Z","evt":"config.load","path":"/etc/claude/gateway.yaml","sha256":"…"} [gateway] 2026-06-10T17:03:21.395Z info waiting for migration lock (another replica may be migrating; check pg_locks for key 6775156 if this persists) @@ -229,7 +229,7 @@ openssl x509 -noout -fingerprint -sha256 -in cert.pem | cut -d= -f2 | tr -d : | tr 'A-F' 'a-f' -When the certificate rotates, every developer sees the trust prompt again, so treat rotations as a planned event and republish the fingerprint. If your gateway policy includes [settings that need approval](</docs/en/server-managed-settings#security-approval-dialogs>), the developer also sees that approval dialog again after accepting the new certificate, because Claude Code keys [approval memory](</docs/en/server-managed-settings#approval-memory>) to the pinned certificate. Once the developer signs in, the [model picker](</docs/en/model-config>) shows the models in their `availableModels` allowlist. Managed settings apply at startup and refresh hourly, and telemetry routes to your collector. Sessions refresh silently before `ttl_hours` expiry. When a refresh fails after IdP deprovisioning, Claude Code prompts the developer to log in again. +When the certificate rotates, every developer sees the trust prompt again, so treat rotations as a planned event and republish the fingerprint. If your gateway policy includes [settings that need approval](</docs/en/server-managed-settings#security-approval-dialogs>), the developer also sees that approval dialog again after accepting the new certificate, because Claude Code keys [approval memory](</docs/en/server-managed-settings#approval-memory>) to the pinned certificate. A gateway can return the optional `email` field in its token response to name the account that a sign-in used. When it does, the developer confirms the account before Claude Code saves the credential. After a confirmed sign-in, `/status` shows the account. The confirmation requires Claude Code v2.1.275 or later on the developer machine; a client below that version ignores the field. The gateway server in the `claude` binary doesn’t return the field, so its sign-ins complete without the confirmation. Once the developer signs in, the [model picker](</docs/en/model-config>) shows the models in their `availableModels` allowlist. Managed settings apply at startup and refresh hourly, and telemetry routes to your collector. Sessions refresh silently before `ttl_hours` expiry. When a refresh fails after IdP deprovisioning, Claude Code prompts the developer to log in again. ### @@ -423,6 +423,9 @@ * **Startup with the gateway unreachable** : signed-in sessions exit at startup with an error after about 10 seconds rather than starting without their settings. * **Startup after the gateway ends the session** : see [Enforce fail-closed startup](</docs/en/server-managed-settings#enforce-fail-closed-startup>) for the launches that open signed out of the gateway and the ones that exit when the gateway answers with a `401`. * **Deprovisioning** : a session whose user is disabled in the IdP expires within `ttl_hours` when the next refresh fails. + * **Sign-out** : `/logout` deletes the gateway credential from the developer’s machine. + * When the gateway’s discovery document advertises a `revocation_endpoint` on the gateway URL’s own scheme, host, and port, `/logout` also sends the stored tokens to that endpoint so the gateway can end the session on its side. The request is best effort, so sign-out completes on the developer’s machine whether or not the endpoint answers. The revocation requires Claude Code v2.1.275 or later on the developer’s machine. + * The gateway server in the `claude` binary advertises none, so a sign-out from it ends the session on the developer’s machine only. To force sessions out server-side, see [JWT secret rotation](</docs/en/claude-apps-gateway-deploy#jwt-secret-rotation>). ###
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -21,7 +21,7 @@ `managed-settings.json`| System-level, varies by OS| Enterprise-enforced settings that you can’t override, apart from [narrow exceptions](</docs/en/settings#security-keys-where-the-stricter-value-applies>). See [where to save the file](</docs/en/managed-settings#deploy-a-managed-settings-file>) and [which managed source Claude Code uses](</docs/en/managed-settings#precedence-within-the-managed-tier>). `CLAUDE.local.md`| Project root| Your private preferences for this project, loaded alongside CLAUDE.md. Create it manually and add it to `.gitignore`. `AGENTS.md`| Project root, `.claude/`, or any directory| Project instructions you write for AI coding agents. Claude Code can [load it](</docs/en/memory#agents-md>) on its own or alongside `CLAUDE.md`. -Installed plugins| `~/.claude/plugins`| Cloned marketplaces, installed plugin versions, and per-plugin data, managed by `claude plugin` commands. For a plugin installed from a marketplace [`command` source](</docs/en/plugin-marketplaces#command-sources>) in link mode, Claude Code stores links here instead of a copy, and the plugin’s files stay in the directory the command prints. A `command` source requires Claude Code v2.1.229 or later. A plugin listed by relative path in a local-directory marketplace also [loads in place](</docs/en/plugins-reference#plugin-caching-and-file-resolution>) from its source directory rather than from a cache copy. See [plugin caching](</docs/en/plugins-reference#plugin-caching-and-file-resolution>) for how orphaned versions are cleaned up. +Installed plugins| `~/.claude/plugins`| Cloned marketplaces, installed plugin versions, the `installed_plugins.json` install record, and per-plugin data, managed by `claude plugin` commands. Plugins [synced from your claude.ai account](</docs/en/plugins-reference#synced-plugins>) download into `~/.claude/plugins/synced/`. For a plugin installed from a marketplace [`command` source](</docs/en/plugin-marketplaces#command-sources>) in link mode, Claude Code stores links here instead of a copy, and the plugin’s files stay in the directory the command prints. A `command` source requires Claude Code v2.1.229 or later. A plugin listed by relative path in a local-directory marketplace also [loads in place](</docs/en/plugins-reference#plugin-caching-and-file-resolution>) from its source directory rather than from a cache copy. See [plugin caching](</docs/en/plugins-reference#plugin-caching-and-file-resolution>) for how orphaned versions are cleaned up. `~/.claude` also holds data Claude Code writes as you work: transcripts, prompt history, file snapshots, caches, and logs. See application data below. @@ -117,7 +117,7 @@ `plans/`| Plan files written during [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) `debug/`| Per-session debug logs, written while debug logging is on, such as when you start with [`--debug`](</docs/en/cli-reference#cli-flags>) or run `/debug` `paste-cache/`| Contents of large pastes -`image-cache/<session>/`| Attached images. On each sweep, Claude Code removes the directories of all other sessions, whatever their age. +`image-cache/<session>/`| Attached images saved by Claude Code v2.1.274 and earlier. Later versions save pasted and attached images outside `~/.claude`, in an `images/` directory for each session under the temp directory that [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) controls. The sweep removes other sessions’ leftover directories here, whatever their age. `uploads/<session>/`| Files you attach from the web or mobile app, and photos you attach from the mobile app, when messaging a [Remote Control](</docs/en/remote-control>) session. An attachment to a [cloud session](</docs/en/claude-code-on-the-web>) is saved in that session’s own cloud environment instead, not on your machine. `session-env/`| Per-session environment metadata `tasks/`| Task lists written by the task tools, one directory per list @@ -126,7 +126,7 @@ `feedback-bundles/`| Redacted transcript archives written by `/feedback` on third-party providers or when no Anthropic credentials are configured, for sending to your Anthropic account team `feedback/drafts/`| Queued [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>) awaiting your review in `/feedback`. Swept after `cleanupPeriodDays` or 30 days, whichever is shorter. When the queue is at its 10-draft limit, Claude Code deletes the oldest draft to make room. `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 -`skills/.trash/`, `plugins/.trash/`| [Skills](</docs/en/skills#how-synced-skills-behave>) and [plugins](</docs/en/plugins-reference#synced-plugins>) synced from claude.ai that Claude Code removed. Moved here instead of deleted so you can recover the files +`skills/.trash/`, `plugins/.trash/`| [Skills](</docs/en/skills#how-synced-skills-behave>) and [plugins](</docs/en/plugins-reference#synced-plugins>) that the claude.ai sync removed, such as after you turn one off on claude.ai or stop syncing. The files stay here so you can recover them until the sweep deletes them `todos/`, `statsig/`, `logs/`| Legacy directories from older versions. No longer written. The sweep removes their contents and then the empty directory. Session files in `sessions/`, auto memory, and Claude Desktop and Cowork transcripts each follow their own retention rule: @@ -188,7 +188,7 @@ * Matching prompt lines in `history.jsonl` * The project’s entry in `~/.claude.json` -The command prints the full deletion plan and asks for confirmation before removing anything. The examples below use `~/work/my-repo` as a placeholder. Replace it with the path to your project. If no state matches the path, the command prints an error and exits with status 1. Preview the plan without deleting anything: +Images you pasted or attached in the project’s sessions are stored under Claude Code’s temp directory rather than `~/.claude`, so the purge doesn’t remove them. The retention sweep deletes them once they’re older than `cleanupPeriodDays`. The command prints the full deletion plan and asks for confirmation before removing anything. The examples below use `~/work/my-repo` as a placeholder. Replace it with the path to your project. If no state matches the path, the command prints an error and exits with status 1. Preview the plan without deleting anything: claude project purge ~/work/my-repo --dry-run @@ -233,8 +233,8 @@ `~/.claude/policy-limits.json`| Nothing. Refreshed automatically. `~/.claude/tasks/`| Task lists that a resumed session would pick up `~/.claude/skills/.trash/`, `~/.claude/plugins/.trash/`| The chance to recover [synced skills](</docs/en/skills#how-synced-skills-behave>) and [synced plugins](</docs/en/plugins-reference#synced-plugins>) that Claude Code removed -`~/.claude/debug/`, `~/.claude/plans/`, `~/.claude/image-cache/`, `~/.claude/session-env/`, `~/.claude/shell-snapshots/`, `~/.claude/backups/`| Nothing user-facing -`~/.claude/todos/`, `~/.claude/statsig/`, `~/.claude/logs/`| Nothing. Legacy directories not written by current versions. +`~/.claude/debug/`, `~/.claude/plans/`, `~/.claude/session-env/`, `~/.claude/shell-snapshots/`, `~/.claude/backups/`| Nothing user-facing +`~/.claude/todos/`, `~/.claude/statsig/`, `~/.claude/logs/`, `~/.claude/image-cache/`| Nothing. Legacy directories not written by current versions. Don’t delete `~/.claude.json`, `~/.claude/settings.json`, or `~/.claude/plugins/`: those hold your auth, preferences, and installed plugins.
modified Let Claude coordinate ongoing work with Projects View current →
--- a/claude-projects.md +++ b/claude-projects.md @@ -50,7 +50,7 @@ * **Threads** : the workers. Each is a separate [cloud session](</docs/en/claude-code-on-the-web>) with its own context window that does one piece of work on its own branch, opens a pull request when the work calls for one, and reports back to the conversation when it finishes. * **What every thread starts with** : * The project’s repositories and files, plus its instructions and memory - * The `CLAUDE.md`, skills, and plugins in each of the project’s repositories, and in a project with one repository, that repository’s permission rules and hooks too + * The `CLAUDE.md` and skills in each of the project’s repositories, and in a project with one repository, that repository’s permission rules and hooks too * The connectors on your claude.ai account * A cloud environment that sets its network access, environment variables, API credentials, and installed tools * **The Overview pane** : where you see all the threads at once and which of them need you. Its other tabs are **Library** for the files you added and the files threads produced, **Pull requests** for the ones threads opened, and **Routines** for scheduled work in the project. @@ -345,16 +345,16 @@ What threads pick up from your repositories -Each thread clones every repository in the project and loads `CLAUDE.md`, skills, and plugins from all of them. Permission rules, hooks, and `env` come only from the `.claude/settings.json` in the directory the thread starts in: inside the repository when the project has one, and above the clones when it has several, where no repository’s file is read for them. +Each thread clones every repository in the project and loads `CLAUDE.md` and skills from all of them. Permission rules, hooks, and `env` come only from the `.claude/settings.json` in the directory the thread starts in: inside the repository when the project has one, and above the clones when it has several, where no repository’s file is read for them. In each repository| One repository| Several repositories ---|---|--- `CLAUDE.md`| Loaded when the thread starts| Loaded from every repository when the thread starts Skills, agents, and commands under `.claude/`| Loaded| Loaded from every repository -Plugins enabled in `.claude/settings.json`| Loaded| Loaded from every repository. If two repositories disagree about a plugin, set it in **Project settings > Plugins**, which takes precedence +Plugins enabled in `.claude/settings.json`| Not loaded. Add the plugin in **Project settings > Plugins** instead| Not loaded. Add the plugin in **Project settings > Plugins** instead Permission rules, hooks, and `env` defined in `.claude/settings.json`| Apply to the thread, except the `env` keys that [no cloud session honors](</docs/en/cloud-environments#what-carries-over-from-your-setup>)| Don’t apply -In a project with several repositories, each clone is attached to the thread as an [additional directory](</docs/en/memory#load-from-additional-directories>) with `CLAUDE.md` loading turned on, which is why every repository’s `CLAUDE.md` and skills load at start even though the thread starts above them. In either case, hooks that an enabled plugin provides still run, since plugins load from every repository. In a project with several repositories, put standing rules in project instructions and give threads environment variables through the cloud environment. +In a project with several repositories, each clone is attached to the thread as an [additional directory](</docs/en/memory#load-from-additional-directories>) with `CLAUDE.md` loading turned on, which is why every repository’s `CLAUDE.md` and skills load at start even though the thread starts above them. In such a project, put standing rules in project instructions and give threads environment variables through the cloud environment. ### @@ -373,7 +373,7 @@ Threads are cloud sessions, so they don’t have the skills, MCP servers, plugins, and tools installed only on your machine. To make each of these available to threads: * Skills, subagents, and commands: commit them to a repository you added to the project, for example a skill at `.claude/skills/<skill-name>/SKILL.md`. Each thread clones every repository in the project and loads `.claude/skills/`, `.claude/agents/`, and `.claude/commands/` from each of them, so a skill committed to one repository is available in every new thread. Threads also load the skills you enable for your claude.ai account. - * Plugins: add them in **Project settings > Plugins**; they load into each new thread. Plugins that a repository declares in its `.claude/settings.json` load too; see [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). + * Plugins: add them in **Project settings > Plugins**; they load into each new thread. Plugins that a repository declares in its `.claude/settings.json` [don’t load in threads](</docs/en/cloud-environments#what-carries-over-from-your-setup>), because threads are cloud sessions. * MCP servers: threads get their MCP tools from the connectors on your claude.ai account, which are MCP servers you connect once at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) or through the **Manage connectors** link in **Project settings > Environment**. Every thread can use all of them with no per-project setup. The project conversation itself has no connectors, so send work that needs one as a task for a thread. In a project with one repository, threads also load MCP servers from that repository’s [`.mcp.json`](</docs/en/cloud-environments#what-carries-over-from-your-setup>). [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) lists the rules for cloud sessions and the settings that turn connectors off. * Command-line tools and packages: install them in the environment’s [setup script](</docs/en/cloud-environments#setup-scripts>).
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -87,7 +87,7 @@ `--exec`| Run a shell command as a PTY-backed background job instead of starting a Claude session. Use with `--bg` to launch from the shell| `claude --bg --exec 'pytest -x'` `--fallback-model`| Enable automatic fallback to the specified model(s) when the primary model is overloaded or not available, for example a retired model. Accepts a comma-separated list tried in order. See [Fallback model chains](</docs/en/model-config#fallback-model-chains>). To persist a chain across sessions, use the [`fallbackModel` setting](</docs/en/settings-reference#fallbackmodel>), which this flag overrides| `claude --fallback-model sonnet,haiku` `--fork-session`| When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`)| `claude --resume abc123 --fork-session` -`--forward-subagent-text`| Emit [subagent](</docs/en/sub-agents>) text and thinking blocks in the output stream as `assistant` and `user` messages with `parent_tool_use_id` set, so you can reconstruct each subagent’s transcript. Without this flag, Claude Code omits the text and thinking blocks of a subagent that runs in the [foreground](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Requires `--print` and `--output-format stream-json`. Claude Code also forwards messages from [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), setting `parent_tool_use_id` to the ID of the Agent tool call that spawned each one; this requires Claude Code v2.1.219 or later. The [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) environment variable enables the same behavior. Requires Claude Code v2.1.211 or later| `claude -p --output-format stream-json --verbose --forward-subagent-text "query"` +`--forward-subagent-text`| Emit [subagent](</docs/en/sub-agents>) text and thinking blocks in the output stream as `assistant` and `user` messages with `parent_tool_use_id` set, so you can reconstruct each subagent’s transcript. Without this flag, Claude Code omits the text and thinking blocks of a subagent that runs in the [foreground](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Requires `--print` and `--output-format stream-json`. Claude Code also forwards messages from [nested subagents](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), setting `parent_tool_use_id` to the ID of the Agent or Skill tool call that started each one; this requires Claude Code v2.1.219 or later, and messages of subagents that a forked skill spawns, and of nested forked skills, require v2.1.275 or later. The [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>) environment variable enables the same behavior. Requires Claude Code v2.1.211 or later| `claude -p --output-format stream-json --verbose --forward-subagent-text "query"` `--from-pr`| Open the session picker filtered to sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request| `claude --from-pr 123` `--ide`| Automatically connect to IDE on startup if exactly one valid IDE is available| `claude --ide` `--init`| Run [Setup hooks](</docs/en/hooks#setup>) with the `init` matcher before the session (print mode only)| `claude -p --init "query"` @@ -97,7 +97,7 @@ `--input-format`| Specify input format for print mode (options: `text`, `stream-json`)| `claude -p --output-format json --input-format stream-json` `--json-schema`| Get validated JSON output matching a JSON Schema after the agent completes its workflow (print mode only). See [structured outputs](</docs/en/agent-sdk/structured-outputs>). Claude Code exits with an error on an invalid schema and accepts the `format` keyword as an annotation without client-side validation| `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` `--maintenance`| Run [Setup hooks](</docs/en/hooks#setup>) with the `maintenance` matcher before the session (print mode only)| `claude -p --maintenance "query"` -`--max-budget-usd`| Maximum dollar amount to spend on API calls before stopping (print mode only). Spend from [subagents](</docs/en/sub-agents>) counts toward the cap. Once spend reaches the cap, spawning another subagent fails with `Budget limit reached`, and Claude Code stops background subagents that are still running; the cap-enforcement behaviors require Claude Code v2.1.217 or later| `claude -p --max-budget-usd 5.00 "query"` +`--max-budget-usd`| Maximum dollar amount to spend on API calls before stopping (print mode only). Spend from [subagents](</docs/en/sub-agents>) counts toward the cap. When you return to a conversation with `--continue` or `--resume`, totals [restored from earlier runs](</docs/en/agent-sdk/cost-tracking#accumulate-costs-across-multiple-calls>) don’t count toward it. Once spend reaches the cap, spawning another subagent fails with `Budget limit reached`, and Claude Code stops background subagents that are still running; the cap-enforcement behaviors require Claude Code v2.1.217 or later| `claude -p --max-budget-usd 5.00 "query"` `--max-turns`| Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default. With `--input-format stream-json`, a message still queued when the limit ends a turn stays queued and starts a new turn with its own limit| `claude -p --max-turns 3 "query"` `--mcp-config`| Load MCP servers from JSON files or strings (space-separated). When you pass this flag with `-p`, Claude Code waits for still-pending servers to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default; a server with a [cached tool list](</docs/en/mcp#managing-your-servers>) skips the wait and connects on first use. The wait requires Claude Code v2.1.221 or later| `claude --mcp-config ./mcp.json` `--model`| Sets the model for the current session with a [model alias](</docs/en/model-config#model-aliases>) such as `sonnet`, `opus`, `haiku`, or `fable`, or a model’s full name. Overrides the [`model`](</docs/en/settings-reference#model>) setting and [`ANTHROPIC_MODEL`](</docs/en/model-config#environment-variables>)| `claude --model claude-sonnet-5` @@ -155,7 +155,7 @@ `--append-system-prompt-file`| Appends file contents to the default prompt| `claude --append-system-prompt-file ./style-rules.txt` `--system-prompt-snapshot`| With `off`, rebuilds the prompt on every request. With `on`, the default, reuses a recorded prompt where recording applies| `claude --append-system-prompt "Draft rules" --system-prompt-snapshot off` -`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. For persistent personas you can switch between and share across a project, use [output styles](</docs/en/output-styles>). For project conventions Claude should always follow, use [CLAUDE.md](</docs/en/memory>). The [Agent SDK guide on system prompts](</docs/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point>) covers the same decision in more depth. +`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be combined with either replacement flag. When the replacement text combines instructions that are the same on every run with context that changes per run, add a line containing only `__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__` between the instructions and the context. Claude Code splits the prompt at the first such line and removes that line, so the part above it stays cached while the part below changes. Requires Claude Code v2.1.275 or later. [Cache the static part of a custom prompt](</docs/en/agent-sdk/modifying-system-prompts#cache-the-static-part-of-a-custom-prompt>) lists the configurations where the split applies. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a `-p` script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. For persistent personas you can switch between and share across a project, use [output styles](</docs/en/output-styles>). For project conventions Claude should always follow, use [CLAUDE.md](</docs/en/memory>). The [Agent SDK guide on system prompts](</docs/en/agent-sdk/modifying-system-prompts#decide-on-a-starting-point>) covers the same decision in more depth. ####
modified Configure cloud environments View current →
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -290,11 +290,11 @@ Your repo’s `.mcp.json` MCP servers| Yes, in a session with one repository| Part of the clone, found from the session’s working directory Your repo’s `.claude/rules/`| Yes| Part of the clone Your repo’s `.claude/skills/`, `.claude/agents/`, `.claude/commands/`| Yes| Part of the clone -Plugins declared in `.claude/settings.json`| Yes| Installed at session start from the [marketplace](</docs/en/plugin-marketplaces>) you declared. Requires network access to reach the marketplace source +Plugins and marketplaces declared in your repo’s `.claude/settings.json`| No| A cloud session doesn’t install the plugins a repository turns on under [`enabledPlugins`](</docs/en/settings-reference#enabledplugins>), including ones from the marketplaces it lists under [`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>). Enable the plugin for your claude.ai account instead, so Claude Code loads it as a [synced plugin](</docs/en/plugins-reference#synced-plugins>) Your organization’s [server-managed settings](</docs/en/server-managed-settings>)| Yes| Fetched from Anthropic’s servers when the session starts. See [Surface coverage](</docs/en/model-config#surface-coverage>) for how `availableModels` is enforced in cloud sessions. Settings deployed to your device through MDM or managed settings files don’t apply, because the session runs on an Anthropic-managed VM; in a [self-hosted environment](</docs/en/self-hosted-environments>), sessions also read the managed settings file in the runner image, per [how Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) Your user `~/.claude/CLAUDE.md`| No| Lives on your machine, not in the repo Your user `~/.claude/skills/`, `~/.claude/agents/`, `~/.claude/commands/`| No| Live on your machine, not in the repo. Commit them to the repo’s `.claude/` directory instead. Cloud sessions automatically load skills you enable on claude.ai -Plugins enabled only in your user settings| No| User-scoped `enabledPlugins` lives in `~/.claude/settings.json`. Declare them in the repo’s `.claude/settings.json` instead, or enable them for your claude.ai account so Claude Code loads them as [synced plugins](</docs/en/plugins-reference#synced-plugins>) +Plugins enabled only in your user settings| No| User-scoped `enabledPlugins` lives in `~/.claude/settings.json` on your machine. Enable them for your claude.ai account instead, so Claude Code loads them as [synced plugins](</docs/en/plugins-reference#synced-plugins>) MCP servers you added with `claude mcp add` at the default local scope or the user scope| No| Those write to `~/.claude.json` on your machine, not the repo. Add the server with `claude mcp add --scope project`, which writes the repo’s [`.mcp.json`](</docs/en/mcp#project-scope>), and commit that file. A session with one repository loads it Transport variables in your repo’s `.claude/settings.json` `env` block, such as `NODE_EXTRA_CA_CERTS` and the [mTLS client certificate variables](</docs/en/network-config#mtls-authentication>)| No| The hosting environment manages the session’s API connection, so Claude Code ignores these keys and notes each ignored key in the session’s debug log API keys and tokens for services Claude calls| On Pro and Max plans, as API credentials| You add the key once on the environment and the agent proxy attaches it to requests for the hosts you list. A key the agent proxy can’t attach, or any key on a Team or Enterprise plan, stays in an environment variable
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -6,7 +6,7 @@ Commands across a typical workflow -Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` to set up any servers the project needs, ask Claude to create any [subagents](</docs/en/sub-agents>) you want, and run `/permissions` to set your approval rules. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust which model you’re using and how much reasoning it applies. When the conversation gets long, `/context` shows what’s filling the window and `/compact` summarizes it to free space. Use `/btw` for a side question that shouldn’t add to the conversation history. **Run work in parallel.** Claude delegates side tasks to [subagents](</docs/en/sub-agents>), and `/tasks` lists the current session’s background work, including subagents that have finished. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed. `/code-review` checks the current diff for correctness bugs and cleanups and can apply the findings with `--fix`; pass a PR number, such as `/code-review high 1234`, to review a pull request instead. `/review` is an alias. `/code-review ultra` runs a multi-agent review in the cloud. `/security-review` checks the diff for security vulnerabilities. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` returns to an earlier conversation, `/branch` branches the current one to try a different direction, and `/fork` copies it into a new [background session](</docs/en/agent-view>). `/teleport` pulls a cloud session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` runs a setup checkup that diagnoses installation and configuration issues and can fix them, `/debug` diagnoses runtime issues, and `/feedback` reports a bug with session context attached. +Most commands are useful at a specific point in a session, from setting up a project to shipping a change. **First session in a repo.** Run `/init` to generate a starter `CLAUDE.md`, then `/memory` to refine it. Use `/mcp` to set up any servers the project needs, ask Claude to create any [subagents](</docs/en/sub-agents>) you want, and run `/permissions` to set your approval rules. **During a task.** `/plan` switches into plan mode before a large change. `/model` and `/effort` adjust which model you’re using and how much reasoning it applies. When the conversation gets long, `/context` shows what’s filling the window and `/compact` summarizes it to free space. Use `/btw` for a side question that shouldn’t add to the conversation history. **Run work in parallel.** Claude delegates side tasks to [subagents](</docs/en/sub-agents>), and `/tasks` lists the current session’s background work, including subagents that have finished. `/background` detaches the whole session to keep running as a [background agent](</docs/en/agent-view>) and frees your terminal. For a large change that spans the codebase, `/batch` decomposes it into independent units and runs each in its own [worktree](</docs/en/worktrees>). See [Run agents in parallel](</docs/en/agents>) for how these approaches relate. **Before you ship.** `/diff` shows what changed. `/code-review` checks the current diff for correctness bugs and can apply the findings with `--fix`; pass a PR number, such as `/code-review high 1234`, to review a pull request instead. `/review` is an alias. `/code-review ultra` runs a multi-agent review in the cloud. `/security-review` checks the diff for security vulnerabilities. **Between sessions.** `/clear` starts fresh on a new task while keeping project memory. `/resume` returns to an earlier conversation, `/branch` branches the current one to try a different direction, and `/fork` copies it into a new [background session](</docs/en/agent-view>). `/teleport` pulls a cloud session into this terminal, and `/remote-control` lets you continue this local session from another device. **When something is wrong.** `/rewind` rolls code and conversation back to a checkpoint, or summarizes part of the conversation. `/doctor` runs a setup checkup that diagnoses installation and configuration issues and can fix them, `/debug` diagnoses runtime issues, and `/feedback` reports a bug with session context attached. ## @@ -43,7 +43,7 @@ `/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings `/claude-api [migrate|upgrade|managed-agents-onboard|prompt-audit|cost-optimize|build-eval|hillclimb]`| **[Skill](</docs/en/skills#bundled-skills>).** Load [Claude API](<https://platform.claude.com/docs/en/api/overview>) and [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) reference material for your project’s language. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`. Run `migrate` to update existing Claude API code to a newer model. Run `upgrade` to move your project’s Anthropic SDK dependency across a major version, currently the Python `anthropic` package from 0.x to 1.x. Run `managed-agents-onboard` for a walkthrough that creates a new Managed Agent. Run `prompt-audit` to flag instructions written for older models in your prompts, skills, and tool descriptions and propose fixes as a diff. Run `cost-optimize` to profile where your project’s Claude API spend goes and propose savings from options such as prompt caching, trimming unneeded input and output tokens, batch processing, effort, and model choice, one change at a time. Run `build-eval` to build an eval set for your Claude-powered app, and `hillclimb` to iteratively improve the app against an existing eval. The `prompt-audit` subcommand requires Claude Code v2.1.221 or later, `upgrade` requires v2.1.236 or later, `cost-optimize` requires v2.1.247 or later, and `build-eval` and `hillclimb` require v2.1.259 or later `/clear [name]`| Start a new conversation with empty context. Pass a name to label the previous conversation in the `/resume` picker. To free up context while continuing the same conversation, use `/compact` instead. Resume the previous conversation with `/resume`, or, in the same Claude Code process, restore it from [the rewind menu’s previous-session entry](</docs/en/checkpointing#rewind-past-a-cleared-conversation>). The rewind entry requires Claude Code v2.1.191 or later. Aliases: `/reset`, `/new` -`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [pr#|branch|path]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff, or a PR number, branch, or path you pass, for correctness bugs and cleanup opportunities. Pass `--fix` to apply findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). Posting to a GitLab merge request requires Claude Code v2.1.257 or later. With `ultra` on a `github.com` PR target, pass `--post` to preselect [posting the finished findings to the PR](</docs/en/ultrareview#post-findings-to-the-pull-request>) in the launch dialog; `--post` requires Claude Code v2.1.227 or later. See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review` +`/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [pr#|branch|path]`| **[Skill](</docs/en/skills#bundled-skills>).** Review the current diff, or a PR number, branch, or path you pass, for correctness bugs. Depending on your model and effort level, the review also covers cleanup opportunities. Pass `--fix` to apply findings, `--comment` to post them on the GitHub PR or GitLab merge request, or `ultra` to run a deep [cloud review](</docs/en/ultrareview>). Posting to a GitLab merge request requires Claude Code v2.1.257 or later. With `ultra` on a `github.com` PR target, pass `--post` to preselect [posting the finished findings to the PR](</docs/en/ultrareview#post-findings-to-the-pull-request>) in the launch dialog; `--post` requires Claude Code v2.1.227 or later. See [Review a diff locally](</docs/en/code-review#review-a-diff-locally>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review` `/color [color|default]`| Set the prompt bar color for the current session. Available colors: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan`. Use `default` to reset, or run with no argument to pick a random color. When [Remote Control](</docs/en/remote-control>) is connected, the color syncs to claude.ai/code. Also available in non-interactive mode (`-p`); requires Claude Code v2.1.205 or later `/compact [instructions]`| Free up context by summarizing the conversation so far. Optionally pass focus instructions for the summary. See [how compaction handles rules, skills, and memory files](</docs/en/context-window#what-survives-compaction>) `/config [key=value ...]`| Open the [Settings](</docs/en/settings>) interface to adjust theme, model, [output style](</docs/en/output-styles>), and other preferences. Pass one or more `key=value` pairs to set a setting directly without opening the interface, for example `/config thinking=false`, `/config theme=dark`, or `/config model=sonnet`. The `key=value` form also works in non-interactive mode (`-p`) and from the Claude mobile app via [Remote Control](</docs/en/remote-control>). The `key=value` form can’t turn on a setting that needs your confirmation in the panel, such as [`autoContinueAtUsageLimit`](</docs/en/interactive-mode#turn-automatic-continue-off>), though it can turn one off. Run `/config --help` to list the keys it accepts. Alias: `/settings` @@ -130,7 +130,8 @@ `/theme`| Change the color theme. Includes an `auto` option that matches your terminal’s light or dark background, light and dark variants, colorblind-accessible (daltonized) themes, ANSI themes that use your terminal’s color palette, and any [custom themes](</docs/en/terminal-config#create-a-custom-theme>) from `~/.claude/themes/` or plugins. Select **New custom theme…** to create one `/tui [default|fullscreen]`| Set the terminal UI renderer and relaunch into it with your conversation intact. `fullscreen` enables the [flicker-free alt-screen renderer](</docs/en/fullscreen>). With no argument, prints the active renderer `/ultraplan <prompt>`| Removed. Use [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) instead. Previously sent a planning task to a [cloud session](</docs/en/claude-code-on-the-web>) for review in your browser -`/ultrareview [PR or branch]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). Pass a PR reference to review that pull request, or a branch name to change the comparison base. The preferred invocation is now `/code-review ultra`, and `/ultrareview` remains as an alias. Includes 3 free runs on Pro and Max, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) +`/ultrareview [PR or branch]`| Run a deep, multi-agent code review in a cloud sandbox with [ultrareview](</docs/en/ultrareview>). Pass a PR reference to review that pull request, or a base branch or commit to change the comparison base. The preferred invocation is `/code-review ultra`, and `/ultrareview` is an alias. Includes 3 free runs on Pro and Max, then requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) +`/update-config [request]`| **[Skill](</docs/en/skills#bundled-skills>).** Describe a settings change, such as allowing a command, setting an environment variable, or adding a [hook](</docs/en/hooks>), and Claude edits the matching [`settings.json`](</docs/en/settings>) file. For options such as theme and model, use `/config` instead `/upgrade`| Open the upgrade page in your browser to switch to a higher plan tier. When the browser fails to open, the command shows a sign-in prompt without printing the URL `/usage`| Show session cost, plan usage limits, and activity stats. On a Pro, Max, Team, or Enterprise plan, includes a [breakdown of what counts against your plan limits](</docs/en/costs#plan-usage-breakdown>). `/cost` and `/stats` are aliases `/usage-credits`| Configure usage credits, or request them from your admin, when you hit a limit. Opens your [usage-credits billing settings](</docs/en/costs#add-usage-credits-to-your-subscription>) in the browser, except that Team and Enterprise members without billing access instead send a usage-credits request to their admin from the CLI, after confirming in a dialog that the request notifies their admins. When no browser can open the billing page, for example over SSH, the command prints the URL to visit instead; this requires Claude Code v2.1.205 or later, and earlier versions showed nothing in that case. Previously `/extra-usage`
modified Communications kit View current →
--- a/communications-kit.md +++ b/communications-kit.md @@ -96,7 +96,7 @@ 📚 Quickstart · VS Code · Free 1-hr course https://code.claude.com/docs/en/quickstart https://code.claude.com/docs/en/vs-code - https://anthropic.skilljar.com/claude-code-in-action + https://academy.claude.com/courses/claude-code-in-action Questions → this thread. [Owner] is on point.
modified Configure your agent View current →
--- a/configuration.md +++ b/configuration.md @@ -171,7 +171,9 @@ TypeScript also has `applyFlagSettings()` and `updateSettings()`: * **`applyFlagSettings()`** : applies settings at runtime, as in `await session.applyFlagSettings({ effortLevel: "high" })`. The method takes settings file keys rather than options fields, so check the [`applyFlagSettings()` reference](</docs/en/agent-sdk/typescript#applyflagsettings>) for the schema and for which keys take effect mid-session. - * **`updateSettings()`** : writes an allowlisted set of keys to the project’s local settings file, as in `await session.updateSettings("localSettings", { outputStyle: "Explanatory" })`. The written keys take effect on the session’s next request and persist for later sessions that load `local` settings. The method’s row in the [methods table](</docs/en/agent-sdk/typescript#methods>) names the allowlisted keys and the version floor. + * **`updateSettings()`** : writes one allowlisted key to a settings file. The [`updateSettings()` reference](</docs/en/agent-sdk/typescript#updatesettings>) names the key each source accepts and the version floors. + * Pass `"localSettings"` to write the project’s local settings file, as in `await session.updateSettings("localSettings", { outputStyle: "Explanatory" })`. The written key takes effect on the session’s next request and persists for later sessions that load `local` settings. + * Pass `"userSettings"` to write `effortLevel`, the only key that source accepts. Claude Code saves it as the default effort level for the session’s current model, and the running session’s effort doesn’t change. The example below runs a two-turn session, changes the configuration between the turns, and prints the model that answered each turn. In TypeScript, the prompt stream holds the second message until the setters have run, and the second turn runs on the new model.
modified Explore the context window View current →
--- a/context-window.md +++ b/context-window.md @@ -11,7 +11,7 @@ * **Before you type anything** : CLAUDE.md, auto memory, MCP tool names, and skill descriptions all load into context. [AGENTS.md files](</docs/en/memory#agents-md>) can load too, on their own or alongside CLAUDE.md. Your own setup may add more here, like an [output style](</docs/en/output-styles>) or text from [`--append-system-prompt`](</docs/en/cli-reference>). * **As Claude works** : each file read adds to context, [path-scoped rules](</docs/en/memory#path-specific-rules>) load automatically alongside matching files, and a [PostToolUse hook](</docs/en/hooks-guide>) fires after each edit. * **The follow-up prompt** : a [subagent](</docs/en/sub-agents>) handles the research in its own separate context window, so the large file reads stay out of yours. Only the summary and a small metadata trailer come back. - * **At the end** : `/compact` replaces the conversation with a structured summary. Most startup content reloads automatically; the table below shows what happens to each mechanism. + * **At the end of the walkthrough** : you run `/compact`, which replaces the conversation with a structured summary. Most startup content reloads automatically; the table below shows what happens to each mechanism. ## @@ -26,6 +26,7 @@ System prompt and output style| Both still apply Project-root CLAUDE.md and unscoped rules| Re-injected from disk Auto memory| Re-injected from disk +[Git status snapshot](</docs/en/settings-reference#includegitinstructions>)| Claude Code reads a fresh one from your repository The plan Claude wrote in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>)| Re-injected from disk Rules with `paths:` frontmatter| Claude Code reloads them as Claude reads files they match Nested CLAUDE.md in subdirectories| Claude Code reloads them as Claude reads files in that subdirectory
modified Track cost and usage View current →
--- a/cost-tracking.md +++ b/cost-tracking.md @@ -23,7 +23,7 @@ * **`query()` call:** one invocation of the SDK’s `query()` function. A single call can involve multiple steps: Claude responds, uses tools, gets results, and responds again. Each call produces one [`result`](</docs/en/agent-sdk/typescript#sdkresultmessage>) message at the end, except in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), where one `query()` call carries multiple user turns and each turn emits its own `result` message. * **Step:** a single request/response cycle within a `query()` call. Each step produces assistant messages with token usage. - * **Session:** a series of `query()` calls linked by a session ID (using the `resume` option). Each `query()` call within a session reports its own cost independently. + * **Session:** a series of `query()` calls linked by a session ID through the `resume` option. A resumed call’s results report the session’s whole spend, not just that call’s own. See Accumulate costs across multiple calls for how the totals carry over. The following diagram shows the message stream from a single `query()` call, with token usage reported at each step and the cumulative estimate at the end: @@ -37,7 +37,7 @@ The result message provides the cumulative estimate -When the `query()` call completes, the SDK emits a result message with `total_cost_usd` and cumulative `usage`, typed as [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) in TypeScript and [`ResultMessage`](</docs/en/agent-sdk/python#resultmessage>) in Python. If you make multiple `query()` calls, for example in a multi-turn session, each result reflects only the cost of that individual call. If you only need the estimated total, you can ignore the per-step usage and read this single value.In streaming input mode, each turn emits its own result message. See Track costs in streaming input mode for how to read call totals in that mode. +When the `query()` call completes, the SDK emits a result message with `total_cost_usd` and cumulative `usage`, typed as [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) in TypeScript and [`ResultMessage`](</docs/en/agent-sdk/python#resultmessage>) in Python. If you only need the estimated total, you can ignore the per-step usage and read this single value.If you make multiple independent `query()` calls, each result reflects only the cost of that individual call. A call that resumes a session also counts the session’s earlier spend.In streaming input mode, each turn emits its own result message. See Track costs in streaming input mode for how to read call totals in that mode. ## @@ -48,7 +48,7 @@ In [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), one `query()` call carries multiple user turns and each turn emits its own result message. The result fields differ in scope: * **`usage`** : covers only that turn, and within it only the main agent loop, not any subagents it ran. - * **`total_cost_usd` and `modelUsage`, or `model_usage` in Python**: carry the running total for the whole call so far. + * **`total_cost_usd` and `modelUsage`, or `model_usage` in Python**: carry the running total for the whole call so far, plus any spend restored when the call resumed a session. In a call where your app never sends `/clear`, `/reset`, or `/new`, read the latest result for call totals rather than summing across results. The running totals start over each time your app sends one of those three commands, and inside a `query()` call nothing else resets them. Three results matter for your accounting: @@ -56,7 +56,7 @@ * **Every later result** : keeps counting from that reset. * **The last result before each`/clear`**: holds the total for the turns since the previous reset. -To total the whole call, add the last result from before each `/clear` to the call’s final result. Every other result, including the `/clear` turn’s own, is superseded by a later one. In TypeScript, the SDK also emits an [`SDKConversationResetMessage`](</docs/en/agent-sdk/typescript#sdkconversationresetmessage>) at each reset, so you can detect resets from the stream. In Python, the SDK likewise emits a `ConversationResetMessage`. Before Python SDK v0.2.137, the Python iterator dropped that message, so on those versions count the resets yourself from the `/clear` turns your app sends. `maxBudgetUsd` (TypeScript) or `max_budget_usd` (Python) is compared against the same running total, so a `/clear` also starts the budget over. +To total the whole call, add the last result from before each `/clear` to the call’s final result. Every other result, including the `/clear` turn’s own, is superseded by a later one. In TypeScript, the SDK also emits an [`SDKConversationResetMessage`](</docs/en/agent-sdk/typescript#sdkconversationresetmessage>) at each reset, so you can detect resets from the stream. In Python, the SDK likewise emits a `ConversationResetMessage`. Before Python SDK v0.2.137, the Python iterator dropped that message, so on those versions count the resets yourself from the `/clear` turns your app sends. `maxBudgetUsd` (TypeScript) or `max_budget_usd` (Python) counts only the call’s own spend: totals restored from a resumed session don’t count against it, and a `/clear` starts the budget over. ## @@ -64,7 +64,12 @@ Get the total cost of a query -The result message, typed as [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) in TypeScript and [`ResultMessage`](</docs/en/agent-sdk/python#resultmessage>) in Python, marks the end of the agent loop for a `query()` call. It includes `total_cost_usd`, the cumulative estimated cost across all steps in that call. In Python the field is typed as optional, so check that it isn’t `None` before you read it. Success and error results both carry it, though the final result of a session crash may carry it zeroed. If you use sessions to make multiple `query()` calls, each result reflects only the cost of that individual call. In streaming input mode, read call totals as described in Track costs in streaming input mode. The three result-level fields differ in what they count when the agent spawns [subagents](</docs/en/agent-sdk/subagents>). Use `modelUsage`, or `model_usage` in Python, for whole-tree token accounting; the `usage` field undercounts as soon as nesting occurs. +The result message, typed as [`SDKResultMessage`](</docs/en/agent-sdk/typescript#sdkresultmessage>) in TypeScript and [`ResultMessage`](</docs/en/agent-sdk/python#resultmessage>) in Python, marks the end of the agent loop for a `query()` call. It includes `total_cost_usd`, the cumulative estimated cost across all steps in that call. A call that resumes a session also counts the session’s earlier spend. Two caveats apply when you read the value: + + * In Python the field is typed as optional, so check that it isn’t `None` before you read it. + * Success and error results both carry it, though the final result of a session crash may carry it zeroed. + +In streaming input mode, read call totals as described in Track costs in streaming input mode. The three result-level fields differ in what they count when the agent spawns [subagents](</docs/en/agent-sdk/subagents>). Use `modelUsage`, or `model_usage` in Python, for whole-tree token accounting; the `usage` field undercounts as soon as nesting occurs. Field| Subagent activity ---|--- @@ -200,7 +205,12 @@ Accumulate costs across multiple calls -Each `query()` call returns its own `total_cost_usd`. The SDK doesn’t provide a session-level total, so if your application makes multiple `query()` calls, for example in a multi-turn session or across different users, accumulate the totals yourself. In streaming input mode, read each call’s total as described in Track costs in streaming input mode. For a call that ended in a crash, see Recover totals after a session crash. The following examples run two `query()` calls sequentially, add each call’s `total_cost_usd` to a running total, and print both the per-call and combined cost: +Each `query()` call returns `total_cost_usd` on its results. How you combine the values depends on whether the calls share a session: + + * **Independent calls, with no`resume` or `continue` option**: each result covers only its own call, so add the totals yourself, as the examples below do. + * **Calls that resume the same session** : Claude Code saves the session’s totals to its [transcript](</docs/en/sessions#where-transcripts-are-stored>) when the process exits normally and restores them when a later call resumes or forks the session. Each result already includes the session’s earlier spend. Read the latest result for the session total; summing results double-counts the restored spend. Before v2.1.277, a session that you resumed through the SDK or `claude -p` started its totals at zero, so each call’s results covered only that call. + +In streaming input mode, read each call’s total as described in Track costs in streaming input mode. For a call that ended in a crash, see Recover totals after a session crash. The following examples run two `query()` calls sequentially, add each call’s `total_cost_usd` to a running total, and print both the per-call and combined cost: TypeScript @@ -302,7 +312,7 @@ When the Claude Code process crashes, it emits a final `error_during_execution` result and exits, in single-shot and streaming input mode alike. That result may carry zeroed `usage`, `total_cost_usd`, and `modelUsage`, so recover the call’s totals from what arrived before it. Step 1 recovers the full totals whenever an earlier result exists; the fallback in step 2 recovers only the main loop’s input and cache tokens. - 1. Use the result of the turn before the crash. In streaming input mode, it holds the running total since the start of the call or since the last `/clear`. Go to step 2 instead when that result can’t help you: + 1. Use the result of the turn before the crash. In streaming input mode, it holds the running total described in Track costs in streaming input mode. Go to step 2 instead when that result can’t help you: * The call was single-shot, so no earlier result exists. * The crash happened on the first turn. * The turn before the crash was the `/clear` itself, so its result covers only the reset.
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -23,7 +23,7 @@ Usage by model: claude-sonnet-4-6: 1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55) -These totals reset when `/clear` starts a new session, so the next session’s total cost starts at $0. Before v2.1.211, they kept accumulating across `/clear` for the lifetime of the Claude Code process. For a response from the Claude API billed at the 1.1× [data residency rate](<https://platform.claude.com/docs/en/about-claude/pricing#data-residency-pricing>), Claude Code multiplies the list price of that response’s tokens by 1.1 in the session cost figure. Claude Code reports the same total in the [status line’s cost field](</docs/en/statusline#cost-and-duration-tracking>) and compares it with [`--max-budget-usd`](</docs/en/cli-reference#cli-flags>). Before v2.1.239, Claude Code didn’t apply the 1.1× to those responses, so the session cost figure was lower than the bill. +These totals reset when `/clear` starts a new session, so the next session’s total cost starts at $0. Before v2.1.211, they kept accumulating across `/clear` for the lifetime of the Claude Code process. For a response from the Claude API billed at the 1.1× [data residency rate](<https://platform.claude.com/docs/en/about-claude/pricing#data-residency-pricing>), Claude Code multiplies the list price of that response’s tokens by 1.1 in the session cost figure. The same total appears in the [status line’s cost field](</docs/en/statusline#cost-and-duration-tracking>), and the multiplied figure also counts toward [`--max-budget-usd`](</docs/en/cli-reference#cli-flags>). Before v2.1.239, Claude Code didn’t apply the 1.1× to those responses, so the session cost figure was lower than the bill. ####
modified Desktop application View current →
--- a/desktop.md +++ b/desktop.md @@ -458,7 +458,7 @@ Install plugins -[Plugins](</docs/en/plugins>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. For local and SSH sessions, click the **+** button next to the prompt box and select **Plugins** to see your installed plugins and their skills. To add a plugin, select **Add plugin** from the submenu to open the plugin browser, which shows available plugins from your configured [marketplaces](</docs/en/plugin-marketplaces>) including the official Anthropic marketplace. Select **Manage plugins** to enable, disable, or uninstall plugins. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI. The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions. To use a plugin in a cloud session, either declare it in the repository’s `.claude/settings.json` under [`enabledPlugins`](</docs/en/settings-reference#enabledplugins>) so Claude Code [installs it at session start](</docs/en/cloud-environments#what-carries-over-from-your-setup>), or enable it for your claude.ai account so Claude Code loads it as a [synced plugin](</docs/en/plugins-reference#synced-plugins>). Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins>). +[Plugins](</docs/en/plugins>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. For local and SSH sessions, click the **+** button next to the prompt box and select **Plugins** to see your installed plugins and their skills. To add a plugin, select **Add plugin** from the submenu to open the plugin browser, which shows available plugins from your configured [marketplaces](</docs/en/plugin-marketplaces>) including the official Anthropic marketplace. Select **Manage plugins** to enable, disable, or uninstall plugins. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI. The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions. A cloud session also doesn’t install plugins that the repository’s `.claude/settings.json` declares, as [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) explains. To use a plugin in a cloud session, enable it for your claude.ai account so Claude Code loads it as a [synced plugin](</docs/en/plugins-reference#synced-plugins>). Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins>). ### @@ -836,7 +836,7 @@ *.claudeusercontent.com *.claudemcpcontent.com -If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled for Claude, route `bridge.claudeusercontent.com` through the same proxy egress as `claude.ai` and `api.anthropic.com`. If you can’t route it that way, add the egress address your proxy uses for that host to your organization’s IP allowlist, but only when that address is dedicated to your organization: a shared proxy egress range also admits the proxy vendor’s other customers. Anthropic checks connections to that host against your organization’s IP allowlist using the address they arrive from. If your proxy sends traffic for it out through an address that isn’t on that allowlist, Claude in Chrome and other features that connect through the bridge stop working while the rest of the app keeps working. An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, and `code.jquery.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. +If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled for Claude, route `bridge.claudeusercontent.com` through the same proxy egress as `claude.ai` and `api.anthropic.com`. If you can’t route it that way, add the egress address your proxy uses for that host to your organization’s IP allowlist, but only when that address is dedicated to your organization: a shared proxy egress range also admits the proxy vendor’s other customers. Anthropic checks connections to that host against your organization’s IP allowlist using the address they arrive from. If your proxy sends traffic for it out through an address that isn’t on that allowlist, Claude in Chrome and other features that connect through the bridge stop working while the rest of the app keeps working. An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, `code.jquery.com`, and `unpkg.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. ###
modified Claude Desktop on Linux (beta) View current →
--- a/desktop-linux.md +++ b/desktop-linux.md @@ -8,7 +8,7 @@ Requirements - * Ubuntu 22.04 or later, or Debian 12 or later + * A Debian-based distribution: Ubuntu 22.04 or later, or Debian 12 or later * x86_64 or arm64 Other Debian-based distributions that meet these requirements may work but aren’t officially tested. On distributions that aren’t Debian-based, such as Fedora or Arch, run the [CLI](</docs/en/setup#system-requirements>) instead. If you work on Windows with WSL 2, install the Windows desktop app and run sessions inside your distribution; see [Claude Code Desktop in WSL](</docs/en/desktop-wsl>).
modified Discover and install prebuilt plugins through marketplaces View current →
--- a/discover-plugins.md +++ b/discover-plugins.md @@ -30,7 +30,13 @@ /plugin install github@claude-plugins-official -`/plugin` opens an interactive panel in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, use the [plugin browser](</docs/en/desktop#install-plugins>) in the Claude desktop app, or declare the plugin under [`enabledPlugins`](</docs/en/settings-reference#enabledplugins>) in `.claude/settings.json` for cloud sessions. If the install fails, match the message Claude Code reports: +`/plugin` opens an interactive panel in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, install the plugin another way: + + * **Claude desktop app** : use the [plugin browser](</docs/en/desktop#install-plugins>). + * **VS Code extension** : install from the [**Manage plugins** dialog](</docs/en/vs-code#manage-plugins>). + * **Cloud sessions** : enable the plugin for your claude.ai account so Claude Code loads it as a [synced plugin](</docs/en/plugins-reference#synced-plugins>). + +If the install fails, match the message Claude Code reports: * `Marketplace "claude-plugins-official" not found`: add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`, then retry the install. * The plugin is not found in the marketplace: check the plugin name. @@ -287,7 +293,7 @@ Add from claude.ai -In terminal sessions where [plugins sync from your claude.ai account](</docs/en/plugins-reference#synced-plugins>), claude.ai can also list marketplaces for you, such as your organization’s plugin library and your own claude.ai uploads. `claude plugin marketplace list` prints them in a `From claude.ai:` section, and the `/plugin` **Marketplaces** tab lists them. Select one there to add it. Adding a marketplace from claude.ai requires Claude Code v2.1.273 or later. To add one from your shell, run `claude plugin marketplace add` with the `--claudeai` flag and the name shown in the list: +In terminal sessions where [plugins sync from your claude.ai account](</docs/en/plugins-reference#synced-plugins>), claude.ai can also list marketplaces for you, such as your organization’s plugin library and your own claude.ai uploads. `claude plugin marketplace list` prints them in a `From claude.ai:` section, and the `/plugin` **Marketplaces** tab lists them. Select one there to add it. Adding a marketplace from claude.ai requires Claude Code v2.1.273 or later. To add a marketplace from that list in your shell instead, run `claude plugin marketplace add` with the `--claudeai` flag and the name the list shows: claude plugin marketplace add --claudeai claudeai-organization-library @@ -339,7 +345,7 @@ /plugin install quality-review-plugin --marketplace your-org/plugins -The source takes the same forms as `/plugin marketplace add`, such as GitHub `owner/repo`, a git URL, or a local path, except that it can’t contain spaces. Give the plugin name bare, without an `@marketplace` suffix. If you haven’t added that marketplace yet, Claude Code shows the source it resolved and asks you to confirm before adding it. Declining cancels the install and adds nothing. Once the marketplace is added, the plugin’s details open and you choose an [installation scope](</docs/en/settings#where-settings-live>). +The source takes the same forms as `/plugin marketplace add`, such as GitHub `owner/repo`, a git URL, or a local path, except that it can’t contain spaces. Give the plugin name bare, without an `@marketplace` suffix. Claude Code shows the source it resolved and asks you to confirm before adding the marketplace. Declining cancels the install and adds nothing. Once the marketplace is added, the plugin’s details open and you choose an [installation scope](</docs/en/settings#where-settings-live>). If the source matches a marketplace you’ve already added, Claude Code skips the confirmation and opens the plugin’s details in that marketplace. ##
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -195,7 +195,7 @@ `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). When unset, Claude Code asks the server on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and when you point `ANTHROPIC_BASE_URL` at an LLM gateway or proxy. Set to `0` to use Claude Code’s own classifier requests instead. Not read on a direct connection to the Anthropic API. Requires Claude Code v2.1.271 or later; asking the server by default requires v2.1.278 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later -`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files a Bash command changed](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later +`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) @@ -220,7 +220,7 @@ `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later -`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later +`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent 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-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `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 @@ -230,7 +230,7 @@ `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting -`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set +`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later @@ -241,7 +241,7 @@ `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 `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills -`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear @@ -268,6 +268,7 @@ `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -361,7 +362,7 @@ `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-reference#syntaxhighlightingdisabled>) 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, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later @@ -446,6 +447,7 @@ `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) +`OTEL_LOG_MANAGED_SETTINGS`| Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](</docs/en/monitoring-usage#managed-settings-resolved-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) @@ -457,7 +459,7 @@ `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility -`TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool keeps (default: 32000; maximum: 160000). If you set the [`taskOutputMaxChars`](</docs/en/settings-reference#taskoutputmaxchars>) setting, Claude Code ignores this variable +`TASK_MAX_OUTPUT_LENGTH`| Removed in v2.1.277 and now a no-op, together with the `TaskOutput` tool it sized. Previously set the maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool kept. Claude reads a background task’s output file with `Read` instead `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Google Cloud’s Agent Platform @@ -507,6 +509,7 @@ * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag + * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) ###
modified Error reference View current →
Show diff (285 lines)
--- a/errors.md +++ b/errors.md @@ -61,6 +61,7 @@ `API Error: 401 Invalid authentication credentials`| Authentication `Login expired · Please run /login`| Authentication `Claude login not accepted · Run /login, then try again`| Authentication +`Artifacts need a claude.ai login`| Authentication `Not signed in to the Cloud gateway — run /login.`| Authentication `Administrator policy requires a Cloud gateway sign-in on this machine`| Authentication `Failed to authenticate: OAuth session expired and could not be refreshed`| Authentication @@ -77,6 +78,7 @@ `Issuer mismatch in authorization response (RFC 9207)`| Authentication `Cloud gateway session expired — run /login to reconnect.`| Authentication `Cloud gateway <url> no longer accepts this session`| Authentication +`Sign-in timed out while waiting for you to continue. Try again.`| Authentication `AWS credentials expired or invalid`| Authentication `AWS authentication failed`| Authentication `Google Cloud credentials expired or invalid`| Authentication @@ -139,6 +141,8 @@ `effort '<level>' is not supported when thinking is disabled`| Request errors `max_tokens must be greater than thinking.budget_tokens`| Request errors `API Error: 400 due to tool use concurrency issues`| Request errors +`API Error: 400 orphaned tool_result in conversation history`| Request errors +`API Error: 400 duplicate tool_use ID in conversation history`| Request errors `[Unsupported tool content removed]`| Request errors `server_tool_use.name: Input should be` on every turn of a resumed session| Request errors `<model> can't help with this. Start a new session to continue`| Request errors @@ -189,6 +193,8 @@ `No conversation found with session ID: <session-id>`| Command-line errors `Cannot switch renderers in this session`| Command-line errors `Cannot switch renderers while work is running in the background`| Command-line errors +`Couldn't open Claude Desktop`| Command-line errors +`Failed to open Claude Desktop. Please try opening it manually.`| Command-line errors `Couldn't read your Zed keymap` / `Couldn't back up your Zed keymap` / `Couldn't update your Zed keymap`| Command-line errors `Your Zed keymap isn't a readable list of keybindings`| Command-line errors `Skill usage reports are not available on this connection.`| Command-line errors @@ -196,6 +202,7 @@ `Output styles are saved to local settings (.claude/settings.local.json), which this session doesn't load`| Command-line errors ``plugin eval` is currently in early access` / ``plugin eval` is currently unavailable`| Plugin errors `Marketplace "<name>" is registered from an untrusted source`| Plugin errors +`Marketplace "<name>" is already added from a different source`| Plugin errors `references ${user_config.*} in a shell-form command`| Plugin errors `Monitor "<name>" from plugin <plugin> references ${user_config.*} in its command`| Plugin errors `headersHelper for MCP server '<name>' references ${user_config.*}`| Plugin errors @@ -206,6 +213,7 @@ `Plugin source path refused`| Plugin errors `Failed to load marketplace configuration`| Plugin errors `Marketplace configuration file is corrupted`| Plugin errors +`Plugin "<name>@synced" is required by your organization and can't be disabled here`| Plugin errors `would be spawned with zero tools — refusing`| Tool errors `File is covered by a Read deny rule in your permission settings`| Tool errors `subagent_type is required: the general-purpose agent is not available in this session`| Tool errors @@ -236,6 +244,8 @@ `Can't open MCP settings in a background session`| Background session errors `blocked because the path is spelled in a form that cannot be safely resolved`| Background session errors `blocked because the path is network-shaped`| Background session errors +`is isolated in the worktree <path>, but this command <reason>. Refusing to run it`| Background session errors +`too complex to verify that it stays inside the worktree`| Background session errors `This session has no saved transcript`| Background session errors `Can't open — this session is running in another terminal`| Background session errors `This conversation is already open in another running Claude session`| Background session errors @@ -271,6 +281,7 @@ `MCP server <name> is blocked by enterprise managed policy`| Configuration warnings `Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.`| Configuration warnings `Managed settings drop-in directory could not be read`| Configuration warnings +`otelHeadersHelper failed; telemetry is not being exported. See /status: ...`| Configuration warnings `"crossSessionInbound" must be one of "accept", "hold", "refuse"`| Configuration warnings `headersHelper not run — this workspace has no persisted trust`| Configuration warnings `Invalid permission rule "..." was skipped: Malformed Tool(content) rule`| Configuration warnings @@ -572,7 +583,7 @@ This is an entitlement check, not a quota exhaustion. It fires even when your session and weekly allowances have capacity remaining. See [Extended context](</docs/en/model-config#extended-context>) for which plans include 1M context directly and which require usage credits. Claude Code runs this check when you pick the model with `/model`, and only on a direct connection to the Anthropic API; if you point `ANTHROPIC_BASE_URL` at an [LLM gateway](</docs/en/llm-gateway>), `/model` allows the `[1m]` selection and the gateway decides whether the request succeeds. When this error appears mid-conversation because the context grew past 200K tokens, Claude Code automatically compacts the conversation back under the standard context limit and keeps the session at that limit afterward, so no action is needed. On versions before v2.1.172, the error repeated on every subsequent request including `/compact`; run `/clear` on those versions to recover. The steps below apply when you explicitly selected a `[1m]` model. **What to do:** * Run `/model` and select the variant without the `[1m]` suffix to fall back to the standard context window - * Where the message names `/usage-credits`, run it to turn on metered billing for the 1M variant on Pro and Max, or to request usage credits from your admin on Team and Enterprise. Restart Claude Code once usage credits are on. Until you restart, the session stays at the standard context limit. + * Where the message names `/usage-credits`, run it to turn on metered billing for the 1M variant on Pro and Max, or to request usage credits from your admin on Team and Enterprise. Once usage credits are on, restart Claude Code or start a new session, whichever the message says. Until then, the session stays at the standard context limit. * If the error persists after `/model`, a 1M model ID may be set elsewhere. See [Setting your model](</docs/en/model-config#setting-your-model>) for the configuration locations to check in priority order. * To remove 1M variants from the model picker entirely, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/env-vars>) @@ -781,7 +792,8 @@ * Run the command configured in `apiKeyHelper` directly in your shell to reproduce the failure * If the command reports an expired session, re-authenticate with your credential provider, for example by signing in to your SSO or secrets vault again * Fix the command so it prints only the key to stdout, as a single token of printable ASCII up to 16,384 characters, and exits with code 0. See [rotate credentials with apiKeyHelper](</docs/en/llm-gateway-connect#rotate-credentials-with-apikeyhelper>) for a working setup. - * Run `/status` to confirm `apiKeyHelper` is the active credential source. Each time the command fails, its exit code and error output appear in an `Authentication` panel in the terminal. Before v2.1.212, the panel was titled `Cloud authentication`. + * Run `/status` to see the failure and confirm `apiKeyHelper` is the active credential source. The `apiKeyHelper` row shows `Failing` with the last failure’s detail, such as the exit code and the command’s error output, and disappears after the next successful run. Before v2.1.274, `/status` showed only the credential source, not the failure. + * Each time the command fails, its exit code and error output also appear in an `Authentication` panel in the terminal. Before v2.1.212, the panel was titled `Cloud authentication`. ### @@ -1045,6 +1057,24 @@ ​ +Artifacts need a claude.ai login + +Claude Code refused an [artifact](</docs/en/artifacts>) publish or read because the session has no claude.ai login it can use for artifacts. Every form of the message starts with the same words, followed by a remedy that depends on how your session authenticates. With no competing credential it reads: + + Artifacts need a claude.ai login. Run /login and select "Claude account with subscription", then retry — the "Anthropic Console account" option does not provide claude.ai credentials. + +**What to do:** + + * Run `/login` and select **Claude account with subscription**. The **Anthropic Console account** option doesn’t provide claude.ai credentials. + * When the message names a credential that takes precedence, such as `ANTHROPIC_API_KEY`, an `apiKeyHelper` setting, or a Console key saved by a previous `/login`, remove it the way the message says, then run `/login` + * When the message says this remote session authenticates through the machine that launched it, sign in to claude.ai on that machine, then reconnect the session + * When the message says the credential is injected by the session’s host environment, you can’t change it in that session; start a session that is signed in to claude.ai + * See [Availability](</docs/en/artifacts#availability>) for the other requirements artifacts have, such as plan, model provider, and organization policy + +### + +​ + Administrator policy requires a Cloud gateway sign-in An administrator’s [managed settings](</docs/en/managed-settings>) on this machine set [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) to `"gateway"` or set [`forceLoginGatewayUrl`](</docs/en/settings-reference#forcelogingatewayurl>). Unless you select a cloud provider through a variable such as `CLAUDE_CODE_USE_BEDROCK`, Claude Code then accepts only the [Claude apps gateway](</docs/en/claude-apps-gateway>) sign-in. You see one of two messages: @@ -1337,6 +1367,20 @@ * Run `/login` in the session and complete the browser sign-in * For a non-interactive launch, start `claude` in the same environment, run `/login`, then rerun your command + +### + +​ + +Sign-in timed out while waiting for you to continue + +During a [Claude apps gateway](</docs/en/claude-apps-gateway>) sign-in, the gateway named the account that signed in, and Claude Code asked you to confirm it before saving the credential. You left the confirmation open past the sign-in’s own expiry, and the gateway issued no refresh token that could renew it, so Claude Code stored nothing when you continued: + + Sign-in timed out while waiting for you to continue. Try again. + +**What to do:** + + * Run `/login` again and confirm the account before the sign-in expires ### @@ -2014,10 +2058,12 @@ The conversation history reached the API in an inconsistent state, usually after a tool call was interrupted or a turn was edited mid-stream. API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation. + API Error: 400 orphaned tool_result in conversation history. Run /rewind to recover the conversation. + API Error: 400 duplicate tool_use ID in conversation history. Run /rewind to recover the conversation. API Error: 400 ... unexpected `tool_use_id` found in `tool_result` blocks API Error: 400 ... thinking blocks ... cannot be modified -All three variants mean the same thing: the sequence of `tool_use`, `tool_result`, and `thinking` blocks in history no longer matches what the API expects. **What to do:** +All variants mean the same thing: the sequence of `tool_use`, `tool_result`, and `thinking` blocks in history no longer matches what the API expects. **What to do:** * If you are using Opus 4.7 or Opus 4.8, run `claude update` first. Versions before v2.1.156 can trigger this error during normal tool use, and `/rewind` doesn’t clear it. * Run `/rewind`, or press Esc twice, to step back to a checkpoint before the corrupted turn and continue from there. See [Checkpointing](</docs/en/checkpointing>) for how checkpoints are created and restored. @@ -2702,6 +2748,7 @@ Claude Code exits with code 1 after showing the message. The `/resume` picker inside a running session reports `Failed to resume conversation` in the conversation instead, and your current session keeps running. Before v2.1.216, a failed resume from the `claude --resume` picker stayed on the `Resuming conversation…` spinner indefinitely instead of showing this message. **What to do:** * Run `claude --resume <session-id>` with the session ID from the message to retry + * If every retry fails the same way, run `claude update` and resume again. Versions before v2.1.275 fail the resume when the saved transcript contains an entry they can’t read. * If the retry fails again, run `claude` to start a new session ### @@ -2756,6 +2803,23 @@ ​ +Couldn’t open Claude Desktop + +You ran [`/desktop`](</docs/en/desktop#coming-from-the-cli>), or its alias `/app`, and the system command Claude Code uses to open Claude Desktop failed. The session stays in the terminal. + + Error: Couldn't open Claude Desktop (`open` exited 1: LSOpenURLsWithRole() failed for the URL claude://resume?session=<session-id> with error -10814). Open Claude Desktop and run /desktop again. + +**What to do:** + + * Open Claude Desktop yourself, then run `/desktop` again + * To read that command’s full error output, turn on debug logging with `/debug`, run `/desktop` again, and check the debug log + +Before v2.1.275, the message was `Failed to open Claude Desktop. Please try opening it manually.` and didn’t say what failed. + +### + +​ + /terminal-setup left your Zed keymap unchanged You ran [`/terminal-setup`](</docs/en/terminal-config#enter-multiline-prompts>) in Zed, and Claude Code couldn’t complete the update to your Zed `keymap.json`, so it left the file as it was. Each message names the path to your keymap and ends with the keybinding block to add yourself: @@ -2867,6 +2931,21 @@ ​ +Marketplace is already added from a different source + +You confirmed adding a marketplace through [`/plugin install <plugin> --marketplace <source>`](</docs/en/discover-plugins#add-a-marketplace-and-install-in-one-command>), and the catalog Claude Code fetched from that source names itself the same as a marketplace you already added from a different source. Claude Code keeps the existing marketplace instead of replacing it, and the plugin isn’t installed. + + Marketplace "acme-tools" is already added from a different source (github:acme/plugins). To use this source instead, remove that marketplace first with /plugin marketplace remove acme-tools. + +**What to do:** + + * If the marketplace you already added is the one you want, install from it by name: `/plugin install <plugin>@<name>` + * To switch to the new source, run `/plugin marketplace remove <name>`, then retry the install + +### + +​ + Plugin command references user_config in a shell command A plugin hook, [monitor](</docs/en/plugins-reference#monitors>), or MCP [`headersHelper`](</docs/en/mcp#use-dynamic-headers-for-custom-authentication>) command references a `${user_config.KEY}` [plugin option](</docs/en/plugins-reference#user-configuration>), and the substituted string would be passed to a shell. A configured value containing `$(...)`, backticks, or `;` would run as code there, so Claude Code refuses to start the component instead of substituting the value. The check runs on the command template, so the error appears even when no value is configured yet. Before v2.1.207, the value was substituted into the shell command. The wording depends on which surface referenced the option. A shell-form hook reports: @@ -3006,6 +3085,20 @@ * Open `~/.claude/plugins/known_marketplaces.json` and repair the JSON, or fix the entries the message names as not matching the registry schema * If you can’t repair it, delete the file or replace its contents with `{}`, then re-add each marketplace with `claude plugin marketplace add <source>`. Claude Code re-registers the marketplaces your user or managed settings declare in [`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>) the next time you start it in a folder you’ve trusted. + +### + +​ + +Plugin is required by your organization + +You ran `claude plugin disable`, or used the `/plugin` **Installed** tab, to turn off a [plugin synced from claude.ai](</docs/en/plugins-reference#synced-plugins>) that your organization marks as required: + + Plugin "<name>@synced" is required by your organization and can't be disabled here. Contact your admin to change it. + +Claude Code saves nothing and the plugin stays enabled. When you try to disable a plugin that a required plugin depends on, Claude Code refuses the same way, with a message naming the required plugin that needs it. **What to do:** + + * Ask an admin of your claude.ai organization to change the plugin’s required status on claude.ai ## @@ -3367,6 +3460,27 @@ ​ +Command blocked by the worktree isolation checks + +Claude ran a Bash or Monitor command in a [session isolated in a worktree](</docs/en/worktrees#how-claude-code-enforces-isolation>), and Claude Code refused it for one of two reasons: + + * The command points git at the main checkout. + * Claude Code can’t verify from the command text that any git the command runs stays inside the worktree. A command that never names git can still be refused for this reason, because expanding a variable indirection such as `${!name}` or running a Bash function substitution such as `${ command; }` produces a value at runtime that can itself be a command. + +The middle of the message names what couldn’t be verified: + + This session is isolated in the worktree /path/to/worktree, but this command evaluates ${!x@P} arithmetically inside a construct too complex to verify, which can run a command hidden in a variable's value. Refusing to run it — a worktree-isolated session's git operations must target its own worktree. Split it into plain, separate commands and run them from /path/to/worktree. + +**What to do:** + + * Usually nothing: Claude reads the message and rewrites the command the way its final sentence asks + * If a command you asked for keeps being refused, spell the flagged value literally: replace the indirection or substitution with its value, and run git as its own plain command from inside the worktree + * To act on the main checkout on purpose, run the command yourself in a terminal outside the session + +### + +​ + This session has no saved transcript You attached to a stopped [background session](</docs/en/agent-view>) that was backgrounded from another conversation with `←` or `/background` and stopped before its first response finished. Until that first response finishes, the conversation still lives only in the session it was backgrounded from, so `claude attach` refuses to start the stopped session rather than begin a blank conversation under the same session ID. The message ends with the `claude respawn` command for this session: @@ -3692,7 +3806,7 @@ Failed to restore the code: No files were restored: 1 file failed (backup missing, or the file could not be updated) -Claude Code deletes a session’s backups in the [retention sweep](</docs/en/claude-directory#cleaned-up-automatically>), by default about 30 days after the session last saved one. If you resume a session after that, `/rewind` still lists its checkpoints, but rewinding to one of them can fail with this error. If the message also says `N paths were skipped for link safety`, see Restored the code, but skipped files for those paths. **What to do:** +Claude Code deletes a session’s backups in the [retention sweep](</docs/en/claude-directory#cleaned-up-automatically>), by default about 30 days after the session last saved one. If you resume a session after that, `/rewind` still lists its checkpoints, but rewinding to one of them can fail with this error. If the message also says `N paths were skipped for link safety`, see Restored the code, but skipped files for those paths. When you fork a session, for example with [`--fork-session`](</docs/en/cli-reference#cli-flags>) or [`/branch`](</docs/en/sessions#branch-a-session>), Claude Code copies the original session’s backups into the fork. When Claude Code can’t copy a backup, for example because the disk is full, that backup is missing in the fork. Rewinding to a checkpoint that needs it can fail with this error. **What to do:** * Undo the changes another way: ask Claude to reverse its edits, or restore the files from version control. When the backups are gone, running `/rewind` again fails the same way. * If Claude Code couldn’t write or delete a file, fix what blocks the write, such as file permissions, then run `/rewind` again. @@ -3936,6 +4050,24 @@ * If you administer the machine, fix the named document so it parses as a JSON object, or remove the file, profile, or registry value. An empty `managed-settings.json` counts as `{}` and doesn’t block launch. * If you don’t, ask your administrator to fix the deployed document. Nothing in your own settings files causes or clears this error. + +### + +​ + +otelHeadersHelper failed + +Claude Code shows this warning as a notification in the terminal interface, once per interactive session, when the [`otelHeadersHelper`](</docs/en/settings-reference#otelheadershelper>) script fails or prints output that doesn’t meet the [script requirements](</docs/en/monitoring-usage#script-requirements>). While the script keeps failing, exports fail and your telemetry backend receives nothing from the session. The text after `See /status:` says what failed, such as the script’s exit code followed by its error output: + + otelHeadersHelper failed; telemetry is not being exported. See /status: exited 1: token service unreachable + +**What to do:** + + * Run `/status` to read the failure detail. + * Fix the script so it exits 0 within 30 seconds and prints a JSON object of string header values on stdout. See [script requirements](</docs/en/monitoring-usage#script-requirements>). + * If your organization deploys the script through [managed settings](</docs/en/managed-settings>), ask whoever maintains them to fix it. + +In [non-interactive mode](</docs/en/headless>) with `-p`, the same failure appears on stderr as `otelHeadersHelper failed (OpenTelemetry export headers unavailable): <error>` instead. ###
modified Speed up responses with fast mode View current →
--- a/fast-mode.md +++ b/fast-mode.md @@ -1,8 +1,8 @@ Fast mode is in research preview. The feature, pricing, and availability may change based on feedback. -Fast mode is a high-speed configuration for Claude Opus, making the model up to 2.5x faster at a higher cost per token. Toggle it on with `/fast` when you need speed for interactive work like rapid iteration or live debugging, and toggle it off when cost matters more than latency. Fast mode is not a different model. It uses Claude Opus with a different API configuration that prioritizes speed over cost efficiency. You get identical quality and capabilities with faster responses. Fast mode is supported on Opus 5 and Opus 4.8. It is not available on Sonnet, Haiku, or other models. Claude Code treats Opus 4.7 like any other model without fast mode support: switching to it turns fast mode off. Fast mode for Opus 4.7 was deprecated on June 25, 2026, and removed on July 24, 2026. What to know: - - * Use `/fast` to toggle on fast mode in the Claude Code CLI. The VS Code extension follows your `fastMode` setting and offers a **Toggle fast mode** command when the selected model supports fast mode. +Fast mode is a high-speed configuration for Claude Opus, making the model up to 2.5x faster at a higher cost per token. Toggle it on with `/fast` when you need speed for interactive work like rapid iteration or live debugging, and toggle it off when cost matters more than latency. Fast mode is not a different model. It uses Claude Opus with a different API configuration that prioritizes speed over cost efficiency. You get identical quality and capabilities with faster responses. Fast mode is supported on Opus 5 and Opus 4.8. It is not available on Sonnet, Haiku, or other models. Opus 4.7 doesn’t support fast mode, so switching to it turns fast mode off. Fast mode for Opus 4.7 was deprecated on June 25, 2026, and removed on July 24, 2026. What to know: + + * Use `/fast` to toggle on fast mode in the Claude Code CLI. The [VS Code extension](</docs/en/vs-code>) offers a **Toggle fast mode** command when the selected model supports fast mode. Claude Code saves that toggle to your `fastMode` setting. * Fast mode pricing per MTok input/output is $10/$50 on Opus 5 and Opus 4.8. * Available to Claude Code users on subscription plans (Pro/Max/Team/Enterprise) and on Claude Console. Team and Enterprise organizations need an Owner to enable it first, and Console organizations need access provisioned first, both described under Requirements. * For Claude Code users on subscription plans (Pro/Max/Team/Enterprise), fast mode is available via usage credits only and not included in the subscription rate limits. @@ -126,9 +126,11 @@ * **Paid Console organization** : Claude Console accounts don’t use usage credits, and your organization pays for fast mode per token with the rest of its API usage. On the Console’s free Evaluation plan, `/fast` shows “Fast mode unavailable during evaluation. Please purchase credits.” To clear it, purchase credits in your [Console billing settings](<https://platform.claude.com/settings/billing>). * **Owner enablement for Team and Enterprise** : fast mode is disabled by default for Team and Enterprise organizations. An Owner must explicitly enable fast mode before users can access it. -Two organization settings can block turning fast mode on with `/fast`: +Four organization settings can block turning fast mode on with `/fast`: * **Fast mode not enabled** : if fast mode hasn’t been enabled for your organization, turning fast mode on with `/fast` shows “Fast mode has been disabled by your organization.” + * **Fast mode turned off by managed settings** : if your organization deploys [managed settings](</docs/en/managed-settings>) that set [`fastMode: false`](</docs/en/settings-reference#fastmode>), turning fast mode on with `/fast` shows the same “Fast mode has been disabled by your organization” message. + * **Per-session opt-in required** : managed settings that set `fastModePerSessionOptIn: true` refuse `/fast on` with the same message everywhere except an interactive terminal session. * **Fast-mode model not allowed** : if your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist excludes the fast-mode Opus model, turning it on is refused with “is not in your organization’s allowed models”. In a session already running on an allowed Opus model that supports fast mode, `/fast` instead enables fast mode on your current model without switching models. ### @@ -174,7 +176,7 @@ "fastModePerSessionOptIn": true } -This is useful for controlling costs in organizations where users run multiple concurrent sessions. The user’s fast mode preference is still saved, so removing this setting restores the default persistent behavior. +This is useful for controlling costs in organizations where users run multiple concurrent sessions. The user’s fast mode preference is still saved, so removing this setting restores the default persistent behavior. When managed settings set the key, `/fast on` works only in an interactive terminal session. Everywhere else, including [non-interactive mode](</docs/en/headless>), the [VS Code extension](</docs/en/vs-code>), and cloud sessions, it’s refused with a message that your organization has disabled fast mode. ##
modified Extend Claude Code View current →
--- a/features-overview.md +++ b/features-overview.md @@ -159,7 +159,7 @@ Features can be defined at multiple levels: user-wide, per-project, via plugins, or through managed policies. You can also nest CLAUDE.md files in subdirectories or place skills in specific packages of a monorepo. When the same feature exists at multiple levels, here’s how they layer: - * **CLAUDE.md files** are additive: all levels contribute content to Claude’s context simultaneously. Files from your working directory and above load at launch; subdirectories load as you work in them. When instructions conflict, Claude uses judgment to reconcile them, with more specific instructions typically taking precedence. See [how CLAUDE.md files load](</docs/en/memory#how-claude-md-files-load>). + * **CLAUDE.md files** are additive: all levels contribute content to Claude’s context simultaneously. Files from your working directory and above load at launch; subdirectories load as you work in them. When instructions conflict, Claude uses judgment to reconcile them. See [how CLAUDE.md files load](</docs/en/memory#how-claude-md-files-load>). * **Skills and subagents** override by name: when the same name exists at multiple levels, one definition wins based on priority (managed > user > project for skills; managed > CLI flag > project > user > plugin for subagents). Plugin skills are [namespaced](</docs/en/plugins#add-skills-to-your-plugin>) to avoid conflicts. See [skill discovery](</docs/en/skills#resolve-skills-that-share-a-name>) and [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>). * **MCP servers** override by name: local > project > user. See [MCP scope](</docs/en/mcp#scope-hierarchy-and-precedence>). * **Hooks** merge: all registered hooks fire for their matching events regardless of source. See [hooks](</docs/en/hooks>).
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -83,7 +83,7 @@ cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txt -With `--output-format json`, the response payload includes `total_cost_usd` and a per-model cost breakdown, so scripted callers can track spend per invocation without consulting the [usage dashboard](</docs/en/costs>). Both figures are [client-side estimates](</docs/en/agent-sdk/cost-tracking>) and can differ from your actual bill. +With `--output-format json`, the response payload includes `total_cost_usd` and a per-model cost breakdown, so scripted callers can track spend without consulting the [usage dashboard](</docs/en/costs>). When you continue an earlier conversation with `--continue` or `--resume`, the run reports the conversation’s whole total, [earlier runs’ spend included](</docs/en/agent-sdk/cost-tracking#accumulate-costs-across-multiple-calls>). Both figures are [client-side estimates](</docs/en/agent-sdk/cost-tracking>) and can differ from your actual bill. Piped stdin is capped at 10MB. If you exceed the cap, Claude Code exits with a clear error and a non-zero status. To work with larger inputs, write the content to a file and reference the file path in your prompt instead of piping it. @@ -168,7 +168,7 @@ * **By default** : the subagent’s `tool_use` and `tool_result` blocks. * **With[`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) or [`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`](</docs/en/env-vars>)**: the subagent’s text and thinking blocks too, so you can reconstruct each subagent’s transcript. This requires Claude Code v2.1.211 or later. -When you enable either option, Claude Code forwards messages from [subagents at every nesting depth](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>): when a subagent spawns its own subagent, the nested subagent’s messages carry the ID of the Agent tool call that spawned it in `parent_tool_use_id`, so you can rebuild the full nesting tree by following those IDs. Before v2.1.219, messages from nested subagents didn’t appear in the stream. Skills that [run in a subagent](</docs/en/skills#run-skills-in-a-subagent>) appear in the stream the same way: the forked skill’s first message is a `user` message carrying the skill content that drives the run. If you enable either option, the stream also carries the forked skill’s text and thinking blocks. Before v2.1.265, only a forked skill’s `tool_use` and `tool_result` blocks appeared in the stream. +When you enable either option, Claude Code forwards messages from [subagents at every nesting depth](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), whether each one was spawned with the Agent tool or started as a [forked skill](</docs/en/skills#run-skills-in-a-subagent>). Messages of subagents that a forked skill spawns, and of forked skills started inside a subagent or another forked skill, require Claude Code v2.1.275 or later. In `parent_tool_use_id`, the nested subagent’s messages carry the ID of the Agent or Skill tool call that started it, so you can rebuild the full nesting tree by following those IDs. Before v2.1.219, messages from nested subagents didn’t appear in the stream. Skills that [run in a subagent](</docs/en/skills#run-skills-in-a-subagent>) appear in the stream the same way: the forked skill’s first message is a `user` message carrying the skill content that drives the run. If you enable either option, the stream also carries the forked skill’s text and thinking blocks. Before v2.1.265, only a forked skill’s `tool_use` and `tool_result` blocks appeared in the stream. ####
modified Hosting the Agent SDK View current →
--- a/hosting.md +++ b/hosting.md @@ -1,4 +1,4 @@ -The Agent SDK spawns and supervises a `claude` CLI subprocess that owns a shell, a working directory, and session files on disk. Hosting it is not like hosting a stateless API wrapper. Every running agent is a long-lived process tied to local state, which shapes how you allocate resources, persist sessions, and scale across tenants. This page covers self-hosting on your own infrastructure. For deployable Dockerfiles and Kubernetes manifests, see the [hosting cookbook](<https://github.com/anthropics/claude-cookbooks/tree/main/claude_agent_sdk/hosting>). If you do not need infrastructure control, custom isolation, or your own data plane, consider [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) instead: a hosted REST API where Anthropic runs the agent and the sandbox, so your application sends events and streams back results with no hosting infrastructure to operate. +The Agent SDK spawns and supervises a `claude` CLI subprocess that owns a shell, a working directory, and session files on disk. Hosting it is not like hosting a stateless API wrapper. Every running agent is a long-lived process tied to local state, which shapes how you allocate resources, persist sessions, and scale across tenants. This page covers self-hosting on your own infrastructure. For deployable Dockerfiles and Kubernetes manifests, see the [hosting cookbook](<https://github.com/anthropics/claude-cookbooks/tree/main/claude_agent_sdk/hosting>). If you don’t need to run the agent loop itself on your own infrastructure, consider [Managed Agents](<https://platform.claude.com/docs/en/managed-agents/overview>) instead. Anthropic hosts the agent loop, and your application sends events and receives streamed results through the client SDKs or the REST API. Tool execution runs in an Anthropic-managed cloud sandbox or a [self-hosted sandbox](<https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes>) on your own infrastructure. ##
modified How Claude Code works View current →
--- a/how-claude-code-works.md +++ b/how-claude-code-works.md @@ -6,7 +6,7 @@ The agentic loop -When you give Claude a task, it works through three phases: **gather context** , **take action** , and **verify results**. These phases blend together. Claude uses tools throughout, whether searching files to understand your code, editing to make changes, or running tests to check its work. The loop adapts to what you ask. A question about your codebase might only need context gathering. A bug fix cycles through all three phases repeatedly. A refactor might involve extensive verification. Claude decides what each step requires based on what it learned from the previous step, chaining dozens of actions together and course-correcting along the way. You’re part of this loop too. You can interrupt at any point to steer Claude in a different direction, provide additional context, or ask it to try a different approach. Claude works autonomously but stays responsive to your input. The agentic loop is powered by two components: models that reason and tools that act. Claude Code serves as the **agentic harness** around Claude: it provides the tools, context management, and execution environment that turn a language model into a capable coding agent. +When you give Claude a task, it works through three phases: **gather context** , **take action** , and **verify results**. These phases blend together. Claude uses tools throughout, whether searching files to understand your code, editing to make changes, or running tests to check its work. The loop adapts to what you ask. A question about your codebase might only need context gathering. A bug fix cycles through all three phases repeatedly. A refactor might involve extensive verification. Claude decides what each step requires based on what it learned from the previous step, chaining dozens of actions together and course-correcting along the way. You’re part of this loop too. You can interrupt at any point to steer Claude in a different direction, provide additional context, or ask it to try a different approach. Claude works autonomously but stays responsive to your input. The agentic loop is powered by two components: models that reason and tools that act. Claude Code is the layer around the model that provides the tools and manages the context the model sees. This surrounding layer is what the term agentic harness refers to. ### @@ -212,10 +212,10 @@ Interrupt and steer -You can redirect Claude at any point without waiting for the turn to finish or starting over: +You can redirect Claude at any point without starting over. Do either of these: * **Press`Esc`** to stop Claude immediately. The running tool call is canceled and Claude waits for your next instruction. If you have messages queued, Claude Code [sends them next](</docs/en/interactive-mode#queue-messages-while-claude-works>). - * **Type a correction and press`Enter`** to send it without stopping the running tool. Claude reads it as soon as the current action completes and adjusts before deciding its next step. + * **Type a correction and press`Enter`** without stopping Claude. The message shows as queued above the input box. If Claude is running tool calls, it reads the message as soon as those calls finish, within the same turn, and adjusts before its next step. [Queue messages while Claude works](</docs/en/interactive-mode#queue-messages-while-claude-works>) covers when other queued entries are sent. ###
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -31,6 +31,7 @@ `Up/Down arrows` or `Ctrl+P`/`Ctrl+N`| Move cursor or navigate command history| When the input spans more than one visual row, whether wrapped or multiline, first moves the cursor within the prompt. Once the cursor is on the first or last visual row, pressing again navigates command history. While you have messages queued, `Up` from the first row instead takes them back `Esc`| Interrupt Claude, or close a dialog| Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far. If you have messages queued, Claude Code sends them next. When a dialog is open, `Esc` closes the dialog. On a permission prompt, `Esc` declines the action, the same as [**No** without a comment](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>) `Esc` \+ `Esc`| Clear input draft, or rewind| When the prompt input contains text, double `Esc` clears it and saves the draft to history so `Up` recalls it. When the input is empty, double `Esc` opens the [rewind menu](</docs/en/checkpointing>) to restore or summarize code and conversation from a previous point +`Ctrl+Enter` or `Ctrl+X Ctrl+S`| Send queued messages now| Interrupts the current turn so your queued messages, and your draft with them, go out right away instead of when the turn ends. In shell mode, the key queues your command without interrupting. In terminals that don’t report extended keys, `Ctrl+Enter` arrives as plain `Enter`; `Ctrl+X Ctrl+S` works in any terminal. Requires Claude Code v2.1.275 or later `Shift+Tab`, or `Alt+M` on Windows when the Node or Bun runtime doesn’t enable VT input mode| Cycle permission modes| Cycle through `default` (labeled Manual in the mode indicator), `acceptEdits`, `plan`, and, when available, `bypassPermissions` and then `auto`. From `auto`, the first press switches to `default`. See [permission modes](</docs/en/permission-modes>). On a file permission prompt, the same key closes an open [comment field](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>). With no field open, it selects the option that allows the action for the rest of the session, when the prompt offers that option `Option+P` (macOS) or `Alt+P` (Windows/Linux)| Switch model| Switch models without clearing your prompt `Option+T` (macOS) or `Alt+T` (Windows/Linux)| Toggle extended thinking| Enable or disable extended thinking mode. Has no effect on Fable 5.1 or Fable 5, which always use extended thinking. Works on macOS without configuring Option as Meta @@ -350,7 +351,9 @@ * Background tasks are automatically cleaned up when Claude Code exits. On macOS and Linux, when you stop a background task from [`/tasks`](</docs/en/commands>) or Claude Code stops it at exit, processes that detached from the task’s shell, such as ones started under `setsid` or `timeout`, stop too * If you background the session instead of exiting it, your background tasks keep running in the background session. See [background a running session](</docs/en/agent-view#from-inside-a-session>) * Background tasks are automatically terminated if output exceeds 5GB, with a note in stderr explaining why - * On macOS and Linux, Claude Code terminates running background tasks when the operating system signals memory pressure, provided the session has been idle for at least 30 minutes and no turn or subagent is running. Set [`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`](</docs/en/env-vars>) to `1` to turn this off. Requires Claude Code v2.1.193 or later + * On macOS and Linux, Claude Code stops your running background tasks when the operating system reports critical memory pressure, provided the session has been idle for at least 30 minutes and no turn or subagent is running. Requires Claude Code v2.1.193 or later + * The [debug log](</docs/en/debug-your-config>) says why tasks were stopped, or why a pressure event left them running + * Set [`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`](</docs/en/env-vars>) to `1` to turn off memory-pressure stops * Background commands owned by a [subagent](</docs/en/sub-agents>) have no time limit, except that a command owned by a subagent running in the foreground ends when that subagent gives its final response; see [Background commands](</docs/en/tools-reference#background-commands>) in the tools reference. Before v2.1.218, neither the memory-pressure reap nor the former 60-minute limit on subagent commands covered commands moved to the background with `Ctrl+B` To disable all background task functionality, set the `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` environment variable to `1`. See [Environment variables](</docs/en/env-vars>) for details. **Common backgrounded commands:** @@ -392,7 +395,7 @@ Queue messages while Claude works -Type a message and press `Enter` while Claude is working. Claude Code queues the message instead of interrupting the turn, and lists the queued entries above the input box until it sends them. You can queue `!` shell commands and most [commands](</docs/en/commands>) the same way, apart from the commands, such as `/status`, that Claude Code runs as soon as you send them. +Type a message and press `Enter` while Claude is working. Claude Code queues the message instead of interrupting the turn, and lists the queued entries above the input box until it sends them. You can queue `!` shell commands and most [commands](</docs/en/commands>) the same way, apart from the commands, such as `/status`, that Claude Code runs as soon as you send them. Sent and queued messages show in gray until Claude starts responding to them, so you can tell which messages Claude hasn’t started on yet. ### @@ -402,10 +405,10 @@ When a queued entry reaches Claude depends on what you queued. - * Messages: if you queue a message while Claude is running tool calls, Claude Code passes it to Claude as soon as those tool calls finish, within the same turn. When the turn ends with messages still queued, Claude Code sends only the oldest as the next turn. The rest stay queued and follow the same rule: Claude Code passes them to Claude when that turn’s tool calls finish, or sends the next oldest as the turn after - * Commands and shell commands: Claude Code holds them until the turn ends, then runs them one at a time - -Press `Esc` to interrupt the turn instead. Claude Code keeps what you queued and sends it right away. Claude Code runs some commands as soon as you send them instead of queueing them, among them `/model`, `/effort`, and `/fast`. Each of the three changes a setting: the model, the effort level, or fast mode. Whether Claude Code applies the new setting to the turn Claude is already working on, or only from your next turn, differs by command: + * Messages: if you queue a message while Claude is running tool calls, Claude Code passes it to Claude as soon as those tool calls finish, within the same turn. When the turn ends with messages still queued, they go out without another key press, in the order you typed them + * Commands and shell commands: Claude Code holds them until the turn ends, then runs them one at a time, keeping the order you queued them in + +To send what you queued without waiting for the turn to finish, press `Ctrl+Enter`. Claude Code interrupts the turn, and your queued messages go out right away, with your draft queued behind them if you had typed one. In shell mode, the key queues your command without interrupting the turn. Requires Claude Code v2.1.275 or later. In terminals that don’t report extended keys, `Ctrl+Enter` arrives as plain `Enter` and queues the draft instead; `Ctrl+X Ctrl+S` works in any terminal. Both keys are bindings of the [`chat:sendNow` action](</docs/en/keybindings#chat-actions>). Press `Esc` to interrupt the turn without submitting your draft. Claude Code keeps what you queued and sends it right away. Claude Code runs some commands as soon as you send them instead of queueing them, among them `/model`, `/effort`, and `/fast`. Each of the three changes a setting: the model, the effort level, or fast mode. Whether Claude Code applies the new setting to the turn Claude is already working on, or only from your next turn, differs by command: * [`/model`](</docs/en/model-config#setting-your-model>): once you confirm the [cache warning](</docs/en/prompt-caching#switching-models>), if Claude Code shows one, Claude Code applies your change to the next request it makes in that turn * [`/effort`](</docs/en/model-config#adjust-effort-level>): once you confirm the [cache warning](</docs/en/prompt-caching#changing-effort-level>), if Claude Code shows one, Claude Code applies your change to the next request it makes in that turn @@ -581,6 +584,14 @@ ​ +Invisible characters in prompts + +Pasted text can carry Unicode characters that a terminal draws as nothing at all, such as tag characters, bidirectional controls, and zero-width spaces, so a prompt can contain text you never see. To keep copied text from carrying instructions your terminal doesn’t draw, Claude Code removes those characters when you press Enter, before sending anything. It cleans both the prompt and the contents of any collapsed [pasted-text reference](</docs/en/terminal-config#paste-large-content>) the prompt includes. Claude Code keeps the joiners that Persian and Indic scripts write and the selectors inside emoji sequences. If Claude Code removed anything, that Enter sends nothing. The cleaned prompt goes back into the input box with a notice such as `Removed 3 invisible characters · review and press Enter to send`, and pressing Enter again sends the text as shown. When you pass a prompt on the command line, as in `claude "fix the login bug"`, or pipe one into an interactive session, Claude Code doesn’t wait for a second Enter. It removes the characters, shows a notice, and sends the cleaned prompt. If the cleaned prompt would begin with `/`, Claude Code puts it in the input box for you to review and send instead. + +## + +​ + Review changes with /diff Run `/diff` to look over the changes in your working tree without leaving Claude Code. You see the edits Claude has made so far alongside anything else you haven’t committed. In the changes `/diff` reads from git, a submodule appears as a single entry, and only when the commit it points to changes; edits to files inside the submodule don’t appear there. In [fullscreen rendering](</docs/en/fullscreen>), `/diff` opens the diff panel beside the conversation, which stays open and updates while you keep working. In the classic renderer, `/diff` opens the diff viewer in place of the prompt, and you close it when you’re done reading.
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -125,6 +125,7 @@ `chat:thinkingToggle`| Meta+T| Toggle extended thinking `chat:submit`| Enter| Submit message `chat:queueSubmit`| Ctrl+X Enter| Submit the message, marked to wait its turn: while Claude is working, Claude Code [queues it](</docs/en/interactive-mode#queue-messages-while-claude-works>) and never interrupts the turn. Unlike `chat:submit`, it submits the draft even while an autocomplete suggestion is highlighted. Requires v2.1.247 or later +`chat:sendNow`| Ctrl+Enter, Ctrl+X Ctrl+S| Interrupt the running turn so your [queued messages](</docs/en/interactive-mode#queue-messages-while-claude-works>), and your draft with them, go out right away. When nothing is running, it submits the draft, and in [shell mode](</docs/en/interactive-mode#shell-mode-with-prefix>) it queues the command without interrupting. Terminals that don’t report extended keys deliver `Ctrl+Enter` as plain `Enter`, so `Ctrl+X Ctrl+S` is the binding that works in any terminal. Requires v2.1.275 or later `chat:newline`| Ctrl+J| Insert a newline without submitting `chat:undo`| Ctrl+_, Ctrl+Shift+-| Undo last action `chat:externalEditor`| Ctrl+G, Ctrl+X Ctrl+E| Open in external editor. The [agent view dispatch input](</docs/en/agent-view#keyboard-shortcuts>) follows this action’s single-keystroke bindings too @@ -295,6 +296,8 @@ `footer:openSelected`| Enter| Open selected footer item `footer:clearSelection`| Escape| Clear footer selection `footer:dismiss`| Backspace, Delete| Dismiss the selected [artifact](</docs/en/artifacts>) link from the footer; the published artifact itself is unaffected. On other footer rows, these keys have no effect. Requires v2.1.217 or later + +While a footer item is selected, such as a row in the agent panel below the prompt, `Enter` opens it even when you rebind `Enter` in the `Chat` context to `chat:queueSubmit` or `chat:newline`. `Chat` bindings on keys the `Footer` context doesn’t bind, such as `Shift+Tab` for `chat:cycleMode`, keep working while an item is selected. ### @@ -584,7 +587,7 @@ ] } -This also works for chord bindings. Unbinding every chord that shares a prefix frees that prefix for use as a single-key binding. A chord in any active context keeps its prefix reserved, so you must unbind each chord in the context that defines it. Claude Code binds these default chords on the `ctrl+x` prefix: `ctrl+x ctrl+k`, `ctrl+x ctrl+e`, `ctrl+x enter`, `ctrl+x ctrl+a`, and `ctrl+x tab` in `Chat`, `ctrl+x ctrl+b` in `Task`, and `ctrl+x b` in `DiffPanel`. The `ctrl+x enter` chord requires v2.1.247 or later, and `ctrl+x b`, `ctrl+x ctrl+a`, and `ctrl+x tab` require v2.1.260 or later. To reclaim `ctrl+x` itself as a single-key binding, unbind all of them: +This also works for chord bindings. Unbinding every chord that shares a prefix frees that prefix for use as a single-key binding. A chord in any active context keeps its prefix reserved, so you must unbind each chord in the context that defines it. Claude Code binds these default chords on the `ctrl+x` prefix: `ctrl+x ctrl+k`, `ctrl+x ctrl+e`, `ctrl+x enter`, `ctrl+x ctrl+a`, `ctrl+x ctrl+s`, and `ctrl+x tab` in `Chat`, `ctrl+x ctrl+b` in `Task`, and `ctrl+x b` in `DiffPanel`. The `ctrl+x enter` chord requires v2.1.247 or later, `ctrl+x b`, `ctrl+x ctrl+a`, and `ctrl+x tab` require v2.1.260 or later, and `ctrl+x ctrl+s` requires v2.1.275 or later. To reclaim `ctrl+x` itself as a single-key binding, unbind all of them: { "bindings": [ @@ -607,6 +610,7 @@ "ctrl+x ctrl+e": null, "ctrl+x enter": null, "ctrl+x ctrl+a": null, + "ctrl+x ctrl+s": null, "ctrl+x tab": null, "ctrl+x": "chat:newline" }
modified Set up Claude Code in a monorepo or large codebase View current →
--- a/large-codebases.md +++ b/large-codebases.md @@ -223,7 +223,7 @@ } } -When Claude creates a worktree, it checks out only `.claude/`, `packages/api/`, and `packages/shared/` instead of the full tree. Paths in `sparsePaths` are relative to the repository root, regardless of which subdirectory you start Claude from. Any directory paths work here, not only package roots. This is particularly useful for [subagent worktree isolation](</docs/en/worktrees#isolate-subagents-with-worktrees>). Subagents are parallel Claude instances spawned for subtasks, and each one that runs in a worktree gets a lightweight checkout instead of the full tree. All worktrees in a session share the same `sparsePaths`, so if one subagent needs `packages/api/` and another needs `packages/web/`, list both. List directories in `sparsePaths`, not individual files. Root-level files like `package.json`, `tsconfig.base.json`, and lock files are always checked out alongside the directories you list. Root-level directories are not, so include `.claude` in the list if you want the repository root’s `.claude/settings.json`, `.claude/rules/`, or `.claude/skills/` available inside the worktree. Sparse checkout requires git to enable `extensions.worktreeConfig` in the repository’s shared `.git/config` while a sparse worktree exists. Claude Code removes that entry after the last worktree is removed, but only if Claude Code added it. It never removes a value you set yourself. Before v2.1.207, the entry remained after the last worktree was removed, and go-git-based tools such as `tea` failed to open the repository until you ran `git config --unset extensions.worktreeConfig`. To avoid duplicating large directories like `node_modules` across worktrees, pair `sparsePaths` with `symlinkDirectories` in the same `.claude/settings.json`: +When Claude creates a worktree, it checks out only `.claude/`, `packages/api/`, and `packages/shared/` instead of the full tree. Paths in `sparsePaths` are relative to the repository root, regardless of which subdirectory you start Claude from. Any directory paths work here, not only package roots. This is particularly useful for [subagent worktree isolation](</docs/en/worktrees#isolate-subagents-with-worktrees>). Subagents are parallel Claude instances spawned for subtasks, and each one that runs in a worktree gets a lightweight checkout instead of the full tree. All worktrees in a session share the same `sparsePaths`, so if one subagent needs `packages/api/` and another needs `packages/web/`, list both. List directories in `sparsePaths`, not individual files. Root-level files like `package.json`, `tsconfig.base.json`, and lock files are always checked out alongside the directories you list. Root-level directories are not, so include `.claude` in the list if you want the repository root’s `.claude/settings.json` or `.claude/rules/` available inside the worktree. For project skills, agents, and commands, see [What worktrees share with the main checkout](</docs/en/worktrees#what-worktrees-share-with-the-main-checkout>). Sparse checkout requires git to enable `extensions.worktreeConfig` in the repository’s shared `.git/config` while a sparse worktree exists. Claude Code removes that entry after the last worktree is removed, but only if Claude Code added it. It never removes a value you set yourself. Before v2.1.207, the entry remained after the last worktree was removed, and go-git-based tools such as `tea` failed to open the repository until you ran `git config --unset extensions.worktreeConfig`. To avoid duplicating large directories like `node_modules` across worktrees, pair `sparsePaths` with `symlinkDirectories` in the same `.claude/settings.json`: .claude/settings.json
modified Connect Claude Code to an LLM gateway View current →
--- a/llm-gateway-connect.md +++ b/llm-gateway-connect.md @@ -516,6 +516,7 @@ `400` errors naming `thinking` or `adaptive`, such as `Input tag 'adaptive' found`| The upstream model build doesn’t accept adaptive reasoning, which Claude Code requests for Claude 4.6 and later models| Upgrade the gateway’s upstream. On Opus 4.6 and Sonnet 4.6, `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1` works instead. The [model configuration](</docs/en/model-config>) capability variables apply only to the provider configurations, such as `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_VERTEX`, not behind an `ANTHROPIC_BASE_URL` gateway `400` errors stating a context or token limit in the gateway’s own words, such as `ContextWindowExceededError` or `prompt token count of N exceeds the limit of M`| The gateway enforces a smaller context than the model’s native window and rewrites the upstream error, so Claude Code doesn’t recognize it as a [too-long error](</docs/en/errors#prompt-is-too-long>) and doesn’t compact and retry automatically| Run `/compact` to recover the session. To prevent it, set `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to the gateway’s limit; Claude Code clamps the value to at least 100,000 tokens and at most the model’s context window, so you can’t match a gateway limit below 100,000, and `/compact` remains the recovery there. Also set `CLAUDE_CODE_MAX_OUTPUT_TOKENS` below the gateway model’s output limit `400` errors on every request, in the gateway’s own words rejecting a tool’s input schema or its `pattern`, on Claude Code v2.1.265 through v2.1.267| In a gradual rollout on those versions, the [Artifact tool](</docs/en/artifacts#availability>) schema carries a regular expression with `\p{...}` Unicode character classes. The Anthropic API accepts it, but a gateway or upstream that checks each tool schema’s `pattern` with its own regex engine rejects the whole request| Update to v2.1.268 or later, which doesn’t send the regular expression. On an affected version, [turn artifacts off](</docs/en/artifacts#disable-artifacts>), which removes the tool and its schema from requests +`400` errors on every request, in the gateway’s own words rejecting an unrecognized tool type, such as `Input tag 'advisor_20260301'`, on Claude Code v2.1.275| In a gradual rollout on that version, requests carry an [advisor tool](</docs/en/advisor>) entry even with the advisor off. The Anthropic API accepts it, but a gateway or upstream that validates tool types rejects the whole request; one that [forwards request body fields unchanged](</docs/en/llm-gateway-protocol#forward-as-open-lists>) passes it through unaffected. The entry is a declaration that carries no conversation content| Update to v2.1.276 or later, which doesn’t send the entry behind an `ANTHROPIC_BASE_URL` gateway unless you turn the advisor on. On v2.1.275, set [`CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1`](</docs/en/env-vars>), which removes the entry from requests Models missing from the `/model` picker| Gateway model names aren’t in Claude Code’s built-in list, or Claude Code is showing a [`modelPicker`](</docs/en/settings-reference#modelpicker>) lineup that replaces the built-in options| Enable gateway model discovery or add names with the [model configuration](</docs/en/model-config>) variables. If Claude Code shows a replacing `modelPicker` lineup, add the gateway models to it, or ask your administrator to add them when managed settings supply it `/fast` reports `Fast mode unavailable due to network connectivity issues` while inference requests work| The [fast mode](</docs/en/fast-mode>) availability check goes directly to `api.anthropic.com` and doesn’t follow `ANTHROPIC_BASE_URL`, so blocked direct egress fails the check. The same message appears on an open network when the check presents a gateway-issued key from `ANTHROPIC_API_KEY` or an `apiKeyHelper` and Anthropic rejects it| Allowlist `api.anthropic.com` if egress is blocked, or set a skip variable; for a rejected gateway key only the skip variables help. See [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) `/fast` reports `Fast mode has been disabled by your organization` in a session authenticated with `ANTHROPIC_AUTH_TOKEN`, even though the organization has fast mode enabled| The availability check requires a claude.ai login or an Anthropic API key; with only a bearer token, Claude Code treats fast mode as disabled without sending the check| Set `CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1`; see [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>)
modified Claude Code gateway compatibility guide View current →
--- a/llm-gateway-protocol.md +++ b/llm-gateway-protocol.md @@ -135,6 +135,37 @@ `x-claude-code-parent-agent-id`| Identifier of the agent that spawned the requesting agent, present only for nested agents Subagent IDs are generated fresh each time Claude Code spawns a subagent. Teammate agents, the named members of an [agent team](</docs/en/agent-teams>), reuse a stable name-based ID across reconnections. In both cases the ID identifies an agent, not a person or a device, so don’t treat the agent ID header as a user identifier. If your developers set `ANTHROPIC_CUSTOM_HEADERS`, those headers appear on requests as well. + +### + +​ + +Gateway hint headers + +Claude Code can also send routing hints: per-request facts a gateway or router can use to schedule, cache, or attribute a request. Requires Claude Code v2.1.273 or later. Whether a request carries them depends on where Claude Code sends it: + + * Direct connection to the Anthropic API: sent by default + * Custom base URL: off by default, because a proxy that rejects unknown headers would fail the request. To receive them, set [`CLAUDE_CODE_GATEWAY_HINT_HEADERS=1`](</docs/en/env-vars>) for your developers, for example in the `env` block of [managed settings](</docs/en/managed-settings>) + * Any other backend, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS: sent only when `CLAUDE_CODE_GATEWAY_HINT_HEADERS=1` is set + +Setting `CLAUDE_CODE_GATEWAY_HINT_HEADERS` to `0` stops the headers on every connection. The headers carry only what the rows below list: fixed vocabularies, tool names, and durations, never prompt text or file contents. Every value is printable ASCII. + +Header| Description +---|--- +`x-claude-code-request-class`| What kind of request this is: `main` for a turn of the main conversation, `subagent` for a turn of a [subagent](</docs/en/sub-agents>), `workflow` for an agent running inside a workflow, `compaction` for the summarization request that compacts a conversation, or `auxiliary` for side requests such as session titles, classifiers, and summaries. Sent on every request +`x-claude-code-agent-type`| The kind of subagent that issued the request: a built-in agent type name such as `Explore`, `Plan`, or `general-purpose`, or `custom` for a user-defined agent, `teammate` for an [agent team](</docs/en/agent-teams>) member running in the lead’s process, or `fork` for a [fork](</docs/en/sub-agents#fork-the-current-conversation>). Present only on a subagent’s own turns; a subagent’s compaction or side requests keep the agent ID but carry no type. A user-chosen agent name is never sent +`x-claude-code-compaction`| Present on the request that summarizes the conversation during a [compaction](</docs/en/prompt-caching#compacting-the-conversation>). The value says what triggered it: `auto` when the context window approached capacity, `manual` for `/compact`, or `reactive` when the API rejected a request as too long. Absent on every other request +`x-claude-code-context-compacted`| Present once, on the first main-conversation request after a compaction, with the same values as `x-claude-code-compaction`. The conversation prefix before this request is no longer used, so a cache keyed on it can be dropped +`x-claude-code-prev-tool-durations`| Measured run time of the tool calls whose results this request carries, as `<name>=<ms>;<name>=<ms>`, for example `Bash=742;Read=9`. Sent on the next request of the same conversation after a batch of tool calls, from the main session or a subagent + +Before parsing `x-claude-code-prev-tool-durations`, check how Claude Code builds the value and what it leaves out: + + * Entries: one per tool call that ran, in the order its result was collected, in whole milliseconds + * Cap: Claude Code sends at most 32 entries and 4 KB, keeping the first entries + * Encoding: tool names are percent-encoded, covering `%`, `;`, `=`, comma, space, and any character outside printable ASCII + * Parsing: split on `;`, then on `=`, and decode each name + * Absence: compaction calls, side requests, and the first request of a new prompt never carry it. Don’t read a missing header as a turn that ran no tools + * Times: each one excludes permission prompts and hooks, and parallel tool calls each report their own time, so the entries don’t add up to the gap between requests ###
modified Roll out an LLM gateway for your organization View current →
--- a/llm-gateway-rollout.md +++ b/llm-gateway-rollout.md @@ -162,6 +162,7 @@ `ANTHROPIC_BASE_URL`| Sends Claude Code’s API requests to the gateway instead of `api.anthropic.com`| Always `apiKeyHelper`, or a credential in `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY`| Authenticates each request to the gateway. The helper runs a command to fetch the key; the variables hold a static key, sent as `Authorization: Bearer` and `x-api-key` respectively| Always; one of the three `ANTHROPIC_CUSTOM_HEADERS`| Adds extra HTTP headers to every API request| Your gateway requires a tenant or routing header on every request +`CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Sends the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), which classify each request for routing and scheduling decisions at the gateway. Requires Claude Code v2.1.273 or later| Your gateway reads the hint headers `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Queries the gateway’s `/v1/models` at startup and adds the returned names to the `/model` picker| Your gateway serves `/v1/models` and you want developers’ pickers populated from it `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Stops Claude Code sending pre-release capability headers and body fields. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers the exact scope| Your gateway forwards to an Amazon Bedrock or Google Cloud’s Agent Platform upstream that rejects beta fields. See Gateway requirements `CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS` or `CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK`| Restores [fast mode](</docs/en/fast-mode>) when its availability check, which calls `api.anthropic.com` directly rather than following `ANTHROPIC_BASE_URL`, fails, is intercepted, or is skipped for lack of an Anthropic credential| Your organization uses fast mode, and developers authenticate with `ANTHROPIC_AUTH_TOKEN` alone, with a gateway-issued key in `ANTHROPIC_API_KEY` or from an `apiKeyHelper`, or your network blocks or intercepts direct requests to `api.anthropic.com`; [use fast mode behind proxies and LLM gateways](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) covers which of the two variables matches your configuration
modified Deploy managed settings View current →
--- a/managed-settings.md +++ b/managed-settings.md @@ -312,18 +312,22 @@ `allowedHttpHookUrls`| Claude Code enforces an empty managed [allowlist](</docs/en/settings-reference#allowedhttphookurls>) until you fix the value, so an HTTP hook runs only if another settings file lists its URL. If only an individual entry is invalid, Claude Code strips that entry and enforces the rest. `httpHookAllowedEnvVars`| Claude Code enforces an empty managed [allowlist](</docs/en/settings-reference#httphookallowedenvvars>) until you fix the value, so a header variable is interpolated only if another settings file names it. If only an individual entry is invalid, Claude Code strips that entry and enforces the rest. `allowedChannelPlugins`| Claude Code enforces an empty allowlist until you fix the value, so no channel plugin passed to `--channels` is admitted. If only an individual entry is invalid, it strips that entry and enforces the rest. +`strictKnownMarketplaces`| Enforced as an empty allowlist until the value is fixed, so no [marketplace source](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>) is admitted. An individual entry that is invalid or can’t be enforced, such as a `hostPattern` regex that doesn’t compile, is stripped and the valid subset is enforced. `allowManagedHooksOnly`| Treated as `true` until fixed: the [hook restrictions](</docs/en/settings-reference#allowmanagedhooksonly>) apply and, unless `disableCommandPluginSources` is explicitly `false`, command-sourced plugins are disabled. `allowManagedMcpServersOnly`| Treated as `true`. `disableCommandPluginSources`| Treated as `true`, so command-sourced plugins stay disabled until the value is fixed. +`disableSideloadFlags`| Treated as `true` until the value is fixed, with the effects listed for [`disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>). `availableModels`| Enforced as an empty allowlist until fixed, so only the Default model is available; a non-string entry is stripped and the valid subset enforced. `enforceAvailableModels`| Treated as `true`. +`syncClaudeAiPlugins`| Treated as `false`, so syncing of [claude.ai plugins](</docs/en/settings-reference#syncclaudeaiplugins>) is off until the value is fixed. `forceLoginOrgUUID`| No organization is permitted to log in until the value is fixed. `gatewayInternalNetworks`| When the invalid value comes from the highest managed source on the machine, `/login` refuses every new [cloud gateway](</docs/en/claude-apps-gateway#allow-a-gateway-on-public-address-space-you-own>) sign-in on that machine until the value is fixed. `crossSessionInbound`| Treated as `refuse`, the most restrictive value, so inbound [cross-session messages](</docs/en/cross-session-messaging#control-inbound-messages>) are refused until the value is fixed. The developer sees [a warning](</docs/en/errors#crosssessioninbound-must-be-one-of-accept-hold-refuse>). `deniedMcpServers`| An individual invalid entry is stripped and the valid subset is enforced. A wholly invalid value is dropped with a warning, since denying every server would block servers the policy never named. +`blockedMarketplaces`| An individual invalid entry is stripped and the valid subset is enforced. An entry that parses but can never match, such as a `hostPattern` regex that doesn’t compile, is kept with a warning. It blocks nothing until fixed, but [marketplace restrictions](</docs/en/plugin-marketplaces#managed-marketplace-restrictions>) stay active. A wholly invalid value is dropped with a warning, since blocking every marketplace would block sources the policy never named. `sandbox.credentials`| A recoverable invalid entry is degraded to `mode: "deny"` with a warning; an unrecoverable one is stripped; valid entries stay enforced. See [invalid credential entries](</docs/en/settings-reference#invalid-credential-entries-in-managed-settings>) -`allowedHttpHookUrls` and `httpHookAllowedEnvVars` merge across settings files, so entries in your user, project, or local settings still apply while the managed list is empty. The fallbacks for those two keys and for `allowedChannelPlugins` require Claude Code v2.1.267 or later; earlier versions drop the whole key when its value or any entry is invalid. `requiredMinimumVersion` and `requiredMaximumVersion` fail open by design: an invalid value is dropped rather than enforced. This tolerance applies only to managed settings. User, project, and local settings files remain strict: a file whose JSON or top-level shape fails validation is rejected as a whole and reported, and an individual entry that fails, such as a malformed permission rule, is skipped with a warning while the rest of the file applies. +`allowedHttpHookUrls` and `httpHookAllowedEnvVars` merge across settings files, so entries in your user, project, or local settings still apply while the managed list is empty. The fallbacks for those two keys and for `allowedChannelPlugins` require Claude Code v2.1.267 or later; earlier versions drop the whole key when its value or any entry is invalid. The `strictKnownMarketplaces`, `blockedMarketplaces`, and `disableSideloadFlags` fallbacks require Claude Code v2.1.277 or later; earlier versions drop the whole key when its value or any entry is invalid. `requiredMinimumVersion` and `requiredMaximumVersion` fail open by design: an invalid value is dropped rather than enforced. This tolerance applies only to managed settings. User, project, and local settings files remain strict: a file whose JSON or top-level shape fails validation is rejected as a whole and reported, and an individual entry that fails, such as a malformed permission rule, is skipped with a warning while the rest of the file applies. ##
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -79,7 +79,7 @@ A project CLAUDE.md can be stored in either `./CLAUDE.md` or `./.claude/CLAUDE.md`. Create this file and add instructions that apply to anyone working on the project: build and test commands, coding standards, architectural decisions, naming conventions, and common workflows. These instructions are shared with your team through version control, so focus on project-level standards rather than personal preferences. To confirm the file loaded, run `/context` in a session and check the list under **Memory files**. -Run `/init` to generate a starting CLAUDE.md automatically. Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers. If a CLAUDE.md already exists, `/init` suggests improvements rather than overwriting it. Refine from there with instructions Claude wouldn’t discover on its own.Set `CLAUDE_CODE_NEW_INIT=1` to enable an interactive multi-phase flow. `/init` asks which artifacts to set up: CLAUDE.md files, skills, and hooks. It then explores your codebase with a subagent, fills in gaps via follow-up questions, and presents a reviewable proposal before writing any files. +Run `/init` to generate a starting CLAUDE.md automatically. Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers. If a CLAUDE.md already exists, `/init` suggests improvements rather than overwriting it. Refine from there with instructions Claude wouldn’t discover on its own.For an interactive multi-phase flow instead, set the `CLAUDE_CODE_NEW_INIT` environment variable to `1` before you run `/init`. Set it in your shell or in the `env` block of a settings file, as shown in [Set environment variables](</docs/en/env-vars#set-environment-variables>). With it set, `/init` asks which artifacts to set up: CLAUDE.md files, skills, and hooks. It then explores your codebase with a subagent, fills in gaps via follow-up questions, and presents a reviewable proposal before writing any files. The variable only changes how `/init` runs, so you can leave it set. ### @@ -133,7 +133,7 @@ CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared-config -This loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md` from the additional directory. `CLAUDE.local.md` is skipped if you exclude `local` from [`--setting-sources`](</docs/en/cli-reference>). +The inline form sets the variable for that one launch in Bash or Zsh. To keep it on for every session, add it to the `env` block in `~/.claude/settings.json` as shown in [Set environment variables](</docs/en/env-vars#set-environment-variables>). This loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md` from the additional directory. `CLAUDE.local.md` is skipped if you exclude `local` from [`--setting-sources`](</docs/en/cli-reference>). ### @@ -225,7 +225,7 @@ ├── preferences.md # Your personal coding preferences └── workflows.md # Your preferred workflows -User-level rules are loaded before project rules, giving project rules higher priority. +Claude Code loads user-level rules before project rules, so a project rule appears later in Claude’s context than a user rule. Neither set overrides the other: if a user rule and a project rule conflict, Claude may follow either one, so keep the two consistent. ###
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -70,7 +70,7 @@ Fable 5.1 requires Claude Code v2.1.257 or later. If a request for it from an older version fails, see [Claude Code does not support this model](</docs/en/errors#claude-code-does-not-support-this-model>). Run `claude update` to upgrade. For availability under zero data retention, see [Model availability under ZDR](</docs/en/zero-data-retention#model-availability-under-zdr>). -On the Anthropic API, the `/model` picker lists a Fable model only after the server reports it available for your organization. When you type `/model fable` or a Fable model ID, Claude Code checks availability with the server directly, so a typed selection can succeed even when the picker doesn’t list the entry. +On the Anthropic API, a Fable model appears in the `/model` picker unless `availableModels` or organization model restrictions exclude it. When your organization can’t use Fable at all, for example under [zero data retention](</docs/en/zero-data-retention#model-availability-under-zdr>), the row stays in the picker grayed out, with a note on why. #### @@ -367,7 +367,7 @@ * **In plan mode** : uses `opus` for complex reasoning and architecture decisions * **In execution mode** : automatically switches to `sonnet` for code generation and implementation -This pairs Opus’s reasoning for planning with Sonnet’s efficiency for execution. The plan-mode Opus phase uses the same context window as the `opus` model setting. On subscription tiers where Opus is automatically upgraded to 1M context, `opusplan` receives the upgrade in plan mode as well. To force 1M context for both phases when you aren’t on an auto-upgrade tier, set the model to `opusplan[1m]`, for example with `/model opusplan[1m]`. Setting it with `/model` requires Claude Code v2.1.265 or later; on earlier versions, use the `--model` flag or the `model` setting instead. When `availableModels` excludes the newest Opus but permits an older version, for example `["sonnet", "claude-opus-4-6"]`, `opusplan` uses the newest permitted Opus for planning and stays on Sonnet only when every Opus is excluded. A Haiku session that would normally upgrade to Sonnet in plan mode likewise uses the newest permitted Sonnet, and stays on Haiku only when every Sonnet is excluded. Before v2.1.205, plan mode stayed on the session’s model whenever the newest version of the upgrade family was excluded, even when the allowlist permitted an older one. The substitution of an older permitted version applies on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Mantle, whose deployments use provider-specific model IDs, plan mode stays on the session’s model whenever the upgrade model is excluded. For a hybrid approach where Claude decides mid-task when to consult a second model rather than switching at the plan boundary, see the [advisor tool](</docs/en/advisor>). +This pairs Opus’s reasoning for planning with Sonnet’s efficiency for execution. The plan-mode Opus phase uses the same context window as the `opus` model setting, and the execution phase uses the same window as `sonnet`. When `opus` and `sonnet` resolve to models that run with the 1M context window by default, as the current models do on the Anthropic API, both phases run with it. To request 1M context for both phases where they don’t, set the model to `opusplan[1m]`, for example with `/model opusplan[1m]`. Setting it with `/model` requires Claude Code v2.1.265 or later; on earlier versions, use the `--model` flag or the `model` setting instead. When `availableModels` excludes the newest Opus but permits an older version, for example `["sonnet", "claude-opus-4-6"]`, `opusplan` uses the newest permitted Opus for planning and stays on Sonnet only when every Opus is excluded. A Haiku session that would normally upgrade to Sonnet in plan mode likewise uses the newest permitted Sonnet, and stays on Haiku only when every Sonnet is excluded. Before v2.1.205, plan mode stayed on the session’s model whenever the newest version of the upgrade family was excluded, even when the allowlist permitted an older one. The substitution of an older permitted version applies on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Mantle, whose deployments use provider-specific model IDs, plan mode stays on the session’s model whenever the upgrade model is excluded. For a hybrid approach where Claude decides mid-task when to consult a second model rather than switching at the plan boundary, see the [advisor tool](</docs/en/advisor>). ### @@ -570,9 +570,9 @@ Extended context -Fable 5.1, Fable 5, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support a [1 million token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) for long sessions with large codebases. Availability varies by model and plan. On the Anthropic API, Fable 5.1, Fable 5, Sonnet 5, and Opus 4.7 and later run with the 1M window by default. On Max, Team, and Enterprise plans, including both Team Standard and Team Premium seats, Opus is automatically upgraded to 1M context with no additional configuration. Sonnet 4.6 with 1M context is not part of the automatic upgrade and requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) on every subscription plan, including Max. - -Plan| Opus with 1M context| Sonnet 4.6 with 1M context +Fable 5.1, Fable 5, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support a [1 million token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) for long sessions with large codebases. On the Anthropic API, Fable 5.1, Fable 5, Sonnet 5, and Opus 4.7 and later run with the 1M window on every plan, including Pro. You don’t select a `[1m]` variant or turn on usage credits for the 1M window on these models. Fable usage itself can bill to usage credits on some plans; see Fable and usage credits. Opus 4.6 and Sonnet 4.6 reach 1M only through their `[1m]` variant, and access to that variant depends on your plan. On Max, Team, and Enterprise plans, including both Team Standard and Team Premium seats, Opus 4.6 with 1M context is included with your subscription. Sonnet 4.6 with 1M context requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) on every subscription plan, including Max. + +Plan| Opus 4.6 with 1M context| Sonnet 4.6 with 1M context ---|---|--- Max, Team, and Enterprise| Included with subscription| Requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) Pro| Requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>)| Requires [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>)
modified Modifying system prompts View current →
--- a/modifying-system-prompts.md +++ b/modifying-system-prompts.md @@ -336,7 +336,7 @@ In the TypeScript SDK, you can pass a custom prompt as an array of strings instead of one string, with the `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` marker between the static part and the rest. Use this when your prompt combines instructions that are the same on every request with context that changes per request, such as the customer or ticket the agent is handling. When you pass both parts as one string, a change to the per-request part changes the whole system prompt, so the static instructions miss the cache too. The array form isn’t available in the Python SDK; [`ClaudeAgentOptions`](</docs/en/agent-sdk/python#claudeagentoptions>) lists the forms `system_prompt` accepts. -The SDK splits the prompt only when it calls the Claude API directly or runs on [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). In every other configuration, such as Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an [LLM gateway](</docs/en/llm-gateway-connect>), and whenever you set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>), the SDK sends the whole prompt as one block, the same as passing one string. +Claude Code splits the prompt only when it calls the Claude API directly or runs on [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). In every other configuration, such as Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or an [LLM gateway](</docs/en/llm-gateway-connect>), it sends the whole prompt as one block, the same as passing one string. The same happens whenever you set [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>). To split the prompt, import `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` from `@anthropic-ai/claude-agent-sdk` and pass it as its own array element between the two parts. The SDK sends the strings before the marker as one text block and the strings after it as a second block, each with its own cache breakpoint. In the example below, a support agent loads its triage instructions from a file and receives details about one ticket on each request, so the instructions stay cached while the ticket details change: @@ -364,6 +364,8 @@ * The SDK joins the strings on each side of the marker with a blank line between them and removes the marker itself, so the marker text doesn’t reach Claude. * If you include the marker more than once, the first one is the split and the SDK removes the others. * If you leave the marker out, the SDK joins all the strings into one block, the same as passing one string. + +With the CLI’s [`--system-prompt` or `--system-prompt-file` flags](</docs/en/cli-reference#system-prompt-flags>), the prompt is one string, so there is no array to carry the marker. Include a line containing only `__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__` between the static and per-request parts instead. Claude Code splits the prompt at the first such line into the same two blocks and removes that line. Requires Claude Code v2.1.275 or later. In the SDK, prefer the array form, which carries the boundary without a marker line. ###
modified Monitoring View current →
Show diff (143 lines)
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -107,6 +107,7 @@ `OTEL_LOG_ASSISTANT_RESPONSES`| Enable logging of assistant response text on `assistant_response` events (default: disabled). When unset, falls back to the value of `OTEL_LOG_USER_PROMPTS`. Requires Claude Code v2.1.193 or later| `1` to enable, `0` to keep redacted `OTEL_LOG_TOOL_DETAILS`| Enable logging of tool parameters and input arguments in tool events and trace span attributes: Bash commands, MCP server and tool names, skill names, user-authored workflow names, and tool input. Also enables custom, plugin, and MCP command names on `user_prompt` events (default: disabled). For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, `mcp_server_name`/`mcp_tool_name` emit on `tool_decision`/`tool_result` even with the flag off. The exception requires Claude Code v2.1.214 or later| `1` to enable `OTEL_LOG_TOOL_CONTENT`| Enable logging of tool content in the `tool.output` span event (default: disabled). Span attributes carry tool content under their own gates. Requires tracing. Content is truncated at the content limit (60 KB by default)| `1` to enable +`OTEL_LOG_MANAGED_SETTINGS`| Add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to managed settings resolved events (default: disabled). A value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later| `1` to enable `OTEL_LOG_RAW_API_BODIES`| Emit the full Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events (default: disabled). Bodies include the entire conversation history. Enabling this implies consent to everything `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, and `OTEL_LOG_TOOL_CONTENT` would reveal| `1` for inline bodies truncated at the content limit (60 KB by default), or `file:<dir>` for untruncated bodies on disk with a `body_ref` pointer in the event `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Content limit: the maximum length of content-bearing attributes such as model responses, tool content, system prompts, and raw API bodies, truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). The default is sized for backends that cap attribute values at 64 KB; raise it only if your backend accepts larger values, or lower it to cut telemetry volume. When an OpenTelemetry SDK attribute limit, `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` or one of its logrecord and span variants, is set lower, Claude Code truncates at that smaller value so the `[TRUNCATED ...]` marker stays within the SDK limit. Requires Claude Code v2.1.214 or later| `262144` `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`| Metrics temporality preference (default: `delta`). Set to `cumulative` if your backend expects cumulative temporality| `delta`, `cumulative` @@ -215,6 +216,7 @@ `workflow.run_id`| Run identifier of the [Workflow](</docs/en/workflows>) tool run that spawned this agent, prefixed `wf_`. Absent for agents not spawned by a workflow| `workflow.name`| Name of the workflow that spawned this agent. User-authored names are replaced with `custom` unless the gate is set| `OTEL_LOG_TOOL_DETAILS` `speed`| `fast` or `normal`| +`effort`| [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `low`, `medium`, `high`, `xhigh`, or `max`. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. Requires Claude Code v2.1.274 or later| `llm_request.context`| `interaction`, `tool`, or `standalone` depending on the parent span| `duration_ms`| Wall-clock duration including retries| `ttft_ms`| Time to first token in milliseconds| @@ -341,8 +343,9 @@ # Example: Multiple headers echo "{\"Authorization\": \"Bearer $(get-token.sh)\", \"X-API-Key\": \"$(get-api-key.sh)\"}" -If the helper fails or prints output that doesn’t meet these requirements, Claude Code reports the error in: - +If the helper fails or prints output that doesn’t meet these requirements, exports fail and your telemetry backend receives nothing from the session until the helper works again. Claude Code reports the failure in: + + * A warning notification in interactive sessions, [`otelHeadersHelper failed; telemetry is not being exported`](</docs/en/errors#otelheadershelper-failed>), shown once per session when the helper first fails * `/status` output * The debug log, when running with [`--debug`](</docs/en/cli-reference#cli-flags>) or after running `/debug` in the session * stderr, in non-interactive sessions started with `-p` @@ -583,7 +586,7 @@ * `model`: Model identifier (for example, “claude-sonnet-5”) * `query_source`: Category of the subsystem that issued the request. One of `"main"`, `"subagent"`, or `"auxiliary"` * `speed`: `"fast"` when the request used fast mode. Absent otherwise - * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when the model doesn’t support effort. + * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. * `agent.name`: Subagent type that issued the request. Built-in agent names and agents from official-marketplace plugins appear verbatim. Other user-defined agent names are replaced with `"custom"`. Absent when the request was not issued by a named subagent type. * `skill.name`: Skill active for the request, set by the Skill tool, a `/` command, or inherited by a spawned subagent. Built-in, bundled, user-defined, and official-marketplace plugin skill names appear verbatim. Third-party plugin skill names are replaced with `"third-party"`. Absent when no skill is active. * `plugin.name`: Owning plugin when the active skill or subagent is provided by a plugin. Official-marketplace plugin names appear verbatim. Third-party plugin names are replaced with `"third-party"`. Absent when neither the skill nor the subagent has an owning plugin. @@ -652,12 +655,12 @@ ---|--- `prompt.id`| UUID v4 identifier linking all events produced while processing a single user prompt `event.sequence`| 0-based counter for ordering events, counted per Claude Code process rather than per session -`message.uuid`| UUID of the message as persisted in the session transcript, the `~/.claude/projects/*/*.jsonl` files. Present on `assistant_response`, and on `user_prompt` except for command dispatches, which can produce zero or many messages. On `assistant_response`, this is the response’s final transcript entry, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.214 or later +`message.uuid`| UUID of the message as persisted in the session transcript, the `~/.claude/projects/*/*.jsonl` files. Present on `assistant_response`, on `api_response_body`, and on `user_prompt` except for command dispatches, which can produce zero or many messages. On `assistant_response` and `api_response_body`, this is the response’s final transcript entry, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.214 or later, or v2.1.274 or later on `api_response_body` `client_request_id`| Client-generated UUID sent as the `x-client-request-id` request header. Present on `api_request` and `api_error` on first-party API connections; absent on third-party provider backends and when the request was retried through the non-streaming fallback. Pairs a request with its response and remains available for failures such as timeouts that never produced a server `request_id`. Matches the same attribute on the `llm_request` trace span. Requires Claude Code v2.1.214 or later To trace all activity triggered by a single prompt, filter your events by a specific `prompt.id` value. This returns the user_prompt event, any api_request events, and any tool_result events that occurred while processing that prompt. `event.sequence` starts at 0 each time a Claude Code process starts and counts up for the life of that process. It keeps counting across `/clear`, which assigns a new `session.id`. If you [resume a session without forking](</docs/en/how-claude-code-works#resume-or-fork-sessions>), the session keeps its `session.id` but takes its `event.sequence` values from the process that resumed it, so within one session a later event can carry a lower value than an earlier one, or repeat one. To order a session’s events, sort by `event.timestamp` and use `event.sequence` to order events that share a timestamp. For message-level reconstruction, each event class carries a key that matches a field in the session transcript. The transcript entry format is [internal to Claude Code](</docs/en/sessions#where-transcripts-are-stored>) and changes between versions, so a pipeline that joins on these fields can break on any release; treat the joins as version-specific rather than a stable contract: - * `message.uuid` on `user_prompt` and `assistant_response` + * `message.uuid` on `user_prompt`, `assistant_response`, and `api_response_body` * `request_id` on the API events, persisted as `requestId` on the transcript’s assistant entries * `tool_use_id` on `tool_result` and `tool_decision` events @@ -754,7 +757,7 @@ * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header; see the event correlation attributes table for when it’s present. Requires Claude Code v2.1.214 or later * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name - * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when the model doesn’t support effort. + * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior. #### @@ -778,7 +781,7 @@ * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header. Available even when a failure such as a timeout or connection error never produced a server `request_id`; see the event correlation attributes table for when it’s present. Requires Claude Code v2.1.214 or later * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name - * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when the model doesn’t support effort. + * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. * `agent.name`, `skill.name`, `plugin.name`, `marketplace.name`, `mcp_server.name`, `mcp_tool.name`: Skill, plugin, agent, and MCP attribution for the request. See Cost counter for definitions and redaction behavior. #### @@ -798,7 +801,7 @@ * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name. See `api_request` for definitions. * `speed`: Either `"fast"` when [Fast mode](</docs/en/fast-mode>) is active, or `"normal"` * `attempt`: Retry attempt number. The first attempt is `1`. - * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when the model doesn’t support effort. + * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. * `server_fallback_hop`: `true` when the API’s server-side model fallback already retried this refusal on a different model, so the user did not see this particular refusal. `false` when the request ended in a refusal. A single turn can emit both a `true` hop event and a later `false` final event when the fallback model also refuses. * `has_category`: `true` when the API response carried a `stop_details.category` of `"cyber"`, `"bio"`, `"frontier_llm"`, or `"reasoning_extraction"`. `false` when the response carried no category or a value outside that set. Absent when `server_fallback_hop` is `true`, because hop blocks don’t carry `stop_details`. * `has_explanation`: `true` when the API response carried a `stop_details.explanation`, otherwise `false`. Absent when `server_fallback_hop` is `true`. @@ -1220,6 +1223,53 @@ * `files_past_cutoff`: Files older than the retention period that the sweep failed to delete, for example because of a permission error or a file held open. A value above zero means files outlived the configured retention period; zero isn’t proof that none did, because a failed removal of a whole directory counts toward `error_count` instead * `error_count`: Number of errors the sweep encountered while listing or deleting files +#### + +​ + +Managed settings resolved event + +Logged with the [managed settings](</docs/en/managed-settings>) a session resolved: once at session start, again when either the managed settings or the [policy helper](</docs/en/managed-settings#compute-the-policy-with-a-helper-program>)’s state changes during the session, and when Claude Code refuses to start or ends the session for one of the reasons the `error.type` attribute lists. Use this event to find machines running on an unexpected managed source, machines whose policy helper is failing, and the reason a machine refused to start. Requires Claude Code v2.1.274 or later. By default, the event carries the managed sources and the policy helper’s state but not the settings themselves. To add the redacted `managed_settings.settings` attribute and the `managed_settings.resolved_sha256` digest, set `OTEL_LOG_MANAGED_SETTINGS=1`: + + * Set it in the `env` block of managed settings, user settings, or `--settings`, or in the environment you launch Claude Code with. A value in project or local settings doesn’t turn it on, because a cloned repository can write them. + * Server-managed settings can set it without showing the [security approval dialog](</docs/en/server-managed-settings#security-approval-dialogs>), because the variable only adds your organization’s own redacted policy to an event your organization already receives. + +In an interactive session in a folder you haven’t [trusted](</docs/en/permissions#what-runs-before-you-trust-a-folder>), Claude Code doesn’t export the refusal event, because project and local settings could point the export at a different collector before trust. **Event Name** : `claude_code.managed_settings_resolved` **Attributes** : + + * All standard attributes + * `event.name`: `"managed_settings_resolved"` + * `event.timestamp`: ISO 8601 timestamp + * `event.sequence`: per-process counter for ordering events, described under Event correlation attributes + * `managed_settings.trigger`: `"startup"` for the session-start event, `"change"` when the managed settings or the policy helper’s state changed later in the session, or `"refused"` when a managed settings policy stopped the session. Claude Code sends a `change` event only when an attribute differs from the last event it sent, and a changed setting value counts even when `OTEL_LOG_MANAGED_SETTINGS` is off + * `error.type`: why Claude Code stopped the session. Present only on `refused` events: + * `"helper_failed"`: a [policy helper run failed](</docs/en/settings-reference#helper-failures>) + * `"policy_invalid"`: the managed settings contain an error that stops Claude Code from starting, or an admin source failed to load, so Claude Code can’t check organization login enforcement + * `"consent_rejected"`: the user rejected the [security approval dialog](</docs/en/server-managed-settings#security-approval-dialogs>) for server-managed settings + * `"force_refresh_failed"`: the settings fetch that [`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>) requires failed + * `"gateway_rejected"`: a [Claude apps gateway](</docs/en/claude-apps-gateway>) answered the managed settings load with HTTP 403 + * `"version_below_minimum"`: this version of Claude Code is below [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>) or above [`requiredMaximumVersion`](</docs/en/settings-reference#requiredmaximumversion>) + * `"_OTHER"`: the Claude apps gateway managed settings load failed for another reason + * `managed_settings.sources`: every managed source that delivers at least one [policy key](</docs/en/managed-settings#how-claude-code-combines-managed-sources>), highest priority first, including sources whose keys don’t take effect under `first-wins`. Values are `"remote"`, `"plist"` or `"hklm"` for the MDM or OS-level policy, `"file"` for managed settings files and drop-ins, `"parent"` when an [embedding host](</docs/en/managed-settings#let-an-embedding-host-add-policy>) supplies settings, and `"hkcu"` for the [Windows HKCU registry value](</docs/en/managed-settings#where-each-mechanism-stores-the-policy>) when Claude Code [reads it](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). A source that carries only control keys, or that Claude Code couldn’t read, isn’t listed. Emitted as an array of strings, empty when no managed source delivers a policy key + * `managed_settings.source_behavior`: the [`managedSourcesBehavior`](</docs/en/settings-reference#managedsourcesbehavior>) value Claude Code read, `"first-wins"` or `"merge"`. `"first-wins"` when no source sets the key + * `managed_settings.helper.state`: state of the policy helper that the selected MDM or file source configures: + * `"ok"`: the helper’s output serves as the managed settings + * `"bad_path"`, `"not_a_file"`, `"exit_nonzero"`, `"timed_out"`, `"oversize"`, `"parse_failed"`, `"envelope_invalid"`, or `"schema_rejected"`: the helper’s last run failed. [Helper failures](</docs/en/settings-reference#helper-failures>) describes the cases + * `"none"`: no helper is configured, or the source that configures it isn’t an MDM policy or managed settings file + * `managed_settings.helper.applied`: `"output"` while the helper’s own output serves as the managed settings, `"none"` when it doesn’t + * `managed_settings.helper.entry`: `"policyHelper"` when Claude Code selected a [`policyHelper`](</docs/en/settings-reference#policyhelper>). Absent when it selected no helper + * `managed_settings.helper.path`: the helper’s configured [`path`](</docs/en/settings-reference#policyhelper-path>). Present whenever Claude Code selected a helper, whether or not `OTEL_LOG_MANAGED_SETTINGS` is set + * `managed_settings.resolved_sha256` (when `OTEL_LOG_MANAGED_SETTINGS=1`): SHA-256 of the resolved managed settings before redaction, serialized as JSON with keys sorted recursively and no whitespace. Machines with the same digest run the same policy. Claude Code sends the digest only with the opt-in because a short policy can be recovered by hashing guesses. Absent when no managed settings resolved, and on `refused` events + * `managed_settings.settings` (when `OTEL_LOG_MANAGED_SETTINGS=1`): the names and shape of the resolved managed settings as a JSON string, with the values redacted. Absent on `refused` events. Claude Code builds it from its settings schema: + * A setting name the schema declares is exported, and a key it doesn’t declare is left out + * Booleans, numbers, and string values the schema restricts to a fixed set of options, such as `permissions.defaultMode`, are exported as-is. `sandbox.network.httpProxyPort` and `sandbox.network.socksProxyPort` are exported as `"[REDACTED]"` + * Every other string, such as `model`, `apiKeyHelper`, every `env` value, every URL, and every command, is exported as `"[REDACTED]"` + * The entry names of maps, such as `env` variable names and plugin IDs, are exported as-is. A setting whose entries the schema doesn’t type, such as `vimInsertModeRemaps`, is exported as a single `"[REDACTED]"`, and `sandbox.ignoreViolations` is exported as a list of its path lists without the command patterns + * A list keeps its length, with each entry redacted by the same rules + * A `permissions.allow`, `permissions.deny`, or `permissions.ask` rule is exported as its tool name with the content redacted, such as `Read([REDACTED])`, when the tool is built into this version of Claude Code or is an `mcp__` reference such as `mcp__jira__create_issue`. Any other rule is exported as `"[REDACTED]"` + * Hooks follow the same rules, so fixed-option and numeric fields such as `type` and `timeout` show, while each command, URL, `matcher`, and `if` condition is exported as `"[REDACTED]"` +For example, managed settings with `apiKeyHelper`, two `env` variables, and a deny rule are exported as `{"apiKeyHelper":"[REDACTED]","env":{"HTTPS_PROXY":"[REDACTED]","CLAUDE_CODE_ENABLE_TELEMETRY":"[REDACTED]"},"permissions":{"deny":["Read([REDACTED])"]}}`. Claude Code cuts the value at 8 KB of UTF-8, and the cut value isn’t valid JSON + * `managed_settings.settings_truncated` (when `managed_settings.settings` is present): `true` when Claude Code cut `managed_settings.settings` at 8 KB, `false` otherwise. Emitted as a boolean, not a string + ## ​ @@ -1349,6 +1399,7 @@ MCP server connect or failure| `mcp_server_connection`| `status`, `server_name`, `is_plugin`, `error_code` Plugin installed and its source| `plugin_installed`| `plugin.name`, `marketplace.name`, `marketplace.is_official` Commands run and files touched| `tool_result` (executed) or `tool_decision` (rejected) with `OTEL_LOG_TOOL_DETAILS=1`| `tool_parameters`; `tool_input` (`tool_result` only) +Which managed settings sources a machine runs on, whether its policy helper is healthy, and why a machine refused to start| `managed_settings_resolved`| `managed_settings.trigger`, `managed_settings.sources`, `managed_settings.source_behavior`, `managed_settings.helper.state`, `error.type`; `managed_settings.settings` and `managed_settings.resolved_sha256` with `OTEL_LOG_MANAGED_SETTINGS=1` Claude Code emits the raw event stream only. Anomaly detection, baselining, correlation across sessions, and alerting are the responsibility of your SIEM or observability backend.
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -234,7 +234,7 @@ Desktop and claude.ai -The preceding table covers the standalone CLI. The Claude Desktop app and claude.ai in a browser load their application code and user content from additional Anthropic CDN hosts, including `assets-proxy.anthropic.com` and the other `*.claudeusercontent.com` origins that serve [artifacts](</docs/en/artifacts>) in those apps. Allowing `claude.ai` while blocking those hosts produces a blank page rather than an error. See [network access requirements](</docs/en/desktop#network-access-requirements>) on the Desktop page. An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, and `code.jquery.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. +The preceding table covers the standalone CLI. The Claude Desktop app and claude.ai in a browser load their application code and user content from additional Anthropic CDN hosts, including `assets-proxy.anthropic.com` and the other `*.claudeusercontent.com` origins that serve [artifacts](</docs/en/artifacts>) in those apps. Allowing `claude.ai` while blocking those hosts produces a blank page rather than an error. See [network access requirements](</docs/en/desktop#network-access-requirements>) on the Desktop page. An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. Artifacts can also load JavaScript libraries, such as React or a charting package, from `cdnjs.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`, `code.jquery.com`, and `unpkg.com`, and from no other external host. If you block those hosts, the parts of an artifact that depend on a library don’t work, and unlike a blocked font, a blocked library has no fallback. Block with a fast rejection here too, so a blocked library request fails at once rather than hanging until it times out. ##
modified Agent SDK overview View current →
--- a/overview.md +++ b/overview.md @@ -6,16 +6,16 @@ Compare the Agent SDK to other Claude tools -The Agent SDK, the CLI, the Client SDK, and Managed Agents each fit different needs. Use the table to find the one that matches what you’re building. +The Agent SDK, the CLI, the Client SDK, and Managed Agents differ in who runs the agent, what comes built in, and how you reach it. Find the row that matches how you want to build and run yours. -If you’re…| Use| Why +You want to| Use| What you get ---|---|--- -Building an agent without implementing the tool loop yourself| **Agent SDK**| A Python or TypeScript library that runs the agent loop for you. -Doing interactive development or running one-off tasks from a terminal| [**Claude Code CLI**](</docs/en/overview>)| The terminal interface, built for daily interactive use. -Calling the API directly and implementing the tool loop yourself| [**Client SDK**](<https://platform.claude.com/docs/en/api/client-sdks>)| Direct access to the Anthropic API rather than to Claude Code. You implement the tool loop yourself. -Running long-running or asynchronous agents without managing your own sandbox or session infrastructure| [**Managed Agents**](<https://platform.claude.com/docs/en/managed-agents/overview>)| Hosted REST API, a separate product from the Agent SDK. Anthropic runs the agent and the sandbox. +Embed Claude Code’s agent in your own Python or TypeScript application, in a process you operate| **Agent SDK**| A library that runs the Claude Code binary, with Claude Code’s capabilities, such as built-in tools, permissions, sessions, and hooks. +Do interactive development or run one-off tasks from a terminal| [**Claude Code CLI**](</docs/en/overview>)| The terminal interface, built for daily interactive use. +Call the Claude API directly from your own code| [**Client SDK**](<https://platform.claude.com/docs/en/cli-sdks-libraries/overview>)| Direct access to the Claude API from any of the client SDK languages. You write the tool loop yourself, or let the client SDK’s beta [tool runner](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner>) drive it. +Have Anthropic host the agent, configured through the Claude API| [**Managed Agents**](<https://platform.claude.com/docs/en/managed-agents/overview>)| A hosted agent harness that runs the agent loop, with sessions in an Anthropic-managed cloud sandbox or a [self-hosted sandbox](<https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes>) on your own infrastructure. Use it from the [SDK for your language](<https://platform.claude.com/docs/en/managed-agents/quickstart#install-the-sdk>), the `ant` CLI, or the REST API. -The SDK is available as a library for Python and TypeScript only. To drive the same agent loop from another language, [run the CLI as a subprocess](</docs/en/headless>) with the `-p` flag and `--output-format json`. +To drive the same agent loop from a language other than Python or TypeScript, [run the CLI as a subprocess](</docs/en/headless>) with the `-p` flag and `--output-format json`. ##
modified Choose a permission mode View current →
--- a/permission-modes.md +++ b/permission-modes.md @@ -209,7 +209,7 @@ When the plan is ready, Claude presents it and asks how to proceed. From that prompt you can choose: - * **Yes, and use auto mode** : approve and start in auto mode. When auto mode is unavailable, this option reads **Yes, auto-accept edits**. If you started the session with bypass permissions enabled, the option reads **Yes, and switch to BYPASS PERMISSIONS (no further prompts) for this session** instead. + * **Yes, and use auto mode** : approve and start in auto mode. If auto mode isn’t available to your session, for example because your organization turned it off, this option reads **Yes, auto-accept edits**. If you started the session with bypass permissions enabled, the option reads **Yes, and switch to BYPASS PERMISSIONS (no further prompts) for this session** instead. * **Yes, manually approve edits** : approve and review each edit individually. * **No, keep planning** : stay in plan mode and tell Claude what to change. @@ -375,6 +375,18 @@ ​ +Approvals you state in conversation + +If you tell Claude that a blocked action is allowed, the classifier reads that as your approval and can clear the block. How you worded it decides whether the action runs, and how far the approval reaches: + + * **Name the action and its specifics** : your message has to name the action and the specific thing that makes it dangerous, such as the branch of a force push. Naming the verb alone clears nothing, so “you can force-push” leaves the block in place. + * **Expect it to cover one action** : an approval covers the destructive action you named, so a later action is blocked again unless you granted the approval as standing. To stop approving a routine pattern one action at a time, add it to [`autoMode.allow`](</docs/en/auto-mode-config#override-the-block-and-allow-rules>). + * **Some blocks stay in place** : [the classifier’s precedence order](</docs/en/auto-mode-config#override-the-block-and-allow-rules>) sets out which blocks your approval can reach. To run a step it won’t clear, leave auto mode and answer the permission prompt. + +### + +​ + When auto mode falls back When auto mode can’t approve your session’s actions, what happens depends on the case: @@ -416,8 +428,6 @@ 1. Before a subagent starts, the delegated task description is evaluated, so a dangerous-looking task is blocked at spawn time. 2. While the subagent runs, each of its actions goes through the classifier with the same rules as the parent session, and any `permissionMode` in the subagent’s frontmatter is ignored. 3. When the subagent finishes, the classifier reviews its work and its final report before the parent reads the report. When the classifier flags the subagent’s work or report, or a separate API safety check refuses the review, the report is still delivered, prepended with a security warning. When the classifier is unavailable for the review, the report arrives with a note to verify the subagent’s work before acting on it. - -Step 1 requires Claude Code v2.1.178 or later. Earlier versions applied the classifier at steps 2 and 3, but did not evaluate the task description before the subagent started. Cost and latency @@ -526,7 +536,12 @@ * Your working directory and its parents * Your additional working directories and their parents, but only when the removal is a glob under one of them, such as `rm -rf <dir>/*`. `rm -rf <dir>` on the directory itself doesn’t trigger this check -Claude Code also treats a glob or trailing slash directly under a shell variable, such as `rm -rf "$DIR"/*`, as a critical-path removal, because the command becomes a removal from the filesystem root when the variable is empty. Hiding the removal inside a subshell with `(...)`, a brace group with `{ ...; }`, command substitution with `$(...)` or backticks, or process substitution with `<(...)`, doesn’t skip the check. Claude Code finds a critical-path removal whether it sits inside the nested form, as in `(rm -rf ~)` or `echo "$(rm -rf ~)"`, or elsewhere in the same command. +Claude Code also treats a glob or trailing slash directly under a shell variable, such as `rm -rf "$DIR"/*`, as a critical-path removal, because the command becomes a removal from the filesystem root when the variable is empty. The prompt for this variable case names the flagged `rm` and says how to rewrite it so the check passes: + + * For a variable such as `$DIR`, guard each expansion so the shell stops with an error when the variable is unset or empty, as in `rm -rf "${DIR:?}"/*`, or use a literal path + * For a variable that is normally set, such as `$HOME`, use a literal path + +A removal whose expansions are all guarded that way isn’t a critical-path removal, so in `bypassPermissions` mode it runs without a prompt. Hiding the removal inside a subshell with `(...)`, a brace group with `{ ...; }`, command substitution with `$(...)` or backticks, or process substitution with `<(...)`, doesn’t skip the check. Claude Code finds a critical-path removal whether it sits inside the nested form, as in `(rm -rf ~)` or `echo "$(rm -rf ~)"`, or elsewhere in the same command. ###
modified Test plugins with evals View current →
--- a/plugin-evals.md +++ b/plugin-evals.md @@ -307,7 +307,7 @@ Grant tools -Runs never stop to ask for permission. Built-in tools that need a grant you didn’t give, such as `Bash`, `Write`, `Edit`, `WebFetch`, and `WebSearch`, are removed from the session, so Claude can’t call them at all. The allowlist is the read-only tools the case lists in `allowed_tools`, from `Read`, `Glob`, `Grep`, `NotebookRead`, `Skill`, `Agent`, `TodoWrite`, and the task tools `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, `TaskStop`, and `TaskOutput`, plus whatever you grant with `--allow-tools`, which applies to every case in the run. To let cases use `Bash`, `Write`, `Edit`, `WebFetch`, or `WebSearch`, grant them yourself: +Runs never stop to ask for permission. Built-in tools that need a grant you didn’t give, such as `Bash`, `Write`, `Edit`, `WebFetch`, and `WebSearch`, are removed from the session, so Claude can’t call them at all. The allowlist is the read-only tools the case lists in `allowed_tools`, from `Read`, `Glob`, `Grep`, `NotebookRead`, `Skill`, `Agent`, `TodoWrite`, and the task tools `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, and `TaskStop`, plus whatever you grant with `--allow-tools`. That grant applies to every case in the run. To let cases use `Bash`, `Write`, `Edit`, `WebFetch`, or `WebSearch`, grant them yourself: claude plugin eval . --allow-tools Write Edit "Bash(npm test *)"
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -45,7 +45,12 @@ Detailed system prompt for the agent describing its role, expertise, and behavior. -Plugin agents support `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, [`omitClaudeMd`](</docs/en/sub-agents#supported-frontmatter-fields>), and `isolation` frontmatter fields. The only valid `isolation` value is `"worktree"`. For security reasons, plugin-shipped agents don’t support `hooks`, `mcpServers`, or `permissionMode`. Claude Code loads a plugin agent even when its frontmatter has no `name` or doesn’t parse: +Plugin agents support `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, [`omitClaudeMd`](</docs/en/sub-agents#supported-frontmatter-fields>), and `isolation` frontmatter fields. The only valid `isolation` value is `"worktree"`. For security reasons, plugin-shipped agents don’t support `hooks`, `mcpServers`, or `permissionMode`. You can put plugin agent files in subfolders of `agents/`. Claude Code [loads them recursively](</docs/en/sub-agents#choose-the-subagent-scope>) and joins the plugin name, each subfolder name, and the file name with colons to form the agent’s scoped name. For example, `agents/review/security.md` in a plugin named `my-plugin` loads as `my-plugin:review:security`. Two settings change that name: + + * Frontmatter `name`: it replaces only the file name, so `name: audit` in `agents/review/security.md` loads as `my-plugin:review:audit` + * Manifest `agents` field: a file you list there loads without subfolder names, so `"agents": "./custom/review/security.md"` loads as `my-plugin:security` + +Claude Code loads a plugin agent even when its frontmatter has no `name` or doesn’t parse: * No `name`: Claude Code names the agent after the file, so `agents/reviewer.md` in a plugin named `my-plugin` loads as `my-plugin:reviewer` * Frontmatter that doesn’t parse: Claude Code names the agent after the file, uses `Agent from my-plugin plugin` as its description, and ignores every field in the file @@ -622,7 +627,7 @@ * 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 * Before v2.1.221, `"."` failed manifest validation and the plugin didn’t load, so use `"./"` to support earlier versions - * Components from custom paths use the same naming and namespacing rules + * Components from custom paths use the same naming and namespacing rules, except agent files. See Agents for how agent names work * Multiple paths can be specified as arrays * A skill path can point to a directory that contains a `SKILL.md` directly, for example `"skills": ["."]` for the plugin root * Claude Code takes the skill’s invocation name from the frontmatter `name` field in `SKILL.md`, so the name stays stable whatever the install directory is named @@ -820,7 +825,9 @@ ├── agents/ # Subagent definitions │ ├── security-reviewer.md │ ├── performance-tester.md - │ └── compliance-checker.md + │ ├── compliance-checker.md + │ └── review/ # Agents here load as enterprise-plugin:review:<name> + │ └── accessibility.md ├── workflows/ # Workflow scripts │ └── release-audit.js ├── output-styles/ # Output style definitions @@ -859,7 +866,7 @@ **Manifest**| `.claude-plugin/plugin.json`| Plugin metadata and configuration (optional) **Skills**| `skills/`| Skills with `<name>/SKILL.md` structure **Commands**| `commands/`| Skills as flat Markdown files. Use `skills/` for new plugins -**Agents**| `agents/`| Subagent Markdown files +**Agents**| `agents/`| Subagent Markdown files. Subfolders are part of the agent name **Workflows**| `workflows/`| [Workflow](</docs/en/workflows>) script files **Output styles**| `output-styles/`| Output style definitions **Themes**| `themes/`| Color theme definitions
modified Prompt library View current →
--- a/prompt-library.md +++ b/prompt-library.md @@ -45,7 +45,7 @@ * [How Anthropic teams use Claude Code](<https://claude.com/blog/how-anthropic-teams-use-claude-code>): real workflows from engineering, product, design, and data teams, with deep dives on [legal](<https://claude.com/blog/how-anthropic-uses-claude-legal>), [marketing](<https://claude.com/blog/how-anthropic-uses-claude-marketing>), and [cybersecurity](<https://claude.com/blog/how-anthropic-uses-claude-cybersecurity>) * [Scaling agentic coding guide](<https://resources.anthropic.com/hubfs/Scaling%20agentic%20coding%20across%20your%20organization.pdf>): the enterprise adoption guide -For video walkthroughs of these patterns, see the free [Claude Code in Action](<https://anthropic.skilljar.com/claude-code-in-action>) course on Anthropic Academy. +For video walkthroughs of these patterns, see the free [Claude Code in Action](<https://academy.claude.com/courses/claude-code-in-action>) course on [Claude Academy](<https://academy.claude.com/>). ##
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -902,7 +902,7 @@ `resume`| `str | None`| `None`| Session ID to resume `session_id`| `str | None`| `None`| Use a specific session ID instead of an auto-generated one. Must be a valid UUID. Can’t be combined with `continue_conversation` or `resume` unless `fork_session` is also set `max_turns`| `int | None`| `None`| Maximum agentic turns (tool-use round trips) -`max_budget_usd`| `float | None`| `None`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`. For accuracy caveats and reset behavior, see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) +`max_budget_usd`| `float | None`| `None`| Stop the query when the client-side cost estimate reaches this USD value. Counts only the call’s own spend; totals restored from a resumed session don’t count. For accuracy caveats and reset behavior, see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) `disallowed_tools`| `list[str]`| `[]`| Tools to deny. A bare name such as `"Bash"` removes the tool from Claude’s context. A scoped rule such as `"Bash(rm *)"` leaves the tool available and denies matching calls in every permission mode, including `bypassPermissions`, for the command [as written](</docs/en/permissions#bash-rule-limits>). See [Permissions](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) `enable_file_checkpointing`| `bool`| `False`| Enable file change tracking for rewinding. See [File checkpointing](</docs/en/agent-sdk/file-checkpointing>) `model`| `str | None`| `None`| Claude model alias or full model name. See [accepted values and provider-specific IDs](</docs/en/model-config#available-models>) @@ -1762,7 +1762,7 @@ `cache_creation_input_tokens`| `int`| Tokens used to create new cache entries. `cache_read_input_tokens`| `int`| Tokens read from existing cache entries. -The `model_usage` dict maps model names to per-model usage. It covers every model call made through the query pipeline: the main loop, subagents, and internal calls such as compaction and Workflow agents. Helper calls outside that pipeline, such as the permission classifier and token-counting requests, are excluded from `model_usage`. Treat `model_usage` as an estimate, not a billing statement. In [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), `model_usage` and `total_cost_usd` are cumulative across turns, so read the latest result rather than summing across results. See [Track costs in streaming input mode](</docs/en/agent-sdk/cost-tracking#track-costs-in-streaming-input-mode>) for resets and [Recover totals after a session crash](</docs/en/agent-sdk/cost-tracking#recover-totals-after-a-session-crash>) for zeroed results. Each value in `model_usage` is a `ModelUsage` TypedDict, imported via `from claude_agent_sdk.types import ModelUsage`. Its keys use camelCase because the SDK passes the value through unmodified from the underlying CLI process, matching the TypeScript [`ModelUsage`](</docs/en/agent-sdk/typescript#modelusage>) type: +The `model_usage` dict maps model names to per-model usage. It covers every model call made through the query pipeline: the main loop, subagents, and internal calls such as compaction and Workflow agents. Helper calls outside that pipeline, such as the permission classifier and token-counting requests, are excluded from `model_usage`. Treat `model_usage` as an estimate, not a billing statement. In [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), `model_usage` and `total_cost_usd` are cumulative across turns, so read the latest result rather than summing across results. A call that resumes a session also counts the [totals restored from the session’s earlier calls](</docs/en/agent-sdk/cost-tracking#accumulate-costs-across-multiple-calls>). See [Track costs in streaming input mode](</docs/en/agent-sdk/cost-tracking#track-costs-in-streaming-input-mode>) for resets and [Recover totals after a session crash](</docs/en/agent-sdk/cost-tracking#recover-totals-after-a-session-crash>) for zeroed results. Each value in `model_usage` is a `ModelUsage` TypedDict, imported via `from claude_agent_sdk.types import ModelUsage`. Its keys use camelCase because the SDK passes the value through unmodified from the underlying CLI process, matching the TypeScript [`ModelUsage`](</docs/en/agent-sdk/typescript#modelusage>) type: Key| Type| Description ---|---|--- @@ -2843,16 +2843,15 @@ "command": str | None, # Shell script; each stdout line is an event, exit ends the watch "ws": dict | None, # WebSocket source: {"url": str, "protocols": list[str] | None}; each text frame is an event "description": str, # Short description shown in notifications - "timeout_ms": int | None, # Kill after this deadline (default 300000, max 3600000) - "persistent": bool | None, # Run for the lifetime of the session; stop with TaskStop + "timeout_ms": int | None, # Deadline in milliseconds (default 300000, max 3600000; the effective deadline is at most 1800000) } **Output:** { "taskId": str, # ID of the background monitor task - "timeoutMs": int, # Timeout deadline in milliseconds (0 when persistent) - "persistent": bool | None, # True when running until TaskStop or session end + "timeoutMs": int, # The watch's effective deadline in milliseconds + "persistent": bool | None, # False: every watch has a deadline } ### @@ -3209,24 +3208,7 @@ TaskOutput -**Tool name:** `TaskOutput`. The previous name `BashOutput` is still accepted as an alias. - -`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. The schemas below remain valid for hooks and permission handlers that encounter the tool. - -**Input:** - - { - "task_id": str, # The task ID to get output from - "block": bool, # Whether to wait for completion (default True) - "timeout": int, # Max wait time in ms (default 30000) - } - -**Output:** - - { - "retrieval_status": "success" | "timeout" | "not_ready", # Whether the output was retrieved - "task": dict | None, # Task details: task_id, task_type, status, description, output, plus type-specific fields such as exitCode - } +Removed in Claude Code v2.1.277. Previously retrieved output from a running or completed background task, with `BashOutput` accepted as an alias; Claude reads a background task’s output file with `Read` instead. A `disallowed_tools` entry or a deny rule that still names either name is ignored without a warning. ### @@ -3466,7 +3448,7 @@ ---|---|---|--- `enabled`| `bool`| `False`| Enable sandbox mode for command execution `autoAllowBashIfSandboxed`| `bool`| `True`| Auto-approve bash commands when sandbox is enabled -`excludedCommands`| `list[str]`| `[]`| Commands that always bypass sandbox restrictions (e.g., `["docker"]`). These run unsandboxed automatically without model involvement +`excludedCommands`| `list[str]`| `[]`| Commands that bypass sandbox restrictions, such as `["docker *"]`. These run unsandboxed automatically without model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies `allowUnsandboxedCommands`| `bool`| `True`| Allow the model to request running commands outside the sandbox. When `True`, the model can set `dangerouslyDisableSandbox` in tool input, which falls back to the permissions system `network`| `SandboxNetworkConfig`| `None`| Network-specific sandbox configuration `ignoreViolations`| `SandboxIgnoreViolations`| `None`| Configure which sandbox violations to ignore @@ -3563,7 +3545,7 @@ Permissions Fallback for Unsandboxed Commands -When `allowUnsandboxedCommands` is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: True` in the tool input. These requests fall back to the existing permissions system, meaning your `can_use_tool` handler will be invoked, allowing you to implement custom authorization logic. Commands listed in `excludedCommands` instead bypass the sandbox automatically, with no model involvement; see `SandboxSettings`. The following example logs each unsandboxed request and denies it unless your own authorization logic allows it: +When `allowUnsandboxedCommands` is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: True` in the tool input. These requests fall back to the existing permissions system, meaning your `can_use_tool` handler is invoked, allowing you to implement custom authorization logic. Your `excludedCommands` entries instead take a call out of the sandbox with no model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies. The following example logs each unsandboxed request and denies it unless your own authorization logic allows it: import asyncio from claude_agent_sdk import (
modified Configure the sandboxed Bash tool View current →
--- a/sandboxing.md +++ b/sandboxing.md @@ -139,7 +139,7 @@ Temporary directories -The session temp directory is writable inside the sandbox by default, alongside the working directory. Unless you disable filesystem isolation, Claude Code sets `$TMPDIR` to this directory for sandboxed commands, so tools that write temporary files work without extra configuration. Unsandboxed commands inherit your shell’s `$TMPDIR` unchanged, so while filesystem isolation is on, sandboxed and unsandboxed commands resolve `$TMPDIR` to different directories. To pass temporary files between the two, write them under the working directory instead. +The session temp directory is writable inside the sandbox by default, alongside the working directory. Unless you disable filesystem isolation, Claude Code sets `$TMPDIR` to this directory for sandboxed commands, so tools that write temporary files work without extra configuration. Unsandboxed commands inherit your shell’s `$TMPDIR` when it is set, so while filesystem isolation is on, sandboxed and unsandboxed commands resolve `$TMPDIR` to different directories. If your shell leaves `$TMPDIR` unset or empty, an unsandboxed command that references `$TMPDIR` receives your [`CLAUDE_CODE_TMPDIR`](</docs/en/env-vars>) override, or the operating system’s temp directory when you haven’t set one or the override is a long path, so the variable doesn’t expand to an empty string. To pass temporary files between the two, write them under the working directory instead. ## @@ -251,7 +251,7 @@ Two other things change: - * Sandboxed commands inherit your shell’s `$TMPDIR` instead of the session temp directory, because every temp directory is writable and Claude Code no longer redirects commands to the session one. On Linux the variable is often unset in the parent shell, so it can expand empty inside sandboxed commands; Claude Code tells Claude through its Bash tool guidance to create scratch directories with `mktemp -d` instead of relying on `$TMPDIR`. + * Sandboxed commands inherit your shell’s `$TMPDIR` instead of the session temp directory, because every temp directory is writable and Claude Code no longer redirects commands to the session one. On Linux the variable is often unset in the parent shell. The Bash tool guidance tells Claude to create scratch directories with `mktemp -d` instead of relying on `$TMPDIR`. * [`autoAllowBashIfSandboxed`](</docs/en/settings-reference#sandbox-autoallowbashifsandboxed>) still defaults to `true`, so sandboxed commands keep running without prompts. Set it to `false` to prompt for sandboxed commands. ### @@ -631,10 +631,10 @@ * **Commands fail with a host-not-allowed error** : many CLI tools need to reach specific hosts. Granting permission when prompted adds the host to your allowed list so the tool runs inside the sandbox in future. * **`jest` hangs or fails**: `watchman` is incompatible with the sandbox. Run `jest --no-watchman` instead. - * **Go-based CLIs fail TLS verification on macOS** : tools such as `gh`, `gcloud`, and `terraform` may fail TLS verification under Seatbelt. List these tools in `excludedCommands` to run them outside the sandbox. If you are using `httpProxyPort` with a MITM proxy and custom CA, set [`enableWeakerNetworkIsolation`](</docs/en/settings-reference#sandbox-enableweakernetworkisolation>) to `true` instead. - * **`open`, `osascript`, or browser-based auth flows fail with error `-600` on macOS**: the sandbox blocks Apple Events by default. Set [`allowAppleEvents`](</docs/en/settings-reference#sandbox-allowappleevents>) to `true` in your user, managed, or CLI settings to allow them. Project settings are ignored for this key. Enabling it removes code-execution isolation, since sandboxed commands can then launch other applications unsandboxed with no user prompt and send AppleScript commands to running applications, subject to the macOS automation-consent prompt (TCC). Alternatively, add the command to `excludedCommands` to run it outside the sandbox. - * **`docker` commands fail**: `docker` is incompatible with the sandbox. Add `docker *` to `excludedCommands` to run it outside the sandbox. - * **`pbcopy`, `xclip`, or `wl-copy` doesn’t update the clipboard**: these clipboard utilities can fail to reach the system clipboard from inside the sandbox, in which case the text piped to them doesn’t arrive. To put Claude’s output on your clipboard, ask Claude to print it in its response, then run [`/copy`](</docs/en/commands>), which writes to the clipboard from the Claude Code process rather than from a sandboxed command. Alternatively, add `pbcopy *`, `wl-copy *`, or `xclip *` to `excludedCommands` to run the command outside the sandbox. + * **Go-based CLIs fail TLS verification on macOS** : tools such as `gh`, `gcloud`, and `terraform` may fail TLS verification under Seatbelt. List these tools in [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>). If you are using `httpProxyPort` with a MITM proxy and custom CA, set [`enableWeakerNetworkIsolation`](</docs/en/settings-reference#sandbox-enableweakernetworkisolation>) to `true` instead. + * **`open`, `osascript`, or browser-based auth flows fail with error `-600` on macOS**: the sandbox blocks Apple Events by default. Set [`allowAppleEvents`](</docs/en/settings-reference#sandbox-allowappleevents>) to `true` in your user, managed, or CLI settings to allow them. Project settings are ignored for this key. Enabling it removes code-execution isolation, since sandboxed commands can then launch other applications unsandboxed with no user prompt and send AppleScript commands to running applications, subject to the macOS automation-consent prompt (TCC). Alternatively, add the command to [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>). + * **`docker` commands fail**: `docker` is incompatible with the sandbox. Add `docker *` to [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>). + * **`pbcopy`, `xclip`, or `wl-copy` doesn’t update the clipboard**: these clipboard utilities can fail to reach the system clipboard from inside the sandbox, in which case the text piped to them doesn’t arrive. To put Claude’s output on your clipboard, ask Claude to print it in its response, then run [`/copy`](</docs/en/commands>). `/copy` writes to the clipboard from the Claude Code process rather than from a sandboxed command. When Claude pipes text to one of these tools, adding the tool to [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) doesn’t take that call out of the sandbox on its own. * **A git command fails with`unable to unlink old`**: `git merge`, `git checkout`, and similar commands fail this way when they need to replace a file the sandbox denies writes to, whether that file is under a protected path such as `.claude/skills`, under one of your `denyWrite` entries, or outside the directories the sandbox lets commands write to at all. On Linux and WSL2 the error ends with `Read-only file system`. After the failure, Claude may offer to rerun the command outside the sandbox; approve that retry, or run the git command yourself in another terminal. If you’ve set `allowUnsandboxedCommands` to `false`, Claude can’t offer the retry, so run the command yourself. If the same git command fails often, add it to [`excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>). * **Bubblewrap fails to start inside a container** : in an unprivileged container, bubblewrap can’t mount a fresh `/proc` filesystem, so sandboxed commands fail with a `bwrap` error such as `Can't mount proc on /newroot/proc: Operation not permitted`. Set [`enableWeakerNestedSandbox`](</docs/en/settings-reference#sandbox-enableweakernestedsandbox>) to `true` so the inner sandbox bind-mounts the container’s existing `/proc` instead. Only use this setting when the outer container already provides the isolation boundary you need, since it exposes process information to sandboxed commands that a fresh `/proc` mount would hide. * **0-byte read-only files appear at`.claude` settings paths, and “Yes, and don’t ask again” doesn’t save**: on Linux and WSL2, the sandbox holds a write denial on a file that doesn’t exist yet by creating a 0-byte read-only placeholder there while a sandboxed command runs. The sandbox removes the placeholder afterward. If a session is killed before that cleanup runs, for example by SIGKILL, the placeholders stay behind. Later sessions bind them read-only again on every start, so a settings write such as saving a permission choice fails where one sits. Run `claude doctor` to list the leftover placeholder files. The [`Stale sandbox mask files left by a killed session`](</docs/en/errors#stale-sandbox-mask-files-left-by-a-killed-session>) warning names up to three of them and counts the rest. Delete each file with `rm` while no other Claude Code session is running in that project. Before v2.1.257, Claude Code left the same placeholders behind without flagging them.
modified Catch security issues as Claude writes code View current →
--- a/security-guidance.md +++ b/security-guidance.md @@ -21,10 +21,11 @@ /plugin install security-guidance@claude-plugins-official -`/plugin` opens an interactive panel and is available only in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, install another way: +`/plugin` opens an interactive panel in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, install another way: * **Claude desktop app, local or SSH session** : open the [plugin browser](</docs/en/desktop#install-plugins>) by clicking the **+** button next to the prompt, then **Plugins** , then **Add plugin** - * **Cloud sessions** : declare the plugin in `.claude/settings.json` as shown under Enable in cloud sessions + * **VS Code extension** : install from the [**Manage plugins** dialog](</docs/en/vs-code#manage-plugins>) + * **Cloud sessions** : enable the plugin for your claude.ai account so Claude Code loads it as a [synced plugin](</docs/en/plugins-reference#synced-plugins>). A cloud session doesn’t load plugins from your user settings or from the repository’s `.claude/settings.json`, as [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) explains The terminal install prompts for a scope. Choose user scope to write the plugin to your user settings, so it loads in every new local session you start on this machine. If the install fails, match the message Claude Code reports: @@ -37,9 +38,9 @@ ​ -Enable in cloud sessions and shared repositories - -User-scoped plugins do not carry into [cloud sessions](</docs/en/claude-code-on-the-web>), because those sessions don’t run on your machine. To enable the plugin there, or to turn it on for everyone who clones a repository, declare it in the project’s checked-in settings: +Enable for your team in local sessions + +To turn the plugin on in the local sessions your teammates start in the repository, declare it in the project’s checked-in settings: .claude/settings.json
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -172,7 +172,7 @@ Use the Anthropic git proxy -Start the runner with `--use-anthropic-git-proxy`, or set `CLAUDE_RUNNER_USE_GIT_PROXY=1`, to have it clone through Anthropic’s git proxy, authenticated with the session’s own short-lived token. For ordinary user sessions, the proxy uses the GitHub or GitHub Enterprise OAuth token stored for the session creator; for bot and agent sessions, it uses your organization’s GitHub App installation token. Either way, the runner image needs no git credentials at all: no SSH keys, no credential helper, no `.netrc`. This is the same auth path Anthropic-hosted environments use. The proxy requires `--capacity 1` because the proxy URL is per-session, and git 2.32 or newer because older git ignores the configuration mechanism the proxy uses to isolate sessions from each other. The runner refuses to start if either requirement is unmet. Because the proxy fetches from Anthropic’s side, your git host must be reachable from Anthropic infrastructure, the same requirement Anthropic-hosted sessions have; for a git host that’s only routable inside your network, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) instead. Each runner process handles one session at a time, so run more replicas for parallelism. When the proxy is enabled, `--git-host-rewrite` and `--git-ssh-rewrite` have no effect: the proxy URL points at `api.anthropic.com`, not your git host. The runner also reports the opt-in to Anthropic when it registers, printing `Registering as opted in to Anthropic-managed git (--use-anthropic-git-proxy)` at startup. Each session on an opted-in runner then uses either Anthropic-managed git or the per-session proxy URL. When a session uses the per-session proxy URL, the runner logs one `[runner:warn]` line saying so. +Start the runner with `--use-anthropic-git-proxy`, or set `CLAUDE_RUNNER_USE_GIT_PROXY=1`, to have it clone through Anthropic’s git proxy, authenticated with the session’s own short-lived token. For ordinary user sessions, the proxy uses the GitHub or GitHub Enterprise OAuth token stored for the session creator; for bot and agent sessions, it uses your organization’s GitHub App installation token. Either way, the runner image needs no git credentials at all: no SSH keys, no credential helper, no `.netrc`. This is the same auth path Anthropic-hosted environments use. The proxy requires `--capacity 1` because the proxy URL is per-session, and git 2.32 or newer because older git ignores the configuration mechanism the proxy uses to isolate sessions from each other. The runner refuses to start if either requirement is unmet. Because the proxy fetches from Anthropic’s side, your git host must be reachable from Anthropic infrastructure, the same requirement Anthropic-hosted sessions have; for a git host that’s only routable inside your network, use a [`checkout` lifecycle hook](</docs/en/self-hosted-environments-configuration#checkout>) instead. Each runner process handles one session at a time, so run more replicas for parallelism. When the proxy is enabled, `--git-host-rewrite` and `--git-ssh-rewrite` have no effect: the proxy URL points at `api.anthropic.com`, not your git host. The runner also reports the opt-in to Anthropic when it registers, printing `Registering as opted in to Anthropic-managed git (--use-anthropic-git-proxy)` at startup. Reporting the opt-in requires Claude Code v2.1.267 or later, and earlier versions accept the flag without reporting it or printing that line. Each session on an opted-in runner then uses either Anthropic-managed git or the per-session proxy URL. When a session uses the per-session proxy URL, the runner logs one `[runner:warn]` line saying so. ### @@ -208,7 +208,7 @@ Swap `linux-x64` for `linux-arm64` if your nodes are ARM, or for `linux-x64-musl` or `linux-arm64-musl` on a musl-based image such as Alpine; see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>) for the extra packages musl images need. The URL is the standard Claude Code release location, so you can verify the downloaded binary against the release’s signed manifest as described in [Binary integrity and code signing](</docs/en/setup#binary-integrity-and-code-signing>). Build the image with Claude Code version 2.1.224 or later, then push it to your registry and reference it in the recipes below: - docker build --build-arg CLAUDE_CODE_VERSION=2.1.224 -t <your-registry>/claude-runner:latest . + docker build --build-arg CLAUDE_CODE_VERSION=2.1.267 -t <your-registry>/claude-runner:latest . ##
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -157,7 +157,7 @@ * **The`env` block**: apart from the telemetry unit and routing variables paired with a credential key, both covered below, it merges per key across the admin-controlled sources. For each environment variable, the highest-priority source defining it wins, and lower admin sources fill in variables the higher sources leave unset. An endpoint-managed `env` entry therefore applies whenever the server-managed configuration leaves that variable unset, or while a cached server value for it is withheld pending server confirmation. Requires Claude Code v2.1.223 or later. Before v2.1.223, Claude Code applies the selected source’s whole `env` block only. * **Telemetry unit** : the `OTEL_EXPORTER_OTLP_*` exporter keys, the `OTEL_LOG_*` content-capture toggles, `OTEL_LOGS_EXPORTER`, and the beta tracing variables `ENABLE_BETA_TRACING_DETAILED` and `BETA_TRACING_ENDPOINT` follow the highest source that sets any of them as a unit. A source that delivers the `otelHeadersHelper` credential key claims the unit too, but lands these variables only when it is the selected source: a source that isn’t selected but delivers the key contributes none of them and still blocks lower sources from filling them in. Either way, an exporter endpoint from one source can never pair with credentials from another. * **Credential-paired routing** : a source that pairs routing variables with a selected-source-only credential key, such as `apiKeyHelper` or `otelHeadersHelper`, contributes those routing variables only when it wins the slot. - * **Gateway sign-in keys** : Claude Code never reads [`forceLoginGatewayUrl`](</docs/en/settings-reference#forcelogingatewayurl>) or the `"gateway"` value of [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) from server-managed settings, so selecting server-managed settings neither supplies a gateway sign-in nor hides one set in an MDM policy or managed settings file. The [`managedSourcesBehavior` entry](</docs/en/settings-reference#managedsourcesbehavior>) says which admin source on the machine supplies them. + * **Gateway sign-in keys** : Claude Code never reads [`forceLoginGatewayUrl`](</docs/en/settings-reference#forcelogingatewayurl>), [`gatewayInternalNetworks`](</docs/en/settings-reference#gatewayinternalnetworks>), or the `"gateway"` value of [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) from server-managed settings, so a value there neither applies nor hides one set in an MDM policy or managed settings file. The [`managedSourcesBehavior` entry](</docs/en/settings-reference#managedsourcesbehavior>) says which admin source on the machine supplies them. ###
modified Settings files and precedence View current →
--- a/settings.md +++ b/settings.md @@ -355,7 +355,7 @@ A [cloud session](</docs/en/claude-code-on-the-web>) runs in a [cloud environment](</docs/en/cloud-environments>) on a fresh clone of your repository, not on your machine. That changes which settings reach it: - * **Shared project settings** (`.claude/settings.json`): read in a session with one repository, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. A session with several repositories starts above the clones, so from each repository’s `.claude/settings.json` it loads only the plugins and marketplaces the file declares, not permission rules, hooks, `env`, or other keys; see [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). + * **Shared project settings** (`.claude/settings.json`): read in a session with one repository, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. A session with several repositories starts above the clones and reads only the `enabledPlugins` and `extraKnownMarketplaces` keys from each repository’s `.claude/settings.json`, not permission rules, hooks, `env`, or other keys. The marketplaces and plugins those two keys declare still [don’t load in a cloud session](</docs/en/cloud-environments#what-carries-over-from-your-setup>). * **User and project local settings** (`~/.claude/settings.json` and `.claude/settings.local.json`): not read. Both stay on your machine, and the local file isn’t in the clone. * **Managed settings** : only [server-managed settings](</docs/en/server-managed-settings>) reach a cloud session; a `managed-settings.json` file or MDM profile on your device doesn’t. A [self-hosted environment](</docs/en/self-hosted-environments>) also reads the managed settings file in its runner image. [How Claude Code combines managed sources](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) says when that file applies. * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your claude.ai settings instead of changing a value. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment, or in a session with one repository, commit the key to that repository’s `.claude/settings.json`.
modified All settings View current →
Show diff (150 lines)
--- a/settings-reference.md +++ b/settings-reference.md @@ -43,7 +43,7 @@ `awsAuthRefresh`| Refresh expired [Bedrock credentials](</docs/en/amazon-bedrock#advanced-credential-configuration>) in `.aws` with your own command| Authentication and providers| Any file `awsCredentialExport`| Supply [Bedrock credentials](</docs/en/amazon-bedrock#advanced-credential-configuration>) as JSON from your own command| Authentication and providers| Any file `axScreenReader`| Render [screen-reader friendly output](</docs/en/accessibility>)| Interface and terminal| Any file -`bashEditDiffEnabled`| Record the [files a Bash command changed](</docs/en/hooks#bash>) in every permission mode| Interface and terminal| User or managed +`bashEditDiffEnabled`| Record the [files that changed while a Bash command ran](</docs/en/hooks#bash>) in every permission mode| Interface and terminal| User or managed `bashOutputMaxChars`| Set how much of a successful command’s [output](</docs/en/tools-reference#output-limits>) Claude receives inline| Memory and context| Any file `blockedMarketplaces`| Block [plugin marketplace](</docs/en/plugin-marketplaces>) sources for your organization| Plugins and skills| Managed `browserExternalPageTools`| Keep Claude’s tools off external pages in the [desktop](</docs/en/desktop>) Browser pane| Tools| Managed @@ -104,7 +104,7 @@ `hooks`| Run your own commands as [hooks](</docs/en/hooks>) at points in Claude Code’s lifecycle| Hooks and automation| Any file `httpHookAllowedEnvVars`| Limit which env vars [HTTP hooks](</docs/en/hooks>) can put in headers| Hooks and automation| Any file `includeCoAuthoredBy`| Deprecated; use `attribution` to hide or change commit and PR attribution| Git and attribution| Any file -`includeGitInstructions`| Remove the built-in commit and PR instructions from the [system prompt](</docs/en/sub-agents#what-loads-at-startup>)| Git and attribution| Any file +`includeGitInstructions`| Remove the built-in commit and PR instructions from Claude’s context| Git and attribution| Any file `inputNeededNotifEnabled`| Get a [push notification](</docs/en/remote-control#mobile-push-notifications>) when Claude is waiting on you| Remote, desktop, and notifications| Any file `isolatePeerMachines`| Ask you before Claude [messages one of your sessions on another machine](</docs/en/cross-session-messaging#require-approval-for-cross-machine-messages>)| Agents, sessions, and worktrees| Any file `keybindingFlavor`| Deprecated and has no effect; the word-editing shortcuts always [follow readline conventions](</docs/en/interactive-mode#make-ctrl-w-delete-back-to-whitespace>)| Interface and terminal| Any file @@ -164,7 +164,7 @@ `sandbox.enabled`| Turn on [Bash sandboxing](</docs/en/sandboxing#get-started>) on macOS, Linux, and WSL2| Sandbox settings| Any file `sandbox.enableWeakerNestedSandbox`| Run the Linux [sandbox](</docs/en/sandboxing>) inside an unprivileged container| Sandbox settings| Any file `sandbox.enableWeakerNetworkIsolation`| Let `gh`, `gcloud`, and `terraform` verify TLS behind a MITM proxy inside the [sandbox](</docs/en/sandboxing#troubleshooting>) on macOS| Sandbox settings| Any file -`sandbox.excludedCommands`| Name commands that always run outside the [sandbox](</docs/en/sandboxing>)| Sandbox settings| Any file +`sandbox.excludedCommands`| Name commands Claude Code can run outside the [sandbox](</docs/en/sandboxing>)| Sandbox settings| Any file `sandbox.failIfUnavailable`| Refuse to start when the [sandbox](</docs/en/sandboxing>) can’t, instead of running unsandboxed| Sandbox settings| Any file `sandbox.filesystem`| Control which paths [sandboxed](</docs/en/sandboxing#filesystem-isolation>) commands can read and write| Sandbox settings| Any file `sandbox.filesystem.allowManagedReadPathsOnly`| Stop developers from re-opening [read paths your organization blocked](</docs/en/sandboxing#keep-developers-from-widening-the-policy>)| Sandbox settings| Managed @@ -216,7 +216,7 @@ `syncClaudeAiPlugins`| Stop loading the [plugins enabled on your claude.ai account](</docs/en/plugins-reference#synced-plugins>) and stop downloading new ones| Plugins and skills| User, local, or managed `syncClaudeAiSkills`| Stop loading the [skills enabled on your claude.ai account](</docs/en/skills#how-synced-skills-behave>) and stop downloading new ones| Plugins and skills| User, local, or managed `syntaxHighlightingDisabled`| Turn off syntax highlighting in diffs and code blocks| Interface and terminal| Any file -`taskOutputMaxChars`| Set how much of a [background task’s](</docs/en/tools-reference#background-commands>) output Claude receives inline| Memory and context| Any file +`taskOutputMaxChars`| Removed in v2.1.277, together with the `TaskOutput` tool it sized| Memory and context| Any file `teammateDefaultModel`| Removed in v2.1.234; see [Specify teammates and models](</docs/en/agent-teams#specify-teammates-and-models>) for how Claude Code picks a teammate’s model| Global config settings| Global config `teammateMode`| Choose how [agent team teammates display](</docs/en/agent-teams#choose-a-display-mode>)| Agents, sessions, and worktrees| Any file `terminalProgressBarEnabled`| Hide the terminal progress bar in terminals that support it| Interface and terminal| Any file @@ -414,7 +414,7 @@ `fastModePerSessionOptIn` -Normally, running `/fast` saves `fastMode` to a person’s user settings, so fast mode is on at the start of every later session. Set this key to `true` to stop that: a saved `fastMode: true` no longer turns fast mode on at session start, and each person has to run `/fast` in each session they want it. Claude Code leaves the `fastMode` key in their file, so turning this key off restores the old behavior. Owners on Team or Enterprise plans can deploy it organization-wide through [server-managed settings](</docs/en/server-managed-settings>). +Normally, running `/fast` saves `fastMode` to a person’s user settings, so fast mode is on at the start of every later session. Set this key to `true` to stop that: a saved `fastMode: true` no longer turns fast mode on at session start, and each person has to run `/fast` in each session they want it. Claude Code leaves the `fastMode` key in their file, so turning this key off restores the old behavior. Owners on Team or Enterprise plans can deploy it organization-wide through [server-managed settings](</docs/en/server-managed-settings>). When managed settings set the key, `/fast on` is refused outside interactive terminal sessions and reports that your organization has disabled fast mode. That covers [non-interactive mode](</docs/en/headless>), the [VS Code extension](</docs/en/vs-code>), and [cloud sessions](</docs/en/claude-code-on-the-web>). * **Scope** : `Any file` * **Type** : Boolean @@ -635,7 +635,7 @@ `modelSettings` -Save an [effort level](</docs/en/model-config#adjust-effort-level>) for each model you use. In an interactive session on your machine, when you save `low`, `medium`, `high`, or `xhigh` as your default with `/effort` or the `/model` picker’s effort slider, Claude Code writes that level here under the model you’re using, so you rarely edit this key yourself. The `effortLevel` entry lists the sessions where `/effort` applies to that session only. Requires Claude Code v2.1.251 or later. Edit the key by hand to change or remove a level you saved. A model’s `effortLevel` here takes precedence over the top-level `effortLevel` in the same settings file. Across files, Claude Code resolves each model separately: the highest-precedence [settings file](</docs/en/settings#settings-precedence>) that sets either an `effortLevel` for that model or the top-level `effortLevel` decides, so an `effortLevel` in managed settings outranks a level you saved in user settings. [Adjust effort level](</docs/en/model-config#adjust-effort-level>) lists what else can override a saved level, such as `--effort` at launch. To cap one model’s effort rather than set its level, add a `maxEffortLevel` field to that model’s entry. The field requires Claude Code v2.1.267 or later. +Save an [effort level](</docs/en/model-config#adjust-effort-level>) for each model you use. Requires Claude Code v2.1.251 or later. In an interactive session on your machine, when you save `low`, `medium`, `high`, or `xhigh` as your default with `/effort` or the `/model` picker’s effort slider, Claude Code writes that level here under the model you’re using, so you rarely edit this key yourself. When you pick one of those levels in the [VS Code extension’s model picker](</docs/en/vs-code#use-the-prompt-box>), Claude Code saves it here the same way. The `effortLevel` entry lists the sessions where `/effort` applies to that session only. Edit the key by hand to change or remove a level you saved. A model’s `effortLevel` here takes precedence over the top-level `effortLevel` in the same settings file. Across files, Claude Code resolves each model separately: the highest-precedence [settings file](</docs/en/settings#settings-precedence>) that sets either an `effortLevel` for that model or the top-level `effortLevel` decides, so an `effortLevel` in managed settings outranks a level you saved in user settings. [Adjust effort level](</docs/en/model-config#adjust-effort-level>) lists what else can override a saved level, such as `--effort` at launch. To cap one model’s effort rather than set its level, add a `maxEffortLevel` field to that model’s entry. The field requires Claude Code v2.1.267 or later. * **Scope** : `Any file` * **Type** : object mapping a model name to an object with an `effortLevel` field, one of `"low"`, `"medium"`, `"high"`, or `"xhigh"`, a `maxEffortLevel` field, or both @@ -1294,7 +1294,7 @@ `sandbox.excludedCommands` -Name commands that Claude Code always runs outside the sandbox, such as tools that don’t work under it. Each entry uses the same syntax as the content of a `Bash(...)` [permission rule](</docs/en/permissions#permission-rule-syntax>): an exact command, a prefix such as `docker *`, or a wildcard pattern. When any part of a compound command matches an entry, Claude Code runs the whole command unsandboxed. +Name commands that Claude Code runs outside the sandbox, such as tools that don’t work under it. Each entry uses the same syntax as the content of a `Bash(...)` [permission rule](</docs/en/permissions#permission-rule-syntax>): an exact command, a prefix such as `docker *`, or a wildcard pattern. Your entries take a Bash call out of the sandbox only when they cover every command in it, and some call shapes stay sandboxed even then. A `docker *` entry alone doesn’t take `npm ci && docker build .` out of the sandbox. * **Scope** : `Any file` * **Type** : array of command patterns @@ -1308,7 +1308,15 @@ } } -Excluded commands still go through the regular permission flow. Exclusion is a convenience, not a security boundary: prefer `filesystem.allowWrite` when a tool only needs to write somewhere specific. Claude Code merges entries across every settings scope the session loads, and there is no managed-only lock for this list, so keep a managed list narrow. +Claude Code keeps a Bash call sandboxed when it has one of these shapes, among others: + + * A command starting with `sudo`, `eval`, or `xargs` + * A `cd`, `pushd`, or `popd`, wherever it appears in the call + * A command substitution, a subshell, or a control-flow block such as `if` or `for` + * A redirection, such as `docker build . > build.log`, other than one that only duplicates a file descriptor, as `2>&1` does + * A command name that comes from a variable + +For example, `cd build && docker compose up` stays sandboxed under a `docker *` entry, and adding a `cd` entry doesn’t change that. Excluded commands still go through the regular permission flow. Exclusion is a convenience, not a security boundary: prefer `filesystem.allowWrite` when a tool only needs to write somewhere specific. Claude Code merges entries across every settings scope the session loads, and there is no managed-only lock for this list, so keep a managed list narrow. ### @@ -2585,19 +2593,9 @@ `taskOutputMaxChars` -Set how many characters of a [background task’s](</docs/en/tools-reference#background-commands>) output Claude receives inline when Claude reads the task with the `TaskOutput` tool. When a finished task’s output is longer, Claude receives the most recent characters. Raise the limit when your background tasks routinely produce more output than the default. Requires Claude Code v2.1.261 or later. - - * **Scope** : `Any file` - * **Type** : number of characters, a positive integer. Claude Code clamps the value into the range `4000` to `128000` - * **Default** : unset, so Claude receives up to 32,000 characters inline - -settings.json - - { - "taskOutputMaxChars": 100000 - } - -When you set this key, Claude Code ignores the [`TASK_MAX_OUTPUT_LENGTH`](</docs/en/env-vars>) environment variable. +Removed in v2.1.277, together with the `TaskOutput` tool it sized. Setting it has no effect on current versions. Claude reads a background task’s [output file](</docs/en/tools-reference#background-commands>) with `Read` instead. + +Through v2.1.276, you set this key to the number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that Claude received inline when it read the task with the `TaskOutput` tool. ## @@ -2699,7 +2697,7 @@ `bashEditDiffEnabled` -Choose whether Claude Code records the files a Bash command changes in a Git repository. When it records them, you see their diff in the terminal after the command, and your [PostToolUse Bash hooks](</docs/en/hooks#bash>) receive the changed-file list. Set the key to `true` to record them in every permission mode. Requires Claude Code v2.1.269 or later. +Choose whether Claude Code records which files changed in a Git repository while a Bash command runs. When it records them, you see their diff in the terminal after the command, and your [PostToolUse Bash hooks](</docs/en/hooks#bash>) receive the changed-file list. A listed file isn’t always one the command changed. A change that another program or another Bash call made while the command ran can appear there too. Set the key to `true` to record them in every permission mode. Requires Claude Code v2.1.269 or later. * **Scope** : `User or managed`. A `true` counts only from your user settings, JSON passed with `--settings`, or [managed settings](</docs/en/managed-settings>), so a `true` in a repository’s `.claude/settings.json` or `.claude/settings.local.json` can’t turn the recording on. A `false` in either repository file still turns it off unless a [higher-precedence](</docs/en/settings#settings-precedence>) file sets `true`. * **Type** : Boolean @@ -3561,7 +3559,7 @@ } } -To hide all attribution, set `commit` and `pr` to empty strings and `sessionUrl` to `false`. Once you set `commit` or `pr`, Claude Code ignores the deprecated `includeCoAuthoredBy` setting and uses its default text for whichever of the two you left unset. +To hide all attribution, set `commit` and `pr` to empty strings and `sessionUrl` to `false`. Once you set `commit` or `pr`, Claude Code ignores the deprecated `includeCoAuthoredBy` setting and uses its default text for whichever of the two you left unset. Claude Code tells Claude that your own instructions about attribution, such as a CLAUDE.md or [memory](</docs/en/memory>) rule, take precedence over these commit and PR lines, unless the line is set in [managed settings](</docs/en/managed-settings>). ### @@ -3593,7 +3591,7 @@ `includeGitInstructions` -At session start, Claude Code adds two git-related pieces to Claude’s prompt: its built-in instructions for how to write commits and pull requests, in the Bash tool’s description, and a git status snapshot of your repository in the system prompt, meaning the current branch, the main branch, `git status` output, and recent commits. Set this key to `false` to leave both out, for example when you use your own git workflow skills. +Claude Code gives Claude two git-related pieces of context: its built-in instructions for how to write commits and pull requests, in the Bash tool’s description, and a git status snapshot of your repository. The snapshot holds the current branch, the main branch, `git status` output, and recent commits. Claude Code reads it when a conversation starts. Set this key to `false` to leave both out, for example when you use your own git workflow skills. * **Scope** : `Any file` * **Type** : Boolean @@ -5586,7 +5584,7 @@ "otelHeadersHelper": "/bin/generate_otel_headers.sh" } -Set the refresh interval with [`CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`](</docs/en/env-vars>). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) for the script requirements and where Claude Code reports a failing helper. +Set the refresh interval with [`CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`](</docs/en/env-vars>). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) for the script requirements and what happens when the helper fails. ## @@ -5627,7 +5625,7 @@ Keep background auto-updates and `claude update` from installing any version below this one, so moving to the `"stable"` channel doesn’t downgrade you from a newer `"latest"` build. Claude Code writes this key for you when you choose to stay on your current version while switching channels in `/config`, and clears it when you switch back to `"latest"`. * **Scope** : `Any file`. Set it in managed settings to pin an organization-wide minimum that user and project settings can’t lower. - * **Type** : string, a version number such as `"2.1.100"` + * **Type** : string, a version number such as `"2.1.100"`; a value that isn’t a valid version is ignored * **Default** : unset, so updates can install any version the channel offers This example follows the stable channel and refuses to install any version below 2.1.100:
modified Customize your status line View current →
--- a/statusline.md +++ b/statusline.md @@ -162,7 +162,7 @@ `workspace.git_worktree`| Git worktree name when the current directory is inside a linked worktree created with `git worktree add`. Absent in the main working tree. Populated for any git worktree, unlike `worktree.*`, which is present only while the session is in a [worktree session](</docs/en/worktrees>) `workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example, `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured. For a gitlab.com project nested in subgroups, `owner` is the full namespace path with slashes, such as `"group/subgroup"`. Before v2.1.260, `workspace.repo` was absent for these projects `cost.total_cost_usd`| Estimated session cost in USD, computed client-side at list price unless a [`modelPricing`](</docs/en/settings-reference#modelpricing>) table is in effect. May differ from your actual bill. Resets to $0 when `/clear` starts a new session. Before v2.1.211, the total carried over after `/clear` -`cost.total_duration_ms`| Total wall-clock time since the session started, in milliseconds +`cost.total_duration_ms`| Total wall-clock time the session has been running, in milliseconds. Accumulates across resumes and doesn’t include time while the session isn’t running `cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds `cost.total_lines_added`, `cost.total_lines_removed`| Lines of code changed `context_window.total_input_tokens`, `context_window.total_output_tokens`| Token counts currently in the context window, from the most recent API response. Input includes cache reads and writes @@ -564,7 +564,7 @@ Cost and duration tracking -Track your session’s API costs and elapsed time. The `cost.total_cost_usd` field accumulates the estimated cost of all API calls in the current session. The `cost.total_duration_ms` field measures total elapsed time since the session started, while `cost.total_api_duration_ms` tracks only the time spent waiting for API responses. Each script formats cost as currency and converts milliseconds to minutes and seconds: +Track your session’s API costs and elapsed time. The `cost.total_cost_usd` field accumulates the estimated cost of all API calls in the current session. The `cost.total_duration_ms` field measures the total time the session has been running, while `cost.total_api_duration_ms` tracks only the time spent waiting for API responses. Each script formats cost as currency and converts milliseconds to minutes and seconds: Bash
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -18,7 +18,7 @@ Built-in subagents -Claude Code includes built-in subagents that Claude automatically uses when appropriate. Each inherits the parent conversation’s permissions; most run with a restricted tool set. Explore and Plan skip your CLAUDE.md files and the parent session’s git status to keep research fast and inexpensive. Every other built-in and custom subagent loads both, unless its definition sets the `omitClaudeMd` field to skip the user, project, and local CLAUDE.md files. For the full breakdown of what reaches a subagent, see what loads at startup. +Claude Code includes built-in subagents that Claude automatically uses when appropriate. Each inherits the parent conversation’s permissions; most run with a restricted tool set. Explore and Plan skip your CLAUDE.md files and the git status snapshot to keep research fast and inexpensive. Every other built-in and custom subagent loads both, unless its definition sets the `omitClaudeMd` field to skip the user, project, and local CLAUDE.md files. For the full breakdown of what reaches a subagent, see what loads at startup. * Explore @@ -231,8 +231,8 @@ ---|---|--- `name`| Yes| Unique identifier using lowercase letters and hyphens. [Hooks](</docs/en/hooks#subagentstart>) receive this value as `agent_type`. The filename doesn’t have to match. Names can’t contain `:`, which is reserved for [plugin-scoped identifiers](</docs/en/plugins>) such as `my-plugin:reviewer`. Claude Code doesn’t load a file whose name contains one and logs an error to the debug log. Before v2.1.218, such names were accepted `description`| Yes| When Claude should delegate to this subagent -`tools`| No| Tools the subagent can use. Inherits every tool available to subagents if omitted. If no entry in the list resolves to a tool, the subagent usually [fails to launch](</docs/en/errors#agent-would-be-spawned-with-zero-tools>) with an error naming the entries. To preload Skills into context, use the `skills` field rather than listing `Skill` here -`disallowedTools`| No| Tools to deny, removed from inherited or specified list. An entry with a specifier, such as `Bash(git push *)`, still removes the whole tool +`tools`| No| Tools the subagent can use, as a comma-separated string such as `Read, Grep, Bash` or a YAML list. Inherits every tool available to subagents if omitted. If no entry in the list resolves to a tool, the subagent usually [fails to launch](</docs/en/errors#agent-would-be-spawned-with-zero-tools>) with an error naming the entries. To preload Skills into context, use the `skills` field rather than listing `Skill` here +`disallowedTools`| No| Tools to deny, removed from inherited or specified list. Same format as `tools`. An entry with a specifier, such as `Bash(git push *)`, still removes the whole tool `model`| No| Model to use: `sonnet`, `opus`, `haiku`, `fable`, a full model ID such as `claude-opus-5`, or `inherit`. When you omit it, Claude Code picks the model in the subagent model order `permissionMode`| No| Permission mode: `default`, `acceptEdits`, `auto`, `dontAsk`, `bypassPermissions`, `plan`, or `manual` as an alias for `default`. The `manual` alias requires Claude Code v2.1.200 or later. Ignored for plugin subagents `maxTurns`| No| Maximum number of agentic turns before the subagent stops. When the subagent reaches the limit, Claude Code returns its output marked as partial, and Claude can resume it to continue. The partial marking requires Claude Code v2.1.246 or later @@ -296,7 +296,12 @@ 3. The [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>) environment variable, when you set it to a model alias or model ID 4. The main conversation’s model -Setting `CLAUDE_CODE_SUBAGENT_MODEL` by itself doesn’t change the model the built-in Explore and Plan subagents run on. To change it, see Run every subagent on one model. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order and overrode both the per-invocation parameter and the frontmatter, including `model: inherit`. Setting the variable to `inherit` is the same as leaving it unset. Before v2.1.196, that value forced subagents onto the main conversation’s model and ignored the other sources. Claude Code checks the per-invocation parameter, frontmatter, and environment variable values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. For a blocked value, it substitutes another model: +In two cases, a family alias such as `opus` in the per-invocation parameter or the frontmatter resolves to the main conversation’s model instead of the [version the alias points to](</docs/en/model-config#model-aliases>): + + * **The main conversation’s model belongs to that family** : the subagent runs on the main conversation’s exact model, including any `[1m]` suffix, so it gets the same [extended context](</docs/en/model-config#extended-context>) window as the main conversation. + * **Claude Code can’t tell the main conversation’s model family, on[a provider other than the Anthropic API](</docs/en/third-party-integrations>)**: this can happen with an [application inference profile ARN](</docs/en/amazon-bedrock#iam-configuration>) on Amazon Bedrock that Claude Code hasn’t resolved to a backing model. This case covers only the `opus` alias, and doesn’t apply when you set [`ANTHROPIC_DEFAULT_OPUS_MODEL`](</docs/en/model-config#environment-variables>), since `opus` then resolves to the model you set. + +An alias in `CLAUDE_CODE_SUBAGENT_MODEL` always resolves to the version the alias points to, even when it names the main conversation’s family. Setting `CLAUDE_CODE_SUBAGENT_MODEL` by itself doesn’t change the model the built-in Explore and Plan subagents run on. To change it, see Run every subagent on one model. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order and overrode both the per-invocation parameter and the frontmatter, including `model: inherit`. Setting the variable to `inherit` is the same as leaving it unset. Before v2.1.196, that value forced subagents onto the main conversation’s model and ignored the other sources. Claude Code checks the per-invocation parameter, frontmatter, and environment variable values against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. For a blocked value, it substitutes another model: * When the blocked value is a family alias such as `opus`, Claude Code runs the subagent on the newest version of that family the allowlist permits, following the same [substitution rules and provider scope](</docs/en/model-config#restrict-model-selection>) as `/model`. Before v2.1.222, Claude Code ran the subagent on the inherited model for a blocked family alias as well. * For any other blocked value, on providers where that substitution doesn’t operate, or when the allowlist permits no version of the family, Claude Code runs the subagent on the inherited model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules. @@ -352,7 +357,6 @@ * `EnterPlanMode` * `ExitPlanMode`, unless the subagent’s `permissionMode` is `plan` * `ScheduleWakeup` - * `TaskOutput` * `WaitForMcpServers` * `Workflow` @@ -809,7 +813,7 @@ * **Backslash insertion** : the scan inserts a backslash into text that imitates Claude Code’s own output, such as a `<system-reminder>` tag or a line starting with `Human:` or `Assistant:`, so the imitation reads as ordinary text instead of being mistaken for part of the conversation. * **Marker line** : the scan prepends a line starting with `[harness: subagent output matched instruction-shaped pattern(s):` when the report imitates a tag like `<system-reminder>` or mentions permission settings such as `bypassPermissions` or `--dangerously-skip-permissions`. Permission-setting mentions get the marker line, but the text itself stays as written. -The scan doesn’t judge whether content is malicious, and it doesn’t change what an instruction in a report can do: a tool call the report leads Claude to make still goes through the session’s [permission checks](</docs/en/permissions>) and [sandboxing](</docs/en/sandboxing>). It isn’t a substitute for restricting what a subagent can reach. +The scan doesn’t judge whether content is malicious, and it doesn’t change what an instruction in a report can do: a tool call the report leads Claude to make still goes through the session’s [permission checks](</docs/en/permissions>) and [sandboxing](</docs/en/sandboxing>). It isn’t a substitute for restricting what a subagent can reach. A report that returns to Claude as the subagent’s result also arrives under a header marking it as subagent output. The header states that instructions or approval claims inside the report are the subagent’s words and carry no authority from you. A background subagent’s report arrives inside a completion notification, which is marked as an automated event rather than a message from you. Subagent output scanning requires Claude Code v2.1.210 or later. @@ -890,7 +894,7 @@ } } -With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. A nested subagent is configured the same way as a top-level one and resolves from the same scopes. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. Claude Code shows nested subagents as a tree in the subagent panel below the prompt input and marks each row that still has descendants in the panel with a `(+N)` count of them. Open a row to see that subagent’s siblings and direct children with a path back to `main`. +With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. A nested subagent is configured the same way as a top-level one and resolves from the same scopes. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. In the terminal, Claude Code shows nested subagents as a tree in the subagent panel below the prompt input and marks each row that still has descendants in the panel with a `(+N)` count of them. Open a row to see that subagent’s siblings and direct children with a path back to `main`. Earlier versions used different defaults: @@ -927,7 +931,7 @@ * **System prompt** : the agent’s own prompt plus environment details that Claude Code appends, not the Claude Code system prompt. Custom subagents define theirs in the markdown body or `prompt` field. Built-in agents have predefined prompts. * **Task message** : the delegation prompt Claude writes when it hands off the work. * **CLAUDE.md files** : every level of the [CLAUDE.md hierarchy](</docs/en/memory#how-claude-md-files-load>) the main conversation loads, including `~/.claude/CLAUDE.md`, project rules, `CLAUDE.local.md`, managed policy files, and any [`AGENTS.md` files](</docs/en/memory#agents-md>) loaded as project instructions. The built-in Explore and Plan agents skip this. A subagent whose definition sets `omitClaudeMd` loads only the managed policy files, or none at all when the definition comes from managed settings. - * **Git status** : a snapshot taken at the start of the parent session. Absent when the working directory isn’t a Git repository or when [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) is `false`. Explore and Plan skip it regardless. + * **Git status** : a snapshot Claude Code reads from your repository when the subagent starts. Absent outside a Git repository or whenever the snapshot is turned off; see [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>). Explore and Plan skip it regardless. * **Preloaded skills** : full content of any skill named in the agent’s `skills` field. Built-in agents don’t preload skills. * **Sibling roster** : a system reminder listing `main` and every other named agent in the session, each a valid `to` value for `SendMessage`. Requires Claude Code v2.1.206 or later. The roster appears only when the subagent’s tools include `SendMessage` and at least one other agent has a name, whether Claude named it when spawning it or it runs as an [agent team](</docs/en/agent-teams>) teammate. It is a snapshot taken when the subagent starts, so agents named later don’t appear.
modified Subagents in the SDK View current →
--- a/subagents.md +++ b/subagents.md @@ -609,7 +609,7 @@ ---|---|---|--- 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. For how the caps behave across a session, see [turns and budget](</docs/en/agent-sdk/agent-loop#turns-and-budget>) +Spend| `maxBudgetUsd` in TypeScript, `max_budget_usd` in Python| No limit. Counts the call’s own spend, subagent requests included| 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. For how the caps behave across a session, 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:
modified Configure your terminal for Claude Code View current →
--- a/terminal-config.md +++ b/terminal-config.md @@ -331,12 +331,34 @@ Paste large content -When you paste more than 800 characters or more than three lines into the prompt, Claude Code collapses the input to a placeholder such as `[Pasted text #1 +120 lines]` so the input box stays usable. In a terminal window shorter than 12 rows the line limit drops, so Claude Code collapses a three-line paste at 11 rows and any multi-line paste at 10 rows or fewer. Claude Code still sends the full content when you submit. When you delete with a word or line shortcut such as `Ctrl+W` or `Ctrl+K`, or with a vim delete through an `f`/`t` motion such as `df]`, and the deleted range reaches inside a placeholder, Claude Code removes the placeholder whole. You can paste the deletion back to restore it, with [`Ctrl+Y`](</docs/en/interactive-mode#text-editing>) after a word or line shortcut, or with [`p` in NORMAL mode](</docs/en/interactive-mode#editing-normal-mode>) after a vim delete. Claude Code keeps the collapsed content under `~/.claude/paste-cache/`, so when you recall a prompt from [command history](</docs/en/interactive-mode#command-history>) and resubmit it, Claude Code sends the full pasted content again, including in a later session, until the retention sweep removes the cache file. Claude Code deletes cache files older than [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>), following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>), so a recalled prompt can reference pasted text that no longer exists. When you submit such a prompt, Claude Code never sends the literal `[Pasted text #N]` string, and shows a notification naming the missing paste: +When you paste more than 800 characters or more than three lines into the prompt, Claude Code collapses the input to a placeholder such as `[Pasted text #1 +120 lines]` so the input box stays usable, and still sends the full content when you submit. For very large inputs such as entire files or long logs, write the content to a file and ask Claude to read it instead of pasting. The conversation transcript stays readable and Claude can refer to the file by path in later turns. The VS Code integrated terminal can also drop characters from very large pastes before they reach Claude Code, so use a file there. If the paste carries [invisible Unicode characters](</docs/en/interactive-mode#invisible-characters-in-prompts>), Claude Code removes them when you press Enter and puts the cleaned prompt back in the input box for you to send with another Enter. + +### + +​ + +How Claude treats pasted text + +When you submit, Claude sees the content behind each `[Pasted text #N]` placeholder marked as text you pasted from somewhere else rather than typed. Claude is told that a paste can contain instructions you didn’t write, and to follow instructions inside it only where the message you typed asks it to. In sessions that don’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), pastes aren’t marked. + +### + +​ + +Delete and restore a collapsed paste + +When you delete with a word or line shortcut such as `Ctrl+W` or `Ctrl+K`, or with a vim delete through an `f`/`t` motion such as `df]`, and the deleted range reaches inside a `[Pasted text #N]` placeholder, Claude Code removes the placeholder whole. To restore it, paste the deletion back with [`Ctrl+Y`](</docs/en/interactive-mode#text-editing>) after a word or line shortcut, or with [`p` in NORMAL mode](</docs/en/interactive-mode#editing-normal-mode>) after a vim delete. + +### + +​ + +Recall a prompt that had pasted text + +Claude Code keeps the content behind each `[Pasted text #N]` placeholder under `~/.claude/paste-cache/`, so when you recall a prompt from [command history](</docs/en/interactive-mode#command-history>) and resubmit it, the full pasted content is sent again, including in a later session. Cache files older than [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) are deleted under the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>), so a recalled prompt can reference pasted text that no longer exists. When you submit such a prompt, Claude Code never sends the literal `[Pasted text #N]` string, and shows a notification naming the missing paste: * In a plain prompt with text remaining, Claude Code removes the placeholder and sends the remaining text. * In a [shell mode](</docs/en/interactive-mode#shell-mode-with-prefix>) command or a `/` command, where the removal would change what runs, and in any prompt the removal leaves empty, Claude Code cancels the submission and keeps the original text in the input, with the placeholder still in it. Delete the placeholder or edit the command, then resubmit. - -The VS Code integrated terminal can drop characters from very large pastes before they reach Claude Code, so prefer file-based workflows there. For very large inputs such as entire files or long logs, write the content to a file and ask Claude to read it instead of pasting. This keeps the conversation transcript readable and lets Claude reference the file by path in later turns. ##
modified Enterprise deployment overview View current →
--- a/third-party-integrations.md +++ b/third-party-integrations.md @@ -6,7 +6,7 @@ Compare deployment options -For most organizations, Claude for Teams or Claude for Enterprise provides the best experience. Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required. **Claude for Teams** is self-service and includes collaboration features, admin tools, and billing management. Best for smaller teams that need to get started quickly. **Claude for Enterprise** adds SSO and domain capture, role-based permissions, compliance API access, and managed policy settings for deploying organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements. Learn more about [Team plans](<https://support.claude.com/en/articles/9266767-what-is-the-team-plan>) and [Enterprise plans](<https://support.claude.com/en/articles/9797531-what-is-the-enterprise-plan>). The deployment options compared below cover where model inference runs. To run Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on compute your organization operates, see [self-hosted environments](</docs/en/self-hosted-environments>). If your organization has specific infrastructure requirements, compare the options below: Feature| Claude for Teams/Enterprise| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform, formerly Vertex AI| Microsoft Foundry +For most organizations, Claude for Teams or Claude for Enterprise provides the best experience. Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required. **Claude for Teams** is self-service and includes collaboration features, admin tools, SSO, billing management, and [server-managed settings](</docs/en/server-managed-settings>) for organization-wide Claude Code configuration. Best for smaller teams that need to get started quickly. **Claude for Enterprise** adds domain capture, role-based permissions, and compliance API access. Best for larger organizations with security and compliance requirements. Learn more about [Team plans](<https://support.claude.com/en/articles/9266767-what-is-the-team-plan>) and [Enterprise plans](<https://support.claude.com/en/articles/9797531-what-is-the-enterprise-plan>). The deployment options compared below cover where model inference runs. To run Claude Code [cloud sessions](</docs/en/claude-code-on-the-web>) on compute your organization operates, see [self-hosted environments](</docs/en/self-hosted-environments>). If your organization has specific infrastructure requirements, compare the options below: Feature| Claude for Teams/Enterprise| Anthropic Console| Amazon Bedrock| Claude Platform on AWS| Google Cloud’s Agent Platform, formerly Vertex AI| Microsoft Foundry ---|---|---|---|---|---|--- Best for| Most organizations (recommended)| Individual developers| AWS-native deployments| AWS Marketplace billing with Claude API features| GCP-native deployments| Azure-native deployments Billing| **Teams:** $150/seat (Premium) with PAYG available
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -18,7 +18,7 @@ `Raw mode is not supported` during install| Rerun the installer `TLS connect error` or `SSL/TLS secure channel`| Update CA certificates `Failed to fetch version` or can’t reach download server| Check network and proxy settings -`irm is not recognized` or `&& is not valid`| Use the right command for your shell +`irm is not recognized` or `The token '&&' is not a valid statement separator`| Use the right command for your shell `Cask 'claude-code' is unavailable: No Cask with this name exists`| Update Homebrew `'bash' is not recognized as the name of a cmdlet`| Use the Windows installer command `A parameter cannot be found that matches parameter name 'fsSL'`| Use the Windows installer command @@ -390,7 +390,7 @@ Wrong install command on Windows -If you see `'irm' is not recognized`, `The token '&&' is not valid`, `A parameter cannot be found that matches parameter name 'fsSL'`, or `'bash' is not recognized as the name of a cmdlet`, you copied the install command for a different shell or operating system. If the command prints the script’s text instead of installing anything, you ran only part of it. +If you see `'irm' is not recognized`, `The token '&&' is not a valid statement separator`, `A parameter cannot be found that matches parameter name 'fsSL'`, or `'bash' is not recognized as the name of a cmdlet`, you copied the install command for a different shell or operating system. If the command prints the script’s text instead of installing anything, you ran only part of it. * **`irm` not recognized**: you’re in CMD, not PowerShell. You have two options: Open PowerShell by searching for “PowerShell” in the Start menu, then run the original install command: @@ -400,7 +400,7 @@ curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd - * **`&&` not valid**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: + * **`&&` not a valid statement separator**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: irm https://claude.ai/install.ps1 | iex
modified Agent SDK reference - TypeScript View current →
Show diff (282 lines)
--- a/typescript.md +++ b/typescript.md @@ -311,7 +311,7 @@ `uuid`| `string`| Unique message identifier `session_id`| `string`| Session this message belongs to `message`| `unknown`| Raw message payload from the transcript -`parent_tool_use_id`| `string | null`| For subagent messages, the `tool_use_id` of the spawning `Agent` tool call. `null` for main-session messages and older sessions +`parent_tool_use_id`| `string | null`| For subagent messages, the `tool_use_id` of the `Agent` or `Skill` tool call that started the subagent. `null` for main-session messages and older sessions `parent_agent_id`| `string | null`| For messages from a [nested subagent](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>), the `agentId` of the subagent that spawned it. `null` for main-session messages, messages from top-level subagents, and older sessions. Requires Claude Code v2.1.202 or later #### @@ -518,13 +518,13 @@ `extraArgs`| `Record<string, string | null>`| `{}`| Additional arguments `fallbackModel`| `string`| `undefined`| Model to use if the primary model fails. Accepts a comma-separated list. For the order and the cap, see [Fallback model chains](</docs/en/model-config#fallback-model-chains>). For guidance, see [Choose a model](</docs/en/agent-sdk/configuration#choose-a-model>) `forkSession`| `boolean`| `false`| When resuming with `resume`, fork to a new session ID instead of continuing the original session -`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. Without this option, Claude Code emits subagent `tool_use` and `tool_result` blocks but not text or thinking. Messages from subagents at every nesting depth are forwarded on Claude Code v2.1.219 and later; before v2.1.219, only messages from depth-1 subagents appeared +`forwardSubagentText`| `boolean`| `false`| Forward subagent text and thinking blocks as assistant and user messages with `parent_tool_use_id` set, so consumers can render a nested transcript. Without this option, Claude Code emits subagent `tool_use` and `tool_result` blocks but not text or thinking. Messages from subagents at every nesting depth are forwarded on Claude Code v2.1.219 and later; before v2.1.219, only messages from depth-1 subagents appeared. Messages of subagents that a forked skill spawns, and of nested forked skills, require v2.1.275 or later `hooks`| `Partial<Record<``HookEvent``, ``HookCallbackMatcher``[]>>`| `{}`| Hook callbacks for events `includeHookEvents`| `boolean`| `false`| Include hook lifecycle events in the message stream as `SDKHookStartedMessage`, `SDKHookProgressMessage`, and `SDKHookResponseMessage`. Lifecycle events for `SessionStart` and `Setup` hooks are always included and don’t need this option. Some hook events, such as `Notification`, `SessionEnd`, `PreCompact`, and `PostCompact`, never produce an `SDKHookStartedMessage`, even with this option. For those events, Claude Code still emits an `SDKHookProgressMessage` while a command hook that runs for more than a second produces output, and emits an `SDKHookResponseMessage` only when a hook [that runs in the background](</docs/en/hooks#run-hooks-in-the-background>) finishes `includePartialMessages`| `boolean`| `false`| Include partial message events `loadTimeoutMs`| `number`| `60000`| _Alpha._ Timeout in milliseconds for each `sessionStore.load()` and `sessionStore.listSubkeys()` call during resume materialization. If the adapter doesn’t settle within this window, the query fails instead of hanging. Ignored when `sessionStore` is not set `managedSettings`| `Settings`| `undefined`| Policy-tier settings your host process supplies to the spawned session. On machines with admin-deployed managed settings, Claude Code ignores these unless the admin’s highest-priority managed source sets `parentSettingsBehavior: 'merge'`, and never merges them while a [`policyHelper`](</docs/en/settings-reference#policyhelper>) supplies managed settings. Merged values pass through a restrictive-only filter; [Restrict parent settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) covers what the filter admits and the `allowManaged*Only` locks. A host that sets [`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`](</docs/en/env-vars>) has three keys read straight from this payload instead: its [model configuration](</docs/en/model-config#restrict-model-selection>) on Claude Code v2.1.222 or later, [`modelPricing`](</docs/en/settings-reference#modelpricing>) when no managed source sets it on v2.1.246 or later, and its `ENABLE_TOOL_SEARCH` env entry on v2.1.247 or later -`maxBudgetUsd`| `number`| `undefined`| Stop the query when the client-side cost estimate reaches this USD value. Compared against the same estimate as `total_cost_usd`. For accuracy caveats and reset behavior, see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) +`maxBudgetUsd`| `number`| `undefined`| Stop the query when the client-side cost estimate reaches this USD value. Counts only the call’s own spend; totals restored from a resumed session don’t count. For accuracy caveats and reset behavior, see [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) `maxThinkingTokens`| `number`| `undefined`| _Deprecated:_ Use `thinking` instead. Maximum tokens for thinking process `maxTurns`| `number`| `undefined`| Maximum agentic turns (tool-use round trips) `mcpServers`| `Record<string, [`McpServerConfig`](#mcpserverconfig)>`| `{}`| MCP server configurations @@ -539,6 +539,7 @@ `persistSession`| `boolean`| `true`| When `false`, disables session persistence to disk. Sessions cannot be resumed later `planModeInstructions`| `string`| `undefined`| Custom workflow instructions for plan mode. When `permissionMode` is `'plan'`, this string replaces the default plan-mode workflow body. The CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer `plugins`| `SdkPluginConfig``[]`| `[]`| Load custom plugins from local paths. See [Plugins](</docs/en/agent-sdk/plugins>) for details +`projectConfigRoot`| `string`| `undefined`| Absolute path of the trusted checkout that `cwd` is a worktree of. Claude Code reads project settings, `.mcp.json`, and the project’s `.claude/` commands, agents, skills, workflows, routines, and output styles from this directory instead of `cwd`, and sets `CLAUDE_PROJECT_DIR` to it. Hooks, helper scripts such as `apiKeyHelper`, and stdio MCP servers start with this directory as their working directory. `CLAUDE.md` files and `.claude/rules/` still load from `cwd`. Requires Claude Code v2.1.275 or later `promptSuggestions`| `boolean`| `false`| Enable prompt suggestions. After a turn, Claude Code emits a `prompt_suggestion` message carrying a predicted next user prompt. Claude Code generates no suggestion for some turns, such as while your account is close to or at its usage limit. See [When Claude Code skips suggestions](</docs/en/interactive-mode#when-claude-code-skips-suggestions>) `resume`| `string`| `undefined`| Session ID to resume `resumeDropsTurn`| `string`| `undefined`| With `resumeSessionAt`: the prompt UUID of the turn the truncating resume intends to discard. Claude Code refuses the resume when the discarded range contains anything not attributable to that turn, such as absorbed queued messages or task notifications, and names the `--resume-drops-turn` flag in the rejection message. Only the Agent SDK and print-mode resumes read the pair. Requires Claude Code v2.1.223 or later @@ -611,7 +612,7 @@ : Settings[K] | null; }): Promise<void>; updateSettings( - source: 'localSettings', + source: 'localSettings' | 'userSettings', settings: Record<string, unknown>, ): Promise<void>; initializationResult(): Promise<SDKControlInitializeResponse>; @@ -651,7 +652,7 @@ `setModel()`| Changes the model (only available in streaming input mode). Passing `undefined` or the string `"default"` resets to [Claude Code’s default model](</docs/en/model-config>) `setMaxThinkingTokens()`| _Deprecated:_ Use the `thinking` option instead. Changes the maximum thinking tokens. Passing `null` resets thinking to the session default: a mid-session override is cleared, and thinking stays off for sessions that have it disabled `applyFlagSettings(settings)`| Merges settings into the session’s flag settings layer at runtime (only available in streaming input mode). See `applyFlagSettings()` -`updateSettings(source, settings)`| Merges settings into the project’s local settings file, `.claude/settings.local.json`; they take effect on the next request. Accepts only `source: 'localSettings'` and an allowlisted key set, currently `outputStyle`, with string values; deleting a key isn’t supported. Rejects on remote transports and in sessions whose `settingSources` exclude `local`. Requires TypeScript SDK v0.3.257 or later, which bundles Claude Code v2.1.257 +`updateSettings(source, settings)`| Writes one allowlisted key to the project’s local settings file or your user settings file, so the value persists for later sessions. See `updateSettings()`. Requires TypeScript SDK v0.3.257 or later, which bundles Claude Code v2.1.257 `initializationResult()`| Returns the full initialization result including supported commands, models, account info, and output style configuration `reinitialize()`| Re-sends the `initialize` control request to the running CLI and returns a fresh result instead of the cached first-connect result. Use it after a transport gap, such as reattaching to a session after a disconnect, so pending permission requests reach your `canUseTool` callback again. Make the callback idempotent per request ID, because a request whose response was lost is dispatched again. Requires Claude Code v2.1.195 or later `supportedCommands()`| Returns available commands. From Agent SDK v0.3.216 the list reflects mid-session command changes; see `SDKCommandsChangedMessage` @@ -681,7 +682,13 @@ * **Applied during the current turn** : `model`. If you switch `model` while Claude is working on a turn, the response Claude is already generating finishes on the old model, and the rest of the turn, starting with the next call Claude Code makes to the model, uses the new one. Subagents keep their own model. Before v2.1.212, a mid-turn switch waited for the next turn. * **No effect mid-session** : the system prompt options. These are resolved once at startup, so the running session keeps the original value even though the call succeeds. To change them, start a new session. -`effortLevel` accepts an [effort level](</docs/en/model-config#adjust-effort-level>) name. It also accepts `"ultracode"`, which requests `xhigh` effort with [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>) on. `applyFlagSettings()` declares `effortLevel` without that value, so pass the equivalent `{ ultracode: true }` in TypeScript. The `ultracode` value requires Claude Code v2.1.203 or later and is accepted only by `applyFlagSettings()`, not by the `effortLevel` key in a settings file. The values are written to the flag-settings layer, the same layer the inline `settings` option of `query()` populates at startup. This is the same tier the on-page precedence section calls programmatic options. Successive calls shallow-merge top-level keys. A second call with `{ permissions: {...} }` replaces the entire `permissions` object from the prior call rather than deep-merging into it. To clear a key from the flag layer, pass `null` for that key. Most keys then fall back to lower-precedence sources. A cleared `model` resets to [Claude Code’s default model](</docs/en/model-config>), even when a settings file sets `model`. Passing `undefined` has no effect because JSON serialization drops it. Only available in streaming input mode, the same constraint as `setModel()` and `setPermissionMode()`. The example below switches the active model mid-session, then clears the override so the model resets to [Claude Code’s default model](</docs/en/model-config>). +`effortLevel` accepts an [effort level](</docs/en/model-config#adjust-effort-level>) name. It also accepts `"ultracode"`, which requests `xhigh` effort with [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>) on. `applyFlagSettings()` declares `effortLevel` without that value, so pass the equivalent `{ ultracode: true }` in TypeScript. The `ultracode` value requires Claude Code v2.1.203 or later and is accepted only by `applyFlagSettings()`, not by the `effortLevel` key in a settings file. The values are written to the flag-settings layer, merged over what the inline `settings` option of `query()` set at startup. This is the same tier the on-page precedence section calls programmatic options. Successive calls shallow-merge top-level keys. A second call with `{ permissions: {...} }` replaces the entire `permissions` object from the prior call rather than deep-merging into it. To clear a key you set with `applyFlagSettings()`, pass `null` for that key. Most keys then fall back first to a value that the `settings` option of `query()` set at startup, then to lower-precedence sources. A cleared `model` resets to [Claude Code’s default model](</docs/en/model-config>), even when a settings file sets `model`. Passing `undefined` has no effect because JSON serialization drops it. Three keys besides `model` reset session state instead of falling back: + + * `effortLevel: null` returns the session to the model’s default effort level, not to the `effort` option of `query()` or an `effortLevel` from a settings file. + * `agent: null` runs the main thread with no agent, starting with the next turn, rather than restoring the `agent` option of `query()` or an `agent` from a settings file. If the cleared agent had applied its own model, the session returns to the model it resolved at startup. + * `ultracode: null` turns ultracode off, as `false` does, rather than restoring an `ultracode` value from a settings file. The session keeps its current effort level, so pass `effortLevel` in the same call to change it. + +Only available in streaming input mode, the same constraint as `setModel()` and `setPermissionMode()`. The example below switches the active model mid-session, then clears the override so the model resets to [Claude Code’s default model](</docs/en/model-config>). import { query } from "@anthropic-ai/claude-agent-sdk"; @@ -694,6 +701,19 @@ await q.applyFlagSettings({ model: null }); `applyFlagSettings()` is TypeScript-only. The Python SDK does not expose an equivalent method. + +#### + +​ + +`updateSettings()` + +Writes one allowlisted key to a settings file on disk, so the value persists for later sessions that load that source. Each source accepts one key, with a string value: + + * **`"localSettings"`** : accepts `outputStyle` and merges it into the project’s local settings file, `.claude/settings.local.json`. The new style takes effect on the session’s next request. + * **`"userSettings"`** : accepts `effortLevel` and saves it as the default [effort level](</docs/en/model-config#adjust-effort-level>) for the session’s current model, under [`modelSettings`](</docs/en/settings-reference#modelsettings>) in your user settings file. Passing `max` writes nothing, because `max` is session-only. The running session keeps its current effort level either way, so call `applyFlagSettings()` when you also want to change that. This source requires TypeScript SDK v0.3.277 or later, which bundles Claude Code v2.1.277. + +The call rejects when the request carries any other key, when the session runs over a remote transport, and when the session’s `settingSources` exclude the source you name. Deleting a key isn’t supported. ### @@ -1337,6 +1357,7 @@ uuid?: UUID; session_id?: string; message: MessageParam; // From Anthropic SDK + pasted_content?: MessageParam["content"][]; parent_tool_use_id: string | null; isSynthetic?: boolean; shouldQuery?: boolean; @@ -1344,7 +1365,7 @@ origin?: SDKMessageOrigin; }; -Set `shouldQuery` to `false` to append the message to the transcript without triggering an assistant turn. The message is held and merged into the next user message that does trigger a turn. Use this to inject context, such as the output of a command you ran out of band, without spending a model call on it. On a message that carries a `tool_result` block, `tool_use_result` is the tool’s structured output object rather than the text sent to the model. Its shape depends on the tool named by the matching `tool_use` block, so the field is typed `unknown`; the built-in shapes are listed under Tool Output Types. For the `Agent` tool, `tool_use_result` is `AgentOutput`. On a `completed` result, `content` holds the subagent’s report without the agent ID and usage trailer that Claude Code appends to the `tool_result` text, so render from `tool_use_result` instead of parsing that text. For an MCP tool whose result contains `resource_link` blocks, `tool_use_result` is an object with a `resourceLinks` array of `SDKMcpResourceLink` entries. Claude receives each link as a line of text in the `tool_result` block, so read `resourceLinks` to render the files the server returned instead of parsing that text. Claude Code omits `resourceLinks` when the result has no links and on results from subagents, keeps at most 50 links per result, and stops adding links once the array reaches 64 KiB of serialized JSON. `resourceLinks` requires Agent SDK v0.3.257 or later. +Set `pasted_content` to send content the user pasted into your prompt UI rather than typed, one entry per paste, each a string or an array of content blocks. Claude Code appends each entry’s text after the typed text, in order, and may wrap each paste in `<pasted_content>` tags. Blocks other than text are ignored, so send images and documents in `message.content`. Requires Agent SDK v0.3.277 or later. Set `shouldQuery` to `false` to append the message to the transcript without triggering an assistant turn. The message is held and merged into the next user message that does trigger a turn. Use this to inject context, such as the output of a command you ran out of band, without spending a model call on it. On a message that carries a `tool_result` block, `tool_use_result` is the tool’s structured output object rather than the text sent to the model. Its shape depends on the tool named by the matching `tool_use` block, so the field is typed `unknown`; the built-in shapes are listed under Tool Output Types. For the `Agent` tool, `tool_use_result` is `AgentOutput`. On a `completed` result, `content` holds the subagent’s report without the agent ID and usage trailer that Claude Code appends to the `tool_result` text, so render from `tool_use_result` instead of parsing that text. For an MCP tool whose result contains `resource_link` blocks, `tool_use_result` is an object with a `resourceLinks` array of `SDKMcpResourceLink` entries. Claude receives each link as a line of text in the `tool_result` block, so read `resourceLinks` to render the files the server returned instead of parsing that text. Claude Code omits `resourceLinks` when the result has no links and on results from subagents, keeps at most 50 links per result, and stops adding links once the array reaches 64 KiB of serialized JSON. `resourceLinks` requires Agent SDK v0.3.257 or later. ### @@ -1450,8 +1471,8 @@ * `first_content_frame_ms`: time in milliseconds until the first `content_block_start` or `content_block_delta` stream event, counting thinking blocks as content. Present on the success arm only, when `is_error` is false. Requires Agent SDK v0.3.260 or later. * `first_stream_post_ms`, `first_stream_post_ack_ms`, `first_stream_post_wall_ms`: timings for uploading the turn’s first stream event. Claude Code records them only in sessions it streams to claude.ai, such as [cloud sessions](</docs/en/claude-code-on-the-web>), and the results `query()` yields don’t carry them. Requires Agent SDK v0.3.260 or later. * `usage`: main agent loop only. Excludes subagent and auxiliary model calls, and is per-turn in streaming-input sessions. Prefer `modelUsage` for token/cost accounting. - * `modelUsage`: per-model totals for every model call made through the query pipeline during this `query()` call, including the main loop, subagents, and internal calls such as compaction and Workflow agents. Helper calls outside that pipeline, such as the permission classifier and token-counting requests, are excluded. In streaming-input sessions the totals are cumulative across turns, so read the latest result rather than summing across results. See [Track costs in streaming input mode](</docs/en/agent-sdk/cost-tracking#track-costs-in-streaming-input-mode>) for resets and [Recover totals after a session crash](</docs/en/agent-sdk/cost-tracking#recover-totals-after-a-session-crash>) for zeroed results. - * `total_cost_usd`: cumulative estimated cost in USD for this `query()` call, covering the same calls as `modelUsage` and reset at the same points. It is an estimate, not a billing statement. See [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats. + * `modelUsage`: per-model totals for every model call made through the query pipeline during this `query()` call, including the main loop, subagents, and internal calls such as compaction and Workflow agents. Helper calls outside that pipeline, such as the permission classifier and token-counting requests, are excluded. A call that resumes a session also counts the [per-model totals restored from the session’s earlier calls](</docs/en/agent-sdk/cost-tracking#accumulate-costs-across-multiple-calls>). In streaming-input sessions the totals are cumulative across turns, so read the latest result rather than summing across results. See [Track costs in streaming input mode](</docs/en/agent-sdk/cost-tracking#track-costs-in-streaming-input-mode>) for resets and [Recover totals after a session crash](</docs/en/agent-sdk/cost-tracking#recover-totals-after-a-session-crash>) for zeroed results. + * `total_cost_usd`: cumulative estimated cost in USD, covering the same calls as `modelUsage` and reset at the same points. A call that resumes a session also counts the [totals restored from the session’s earlier calls](</docs/en/agent-sdk/cost-tracking#accumulate-costs-across-multiple-calls>). It is an estimate, not a billing statement. See [Track cost and usage](</docs/en/agent-sdk/cost-tracking>) for accuracy caveats. * `queued_turn_count`: the number of messages you sent with `origin: { kind: "human" }` that are still waiting when Claude Code produced the result. See `queued_turn_count` for what `0` and an absent field tell you. * `startup_failure_reason`: why Claude Code refused to start, on the `error_during_execution` result it writes before exiting on a known startup failure. See `startup_failure_reason` for the values and which failures carry it. Requires Agent SDK v0.3.274 or later. * `terminal_reason`: why the loop ended. One of `"completed"`, `"max_turns"`, `"tool_deferred"`, `"aborted_streaming"`, `"aborted_tools"`, `"hook_stopped"`, `"stop_hook_prevented"`, `"background_requested"`, `"blocking_limit"`, `"rapid_refill_breaker"`, `"prompt_too_long"`, `"image_error"`, `"model_error"`, `"api_error"`, `"malformed_tool_use_exhausted"`, `"budget_exhausted"`, `"structured_output_retry_exhausted"`, `"tool_deferred_unavailable"`, or `"turn_setup_failed"`. @@ -1473,7 +1494,7 @@ `sdk_opt_in_required`| The session hasn’t opted in to fast mode: pass `fastMode: true` in the `settings` option or through `applyFlagSettings()` `pending`| The availability check hasn’t completed yet -The same pair of fields appears on `SDKSystemMessage` and on the `SDKControlInitializeResponse`, so you can read the fast mode state before the first turn. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When the SDK injects a synthetic follow-up turn, such as for a finished background task, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Routines whose trigger fired and server-verified messages from your other sessions arrive with this kind too, each with the `subkind` described in Task-notification subkinds. Check `kind` to distinguish results that answer your prompt from injected follow-ups before routing or suppressing them. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip. +The same pair of fields appears on `SDKSystemMessage` and on the `SDKControlInitializeResponse`, so you can read the fast mode state before the first turn. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When the SDK injects a synthetic follow-up turn, such as for a finished background task, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Routines whose trigger fired and server-verified messages from your other sessions arrive with this kind too, each with the `subkind` described in Task-notification subkinds. Check `kind` to distinguish results that answer your prompt from injected follow-ups before routing or suppressing them. When several background-task completions are queued together, Claude Code can answer them in one turn rather than one turn each. Each completion still produces its own result with this origin. All but the last of the completions Claude Code answers together produce empty results with `num_turns: 0`, in order, and the last one’s result carries the turn that answers them all. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip. #### @@ -2791,14 +2812,12 @@ | ReadMcpResourceInput | RefreshMcpToolsInput | RemoteTriggerInput - | REPLInput | ReportFindingsInput | ScheduleWakeupInput | ShowOnboardingRolePickerInput | TaskCreateInput | TaskGetInput | TaskListInput - | TaskOutputInput | TaskStopInput | TaskUpdateInput | TodoWriteInput @@ -2888,7 +2907,7 @@ }; }; -Runs a background source and delivers each event to Claude so it can react without polling: `command` runs a script and emits one event per stdout line, and `ws` opens a WebSocket and emits one event per text frame. Provide exactly one of `command` or `ws`. The `ws` source requires Claude Code v2.1.195 or later. `timeout_ms` is the watch’s deadline in milliseconds. It defaults to 300000, and the effective deadline is at most 1800000, which is 30 minutes. At the deadline the watch ends and Claude receives one notice so it can start a new watch if it still needs one. The exported type marks `timeout_ms` as required because the schema fills in the default; a call that omits it validates. When Monitor runs a command, it follows the same permission rules as Bash; a WebSocket watch prompts for approval separately. See the [Monitor tool reference](</docs/en/tools-reference#monitor-tool>) for behavior and provider availability. +Runs a background source and delivers each event to Claude so it can react without polling: `command` runs a script and emits one event per stdout line, and `ws` opens a WebSocket and emits one event per text frame. Provide exactly one of `command` or `ws`. The `ws` source requires Claude Code v2.1.195 or later. `timeout_ms` is the watch’s deadline in milliseconds. It defaults to 300000 and accepts values up to 3600000. The effective deadline is at most 1800000, which is 30 minutes, so a larger accepted value is shortened to that. At the deadline the watch ends and Claude receives one notice so it can start a new watch if it still needs one. The exported type marks `timeout_ms` as required because the schema fills in the default; a call that omits it validates. When Monitor runs a command, it follows the same permission rules as Bash; a WebSocket watch prompts for approval separately. See the [Monitor tool reference](</docs/en/tools-reference#monitor-tool>) for behavior and provider availability. ### @@ -2896,17 +2915,7 @@ TaskOutput -**Tool name:** `TaskOutput` - -`TaskOutput` is deprecated; prefer `Read` on the task’s output file path. The schemas below remain valid for hooks and permission handlers that encounter the tool. - - type TaskOutputInput = { - task_id: string; - block: boolean; - timeout: number; - }; - -Retrieves output from a running or completed background task. +Removed in Claude Code v2.1.277, together with its `TaskOutputInput` type. Previously retrieved output from a running or completed background task; Claude reads a background task’s output file with `Read` instead. A `disallowedTools` entry or a deny rule that still names `TaskOutput` is ignored without a warning. ### @@ -3387,15 +3396,7 @@ REPL -**Tool name:** `REPL` - - type REPLInput = { - code: string; - description?: string; - timeout?: number; - }; - -Executes JavaScript code in a persistent REPL. State persists across calls and top-level await is supported. `timeout` is in milliseconds, with a default of 30000 and a maximum of 600000. The types are exported, but the tool is off in SDK sessions unless you set `CLAUDE_CODE_REPL=1` in the `env` option. It also requires the Bun-based `claude` executable that the native installer provides. +Removed in v2.1.275. Through v2.1.274, an experimental `REPL` tool could be turned on with `CLAUDE_CODE_REPL=1` in the `env` option. ### @@ -3440,6 +3441,7 @@ action?: "publish" | "list"; file_path?: string; favicon?: string; + icon?: string; limit?: number; scope?: "mine" | "shared" | "all"; title?: string; @@ -3451,7 +3453,14 @@ contract?: "latest" | string; }; -Publishes a local `.html` or `.md` file as a hosted artifact page, or lists the user’s published artifacts. Omit `action` or pass `"publish"` to publish `file_path`, which is required for the publish action along with `favicon`, one or two emoji that mark the artifact in the user’s gallery. `title` names the published page in the browser tab and gallery when the HTML file has no `<title>` tag. `url` targets an existing artifact to update in place instead of minting a new one. `force` is a last-resort overwrite that discards a newer version another session published. On a conflict, the failed publish returns the newer content; Claude merges its changes onto that content, or re-reads the artifact, and publishes again. Pass `force` only when the user explicitly asks to discard that version. Pass `"list"` to enumerate the user’s published artifacts; only `limit` and `scope` may accompany it. `scope` defaults to `"mine"`, which lists artifacts the user owns; `"shared"` lists artifacts other people shared with the user, and `"all"` lists both. +Publishes a local `.html` or `.md` file as a hosted artifact page, or lists the user’s published artifacts. Omit `action` or pass `"publish"` to publish `file_path`, which is required for the publish action. Each field below applies to a publish: + + * `icon`: one short generic word for the artifact’s browser-tab icon, such as `chart` or `map`. Claude includes it on a first publish and omits it on an update, which keeps the artifact’s stored icon. + * `favicon`: deprecated, and Claude omits it. + * `title`: names the published page in the browser tab and gallery when the HTML file has no `<title>` tag. + * `url`: targets an existing artifact to update in place instead of creating a new one. + +`force` is a last-resort overwrite that discards a newer version another session published. On a conflict, the failed publish returns the newer content; Claude merges its changes onto that content, or re-reads the artifact, and publishes again. Pass `force` only when the user explicitly asks to discard that version. Pass `"list"` to enumerate the user’s published artifacts; only `limit` and `scope` may accompany it. `scope` defaults to `"mine"`, which lists artifacts the user owns; `"shared"` lists artifacts other people shared with the user, and `"all"` lists both. * `capabilities`: the runtime capabilities the published page uses, keyed by capability name, such as the [connectors the page may call](</docs/en/artifacts#pull-live-data-with-mcp-connectors>). The artifact service validates the declaration and rejects a publish that names a capability the account can’t use or gives one an invalid config. Pass `{}` to clear a stored declaration, and omit the field on a redeploy to keep it. Requires Agent SDK v0.3.235 or later. * `contract`: the runtime version the published page runs against. Omit it to keep the artifact’s current version, pass `"latest"` to upgrade, or pass a specific version to pin or roll back. Requires Agent SDK v0.3.235 or later. @@ -3587,7 +3596,6 @@ | ReadMcpResourceOutput | RefreshMcpToolsOutput | RemoteTriggerOutput - | REPLOutput | ReportFindingsOutput | ScheduleWakeupOutput | ShowOnboardingRolePickerOutput @@ -4412,34 +4420,6 @@ ​ -REPL - -**Tool name:** `REPL` - - type REPLOutput = { - code: string; - result: { - [k: string]: unknown; - }; - stdout: string; - stderr: string; - error?: string; - registeredTools?: string[]; - images?: { - base64: string; - mediaType: string; - }[]; - documents?: { - base64: string; - }[]; - }; - -Returns the execution result, captured console output, and any images or documents surfaced by inner `Read` calls. - -### - -​ - ReportFindings **Tool name:** `ReportFindings` @@ -4777,7 +4757,10 @@ description: string; argumentHint: string; aliases?: string[]; - }; + builtin?: boolean; + }; + +`builtin` is `true` on a row when the command is Claude Code’s own and typing `/name` runs it. It’s absent for a command defined by a user, project, plugin, or MCP server, and for a bundled command that one of those [replaces by name](</docs/en/skills#resolve-skills-that-share-a-name>). Requires Agent SDK v0.3.277 or later. ### @@ -5597,7 +5580,7 @@ `enabled`| `boolean`| `false`| Enable sandbox mode for command execution `failIfUnavailable`| `boolean`| `true`| Stop at startup if `enabled` is `true` but the sandbox can’t start. Set `false` to fall back to unsandboxed execution with a warning on stderr `autoAllowBashIfSandboxed`| `boolean`| `true`| Auto-approve Bash commands when sandbox is enabled -`excludedCommands`| `string[]`| `[]`| Commands that always bypass sandbox restrictions (e.g., `['docker']`). These run unsandboxed automatically without model involvement +`excludedCommands`| `string[]`| `[]`| Commands that bypass sandbox restrictions, such as `['docker *']`. These run unsandboxed automatically without model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies `allowUnsandboxedCommands`| `boolean`| `true`| Allow the model to request running commands outside the sandbox. When `true`, the model can set `dangerouslyDisableSandbox` in tool input, which falls back to the permissions system `network`| `SandboxNetworkConfig`| `undefined`| Network-specific sandbox configuration `filesystem`| `SandboxFilesystemConfig`| `undefined`| Filesystem-specific sandbox configuration for read/write restrictions @@ -5698,7 +5681,7 @@ Permissions Fallback for Unsandboxed Commands -When `allowUnsandboxedCommands` is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: true` in the tool input. These requests fall back to the existing permissions system, meaning your `canUseTool` handler is invoked, allowing you to implement custom authorization logic. Commands listed in `excludedCommands` instead bypass the sandbox automatically, with no model involvement; see `SandboxSettings`. In the example below, `isCommandAuthorized` stands in for an authorization check you define. +When `allowUnsandboxedCommands` is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: true` in the tool input. These requests fall back to the existing permissions system, meaning your `canUseTool` handler is invoked, allowing you to implement custom authorization logic. Your `excludedCommands` entries instead take a call out of the sandbox with no model involvement; [`sandbox.excludedCommands`](</docs/en/settings-reference#sandbox-excludedcommands>) covers when an entry applies. In the example below, `isCommandAuthorized` stands in for an authorization check you define. import { query } from "@anthropic-ai/claude-agent-sdk";
modified Find bugs with ultrareview View current →
--- a/ultrareview.md +++ b/ultrareview.md @@ -30,7 +30,7 @@ /code-review ultra develop -The base branch doesn’t need to exist in your local clone; Claude Code fetches it from `origin`. If the name has a typo, Claude Code suggests the closest branch name in the error. +The base branch doesn’t need to exist in your local clone; Claude Code fetches it from `origin`. If the name has a typo, Claude Code suggests the closest branch name in the error. A commit id or tag also works as the base, and the review then covers the changes on your branch since that commit. ### @@ -84,8 +84,9 @@ Ultrareview checks the diff before any review work runs and tells you when it can’t review it as-is: * **Diff too large** : a branch review can include up to 500 changed files and 8,000 changed lines by default. The exact values can change, and the [refusal](</docs/en/errors#diff-is-too-large-for-ultrareview>) names the ones in effect, the size of your diff, and the files with the most changed lines. Claude Code refuses a too-large pull request the same way, naming its file and line counts but not the per-file breakdown - * **Nothing to review** : when the diff against the base is empty, Claude Code says so and suggests staging or committing local edits, or passing a different base - * **No merge base** : when your branch shares no history with the base branch, Claude Code falls back to reviewing every tracked file in the repository instead; the fallback requires a full clone and applies the same size limits. On a checkout with no branches or other refs, such as a detached HEAD created by checking out `FETCH_HEAD` after fetching a URL, Claude Code [refuses the review](</docs/en/errors#your-checkout-has-no-branches>) and suggests creating a branch first + * **Nothing to review** : when the diff against the base is empty, ultrareview refuses and names the branch or commit it compared against and the case you’re in, such as being on the base branch itself with nothing uncommitted, or a branch whose commits are all part of the base already. It also suggests the way out for that case, such as switching to the branch with your work, staging or committing local edits, or passing a different base + * **First commit** : a repository’s first commit has nothing earlier to compare with, so ultrareview reviews every file in it after you confirm in the launch dialog. If you have untracked files, it refuses instead and tells you to `git add` the ones you want reviewed. The same size limits apply. A first commit is reviewed whole only after that confirmation, so the `claude ultrareview` subcommand and `claude -p` refuse it and point you to an interactive session instead. Requires Claude Code v2.1.277 or later + * **No merge base** : when your branch shares no history with the base branch, or the repository has no base branch to compare with, ultrareview reviews every tracked file in the repository instead. The fallback requires a full clone and applies the same size limits. It launches only when you confirm in the launch dialog or run the `claude ultrareview` subcommand yourself. In `claude -p` and anywhere else neither happens, ultrareview refuses, says the review would cover every file, and points you to an interactive session. On a checkout with no branches or other refs, such as a detached HEAD created by checking out `FETCH_HEAD` after fetching a URL, Claude Code [refuses the review](</docs/en/errors#your-checkout-has-no-branches>) and suggests creating a branch first ## @@ -132,7 +133,7 @@ claude ultrareview 1234 claude ultrareview origin/main -Without arguments, the subcommand reviews the diff between your current branch and the default branch, with the same whole-repository fallback as `/code-review ultra` when no merge base exists. Pass a PR number to review a pull request, or a base branch to review against it; base-branch handling matches the interactive command. You consent to the whole-repository fallback and to the billing and terms prompt when you run the subcommand, so the run starts without waiting for input. On Claude Code v2.1.218 or later, you can also start the cloud review by running `/code-review ultra` in a non-interactive session, for example `claude -p '/code-review ultra'`. Claude Code launches the review and prints a tracking link without waiting for the findings, unlike `claude ultrareview`, which blocks until they arrive. When the review would bill usage credits, Claude Code stops before launching and points you to `claude ultrareview`, because the billing confirmation needs an interactive session. Before v2.1.218, `/code-review ultra` in a non-interactive session ran a local review. Progress messages and the live session URL go to stderr so stdout stays parseable. Use these flags to control the output, the timeout, and whether to post the findings: +Without arguments, the subcommand reviews the diff between your current branch and the default branch, with the same whole-repository fallback as `/code-review ultra` when no merge base exists. Pass a PR number to review a pull request, or a base branch to review against it; base-branch handling matches the interactive command. You consent to the whole-repository fallback and to the billing and terms prompt when you run the subcommand, so the run starts without waiting for input. Running it yourself is what counts as consent. When Claude runs the subcommand for you instead, for example through the Bash tool, Claude Code refuses the whole-repository review. On Claude Code v2.1.218 or later, you can also start the cloud review by running `/code-review ultra` in a non-interactive session, for example `claude -p '/code-review ultra'`. Claude Code launches the review and prints a tracking link without waiting for the findings, unlike `claude ultrareview`, which blocks until they arrive. When the review would bill usage credits, Claude Code stops before launching and points you to `claude ultrareview`, because the billing confirmation needs an interactive session. Before v2.1.218, `/code-review ultra` in a non-interactive session ran a local review. Progress messages and the live session URL go to stderr so stdout stays parseable. Use these flags to control the output, the timeout, and whether to post the findings: Flag| Description ---|---
modified Use Claude Code in VS Code View current →
Show diff (186 lines)
--- a/vs-code.md +++ b/vs-code.md @@ -72,6 +72,8 @@ * In Auto or Edit automatically mode, Claude edits most files in your workspace without asking. * In Manual mode, when Claude wants to edit a file, it shows a side-by-side comparison of the original and proposed changes, then asks for permission. You can accept, reject, or tell Claude what to do instead. If you edit the proposed content directly in the diff view before accepting, Claude is told that you modified it so it doesn’t assume the file matches its original proposal. + +To review a proposed edit one change at a time, use the **Accept this change** and **Reject this change** buttons under each change in the diff. Rejecting a change reverts it in the proposed content; accepting marks it as reviewed. Accepting or rejecting the whole file still finishes the review. A diff with more than 100 changes opens without the per-change buttons, so review it as a whole file. Per-change review requires Claude Code v2.1.275 or later.The same actions are available at the cursor from the editor’s context menu and from the Command Palette as **Claude Code: Accept Change at Cursor** and **Claude Code: Reject Change at Cursor**. For more ideas on what you can do with Claude Code, see [Common workflows](</docs/en/common-workflows>). @@ -90,22 +92,26 @@ * **Manual** : Claude asks permission before file edits and most shell commands. * **Plan** : Claude describes what it will do and waits for approval before making changes. VS Code automatically opens the plan as a full Markdown document where you can add inline comments to give feedback before Claude begins. * **Edit automatically** : Claude makes edits without asking. - * **Model** : select **Switch model…** from the command menu to change the model mid-session. You can also click the model name at the bottom of the prompt box to open the same picker. When the current model supports [effort levels](</docs/en/model-config#adjust-effort-level>), the picker also shows an **Effort** row and the model name button shows the selected level. The model name button and the **Effort** row require Claude Code v2.1.257 or later. - * **Command menu** : click `/` or type `/` to open the command menu. Options include attaching files, switching models, and toggling extended thinking. The Customize section provides access to MCP servers, commands, output styles, hooks, memory, permissions, and plugins. Items with a terminal icon open in the integrated terminal. + * **Model** : select **Switch model…** from the command menu to change the model mid-session. You can also click the model name at the bottom of the prompt box to open the same picker. When the current model supports [effort levels](</docs/en/model-config#adjust-effort-level>), the picker also shows an **Effort** row and the model name button shows the selected level. When you pick a level other than `max`, Claude Code saves it for the current model as your default, under [`modelSettings`](</docs/en/settings-reference#modelsettings>) in your user settings; `max` applies to the current session only. The model name button and the **Effort** row require Claude Code v2.1.257 or later. + * **Command menu** : click `/` or type `/` to open the command menu. Options include attaching files, switching models, and toggling extended thinking. The Customize section provides access to MCP servers, commands, output styles, hooks, memory, instructions, permissions, and plugins. Items with a terminal icon open in the integrated terminal. * To browse commands such as `/usage` or [`/remote-control`](</docs/en/remote-control>), select **Slash commands** in the Customize section. A dialog lists them with a filter box. Pick one to run it. Typing `/` in the prompt box still suggests commands inline. Requires Claude Code v2.1.257 or later. * Select **Output styles** in the Customize section to pick an [output style](</docs/en/output-styles>), including your custom styles. Requires Claude Code v2.1.257 or later. To create a custom style instead, select **Build a custom style** from the **Output styles** menu. Claude Code writes the [style file](</docs/en/output-styles#create-a-custom-output-style>) for you at the project or user level. Requires Claude Code v2.1.261 or later. * Select **Hooks** in the Customize section to view the [hooks](</docs/en/hooks>) loaded in the session, grouped by event. You can add, edit, or remove hooks saved in your user, project, and local settings files. Hooks from other sources, such as managed settings or plugins, are read-only. Requires Claude Code v2.1.269 or later. * Select **Permissions** in the Customize section to view the session’s [permission rules](</docs/en/permissions>), grouped into Allow, Ask, and Deny. You can add rules to your user, project, or local settings and remove rules saved there. Rules from other sources, such as managed settings or approvals made for this session only, are read-only. Requires Claude Code v2.1.269 or later. + * Select **Memory** in the Customize section to turn [auto memory](</docs/en/memory#auto-memory>) on or off. While it’s on, you can also browse the memories Claude has saved and reveal the folders that store them in your file manager. Requires Claude Code v2.1.274 or later. Click a saved memory to read it in the dialog, where you can edit the text, delete the memory, or open its file in the editor. Viewing, editing, and deleting a memory in the dialog require Claude Code v2.1.275 or later. + * Select **Instructions** in the Customize section to edit the [CLAUDE.md files](</docs/en/memory#claude-md-files>) Claude reads. Pick a file to open it in the editor. If the file doesn’t exist yet, Claude Code creates it first. Requires Claude Code v2.1.274 or later. * The Settings section includes **Enable Remote Control for all sessions** , which sets [`remoteControlAtStartup`](</docs/en/settings-reference#remotecontrolatstartup>) to control whether [new interactive sessions connect to Remote Control automatically](</docs/en/remote-control#enable-remote-control-for-all-sessions>). Requires Claude Code v2.1.203 or later. When you turn the toggle on or off in a VS Code window, the change applies to the sessions already open in that VS Code window, not only to sessions you start afterwards. If you turn it off, the open sessions disconnect. With Claude Code v2.1.261 or later, the change also reaches sessions open in your other VS Code windows. * The Settings section also includes **Focus view** , which hides tool calls, tool results, and thinking behind expandable rows, leaving your prompts and Claude’s responses. Toggle it there, with `Ctrl+Option+F` (Mac) / `Ctrl+Alt+F` (Windows/Linux), or from the Command Palette with **Claude Code: Toggle Focus view**. The change applies to every open session and persists across sessions. Requires Claude Code v2.1.221 or later. Claude’s latest to-do list stays visible, and so does the text a pending question from Claude is asking about; this requires Claude Code v2.1.225 or later. While Claude runs [subagents](</docs/en/sub-agents>), live progress rows with their latest activity appear under the tool-call group that started them. This requires Claude Code v2.1.269 or later. + * To sign out of your Anthropic account, select **Sign out** in the Settings section, or type `/logout`. On a third-party provider, the menu doesn’t offer either. Requires Claude Code v2.1.277 or later. * To report a bug, click **Report a problem** at the bottom of the menu, or type `/bug` or `/feedback` with an optional description that prefills the report. When you submit the report and you’re signed in to Anthropic on a first-party connection, Claude Code sends it to Anthropic. On a third-party provider, or without Anthropic credentials, the dialog still opens, but submitting shows an error and sends nothing: unlike the CLI’s `/bug`, the extension doesn’t write a local archive. Requires Claude Code v2.1.229 or later. If your organization’s policy turns product feedback off, **Report a problem** doesn’t appear in the menu, and `/bug` and `/feedback` show a `Feedback is turned off by your organization's policy or this environment's settings.` notice instead of opening the report. * **Side questions** : type `/btw` followed by a question to ask about your session [without adding to the conversation](</docs/en/interactive-mode#side-questions-with-%2Fbtw>). The answer opens in a panel beside the chat, where you can ask follow-up questions. The thread survives window reloads. Claude Code keeps the newest 20 exchanges and expires stored threads on the [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) schedule, as long as Claude Code can [safely determine the retention period](</docs/en/claude-directory#cleaned-up-automatically>). To clear a thread, click the trash icon in the panel. Requires Claude Code v2.1.227 or later. + * **Copy a response** : hover over a response and click **Copy response** to copy it to your clipboard, or type `/copy` to copy the latest response. `/copy 2` copies the second-to-last. Requires Claude Code v2.1.277 or later. * **Context indicator** : the prompt box shows how much of Claude’s context window you’re using. Claude automatically compacts when needed, or you can run `/compact` manually. * **Prompt cache clock** : a clock icon next to the context indicator estimates how much time the conversation’s [prompt cache](</docs/en/prompt-caching>) has left before it expires. It counts down from the cache’s five-minute or one-hour [lifetime](</docs/en/prompt-caching#cache-lifetime>), and each response that uses the cache restarts the countdown. Apart from compaction, the [actions that invalidate the cache](</docs/en/prompt-caching#actions-that-invalidate-the-cache>) don’t reset the clock, so it can still show minutes left after you switch models. * Until the countdown runs out, the icon shows the minutes left, such as **12m**. * When the countdown runs out, the minutes disappear and the icon turns red, or your theme’s error color, until the next response. The cache has likely expired, so expect a slower, more expensive response to your next message while the cache rebuilds. If the five-minute lifetime keeps running out between your messages, see [Choose the TTL yourself](</docs/en/prompt-caching#choose-the-ttl-yourself>). * Right after the conversation is [compacted](</docs/en/prompt-caching#compacting-the-conversation>), the icon also turns red without minutes until the next response, because the cache doesn’t cover the compacted conversation yet. - * **Agent map** : when the conversation includes [subagents](</docs/en/sub-agents>), an agent count such as **2 agents** appears at the bottom of the prompt box. Its dot shows whether any subagent is working or waiting for your permission. Click the agent count to open the agent map, which draws the conversation’s subagents as a tree under the main agent, each with its status, elapsed time, and token count. Click a subagent to see its prompt and tool calls, open its read-only transcript, or stop it while it runs. Requires Claude Code v2.1.269 or later. + * **Agent map** : when the conversation includes [subagents](</docs/en/sub-agents>), an agent count such as **2 agents** appears at the bottom of the prompt box. Its dot shows whether any subagent is working or waiting for your permission. Click the agent count to open the agent map, which draws the conversation’s subagents as a tree under the main agent, each with its status, elapsed time, and token count. Click a subagent to see its prompt and tool calls, open its read-only transcript, or stop it while it runs. Requires Claude Code v2.1.269 or later. The map also lists the session’s other [background tasks](</docs/en/tools-reference#background-commands>), such as background shell commands and [monitors](</docs/en/tools-reference#monitor-tool>), below the agents. Click a row to open the task’s card and stop it there. To open the map when no agent count is showing, such as when Claude has started a background shell but no subagents, type `/tasks` in the prompt box. Background tasks in the map and the typed `/tasks` require Claude Code v2.1.277 or later. * **Extended thinking** : lets Claude spend more time reasoning through complex problems. Toggle it on via the command menu (`/`). Claude’s reasoning appears in the conversation as collapsed blocks: click a block to read it, or press `Ctrl+O` to expand or collapse every thinking block in the session. See [Extended thinking](</docs/en/model-config#extended-thinking>) for details. * **Multi-line input** : press `Shift+Enter` to add a new line without sending. This also works in the “Other” free-text input of question dialogs. @@ -120,7 +126,11 @@ Explain the logic in @auth (fuzzy matches auth.js, AuthService.ts, etc.) What's in @src/components/ (include a trailing slash for folders) -For large PDFs, you can ask Claude to read specific pages instead of the whole file: a single page, a range like pages 1-10, or an open-ended range like page 3 onward. When you select text in the editor, Claude can see your highlighted code automatically. The prompt box footer shows how many lines are selected. Press `Option+K` (Mac) / `Alt+K` (Windows/Linux) to insert an @-mention with the file path and line numbers (e.g., `@app.ts#5-10`). Click the **X** on the selection indicator to remove it so Claude doesn’t receive the selection. The indicator comes back when you select other text. Claude also sees which file you have open in the editor, even when nothing is selected, and the prompt box shows its name. To add only your selected text, turn off the [Attach Open File setting](<vscode://settings/claudeCode.attachOpenFile>). The setting requires Claude Code v2.1.271 or later. To attach an image, paste it from your clipboard into the prompt box. You can also hold `Shift` while dragging files into the prompt box to add them as attachments. Click the X on any attachment to remove it from context. +For large PDFs, you can ask Claude to read specific pages instead of the whole file: a single page, a range like pages 1-10, or an open-ended range like page 3 onward. When you select text in the editor, Claude can see your highlighted code automatically. The prompt box footer shows how many lines are selected. Press `Option+K` (Mac) / `Alt+K` (Windows/Linux) to insert an @-mention with the file path and line numbers (e.g., `@app.ts#5-10`). Click the **X** on the selection indicator to remove it so Claude doesn’t receive the selection. The indicator comes back when you select other text. The extension withholds selected text from some files. When the file is inside your workspace and matches your `files.exclude` or `search.exclude` settings, Claude receives at most the file’s path and not the text you selected. The same applies to a file git ignores, as long as VS Code’s `search.useIgnoreFiles` setting and the extension’s `respectGitIgnore` setting are both on, which is the default. This filter covers the chat panel only: when Claude Code runs in the integrated terminal, the CLI sends your selected text whatever the file, so add a `Read` deny rule to keep a file’s contents from Claude there. Claude also sees which file you have open in the editor, even when nothing is selected, and the prompt box shows its name. To add only your selected text, turn off the [Attach Open File setting](<vscode://settings/claudeCode.attachOpenFile>). The setting requires Claude Code v2.1.271 or later. You can also attach images and files to your message: + + * To attach an image, paste it from your clipboard into the prompt box. + * To attach files, hold `Shift` while dragging them into the prompt box. + * To remove an attachment from context, click the X on it. ### @@ -133,7 +143,7 @@ * **Session titles** : new sessions receive AI-generated titles based on your first message. * **Rename and archive** : hover over a session to reveal these actions. Rename to give it a descriptive title, or archive to move it to the **Archived sessions** group at the bottom of the list. -By default, a session with no activity for 14 days moves to **Archived sessions** automatically, unless it is open, unread, or in a group. Automatic archiving requires Claude Code v2.1.265 or later. To change the period or turn it off, open the [Archive Inactive Sessions setting](<vscode://settings/claudeCode.archiveInactiveSessions>) and select a number of days or **Never**. To restore an archived session, expand **Archived sessions** and click **Unarchive session**. Before v2.1.257, the action was **Delete session** , which hid a session with no way to restore it. Sessions you deleted then appear under **Archived sessions** after you upgrade. When the conversation you resume ended in plan mode, Claude Code restores plan mode. Requires Claude Code v2.1.246 or later. Claude Code doesn’t restore it in two cases: +By default, a session with no activity for 14 days moves to **Archived sessions** automatically, unless it is open, unread, or in a group. Automatic archiving requires Claude Code v2.1.265 or later. To change the period or turn it off, open the [Archive Inactive Sessions setting](<vscode://settings/claudeCode.archiveInactiveSessions>) and select a number of days or **Never**. To restore an archived session, expand **Archived sessions** and click **Unarchive session**. To restore every archived session at once, hover over the **Archived sessions** header in the sessions list in the Activity Bar and click its unarchive icon, which requires Claude Code v2.1.277 or later. Before v2.1.257, the action was **Delete session** , which hid a session with no way to restore it. Sessions you deleted then appear under **Archived sessions** after you upgrade. When the conversation you resume ended in plan mode, Claude Code restores plan mode. Requires Claude Code v2.1.246 or later. Claude Code doesn’t restore it in two cases: * The extension [chooses the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) from `claudeCode.initialPermissionMode` or a pick that carries over from an earlier conversation * You have `claudeCode.claudeProcessWrapper` configured @@ -172,7 +182,12 @@ Check account and usage -Run `/usage` to open the Account & usage dialog. The dialog requires a claude.ai sign-in, so it isn’t offered on a third-party provider. It shows your signed-in account, your plan, and usage bars for your plan’s limits, such as the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits. It flags behaviors that account for 10% or more of recent usage, such as cache misses, long context, and subagent-heavy or highly parallel sessions, each with a tip to reduce it. Attribution tables show how much usage came from each skill, subagent, plugin, and MCP server. Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. For more on tracking and reducing usage, see [Track your costs](</docs/en/costs#track-your-costs>). +Run `/usage` to open the Account & usage dialog. It shows your signed-in account, and the usage it reports differs by sign-in: + + * **claude.ai plan** : usage bars for your plan’s limits, such as the current session and the week. Each bar shows how long until its limit resets. The dialog also breaks down what is contributing to your plan limits. It flags behaviors that account for 10% or more of recent usage, such as cache misses, long context, and subagent-heavy or highly parallel sessions, each with a tip to reduce it. Attribution tables show how much usage came from each skill, subagent, plugin, and MCP server. Use the Day and Week toggle to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local sessions on this machine, so usage from other devices or claude.ai is not included. + * **Other sign-ins** : when plan limits don’t apply to your sign-in, such as on a third-party provider or with an API key, the Usage section shows the session’s own cost and token usage instead. The CLI’s `/usage` shows the same totals in its [Session block](</docs/en/costs#track-your-costs>). The sessions list in the Activity Bar also shows the active session’s totals under its **Account & usage** header. Requires Claude Code v2.1.277 or later. + +For more on tracking and reducing usage, see [Track your costs](</docs/en/costs#track-your-costs>). ## @@ -194,12 +209,16 @@ * **Primary sidebar** : the left sidebar with icons for Explorer, Search, etc. * **Editor area** : opens Claude as a tab alongside your files. Useful for side tasks. +When Claude opens a tab in a new editor group, the extension locks that group, so files you open while the Claude tab is focused go to another group instead of next to it. To stop the extension from locking groups, turn off the [Lock Editor Groups setting](<vscode://settings/claudeCode.lockEditorGroups>). Groups that are already locked stay locked until you unlock them. The setting requires Claude Code v2.1.274 or later. + Use the sidebar for your main Claude session and open additional tabs for side tasks. Claude remembers your preferred location. The Activity Bar sessions list icon is separate from the Claude panel: the sessions list is always visible in the Activity Bar, while the Claude panel icon only appears there when the panel is docked to the left sidebar. After you run **Developer: Reload Window** or restart VS Code, whether a chat comes back with its conversation depends on where it was open: * **Editor tab** : the conversation comes back with its tab. * **Sidebar** : the conversation comes back if you sent a message or Claude responded in it within the last 10 minutes. If it doesn’t come back, resume the conversation from Session history. + +If the reload interrupted Claude mid-step, Claude continues that step when the conversation comes back, and a notice in the chat marks the continuation. Requires Claude Code v2.1.274 or later. If the step was interrupted more than an hour ago or the session is open elsewhere, the conversation comes back idle instead. To turn continuation off, open the [Continue After Reload setting](<vscode://settings/claudeCode.continueAfterReload>) and uncheck it. ### @@ -274,9 +293,9 @@ Parameter| Description ---|--- `plugin`| The plugin’s name as its marketplace lists it. Required. -`marketplace`| Where the plugin comes from, in any form the Marketplaces tab accepts, such as a GitHub `owner/repo` or a git URL. URL-encode it if it contains characters such as `&`. Defaults to `anthropics/claude-plugins-official` when omitted. - -Two cases end at a message in the dialog instead of the scope choice: +`marketplace`| Where the plugin comes from: a GitHub `owner/repo`, an `https://` URL, or a git SSH URL such as `git@github.com:owner/repo.git`. Defaults to `anthropics/claude-plugins-official` when omitted. + +Some values that the Marketplaces tab accepts don’t work in a link, such as a local path or an `http://` address. For those, VS Code shows an error message and the dialog doesn’t open. Two cases end at a message in the dialog instead of the scope choice: * **The marketplace doesn’t list a plugin by that name** : the dialog reports that the plugin wasn’t found. Check the `plugin` value against the marketplace’s listing. * **The plugin is already installed** : the dialog says so, and nothing changes. @@ -326,6 +345,7 @@ Command| Shortcut| Description ---|---|--- Focus Input| `Cmd+Esc` (Mac) / `Ctrl+Esc` (Windows/Linux)| Toggle focus between editor and Claude +Focus last message| -| Move keyboard focus to the newest message in the conversation, or to a waiting permission prompt, so you can read from there with the keyboard or a screen reader. Not available in terminal mode. Requires Claude Code v2.1.268 or later Open in Side Bar| -| Open Claude in the sidebar Open in Terminal| -| Open Claude in terminal mode Open in New Tab| `Cmd+Shift+Esc` (Mac) / `Ctrl+Shift+Esc` (Windows/Linux)| Open a new conversation as an editor tab @@ -333,6 +353,8 @@ New Conversation| `Cmd+N` (Mac) / `Ctrl+N` (Windows/Linux)| Start a new conversation. Requires Claude to be focused and `enableNewConversationShortcut` set to `true` Reopen Closed Session| `Cmd+Shift+T` (Mac) / `Ctrl+Shift+T` (Windows/Linux)| Reopen the most recently closed Claude session tab. Falls through to VS Code’s normal reopen-closed-editor when the last closed tab wasn’t a Claude session. Disable with `enableReopenClosedSessionShortcut` Insert @-Mention Reference| `Option+K` (Mac) / `Alt+K` (Windows/Linux)| Insert a reference to the current file and selection (requires editor to be focused) +Accept Change at Cursor| -| Accept the change at the cursor while reviewing a proposed edit one change at a time. Requires Claude Code v2.1.275 or later +Reject Change at Cursor| -| Revert the change at the cursor while reviewing a proposed edit one change at a time. Requires Claude Code v2.1.275 or later Toggle Focus view| `Ctrl+Option+F` (Mac) / `Ctrl+Alt+F` (Windows/Linux)| Hide or show tool activity in the conversation. Works while a Claude panel or sidebar is visible. Requires Claude Code v2.1.221 or later Rename Session Tab| -| Rename the session in the active Claude tab. Requires Claude Code v2.1.257 or later Add Session Tab to Group| -| Add the session in the active Claude tab to a session group you pick or create. Requires Claude Code v2.1.257 or later @@ -407,15 +429,18 @@ `useTerminal`| `false`| Launch Claude in terminal mode instead of graphical panel `initialPermissionMode`| -| Controls approval prompts for new conversations: `default`, `plan`, `acceptEdits`, or `bypassPermissions`. `manual` is an alias for `default` and selects the mode labeled **Manual** in the mode indicator. When you leave it unset, the extension chooses the starting permission mode as described in [Switch permission modes](</docs/en/permission-modes#switch-permission-modes>). `preferredLocation`| `panel`| Where Claude opens: `sidebar` (right) or `panel` (new tab) +`lockEditorGroups`| `true`| Lock the editor groups Claude starts for its tabs, so files you open while a Claude tab is focused go to another group. When off, the extension never locks an editor group. Requires Claude Code v2.1.274 or later `autosave`| `true`| Auto-save files before Claude reads or writes them `attachOpenFile`| `true`| Add the file that is open in the editor to your messages and show it in the prompt box. When off, only your selected text is added. Requires Claude Code v2.1.271 or later `useCtrlEnterToSend`| `false`| Use Ctrl/Cmd+Enter instead of Enter to send prompts +`scrollToBottomOnSend`| `true`| Scroll the conversation to the bottom when you send a message. When off, the conversation stays where you left it. Requires Claude Code v2.1.275 or later `enableNewConversationShortcut`| `false`| Enable Cmd/Ctrl+N to start a new conversation `enableReopenClosedSessionShortcut`| `true`| Use Cmd/Ctrl+Shift+T to reopen the most recently closed Claude session tab. When the last closed tab wasn’t a Claude session, the shortcut runs VS Code’s normal reopen-closed-editor command instead. `archiveInactiveSessions`| `14`| Archive a session automatically after this many days without activity: `1`, `2`, `7`, or `14`. Set `0` to turn it off. Requires Claude Code v2.1.265 or later +`continueAfterReload`| `true`| After a window reload, Claude continues the step that was interrupted in the restored session. Requires Claude Code v2.1.274 or later `hideOnboarding`| `false`| Hide the onboarding checklist (graduation cap icon) `focusView`| `false`| Hide tool calls, tool results, and thinking behind expandable rows, leaving your prompts and Claude’s responses. Claude’s latest to-do list stays visible; this requires Claude Code v2.1.225 or later. You can also toggle Focus view from the command menu. Requires Claude Code v2.1.221 or later -`respectGitIgnore`| `true`| Exclude .gitignore patterns from file searches +`respectGitIgnore`| `true`| Exclude .gitignore patterns from file searches and from selection context `usePythonEnvironment`| `true`| Activate the workspace’s Python environment when running Claude. Requires the Python extension. `environmentVariables`| `[]`| Set environment variables for the Claude process. Use Claude Code settings instead for shared config. `disableLoginPrompt`| `false`| Skip authentication prompts (for third-party provider setups) @@ -435,7 +460,22 @@ * **Status changes** : the extension announces when Claude starts working, when Claude is ready for your input, and when Claude Code starts compacting the conversation. * **Errors and model prompts** : the extension announces errors in the conversation, and announces when the [usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) or the [flagged-request prompt](</docs/en/model-config#ask-before-switching>) appears. -Each turn in the transcript starts with a visually hidden heading labeled with the prompt that started the turn, so you can jump between turns with your screen reader’s heading navigation. You can also move focus to the transcript itself with `Tab`, since the extension exposes it as a labeled region, and read it at your own pace. While Claude works, your screen reader reads a text label in place of the progress spinner’s animation. When you reopen a session or switch to another one, the extension announces nothing: restored history, pending permission prompts, and in-progress status stay silent until something new happens. +While Claude works, your screen reader reads a text label in place of the progress spinner’s animation. When you reopen a session or switch to another one, the extension announces nothing: restored history, pending permission prompts, and in-progress status stay silent until something new happens. + +### + +​ + +Use the chat panel from the keyboard + +Each turn in the transcript starts with a visually hidden heading labeled with the prompt that started the turn, so you can jump between turns with your screen reader’s heading navigation. Within a turn, your screen reader announces whose message you’re on as you move through it: + + * **Your messages** : “You” + * **Claude’s messages** : “Claude” + * **Tool steps** : “Claude” plus the tool name, such as “Claude, Bash” + * **Thinking blocks** : “Claude, thinking” + +Because the extension exposes the transcript as a labeled region, you can also move focus to the transcript itself with `Tab` and read it at your own pace. To move focus to the newest message or a waiting permission prompt instead, run **Claude Code: Focus last message** from the Command Palette. When an option on a permission prompt saves a permission rule or directory access, its label ends by naming where the approval is saved, such as “all projects” or “this session”. With that option focused, press the `Left` or `Right` arrow key to change the destination, and the extension announces each destination as you move to it. You can also click the destination in the label. The arrow keys require Claude Code v2.1.268 or later. ## @@ -497,7 +537,7 @@ Monitor background processes -Visibility for background tasks in the extension is limited compared to the CLI. For better visibility, have Claude output the command so you can run it in VS Code’s integrated terminal. +Type `/tasks` in the prompt box to open the agent map, which lists the session’s background tasks, such as a dev server Claude left running as a background shell command. Click a task to open its card and stop it there. Requires Claude Code v2.1.277 or later. ### @@ -560,7 +600,7 @@ These guides cover configuring your provider in `~/.claude/settings.json`, which ensures your settings are shared between the VS Code extension and the CLI. -On a third-party provider, the extension doesn’t offer features that require a claude.ai account, such as usage tracking, [voice dictation](</docs/en/voice-dictation>), and the Web tab for cloud sessions. A claude.ai sign-in left over from an earlier `/login` stays unused: the extension doesn’t send it with any request. +On a third-party provider, the extension doesn’t offer features that require a claude.ai account, such as plan usage bars, [voice dictation](</docs/en/voice-dictation>), and the Web tab for cloud sessions. For what the Account & usage dialog shows on these sign-ins, see Check account and usage. A claude.ai sign-in left over from an earlier `/login` stays unused: the extension doesn’t send it with any request. ##
modified Orchestrate subagents at scale with dynamic workflows View current →
--- a/workflows.md +++ b/workflows.md @@ -205,7 +205,7 @@ * Project location: Claude Code refuses if `.claude`, `.claude/workflows`, or the target file is a symlink. * Personal location: Claude Code refuses only if the target file itself is a symlink, so a `~/.claude` directory managed by a dotfiles tool still works. -Before v2.1.216, Claude Code followed the link, which could place the file outside the location you chose. In a monorepo with several `.claude/` directories, you can keep workflows alongside the package they apply to. As of v2.1.178, saving to the project location writes to the closest `.claude/workflows/` directory that already exists between your working directory and the repository root, or to the repository root if none exists yet. Project workflows also load from every `.claude/workflows/` along that path, and when more than one defines the same name Claude Code runs the one closest to the working directory. If a project workflow and a personal workflow share a name, the project one runs. +Before v2.1.216, Claude Code followed the link, which could place the file outside the location you chose. In a monorepo with several `.claude/` directories, you can keep workflows alongside the package they apply to. Saving to the project location writes to the closest `.claude/workflows/` directory that already exists between your working directory and the repository root, or to the repository root if none exists yet. Project workflows also load from every `.claude/workflows/` along that path, and when more than one defines the same name Claude Code runs the one closest to the working directory. If a project workflow and a personal workflow share a name, the project one runs. ### @@ -318,7 +318,7 @@ return audits.filter(Boolean) -The body is plain JavaScript with top-level `await`. `agent()` spawns one subagent, `pipeline()` runs one per item in a list, and `parallel()` runs a set of agent tasks at the same time and waits for all of them. An `agent()` call resolves to `null` if you stop it mid-run or it hits an unrecoverable API error. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier can block an `agent()` call before the subagent starts. A blocked call resolves to `null` and shows in the run’s progress view with the reason. `pipeline()` keeps each `null` in the results array, which is why the example ends with `.filter(Boolean)` to drop those entries. If you pass a `schema` on an `agent()` call, that subagent returns JSON matching the shape instead of prose. Claude Code checks the schema before starting the subagent: when it can prove the schema contradicts itself, the call fails with an error naming the contradiction, and the subagent never starts. One contradiction it can prove is a `required` key that `additionalProperties: false` rules out. If the subagent’s output still fails validation after five attempts, the call fails with an error that includes the last validation failure. To change the attempt count, set [`MAX_STRUCTURED_OUTPUT_RETRIES`](</docs/en/env-vars>). +The body is plain JavaScript with top-level `await`. `agent()` spawns one subagent, `pipeline()` runs one per item in a list, and `parallel()` runs a set of agent tasks at the same time and waits for all of them. An `agent()` call resolves to `null` if you stop it mid-run or it hits an unrecoverable API error. `pipeline()` keeps each `null` in the results array, which is why the example ends with `.filter(Boolean)` to drop those entries. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the prompt your script passes to `agent()` doesn’t count as a request from you when the classifier reviews that subagent’s actions, because Claude Code marks it as text the script computed. If you pass a `schema` on an `agent()` call, that subagent returns JSON matching the shape instead of prose. Claude Code checks the schema before starting the subagent: when it can prove the schema contradicts itself, the call fails with an error naming the contradiction, and the subagent never starts. One contradiction it can prove is a `required` key that `additionalProperties: false` rules out. If the subagent’s output still fails validation after five attempts, the call fails with an error that includes the last validation failure. To change the attempt count, set [`MAX_STRUCTURED_OUTPUT_RETRIES`](</docs/en/env-vars>). ###
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -45,10 +45,11 @@ Clean up worktrees -When you exit an interactive worktree session, Claude checks the worktree for work that removal would delete: changed or untracked files, and new commits. +When you exit an interactive worktree session, Claude checks the worktree for work that removal would delete: changed or untracked files, uncommitted work inside checked-out submodules, and new commits. * **The worktree is clean** : for an unnamed session, Claude removes the worktree and its branch automatically. A [named](</docs/en/sessions#name-your-sessions>) session prompts you first so you can keep the worktree for later * **The worktree has work in it** : Claude prompts you to keep or remove the worktree. Keeping preserves the directory and branch so you can return later. Removing deletes the worktree directory and its branch, along with all the work in them + * **The worktree’s state can’t be verified** : when Claude Code can’t count the worktree’s changes or can’t inspect its submodule checkouts, it prompts you rather than removing the worktree automatically. The prompt names what it couldn’t check Non-interactive runs with `-p` have no exit prompt, so Claude doesn’t clean up their worktrees, and Claude Code leaves the lock it took on each one at creation in place until a later session’s stale-lock sweep releases it. To remove one, run `git worktree remove`; if git refuses because the worktree is locked, run `git worktree unlock` on it first. On Windows, removing a worktree doesn’t delete files outside it. If a folder inside the worktree is a link to somewhere else, such as an NTFS junction or a directory symlink, Claude Code deletes only the link and keeps the folder it points to. Before v2.1.205, removing a worktree with a link nested in a subdirectory could delete the folder it pointed to. @@ -79,9 +80,9 @@ * **File edits** : Claude Code blocks an `Edit`, `Write`, or `NotebookEdit` that targets a path in the main checkout. * **Command working directory** : Claude Code blocks a Bash, PowerShell, or Monitor command whose working directory resolves to the main checkout, or whose working directory it can’t verify stays outside it. * **Git redirects** : Claude Code blocks a Bash or Monitor command that redirects git into the main checkout. The redirect can come through `git -C`, `--git-dir`, a `GIT_DIR` or `GIT_WORK_TREE` variable, or a `cd` into the main checkout before running git. - * **Command shape** : Claude Code blocks a Bash or Monitor command when it can’t verify from the command text that any git the command runs stays inside the worktree, for example when the command name is computed at runtime or the syntax can’t be parsed. Claude Code tells Claude how to rewrite the refused command, such as splitting it into plain, separate commands. You can’t turn this check off. - -The checks apply to the repository you launched Claude Code from. They also cover the main checkout a linked worktree is linked from. For PowerShell commands, Claude Code applies only the working-directory check. Claude sees each refusal as a tool error that names the worktree and says how to proceed. + * **Command shape** : Claude Code blocks a Bash or Monitor command when it can’t verify from the command text that any git the command runs stays inside the worktree. That happens, for example, when the command name is computed at runtime, when the syntax can’t be parsed, or when an expansion such as `${!name}` or `${ command; }` could run a command the text doesn’t spell out. Claude Code tells Claude how to rewrite the refused command, such as splitting it into plain, separate commands. You can’t turn this check off. + +The checks apply to the repository you launched Claude Code from. They also cover the main checkout a linked worktree is linked from. For PowerShell commands, Claude Code applies only the working-directory check. Claude sees each refusal as a tool error that names the worktree and says how to proceed. For a refused command, see [what the refusal message means and how to clear it](</docs/en/errors#command-blocked-by-the-worktree-isolation-checks>). ## @@ -111,6 +112,7 @@ Claude Code runs a periodic sweep that removes worktrees that Claude created for subagents and [background sessions](</docs/en/agent-view#how-file-edits-are-isolated>) once they are older than your [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) setting, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). When you [background](</docs/en/agent-view#send-the-session-to-the-background>) a `--worktree` session, its worktree becomes a background-session worktree that the sweep can remove. The sweep leaves a worktree in place in these cases: * The worktree still holds work: changed or untracked files, or unpushed commits. + * A checked-out submodule in the worktree holds changed or untracked files, or Claude Code can’t inspect the worktree’s submodules. This check requires Claude Code v2.1.274 or later. * One of the four cases that also block worktree creation applies: Claude Code can’t determine which filter drivers the repository config defines, or finds a setting there it can’t switch off. * The worktree belongs to a `--worktree` session you haven’t backgrounded, whatever its age. * You created the worktree yourself with `git worktree add`, even if you then ran a `--worktree <name>` session in it and backgrounded that session. @@ -213,13 +215,14 @@ What worktrees share with the main checkout -A worktree gets its own files and branch, but it shares the repository’s `.git` directory, project-scope plugins, and saved permission approvals with the main checkout: +A worktree gets its own files and branch, but it shares the following with the main checkout: * **The repository’s`.git` directory**: git commands in a worktree write to the main repository’s shared `.git` directory, and [sandboxing](</docs/en/sandboxing#filesystem-isolation>) allows those writes, so commands such as `git commit` work from inside a worktree with the sandbox enabled. * **Plugins** : plugins installed at [project scope](</docs/en/plugins-reference#plugin-installation-scopes>) from the main checkout also load in worktrees of the same repository, so you don’t need to reinstall them per worktree. Requires Claude Code v2.1.200 or later. * **Permission approvals** : choosing “Yes, and don’t ask again” for a Bash command in a worktree session saves the rule to the main checkout’s `.claude/settings.local.json`, so it applies in the main checkout and in every other worktree of the repository, and it survives the worktree’s removal. On Windows and in the other cases where Claude Code [doesn’t use the repository root](</docs/en/settings#where-claude-code-looks-for-each-file>), the rule stays with that worktree. Before v2.1.211, an approval granted in a worktree was saved inside that worktree, didn’t apply elsewhere, and was lost when the worktree was removed. See [where approvals are saved](</docs/en/permissions#permission-system>). - -All three apply whether you create the worktree with `--worktree`, with `git worktree add`, or through the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>). + * **Untracked skills, agents, and commands** : when the worktree checkout has no `.claude/skills` directory at its root, for example because your `.claude/skills` is gitignored, Claude Code loads the main checkout’s [project skills](</docs/en/skills#where-skills-live>) in the worktree session. In a worktree with its own `.claude/skills` directory, only that copy loads. The same read-through covers `.claude/agents` and `.claude/commands`. For skills, the read-through requires Claude Code v2.1.277 or later. + +All of these apply whether you create the worktree with `--worktree`, with `git worktree add`, or through the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>). ##