modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -80,7 +80,7 @@ [Permission lockdown](</docs/en/permissions#managed-only-settings>)| Make managed settings the [only settings source of permission rules](</docs/en/settings-reference#allowmanagedpermissionrulesonly>). Disable `--dangerously-skip-permissions`| `allowManagedPermissionRulesOnly`, `permissions.disableBypassPermissionsMode` [Starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>)| Choose the permission mode your developers’ terminal sessions start in instead of the built-in starting permission mode, or remove auto mode. [Switch permission modes](</docs/en/permission-modes#switch-permission-modes>) lists when the VS Code extension reads a `defaultMode` you set| `permissions.defaultMode`, `permissions.disableAutoMode` [Sandboxing](</docs/en/sandboxing>)| OS-level filesystem and network isolation with domain allowlists| `sandbox.enabled`, `sandbox.network.allowedDomains` -[Managed policy CLAUDE.md](</docs/en/memory#deploy-organization-wide-claude-md>)| Org-wide instructions loaded in every session, can’t be excluded| File at the managed policy path +[Managed policy CLAUDE.md](</docs/en/memory#deploy-organization-wide-claude-md>)| Organization-wide behavioral guidance for Claude rather than a client-enforced rule| File at the managed policy path [MCP server control](</docs/en/managed-mcp>)| Restrict which MCP servers users can add or connect to, deploy a fixed set, or provide remote servers to every user alongside their own| `allowedMcpServers`, `deniedMcpServers`, `allowManagedMcpServersOnly`, `managedMcpServers`, or a deployed `managed-mcp.json` file [Plugin marketplace control](</docs/en/plugins/org#restrict-what-users-can-install>)| Restrict which marketplace sources users can add and install from, reject the CLI flags that sideload plugins, agents, and MCP servers for a single run, block [`command` plugin sources](</docs/en/plugins/marketplace-reference#command-plugin-source>), and allowlist which marketplaces’ plugins can be suggested| `strictKnownMarketplaces`, `blockedMarketplaces`, `disableSideloadFlags`, `disableCommandPluginSources`, `pluginSuggestionMarketplaces` [Customization lockdown](</docs/en/settings-reference#strictpluginonlycustomization>)| Block skills, agents, hooks, and MCP servers from user and project sources, so they can only come from plugins or managed settings. Locking skills also stops the [skills your developers enable on claude.ai](</docs/en/skills#where-synced-skills-load>) from syncing| `strictPluginOnlyCustomization`
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -30,7 +30,7 @@ | Subagents| Agent teams ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent -**Communication**| Return a result to the caller. Subagents that Claude named when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>)| Teammates message each other directly +**Communication**| Return a result to the caller. Subagents that Claude [named](</docs/en/sub-agents#subagent-names>) when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>)| Teammates message each other directly **Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -150,7 +150,7 @@ Spawn an architect teammate to refactor the authentication module. -When a teammate finishes planning, it sends a plan approval request to the lead. Claude Code approves the plan in the lead’s session as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. +When that teammate finishes planning, it sends a plan approval request to the lead. If you haven’t changed that teammate’s permission mode since it was spawned, Claude Code approves the plan as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. If you put a running in-process teammate in plan mode by pressing [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>) while viewing its session, the lead reviews that run’s plan instead of Claude Code approving it. You aren’t asked to approve it; the lead approves it or sends it back for revision. ### @@ -274,7 +274,7 @@ Permissions -Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. +Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. You don’t need to approve a teammate’s plan. ####
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -222,13 +222,22 @@ When Claude Code can’t reopen the conversation, it exits and prints a `claude --resume` command that resumes it. [Claude’s task list](</docs/en/interactive-mode#task-list>) moves to the background session with the conversation, so the checklist is intact when you return to that row. The row you pressed `←` from also keeps a bold, undimmed name after you move the selection with the arrow keys or the mouse, so you can tell which session you came from. If a tool is running when you press `←`, Claude Code waits for it to finish before backgrounding, and Claude continues the response in the background session. Press `←` again to background immediately instead of waiting. When in-flight background work can’t carry over to the background session, Claude Code shows the `Background this session?` dialog first, the same as with `/background`. After about ten seconds, Claude Code backgrounds the session without waiting any longer, except in cases such as these: - * **Foreground subagents are still running** : Claude Code keeps waiting so the work of the [foreground subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) Claude started carries over, and shows `Still backgrounding after the current tool`. Press `←` again to background without waiting, which restarts those subagents from the beginning. + * **Foreground subagents are still running** : Claude Code keeps waiting so the work of the [foreground subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that Claude started carries over, and shows `Still backgrounding after the current tool`. Press `←` again to background without waiting, which restarts those subagents from the beginning. * **A permission prompt or question is waiting for your answer** : while a permission prompt or a question Claude asked waits, Claude Code keeps waiting and shows `Still backgrounding after the current tool — a question is waiting for your answer.` If your answer lets the turn continue, such as **Yes** on a permission prompt, Claude Code backgrounds the session when the current tool finishes. - * **You type into the prompt input** : Claude Code cancels the switch, because unsent text stays in your terminal’s input box and wouldn’t move to the background session. It shows `Backgrounding cancelled — you have unsent text in the input. Send it or clear it, then press ← again.` + * **You type into the prompt input** : Claude Code cancels the switch, because unsent text stays in your terminal’s input box and wouldn’t move to the background session. It shows `Backgrounding cancelled — you have unsent text in the input. Send it or clear it, then press ← again.` Claude keeps working in the foreground. * **You stop the turn** : Claude Code cancels the switch and shows `Backgrounding cancelled — the turn was stopped.` For example, the turn stops when you [interrupt Claude with `Esc`](</docs/en/interactive-mode#general-controls>) or select **No** [without a comment](</docs/en/permissions#add-a-comment-when-you-answer-a-permission-prompt>) on a permission prompt from the main conversation, or press `Esc` on a question Claude asks there. Press `←` again to background the session. * **A queued message can’t move** : messages you [queued while Claude was working](</docs/en/interactive-mode#queue-messages-while-claude-works>) move to the background session with the conversation. When one of them can’t, the session stays in the foreground and Claude Code shows a notice such as `Cannot open agents — 1 queued message can't move to the background. Press ← again once Claude has read it.` When Claude Code backgrounds the session, either after about ten seconds or after you press `←` again, it stops a shell command that Claude is still running in the foreground. Claude Code doesn’t show the `Background this session?` dialog for that command. In the background session, Claude has no record that the command started, so Claude may run the command again. To keep the command running when the session moves, press `Ctrl+B` to [turn it into a background command](</docs/en/interactive-mode#background-bash-commands>) while Claude Code is still waiting. Pressing `←` creates the session’s row even when the conversation has no messages yet, so `→` still returns to it. You can turn this shortcut off for foreground sessions with the [`leftArrowOpensAgents`](</docs/en/settings-reference#leftarrowopensagents>) setting in `/config`. + +##### Prompts sent as the session moves to the background + +If you enter a prompt or `!` shell command at the moment the session moves to the background, it is stopped or left unsent: + + * **Sent as the conversation closes** : the response or command stops when the conversation closes and agent view opens + * **Still waiting on[hooks](</docs/en/hooks>) at that moment**: the prompt isn’t sent, and nothing on screen says so. This includes a prompt you typed while [`SessionStart` hooks](</docs/en/hooks#sessionstart>) were still running + +In both cases the text you typed is kept in [prompt history](</docs/en/interactive-mode#command-history>). To send it again, open the backgrounded session and press `↑` at its prompt to bring the text back. ### @@ -310,7 +319,7 @@ `Ctrl+X`| Stop the session; press again within two seconds to delete it `Shift+↑` / `Shift+↓`| Reorder the selected session `Esc`| Close the peek panel, clear the input, or exit. When you opened agent view by backgrounding your session with `←`, the final `Esc` returns to that conversation instead of exiting. With [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>) on, pressing `Esc` in the input switches from INSERT to NORMAL mode and keeps your text, as in the main prompt -`Ctrl+C`| Clear the input; press twice to exit +`Ctrl+C`| Clear the input; press twice to exit. While text on screen is selected, the press clears the selection instead, copying it first unless [selecting already copied it](</docs/en/settings-reference#copyonselect>) `?`| Show shortcuts The shortcuts that have an action in the [`Agents` context](</docs/en/keybindings#agents-actions>) follow your [`keybindings.json`](</docs/en/keybindings>). So does `Ctrl+G`, through the `Chat` context’s `chat:externalEditor` binding. @@ -446,6 +455,18 @@ claude attach 7c5dcf5d open in this terminal claude logs 7c5dcf5d show recent output claude stop 7c5dcf5d stop this session + +#### + +​ + +Prompts that contain `--bg` + +A prompt that mentions `--bg` or `--background` is delivered as typed, and so is a reply of `--bg` that you send to a background session. For example, this command starts one background session, and the second `--bg` is part of its prompt: + + claude --bg "find out why --bg sessions are slow to start on this machine" + +Claude Code reads a whole argument as the flag only where a flag can stand: before any bare `--` separator and not where another flag expects its value. Put the flag first, as in `claude --bg "<prompt>"`. Where the position is ambiguous, such as after a run of combined short flags, Claude Code starts nothing. It exits with [`Couldn't tell whether --bg is a flag or text here`](</docs/en/errors#couldnt-tell-whether-bg-is-a-flag-or-text>) instead. #### @@ -531,8 +552,8 @@ In agent view, type `/model`, `/effort`, or `/fast` in the dispatch input and press `Enter`, and the sessions you dispatch afterward start with what you set. Your choice stays with that agent view window and isn’t saved to a settings file. `/effort` and `/fast` require Claude Code v2.1.299 or later, as does `/model` typed with nothing after it. Give the value after the command, or type the command alone to choose one from a list: * **Model** : `/model <name>`, for example `/model opus` - * **[Effort level](</docs/en/model-config#adjust-effort-level>)** : `/effort` with `low`, `medium`, `high`, `xhigh`, or `max`, for example `/effort high` - * **Fast mode** : `/fast on` or `/fast off`. The session starts in fast mode only if fast mode is [available to you](</docs/en/fast-mode#requirements>) and its model supports fast mode. On a model that doesn’t, the session starts with fast mode off, so first use `/model` to pick one of the [models that support fast mode](</docs/en/fast-mode>). + * **[Effort level](</docs/en/model-config#adjust-effort-level>)** : `/effort` with `low`, `medium`, `high`, `xhigh`, or `max`, for example `/effort high`. To start sessions in [ultracode](</docs/en/workflows#let-claude-decide-with-ultracode>), open agent view from your shell with `claude agents --effort ultracode` instead; the dispatch input doesn’t accept `/effort ultracode` + * **Fast mode** : `/fast on` or `/fast off`. The session starts in fast mode only if fast mode is [available to you](</docs/en/fast-mode#requirements>) and its model supports fast mode. On a model that doesn’t, the session starts with fast mode off, so first use `/model` to pick one of the [models that support fast mode](</docs/en/fast-mode>). The hint under the input, not the header, confirms whether new sessions get fast mode. To undo a choice, give `default` as the value, for example `/effort default`. The following example dispatches one session on Opus and the next on Sonnet: @@ -978,6 +999,11 @@ Version| Change ---|--- v2.1.299| `/effort` and `/fast` in the dispatch input set the effort level and fast mode for the sessions you dispatch next. `/model`, `/effort`, or `/fast` typed with no value opens a picker. +v2.1.299| Claude Code reads `--bg` and `--background` as the flag only before any bare `--` separator and outside another flag’s value, and refuses an ambiguous position instead of guessing. Before this release, a prompt or reply of `--bg` or `--background` to a background session could be taken for the flag. That could start new background sessions over and over instead of delivering the text. +v2.1.296| A prompt or `!` shell command that you enter as the session moves to the background is stopped or left unsent, and its text is kept in prompt history. Before this release, the response or command kept running where you could no longer see it, and a prompt sent right after `←` could run a second time unseen. A prompt typed while `SessionStart` hooks were still running was lost: not sent, and not in prompt history. +v2.1.295| `Ctrl+C` at the idle prompt of an attached background session leaves the pending wakeup of a [self-paced `/loop`](</docs/en/scheduled-tasks#let-claude-choose-the-interval>) alone, so pressing it twice detaches and the loop keeps running. `Esc` at that prompt [stops the self-paced loop](</docs/en/scheduled-tasks#stop-a-loop>) and shows a `Pending wakeup cancelled` notice. Before this release, the first `Ctrl+C` could end a self-paced loop without saying so, and `Esc` didn’t stop one that had moved to the background with the session. +v2.1.295| On macOS and Linux, when `claude agents` exits while no supervisor is running, it doesn’t start a new one on its own. Running sessions then stop about a minute later unless you run `claude agents` again, and agent view can print a notice saying so as it exits. Before this release, the exiting `claude agents` started a new supervisor. +v2.1.295| On macOS with the native installer, background sessions that restart together after an update run under the same Claude Code entry that holds the protected-folder access you granted. Before this release, those sessions could run under the binary’s own path instead. macOS lists that path as a separate entry, so the folder-access prompts could come back after an update. v2.1.290| `claude attach` and `claude logs` can take part of a session’s name in place of the ID. v2.1.290| `/model`, `/effort`, `/rename`, and `/usage` sent as a peek reply to a working session run right away. v2.1.290| A peek reply that can’t be delivered is no longer saved for the next restart when it starts with `/`, or when it answers a question with predefined choices while the session’s process is running.
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -106,6 +106,18 @@ * **Within your organization** : on Team and Enterprise plans, grant access to specific people in your organization, or to everyone in it. Viewers sign in to claude.ai as members of your organization to see the page. * **Publicly** : share a link that anyone on the internet can open, with no claude.ai sign-in required. On Team and Enterprise plans, public sharing is off until an Owner enables it for the organization. + +### + +​ + +Link to a specific view + +If a page has several views, such as tabs or sections, you can link to one of them directly. Ask Claude for the links: + + Give me a link to each tab of the deploy failures dashboard. + +Each link is the artifact’s link with an anchor on the end, such as `#overview`. ###
modified Authentication View current →
--- a/authentication.md +++ b/authentication.md @@ -6,7 +6,12 @@ Log in to Claude Code -After [installing Claude Code](</docs/en/setup#install-claude-code>), run `claude` in your terminal. On first launch, Claude Code opens a browser window for you to log in. If you’ve set the `ANTHROPIC_API_KEY` environment variable and you approve the key when Claude Code asks whether to use it, Claude Code skips the login prompt. If the browser doesn’t open automatically, press `c` to copy the login URL to your clipboard, then paste it into your browser. If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the `Paste code here if prompted` prompt. This happens when the browser can’t reach Claude Code’s local callback server, which is common in WSL2, SSH sessions, and containers. When login completes, the terminal shows `Login successful` and prompts you to press `Enter` to continue. You can authenticate with any of these account types: +After [installing Claude Code](</docs/en/setup#install-claude-code>), run `claude` in your terminal. Claude Code opens a browser window for you to log in on first launch, except in cases such as these, where it can skip the login prompt: + + * **API key** : you’ve set the `ANTHROPIC_API_KEY` environment variable and you approve the key when Claude Code asks whether to use it + * **Earlier sign-in** : you ran [`claude auth login`](</docs/en/cli-reference#cli-commands>) in your shell before your first session, or you rebuilt a dev container that keeps your credentials in a [volume](</docs/en/devcontainer#persist-authentication-and-settings-across-rebuilds>). If you see the login prompt anyway, check what can cause it. + +If the browser doesn’t open automatically, press `c` to copy the login URL to your clipboard, then paste it into your browser. If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the `Paste code here if prompted` prompt. This happens when the browser can’t reach Claude Code’s local callback server, which is common in WSL2, SSH sessions, and containers. When login completes, the terminal shows `Login successful` and prompts you to press `Enter` to continue. You can authenticate with any of these account types: * **Claude Pro or Max subscription** : log in with your claude.ai account. Subscribe at [claude.com/pricing](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=authentication_pro_max>). * **Claude for Teams or Enterprise** : log in with the claude.ai account your team admin invited you to. @@ -15,6 +20,19 @@ * **Cloud gateway** : if your organization runs a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>), sign in with corporate SSO through `/login`. The gateway-issued token is the session’s only credential. Admins can direct which login method developers use and require claude.ai logins to belong to a specific organization; see Restrict login to your organization. To log out and re-authenticate, type `/logout` at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run `claude` it walks you through login and setup again. If you’re having trouble logging in, see [authentication troubleshooting](</docs/en/troubleshoot-install#login-and-authentication>). + +### + +​ + +Login prompt still appears after an earlier sign-in + +If you signed in earlier and first-launch setup shows the login prompt instead of skipping it, check for causes such as these: + + * **Expired sign-in** : your earlier sign-in expired and Claude Code can’t refresh it. Log in again at the prompt. + * **Login restricted to an organization** : an administrator set [`forceLoginOrgUUID`](</docs/en/settings-reference#forceloginorguuid>) in managed settings to require logins from specific organizations. The prompt appears whether or not your account belongs to one of them. Log in with an account in a required organization. If you don’t have one, ask your administrator to add you. + * **Required login method** : your sign-in isn’t the kind that [`forceLoginMethod`](</docs/en/settings-reference#forceloginmethod>) in a settings file requires. With `"claudeai"`, an API key from an earlier Claude Console login doesn’t count as an existing sign-in. With `"console"`, a claude.ai account doesn’t. Log in with the kind of account that setting names. + * **Older version** : before v2.1.290, the prompt appeared during setup whether or not you were signed in. [Update Claude Code](</docs/en/setup#update-claude-code>) to skip it. ###
modified Configure auto mode View current →
--- a/auto-mode-config.md +++ b/auto-mode-config.md @@ -337,7 +337,13 @@ Fix a denial with an allow rule, an environment entry, or a retry -To see what the classifier blocked, find the tool call in the conversation. If the call appears shortened or folded into a summary line such as `Ran 3 shell commands`, press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>), which expands it. Two other places on screen that report denials leave out the command or URL: the notice near the input box, such as `bash denied by auto mode · [Data Exfiltration] · /permissions`, gives the tool and the reason, and the **Recently denied** tab lists a shell command by the description Claude wrote for it. To capture the exact input of these denials programmatically, add a [`PermissionDenied` hook](</docs/en/hooks#permissiondenied>), which receives it as `tool_input`. The text beneath the call tells you whether there is anything to fix. A dim `Not run · auto mode's check had no usable answer` row, or text that reports a problem with the classifier itself, such as `Auto mode could not evaluate this action`, means Claude Code blocked the call without a verdict from the classifier. For a `Not run` row, press `Ctrl+O` to read the full message, then see [Auto mode cannot determine the safety of an action](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) or [The server returned no safety verdict](</docs/en/errors#the-server-returned-no-safety-verdict>) for what to do. Otherwise, a line reading `Denied by auto mode classifier` with a reason such as `[Production Deploy]` or `Blocked by classifier` means the classifier judged the call unsafe, so pick the fix from what the call was trying to reach or do: +To read the command or URL behind a notice such as `bash denied by auto mode · [Data Exfiltration] · /permissions`, use the **Recently denied** tab, a hook, or the conversation: + + * **Recently denied tab** : in the `/permissions` dialog, highlight a denied Bash or PowerShell action to read its command below the list. In [screen reader mode](</docs/en/accessibility>), all the commands appear before the list instead. + * **Hook** : to capture the exact input of denials programmatically, add a [`PermissionDenied` hook](</docs/en/hooks#permissiondenied>), which receives it as `tool_input`. + * **Conversation** : find the tool call. If the call appears shortened or folded into a summary line such as `Ran 3 shell commands`, press `Ctrl+O` to open the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>), which expands it. + +The text beneath the call tells you whether there is anything to fix. A dim `Not run · auto mode's check had no usable answer` row, or text that reports a problem with the classifier itself, such as `Auto mode could not evaluate this action`, means Claude Code blocked the call without a verdict from the classifier. For a `Not run` row, press `Ctrl+O` to read the full message, then see [Auto mode cannot determine the safety of an action](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) or [The server returned no safety verdict](</docs/en/errors#the-server-returned-no-safety-verdict>) for what to do. Otherwise, a line reading `Denied by auto mode classifier` with a reason such as `[Production Deploy]` or `Blocked by classifier` means the classifier judged the call unsafe, so pick the fix from what the call was trying to reach or do: * A destination Claude needs throughout the task, such as a package registry, an internal domain, or a repository host: add it to `autoMode.environment`. * A command you want to run without review from now on: add an `allow` rule.
modified Claude Code changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,73 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Longer releases are grouped by type of change, with long lists of improvements and bug fixes collapsed. Run `claude --version` to check your installed version. + +​ + +2.1.308 + +October 22, 2026 + + * Bug fixes and reliability improvements + +​ + +2.1.307 + +October 21, 2026 + +**Added** + + * Added `/claude-api api-version` to move Claude API code to API version `2026-10-21` + * Added the `claude_code.safety_event` OpenTelemetry event for each tool call a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted or sent back + * [VSCode] Added a notice on the microphone button when voice dictation stops by itself (15 seconds without recognized speech, or the 2-minute limit), saying why and that the text so far is kept + * [Code Review] Added `@claude review stop` (also `off` and `pause`) to Code Review, ending an `@claude review always` subscription on a pull request without starting a new review + +**Changed** + + * Changed the notice Claude gets when the WebSearch budget is used up to also tell it not to query search engines in a browser or through computer use + * Changed the `axScreenReader` setting and `CLAUDE_AX_SCREEN_READER` in a settings `env` block to apply only from user, managed or `--settings` settings (since 2.1.305) + * Self-hosted runner: Changed checkout hooks to be stopped after 30 minutes by default, failing the session’s setup; if yours needs longer, raise `--checkout-hook-timeout-min` or set it to `0` + * Self-hosted runner: Changed the certificate file built for Anthropic-managed git to filter its trusted certificates as the CLI does; a `[runner:warn]` line gives the number left out + * [VSCode] Changed the “still open somewhere else” notice to also cover a Claude process left over from an extension restart, which usually ends on its own within about 10 minutes + * [VSCode] Changed voice dictation to filter its trusted certificates as the CLI does + * [VSCode] Changed the extension’s own requests to filter their trusted certificates as the CLI does, and to trust the `NODE_EXTRA_CA_CERTS` file named in the environment or in user settings + +Show 6 improvements + + * Improved recovery from unparseable tool calls: Claude Code now retries the call up to twice before ending the turn with an error + * Improved fork subagents launched together: each is now told which launch is its own, so forks are much less likely to try to start each other’s work + * Improved browser sign-in: the success page now appears as soon as sign-in completes, without waiting for your account profile to load + * Improved web search errors in cloud and self-hosted runner sessions: a search refused with a 403 that gives a reason now shows that reason instead of a generic “Authentication error” + * Improved the time to the first reply in cloud sessions when one of the desktop app’s MCP servers can’t connect + * Improved Remote Control connect time for sessions whose transcript contains large pasted images or PDF reads + +Show 26 bug fixes + + * Fixed requests failing with a model-not-found error when `CLAUDE_CODE_DISABLE_1M_CONTEXT` is set and the model is an alias with the `[1m]` suffix, such as `opus[1m]` + * Fixed the `prompt-caching-scope` beta header being sent behind custom `ANTHROPIC_BASE_URL` gateways and on Foundry, where it has no effect + * Fixed MCP servers showing “needs authentication” in `claude -p` on macOS while the login keychain was locked; they now say why, and the next run after an unlock connects without a new sign-in + * Fixed MCP servers being reported as timed out, and staying failed in headless runs, when a macOS or Linux computer went to sleep while they were connecting + * Fixed HTTP MCP tool calls being sent twice when the connection closed mid-call; only read-only or idempotent tools are now retried + * Fixed a turn sometimes starting without an SDK MCP server’s latest tools when a background task was running + * Fixed some “Autocompact is thrashing” errors in turns that read many PDF pages, images or other large tool results + * Fixed `/autocompact` in cloud sessions going back to the default window after the session restarted + * Fixed a conversation cleared with `/clear` sometimes coming back when a cloud or self-hosted runner session restarted + * Fixed `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` being ignored in Claude apps gateway sessions + * Fixed telemetry from Claude Desktop sessions behind a Claude apps gateway being rejected when `OTEL_EXPORTER_OTLP_HEADERS` is set + * Fixed `/permissions` > Recently denied not showing the denied shell command, and auto mode’s local classifier ignoring an approval from there when it checks a retried command; approving a row now names the command, not its description + * Fixed `/help` and the `/` command menu showing long model-facing descriptions for bundled skills such as `/claude-api` instead of their short descriptions + * Fixed subagent transcripts recording placeholder token usage and an empty stop reason for streamed responses + * Fixed model switches through the Agent SDK’s `setModel()`, and apps built on it, being refused when the API took more than 5 seconds to confirm the model; Claude Code now waits up to 15 seconds + * Fixed a background command stopped through a connected app (such as the desktop app archiving an idle session) being reported to Claude as stopped by the user; the notice now names its output file + * Fixed WebFetch in Cowork cloud sessions reporting a tool error when a site answered with a 4xx status or a robots.txt refusal; it is now a normal result, as in local sessions + * Fixed write tools on a directly configured GitHub MCP server showing a form that closed without creating anything in the desktop app’s Code tab + * Fixed Artifact tool reads failing with a connection reset when the server had closed a reused connection + * Self-hosted runner: Fixed sessions with `--use-anthropic-git-proxy` committing a `.claude/settings.local.json` left in the clone by an earlier session + * Self-hosted runner: Fixed archiving or requeueing a session, or stopping the runner, during its checkout hook leaving the hook’s processes running and the runner’s slot held + * [VSCode] Fixed a long prompt expanded with Show more covering the whole chat panel: a pinned prompt is now capped at 40% of the panel and scrolls + * [VSCode] Fixed part of a list item or table cell with LaTeX math pasting as a new list or table in rich text editors + * [VSCode] Fixed dictation failing behind a TLS-inspecting proxy when `NODE_EXTRA_CA_CERTS` is set only in `~/.claude/settings.json`; it now also follows `CLAUDE_CODE_CERT_STORE` + * [Cloud sessions] Fixed the repository picker saying “No repositories match” while a search was still running; it now shows “Searching…” until the results arrive + * [Cloud sessions] Fixed the “Waiting for a runner” status on self-hosted environments being cut off; with on-demand runners it now counts up from your last message and shows failed attempts ​
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 @@ -482,7 +482,7 @@ [`/design-sync`](</docs/en/commands#all-commands>) and `/design-login`| Not available| Both need claude.ai, which the CLI doesn’t contact on gateway sessions, so neither command appears there Features that need feature-flag fetching, such as `/import` and `claude import`| Not available| The CLI skips the flag fetch on gateway sessions. [Features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) lists what that turns off Standard prompt caching| Available| The gateway forwards `cache_control` breakpoints to every upstream. [Where the cache lives](</docs/en/prompt-caching#where-the-cache-lives>) covers which blocks the CLI marks, including the system context it appends mid-conversation -1-hour cache TTL| Not available| The CLI omits the extended-cache-ttl beta on gateway sessions, because not every upstream the gateway can route to supports the 1-hour TTL, so prompt caching through the gateway uses the 5-minute TTL; see the beta-header note above +1-hour cache TTL| Available with opt-in| The CLI uses the 5-minute TTL on gateway sessions by default. To request the 1-hour TTL, set it [in a policy](</docs/en/claude-apps-gateway-config#one-hour-prompt-cache>). Set it only if your upstreams offer the 1-hour TTL for every model the gateway serves, because the request fails if an upstream rejects the TTL Auto mode| Available| Follows the [third-party provider rules](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>): only the models eligible on third-party providers can use it. Before v2.1.207, auto mode on gateway sessions required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, deliverable through the managed policy `env` block First-party-only optimizations such as global cache scope and token-efficient tools| Not available| The CLI doesn’t enable them on gateway sessions; see the beta-header note above OTLP/gRPC| Not supported| OTLP over HTTP only
modified Claude apps gateway configuration View current →
--- a/claude-apps-gateway-config.md +++ b/claude-apps-gateway-config.md @@ -220,7 +220,7 @@ `postgres_url`| Yes| `postgres://` or `postgresql://` URL with one host, not a comma-separated list. The gateway runs its own schema migrations at boot and on upgrade, so the role needs rights to create and alter tables on the target schema. See [Upgrades](</docs/en/claude-apps-gateway-deploy#upgrades>) and [Postgres](</docs/en/claude-apps-gateway-deploy#postgres>). `username`| No| Overrides the user in `postgres_url` `password`| No| Database credential. Set it here rather than in `postgres_url` so the credential stays out of the URL. Accepts any characters and takes precedence over URL credentials. -`max_connections`| No| Postgres connection-pool size per replica. Default `5`, which is conservative and friendly to shared databases. With spend limits enabled, the hot path does a few operations per inference request, so raise it for a dedicated database under load, and keep replicas × this below the database’s `max_connections`. +`max_connections`| No| Postgres connection-pool size per replica. Default `5`, which is conservative and friendly to shared databases. With spend limits enabled, the gateway makes a few database operations per inference request, so raise it for a dedicated database under load, within what [Size the connection pool](</docs/en/claude-apps-gateway-deploy#size-the-connection-pool>) allows. `connect_timeout_seconds`| No| Seconds the gateway waits when it opens a Postgres connection. A whole number from `1` to `60`, default `5`. Raise it if connection attempts time out when a new gateway instance starts. Requires Claude Code v2.1.274 or later on the gateway server. Earlier versions refuse to start when the key is set. `readiness_grace_seconds`| No| How many seconds `/readyz` keeps reporting ready after Postgres stops answering. A whole number from `0` to `3600`, default `0`. See [Outage behavior](</docs/en/claude-apps-gateway-deploy#outage-behavior>) for how to pick a value. Requires Claude Code v2.1.282 or later on the gateway server. Earlier versions refuse to start when the key is set. @@ -623,7 +623,7 @@ VPC / FIPS endpoints| Set `base_url:` on the upstream to your VPC endpoint or FIPS endpoint URL Model-scoped routing| Only a custom model `id`, one that isn’t a built-in Claude model, skips the upstreams absent from its `upstream_model:` map. A `mantle` upstream is tried only for the models listed in its `models` field. On every other upstream the gateway tries built-in models in order and uses the provider’s default ID where the map has no entry, so for built-in models the map changes which ID an upstream receives rather than whether it is tried; an upstream that rejects the ID follows the same failover rules as any other upstream error. -Failing over between cloud providers, or to the direct Anthropic API, changes which agreement, geography, and other terms govern the request. The CLI applies the same feature gating to gateways regardless of which upstream serves a given request, so failover doesn’t send a body field an upstream would reject. +Failing over between cloud providers, or to the direct Anthropic API, changes which agreement, geography, and other terms govern the request. The CLI applies the same feature gating to gateways regardless of which upstream serves a given request, so by default failover doesn’t send a body field an upstream would reject. If you set the one-hour cache TTL in a policy, it goes to every upstream in the list, so set it only if all of them accept it. ## @@ -951,6 +951,25 @@ CLAUDE_CODE_AUTO_COMPACT_WINDOW: "200000" Claude Code applies this variable without showing the developer the approval dialog. The variable applies to every model, including model IDs that end in `[1m]`. To turn off 1M context instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT: "1"`](</docs/en/model-config#extended-context>) in the same `env` block. Claude Code then treats every model as having a 200K window. In interactive sessions, each developer approves this variable in the approval dialog before it takes effect. + +#### + +​ + +One-hour prompt cache + +To request the one-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default five minutes, add these keys to a policy’s existing `code`, `cli`, or `settings` block and restart the gateway. The keys need Claude Code v2.1.242 or later on the gateway server and on clients. `promptCacheTtl` covers the main conversation. `subagentPromptCacheTtl` is optional and covers subagents, workflows, and background requests. This example adds both to a `match: {}` policy keyed `cli`: + + managed: + policies: + - match: {} + cli: + promptCacheTtl: 1h + subagentPromptCacheTtl: 1h + +Set the keys only if your upstreams offer the one-hour TTL for every model the gateway serves. If an upstream rejects the TTL, the request fails, and neither the gateway nor Claude Code retries it with the five-minute TTL. For Amazon Bedrock, check [supported models, regions, and limits](<https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models>). + +To confirm `promptCacheTtl`, sign in to the gateway as a user the policy matches and [check which TTL your cache writes used](</docs/en/prompt-caching#choose-the-ttl-yourself>). Pass `--model` to repeat the check for each model the gateway serves. One-hour cache writes [cost more](</docs/en/prompt-caching#cache-lifetime>) than five-minute writes. For [spend limits](</docs/en/claude-apps-gateway-spend-limits#how-requests-are-priced>) to count that higher rate, you need v2.1.286 or later on the gateway server. ####
modified Claude apps gateway deployment and operations View current →
Show diff (143 lines)
--- a/claude-apps-gateway-deploy.md +++ b/claude-apps-gateway-deploy.md @@ -190,6 +190,19 @@ ​ +Keep `API_TIMEOUT_MS` above the gateway’s time to first byte + +If you lower [`API_TIMEOUT_MS`](</docs/en/network-config#streaming-idle-watchdogs>) to retry an unanswered request sooner, keep it above the time the gateway takes to send the first bytes of a streaming response. A request that waits longer times out, and so does each retry that waits as long, until the turn ends with `Request timed out`. + + * **`provider: anthropic`** : set `API_TIMEOUT_MS` above the longest time your upstream takes to send its first event. + * **Every other upstream** : set it more than 20 seconds above the longest time your upstream takes to return response headers. The gateway sends its first keepalive `ping` about 15 seconds after those headers, unless the upstream’s first event comes sooner. A gateway older than v2.1.229 sends no pings, so use the `provider: anthropic` rule there. + +On top of that time, allow for any wait for a free slot and for the wait on a down upstream before [failover](</docs/en/claude-apps-gateway-config#multiple-upstreams>). Keep the value above the longest [non-streaming request](</docs/en/network-config#streaming-idle-watchdogs>) too. + +### + +​ + Outage behavior If Postgres goes down, the gateway itself keeps serving signed-in developers and new sign-ins fail. Whether developers actually keep working depends on how your orchestrator handles readiness: @@ -245,6 +258,23 @@ `principal_emails`| Each principal’s last-seen email, display name, and IdP groups. Contains PII.| `admin.identity_retention_days` since last activity, default 90 A 30-second loop expires `kv` rows past their TTL, and an hourly sweep enforces the retention windows on the spend tables, so nothing grows without bound. Without [spend limits](</docs/en/claude-apps-gateway-spend-limits>) configured, only `kv` is written. The gateway applies its own schema migrations at boot and on every upgrade, so its database role needs rights to create and alter tables. Point it at a database or schema dedicated to the gateway to keep that grant narrow. With spend limits in use, a lost database means lost spend tracking and caps, not only developer re-logins, so run regular backups. To erase one departed developer immediately rather than waiting on retention, run `DELETE FROM principal_emails WHERE principal = '<sub>'` directly; that removes the only table holding their email, name, and groups. `spend` and `admin_audit` rows reference the pseudonymous OIDC `sub` only. + +#### + +​ + +Size the connection pool + +Each replica opens up to [`store.max_connections`](</docs/en/claude-apps-gateway-config#store>) Postgres connections, five by default. Keep replicas × `store.max_connections` at or below the connections the database has left for the gateway: + + * **Replicas** : count the most that run at once. Start from your autoscaling maximum, or your replica count if you don’t autoscale, and add the extra replicas a rolling update starts before it stops old ones. On Amazon ECS with default settings, and on Cloud Run, that can be as many again. + * **Connections left** : take the database’s `max_connections`, then subtract what the database reserves and what other clients hold. PostgreSQL reserves `superuser_reserved_connections`, three by default. A managed service can reserve more, so check its documentation. + +For example, take an autoscaling maximum of six, rolling updates that start at most two extra replicas, and the default pool of five. That needs (6 + 2) × 5 = 40 connections. A database with a `max_connections` of 50 and two connections held by other clients has 50 − 3 − 2 = 45 left, so the total fits. If your total doesn’t fit, change one of these: + + * **The database** : raise its `max_connections` + * **The replicas** : run fewer, or have your orchestrator start fewer extra replicas in a rolling update + * **The pool** : lower `store.max_connections`, but with [spend limits](</docs/en/claude-apps-gateway-spend-limits>) on, keep it large enough for each replica’s load. Otherwise spend checks can [time out](</docs/en/claude-apps-gateway-spend-limits#postgres-availability>) waiting for a connection, and the gateway logs `spend check failed: spend precheck timed out`. ### @@ -377,13 +407,17 @@ Boot exits: `requires the native binary`| Running under Node instead of the native binary| Install Claude Code with one of the [standalone install methods](</docs/en/setup>) Boot exits with an OIDC discovery error after `config.load`| `oidc.issuer` unreachable, or TLS chain not trusted| Check the issuer is reachable from the pod and serves `/.well-known/openid-configuration`. Set `ca_cert_pem` for private PKI. If the pod reaches the IdP only through a forward proxy, set [`oidc.use_proxy: true`](</docs/en/claude-apps-gateway-config#idp-requests-through-a-forward-proxy>); on versions before v2.1.227, give the pod a direct route to each of the IdP’s endpoints instead. If the pod also can’t resolve the IdP’s hostname, or the proxy refuses `CONNECT` to an IP address, see [Proxy-only egress](</docs/en/claude-apps-gateway-config#proxy-only-egress>), which requires v2.1.277 or later. Boot exits with a Postgres permission error| The database role lacks DDL rights on its schema| Grant the role `CREATE` on the gateway’s schema so it can create and alter its tables at boot -Log: `could not connect to Postgres at boot, attempt 1 of 3`| The database wasn’t reachable yet when the gateway started, for example on a cold instance whose network is still coming up| If the gateway then finishes booting, no action is needed. When the database isn’t reachable, the gateway tries the connection three times, two seconds apart, before it exits. If it exits with `could not connect to Postgres`, check `store.postgres_url`, including that it names one host, and the network path to the database. If the attempts time out rather than being refused, raise [`store.connect_timeout_seconds`](</docs/en/claude-apps-gateway-config#store>) to give each one longer. +Log: `remaining connection slots are reserved` or `sorry, too many clients already`, from PostgreSQL. It shows in running replicas’ `postgres connection closed` warnings, or in a new replica’s boot log. There, `remaining connection slots are reserved` can follow `attempt 1 of 3`, and the replica may still start.| The replicas ask for more connections than the database has left for the gateway, and PostgreSQL refuses the extra ones| Make the total fit, as Size the connection pool describes: run fewer replicas, lower `store.max_connections`, or raise the database’s `max_connections`. If the total fits except during a rolling update, you can instead have your orchestrator stop an old replica before it starts a new one, if it supports that. +Log: `could not connect to Postgres at boot, attempt 1 of 3`, with a reason other than `remaining connection slots are reserved`| The database wasn’t reachable yet when the gateway started, for example on a cold instance whose network is still coming up| If the gateway then finishes booting, no action is needed. When the database isn’t reachable, the gateway tries the connection three times, two seconds apart, before it exits. If it exits with `could not connect to Postgres`, check `store.postgres_url`, including that it names one host, and the network path to the database. If the attempts time out rather than being refused, raise [`store.connect_timeout_seconds`](</docs/en/claude-apps-gateway-config#store>) to give each one longer. +Log: `Postgres <version> is below the supported floor`| The database runs a PostgreSQL version older than your gateway version supports. The gateway keeps running.| Upgrade the database. On PostgreSQL 11, 12, or 13, you can instead upgrade the gateway to meet the [PostgreSQL requirement](</docs/en/claude-apps-gateway#prerequisites>). `/oauth/callback` shows “Sign-in could not be completed”| Email domain rejected, id_token validation failed, or `email_verified` is explicitly `false`, which the gateway always rejects with no override| Check `allowed_email_domains` and that the IdP returns a verified `email` claim. For `email_verified: false`, fix the IdP-side verification. If your IdP emits email under a different claim name, set `oidc.email_claim`. Log: `token exchange failed request_id=<id>: id_token missing email claim`| The IdP isn’t including `email` in the id_token by default. This rejection fires only when `allowed_email_domains` is set; without it, a missing email mints a session with no email| Configure the IdP to emit `email` in the id_token. Okta: add `email` to a custom authorization server’s ID-token claims. Entra: add `email` as an optional claim on the app registration. PingFederate: enable an OpenID Connect Policy that emits `email`. If the IdP serves `email` from the userinfo endpoint but won’t include it in the id_token, such as the Okta org authorization server, set `oidc.userinfo_fallback: true`. Log: `refresh failed request_id=<id>: invalid_token (…) (at userinfo_no_id_token, …)`, and developers see `Cloud gateway session expired` every `session.ttl_hours`| The IdP accepted the refresh token but returned no id_token with it, so the gateway asked the IdP’s userinfo endpoint for the user’s claims. The IdP rejected the refreshed access token there. The gateway answers `temporarily_unavailable`, so Claude Code keeps the refresh token but can’t renew the session. Gateway versions before v2.1.260 log the same line without the `(at …)` detail.| Set [`oidc.scope_on_refresh: true`](</docs/en/claude-apps-gateway-config#oidc>), available in gateway v2.1.260 or later, so the refresh request asks for `openid` again. Some IdPs, such as Okta, return an id_token on refresh only when asked. On PingFederate, enable **Return ID Token On Refresh Grant** under **Applications > OAuth > OpenID Connect Policy Management** instead. The key doesn’t change PingFederate’s behavior. For other IdPs that still omit it, check whether the userinfo endpoint accepts access tokens issued by a refresh. As a stopgap, raise [`session.ttl_hours`](</docs/en/claude-apps-gateway-config#session>). See Identity provider setup for the deprovisioning tradeoff. A developer signs in, then every request from that session fails with a `431` error| The session token in every request’s `Authorization` header lists the developer’s IdP groups, so for a developer in many groups the headers can total more than the gateway accepts| See Request headers too large after sign-in for which limit applies and what to change Every Amazon Bedrock request returns 502; log shows `Could not load credentials from any providers`| On EC2, IMDSv2’s default hop limit of 1 blocks the instance-metadata request from inside the container. Boot and `/readyz` pass anyway because the AWS SDK resolves instance credentials on the first request, not at client construction| Raise the hop limit with `aws ec2 modify-instance-metadata-options --instance-id <id> --http-put-response-hop-limit 2`, or set it in the launch template. The change applies to every container on the instance. Prefer ECS task roles where available, which read credentials from the ECS container-credentials endpoint and avoid the change entirely, or apply the change on a dedicated gateway instance to limit the exposure. At peak load, responses are slow to start or appear to hang, or fail with a 502 `all upstreams failed` while the upstream is healthy| A replica has more requests open than it sends upstream at once, so the extra requests wait inside the gateway. On a `provider: anthropic` upstream, a request that waits longer than `timeouts.upstream_ttfb_ms` gives up on that upstream, which produces the 502 when no later upstream serves it. The log shows a warning that contains `client requests are open`.| Add replicas, or raise the limit on each replica. See Concurrent upstream requests. +On an upstream other than `provider: anthropic`, a turn with a long thinking pause fails. The proxy in front of the gateway logs one request that stays open for about 12.5 minutes, then a run of `504` errors| Claude Code ended a stream that had delivered its first response event and then carried only keepalive pings. It re-sent the request without streaming, and each reply takes longer than the proxy’s timeout.| Raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for your developers. See Long thinking ends in proxy timeouts. +On `provider: anthropic`, a turn with a long thinking pause fails. The proxy logs one request open for about 20 minutes, then `502` or `504` errors| Claude Code ended a stream that had delivered its first response event and then carried only keepalive pings. It re-sent the request without streaming, and each reply takes longer than the gateway’s wait on the upstream, `timeouts.upstream_ttfb_ms`, or the proxy’s timeout.| Raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for your developers. See Long thinking on an Anthropic API upstream. IdP error: unknown or unsupported scope| The IdP rejects scopes it doesn’t recognize| Set `oidc.scopes` to exactly the list your IdP accepts; it must include `openid`. The default is `openid profile email offline_access`. Sessions don’t silently renew after setting `oidc.scopes`| `offline_access` was dropped from the override| Add `offline_access` back if your IdP supports it. Without a refresh token, developers re-run the browser login every `session.ttl_hours`. Browser shows “This request came from another site and was blocked”| Cross-site form POST, blocked as CSRF protection. Expected for embedded or proxied pages| Open the verification link directly @@ -416,6 +450,77 @@ * **`match.groups` in [`managed.policies`](</docs/en/claude-apps-gateway-config#managed>)**: decides which policy applies to a developer * **`rbac_group` [spend caps](</docs/en/claude-apps-gateway-spend-limits>)**: decide which group caps apply to a developer +### + +​ + +Long thinking ends in proxy timeouts + +If your upstream is `provider: anthropic`, use Long thinking on an Anthropic API upstream instead: you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` there too, but the times and errors differ. If turns fail after long thinking and your proxy logs one request open for about 12.5 minutes, then a run of `504` errors, raise [`CLAUDE_STREAM_IDLE_TIMEOUT_MS`](</docs/en/env-vars>) in a gateway policy. For example, with a 240-second idle timeout on the proxy, the run is 10 requests, each cut at 240 seconds. + + * **The first request** : a stream that delivers its first response event, `message_start`, and then only pings while Claude thinks. With default settings, Claude Code ends that stream after about 12.5 minutes. + * **The other 10** : the same request, sent [without streaming](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) and then retried, 10 sends in all by default. They get no pings, so a slow reply hits the proxy’s timeout. + +You don’t need a longer proxy timeout for this fix. If you raise only the proxy’s timeout, requests without streaming still fail once a reply takes longer than Claude Code’s own wait, 300 seconds by default. + +#### + +​ + +Confirm the cause + +Have a developer reproduce the failure with `claude --debug-file ./claude-debug.txt`, then search that file for this line: + + Error streaming, falling back to non-streaming mode: Stream idle timeout - no chunks received + +If your developers already set [`CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`](</docs/en/env-vars>) to `1`, you see no requests without streaming, and the turn ends with `API Error: Stream idle timeout - no chunks received`. The same fix applies. + +#### + +​ + +Pick a value + +Pick a `CLAUDE_STREAM_IDLE_TIMEOUT_MS` value whose second column covers your longest thinking pause, or start with `1800000` if you don’t know it. A stream can stay on pings alone for about 7.5 minutes longer than the value: + +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| A stream can stay on pings alone for +---|--- +`300000`, the default| About 12.5 minutes +`900000`| About 22.5 minutes +`1800000`| About 37.5 minutes + +If an upstream hangs while the gateway keeps sending pings, your developers also wait that long before Claude Code gives up on the stream. A connection that goes fully silent still ends after 5 to 6 minutes, because the [body idle timeout](</docs/en/network-config#streaming-idle-watchdogs>) doesn’t follow this variable. + +#### + +​ + +Deliver the value in a policy + +Add the `env` entry to each policy in `gateway.yaml` that already delivers Claude Code settings to the developers you want to cover. Put it under the `code`, `cli`, or `settings` key that policy already has. To try the value first, start with a policy that matches one group. See [`managed`](</docs/en/claude-apps-gateway-config#managed>) for how policies match and inherit. This example adds the entry to a `match: {}` policy keyed `cli`: + + managed: + policies: + - match: {} + cli: + env: + CLAUDE_STREAM_IDLE_TIMEOUT_MS: "1800000" + +With the `cli` key, you cover terminal, IDE extension, and Agent SDK sessions. For Claude Desktop’s Code tab, see [Choose `cli` or `code`](</docs/en/claude-apps-gateway-config#choose-cli-or-code>). Restart the gateway so that it reads the edited file. Then have developers restart Claude Code to get `CLAUDE_STREAM_IDLE_TIMEOUT_MS`. + +### + +​ + +Long thinking on an Anthropic API upstream + +If `provider: anthropic` is the model’s only upstream and your proxy logs one request open for about 20 minutes, then `502` or `504` errors, raise [`CLAUDE_STREAM_IDLE_TIMEOUT_MS`](</docs/en/env-vars>) in a gateway policy. + + * **The long request** : a stream that delivers `message_start` and then only pings while Claude thinks. Claude Code ends it after about 20 minutes with default settings, and later once you raise the variable. + * **The errors** : requests that Claude Code then sends [without streaming](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>). Each one fails with a `502` from the gateway, or with your proxy’s `504` if the proxy’s timeout is shorter than the gateway’s wait. That wait is [`timeouts.upstream_ttfb_ms`](</docs/en/claude-apps-gateway-config#http-tuning>), which you don’t need to raise for this fix. + +To confirm the cause, see Confirm the cause. Pick the value whose time covers your longest thinking pause: about 20 minutes at the default, 30 at `900000`, and 45 at `1800000`. Then follow Deliver the value in a policy. + ## ​
modified Deploy Claude apps gateway on AWS View current →
--- a/claude-apps-gateway-on-aws.md +++ b/claude-apps-gateway-on-aws.md @@ -532,6 +532,7 @@ This route uses only the [`models`](</docs/en/claude-apps-gateway-config#models>) and [`managed`](</docs/en/claude-apps-gateway-config#managed>) sections. Create one Bedrock [application inference profile](<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-create.html>) per team and model, tag each profile with the team, and activate that tag as a cost allocation tag. Then give each team its own model id in `gateway.yaml` and pin each IdP group to its team’s ids: models: + # Include the served model's id, such as claude-opus-4-8, in each id so the gateway's spend meter can price it. - id: platform-claude-opus-4-8 upstream_model: bedrock: arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123 @@ -547,7 +548,51 @@ - match: {} cli: {availableModels: [claude-opus-4-8, claude-sonnet-4-6], enforceAvailableModels: true} -Tell developers in a pinned team to start Claude Code with `--model platform-claude-opus-4-8`, using their team’s id, because a session started without it runs the default model, which the gateway refuses for them. The gateway enforces `availableModels` on every request, not only in the model picker, and AWS billing groups the spend by the tag you activated. Without the `match: {}` catch-all, a developer who matches no policy gets every model in the catalog and can bill either team’s profile. The costs: the config grows with teams times models, and the role that signs this upstream’s Bedrock requests must also be allowed to invoke the `application-inference-profile/*` ARNs. That role is the gateway’s principal, or with `assume_role` the role it assumes. See [`pricing`](</docs/en/claude-apps-gateway-config#pricing>) for how the gateway’s own spend meter prices these ids. +Tell developers in a pinned team to start Claude Code with `--model platform-claude-opus-4-8`, using their team’s id, because a session started without it runs the default model, which the gateway refuses for them. The gateway enforces `availableModels` on every request, not only in the model picker, and AWS billing groups the spend by the tag you activated. Without the `match: {}` catch-all, a developer who matches no policy gets every model in the catalog and can bill either team’s profile. The costs: + + * The config grows with teams times models + * The role that signs this upstream’s Bedrock requests must also be allowed to invoke the `application-inference-profile/*` ARNs. That role is the gateway’s principal, or with `assume_role` the role it assumes. + +See [How requests are priced](</docs/en/claude-apps-gateway-spend-limits#how-requests-are-priced>) for how the gateway’s own spend meter prices these ids. + +#### + +​ + +Let a developer choose which team to bill + +To let a developer who works for two teams choose which team each session bills, give that pair of teams an IdP group and a policy of its own. + +1 + +Add a group for the pair + +In your IdP, add the developer to a new group, such as `team-platform-and-data`. If they’re already signed in, have them run `/login` again, or wait for the next [silent refresh](</docs/en/claude-apps-gateway-config#managed>), so the gateway sees the new group. + +2 + +List its policy first + +Put the group’s policy above the single-team policies and allow both teams’ ids in it. Copy in any other settings the two team policies set. + + managed: + policies: + - match: {groups: [team-platform-and-data]} + cli: {availableModels: [platform-claude-opus-4-8, data-claude-opus-4-8], enforceAvailableModels: true} + - match: {groups: [team-platform]} + cli: {availableModels: [platform-claude-opus-4-8], enforceAvailableModels: true} + - match: {groups: [team-data]} + cli: {availableModels: [data-claude-opus-4-8], enforceAvailableModels: true} + - match: {} + cli: {availableModels: [claude-opus-4-8, claude-sonnet-4-6], enforceAvailableModels: true} + +3 + +Start each session on a team's id + +Have the developer pass the id of the team the work is for, such as `claude --model data-claude-opus-4-8`. + +The gateway applies the [first policy that matches](</docs/en/claude-apps-gateway-config#managed>), so a developer in only the two team groups gets the `team-platform` policy. Their sessions on the data team’s id fail with `is not in your role's availableModels allowlist`, naming Claude Code’s default model and not the id they typed. If you list both team groups in one policy’s `groups` instead, everyone in either team can bill either team’s profile. In the gateway’s own [spend limits](</docs/en/claude-apps-gateway-spend-limits#set-a-cap>), the developer has one total and one cap per period, by default the lowest of their groups’ caps, whichever id a session uses. To keep one team’s lower cap from stopping work for the other, set a per-user cap for the developer. ##
modified Deploy Claude apps gateway on Google Cloud View current →
--- a/claude-apps-gateway-on-gcp.md +++ b/claude-apps-gateway-on-gcp.md @@ -221,7 +221,11 @@ --set-secrets=/etc/claude/gateway.yaml=gateway-config:latest,GATEWAY_JWT_SECRET=gateway-jwt-secret:latest,OIDC_CLIENT_SECRET=gateway-oidc-client-secret:latest,GATEWAY_POSTGRES_URL=gateway-postgres-url:latest \ --no-invoker-iam-check -Direct VPC egress, via `--network`, `--subnet`, and `--vpc-egress=private-ranges-only`, lets the service reach the Cloud SQL private IP directly. Each instance holds up to [`store.max_connections`](</docs/en/claude-apps-gateway-config#store>) Postgres connections, five by default, so keep maximum instances × `store.max_connections` below your Cloud SQL tier’s connection limit; the reference assets cap instances at 8 for the `db-g1-small` tier for this reason. Public egress to Google Cloud’s Agent Platform endpoints and `accounts.google.com` goes directly to the internet rather than through the VPC, so no Cloud NAT is needed.The invoker IAM check must be open or disabled. The gateway runs its own OIDC and its clients carry no GCP token, so Cloud Run’s invoker check has to admit unauthenticated requests. The gateway’s OIDC sign-in authenticates the request once it reaches the container, with `allowed_email_domains` gating which domains may sign in.Two flags admit unauthenticated requests: +Direct VPC egress, via `--network`, `--subnet`, and `--vpc-egress=private-ranges-only`, lets the service reach the Cloud SQL private IP directly. Public egress to Google Cloud’s Agent Platform endpoints and `accounts.google.com` goes directly to the internet rather than through the VPC, so no Cloud NAT is needed. + +Each instance holds up to [`store.max_connections`](</docs/en/claude-apps-gateway-config#store>) Postgres connections, five by default. Use [Size the connection pool](</docs/en/claude-apps-gateway-deploy#size-the-connection-pool>) to check `--max-instances=8` against the connections your database has left for the gateway, and include the extra instances a rolling update starts. + +The invoker IAM check must be open or disabled. The gateway runs its own OIDC and its clients carry no GCP token, so Cloud Run’s invoker check has to admit unauthenticated requests. The gateway’s OIDC sign-in authenticates the request once it reaches the container, with `allowed_email_domains` gating which domains may sign in.Two flags admit unauthenticated requests: * `--no-invoker-iam-check`: disables the check with no `allUsers` binding to manage, and works under Domain Restricted Sharing * `--allow-unauthenticated`: grants `allUsers` the `run.invoker` role; use it if your organization doesn’t allow `--no-invoker-iam-check`
modified Claude apps gateway spend limits View current →
--- a/claude-apps-gateway-spend-limits.md +++ b/claude-apps-gateway-spend-limits.md @@ -61,6 +61,14 @@ 4. The unknown-model tier of $5/$25 per million input/output tokens, so an ID the meter can’t place is never free. The gateway warns at boot and once per ID at runtime when it uses this tier. Whichever rate applies, the meter then multiplies the amount by [`pricing.multiplier`](</docs/en/claude-apps-gateway-config#pricing>), default `1`. Client aborts are billed too. When a stream ends without the upstream’s final usage frame, the meter bills a floor estimate of about four characters per output token for the text already sent to the client, so aborting requests early doesn’t evade a cap. + +#### + +​ + +Long-prompt rates + +The list price for [Claude Haiku 5.5](<https://platform.claude.com/docs/en/models/haiku-5-5/overview>) has a [higher rate for prompts over a token threshold](</docs/en/model-config#haiku-5-5-context-window-and-pricing>). When Haiku 5.5 serves a request whose prompt exceeds the threshold, a gateway server running Claude Code v2.1.293 or later prices the whole request at that rate. The meter counts input tokens, cache reads, and cache writes toward that threshold. If one of your `pricing.overrides` rows matches the request, that row’s rates apply at any prompt length. ###
modified Use Claude Code in the cloud View current →
--- a/claude-code-on-the-web.md +++ b/claude-code-on-the-web.md @@ -1,4 +1,4 @@ -Cloud sessions are available on Pro, Max, and Team plans, and for Enterprise users with premium seats or Chat + Claude Code seats. +Cloud sessions are available on Pro, Max, and Team plans, and for Enterprise users with premium seats or Chat + Claude Code seats. If your Enterprise organization manages your access with [custom roles](<https://support.claude.com/en/articles/13930452>), you also need a role that includes the cloud sessions permission. Ask an Owner to check your roles and add it at [**Organization settings > Roles**](<https://claude.ai/admin-settings/roles>) if it’s missing. A cloud session is a Claude Code session that runs on cloud infrastructure instead of on your machine. By default it runs on infrastructure Anthropic manages, or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there. The session keeps running after you close your laptop, and you can check on it or steer it from any device. It counts toward your plan’s usage limits alongside the rest of your Claude and Claude Code usage, and there’s no separate charge for the cloud VM. To let cloud sessions clone your code from GitHub and push branches, connect GitHub with one of the GitHub connection methods. If your repository is on GitLab, Bitbucket, or another host, see Platform restrictions for what works. You can start a cloud session from any of these surfaces: @@ -258,7 +258,7 @@ * **`/model`, `/effort`, `/color`, and `/rename`**: pass the value as an argument, for example `/model sonnet`, instead of opening the terminal picker or slider. The argument forms follow each command’s [availability notes](</docs/en/commands#all-commands>). * **`/fast`** : toggles [fast mode](</docs/en/fast-mode#use-fast-mode-in-cloud-sessions>) for the session when fast mode is [available on your account](</docs/en/fast-mode#requirements>). Requires Claude Code v2.1.271 or later in the session’s environment. - * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment. In a session with one repository outside a [project](</docs/en/claude-projects>), commit the key to that repository’s `.claude/settings.json` instead. [Settings in cloud sessions](</docs/en/settings#settings-in-cloud-sessions>) lists what each session reads. + * **`/config`** : in your browser at claude.ai/code, opens the Claude Code section of your settings instead of setting a value, and text after the command, including `key=value`, is ignored. To change a setting for a cloud session, set an [environment variable](</docs/en/cloud-environments#set-environment-variables>) on the environment. In a session with one repository outside a [project](</docs/en/claude-projects>)’s threads, commit the key to that repository’s `.claude/settings.json` instead. [Settings in cloud sessions](</docs/en/settings#settings-in-cloud-sessions>) lists what each session reads. For context management specifically: @@ -464,7 +464,10 @@ Cloud sessions stop after a period of inactivity and the session’s VM is reclaimed. A session counts as inactive while it waits for you to approve an [MCP connector](</docs/en/cloud-environments#network-access>) tool call or to sign in to an MCP server, and it can expire during that wait. Reopen the session from [claude.ai/code](<https://claude.ai/code>) to provision a fresh VM: * **Restored** : your conversation history - * **Not restored** : background work that was still running when the VM was reclaimed, such as subagents and shell commands, and the pending wakeup of a [self-paced `/loop`](</docs/en/scheduled-tasks#let-claude-choose-the-interval>). To restart the loop, run `/loop` again. + * **Not restored** : background work that was still running or pending when the VM was reclaimed, including: + * **Shell commands** : Claude Code tells Claude which commands stopped. Ask Claude to rerun the ones you still need. + * **Subagents** : Claude Code tells Claude which subagents stopped, and which of those can be [resumed](</docs/en/sub-agents#resume-subagents>) instead of started over. Ask Claude to continue their work. + * **Session-scoped scheduled tasks** : tasks you [scheduled in the session](</docs/en/scheduled-tasks>) and a `/loop` waiting for its next iteration don’t carry over to the reopened session. Ask Claude to schedule the tasks again, or run `/loop` again to restart the loop. ##
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -78,7 +78,7 @@ `agents/*.md`| Project and global| ✓| Subagent definitions with their own prompt and tools| [Subagents](</docs/en/sub-agents>) `workflows/*.js`| Project and global| ✓| Dynamic workflow scripts written by Claude and saved from `/workflows`; each file becomes a `/<name>` command| [Dynamic workflows](</docs/en/workflows>) `agent-memory/<name>/`| Project and global| ✓| Persistent memory for subagents| [Persistent memory](</docs/en/sub-agents#enable-persistent-memory>) -`~/.claude.json`| Global only| | App state, OAuth, UI toggles, personal MCP servers| [Global config](</docs/en/settings-reference#global-config-settings>) +`~/.claude.json`| Global only| | App state, account details, UI toggles, personal MCP servers| [Global config](</docs/en/settings-reference#global-config-settings>) `projects/<project>/memory/`| Global only| | Auto memory: Claude’s notes to itself across sessions| [Auto memory](</docs/en/memory#auto-memory>) `keybindings.json`| Global only| | Custom keyboard shortcuts| [Keybindings](</docs/en/keybindings>) `themes/*.json`| Global only| | Custom color themes| [Custom themes](</docs/en/terminal-config#create-a-custom-theme>) @@ -192,7 +192,7 @@ Path under `~/.claude/`| Contents ---|--- -`history.jsonl`| Every prompt you’ve typed, with timestamp and project path. Used for up-arrow recall, `Ctrl+R` history search, and `!` shell-command completion. Each sweep removes the entries older than `cleanupPeriodDays` when the [HIPAA configuration applies to your sessions](</docs/en/hipaa-setup#check-how-developers-sign-in-and-connect>). +`history.jsonl`| Prompts you’ve typed, with timestamp and project path. Used for up-arrow recall, `Ctrl+R` history search, and `!` shell-command completion. Each sweep removes the entries older than `cleanupPeriodDays` when the [HIPAA configuration applies to your sessions](</docs/en/hipaa-setup#check-how-developers-sign-in-and-connect>). `stats-cache.json`| Aggregated token and cost counts shown by `/usage` `remote-settings.json`| Cached copy of [server-managed settings](</docs/en/server-managed-settings>) for your organization, or `{}` when your organization has configured none. Only present when the session [fetches them](</docs/en/server-managed-settings#platform-availability>). Claude Code checks for updates at startup and hourly during a session. Claude Code deletes it when you log out. `cache/changelog.md`| Cached copy of the Claude Code changelog, shown by `/release-notes`. Refreshed in the background. @@ -290,7 +290,7 @@ `~/.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. +Don’t delete `~/.claude.json`, `~/.claude/settings.json`, or `~/.claude/plugins/`: those hold your account details, preferences, and installed plugins. ##
modified Scan your codebase for vulnerabilities View current →
--- a/claude-security.md +++ b/claude-security.md @@ -1,4 +1,4 @@ -The Claude Security plugin runs a multi-agent vulnerability scan of your codebase inside a Claude Code session. A team of Claude agents maps your architecture, builds a threat model, hunts for vulnerabilities, and independently reviews every finding before writing the report. Use the plugin to scan a whole repository or only a set of changes, such as a branch’s diff, a pull request’s diff, or a single commit, then turn the findings you choose into patches that you review and apply yourself. The plugin runs locally in your session, uses whichever models you have access to in Claude Code, and each scan counts toward your [usage](</docs/en/costs>). If you want a managed service that monitors your repositories, or want to run scans on [Claude Mythos](<https://platform.claude.com/docs/en/about-claude/models/introducing-claude-fable-5-and-claude-mythos-5>), see the [Claude Security](<https://claude.com/product/claude-security>) product, available on the Enterprise plan. The plugin reaches code the managed product can’t reach, such as repositories hosted on GitLab or Bitbucket, or on networks that don’t allow inbound connections. The plugin is also distinct from the review tools already in Claude Code: the [security guidance plugin](</docs/en/security-guidance>) reviews code as Claude writes it, [`/security-review`](</docs/en/commands#all-commands>) runs a single pass over your branch, and [Code Review](</docs/en/code-review>) reviews pull requests. For how the layers stack, see How the plugin fits with other security tools. +The Claude Security plugin runs a multi-agent vulnerability scan of your codebase inside a Claude Code session. A team of Claude agents maps your architecture, builds a threat model, hunts for vulnerabilities, and independently reviews every finding before writing the report. Use the plugin to scan a whole repository or only a set of changes, such as a branch’s diff, a pull request’s diff, or a single commit, then turn the findings you choose into patches that you review and apply yourself. The plugin runs locally in your session, uses whichever models you have access to in Claude Code, and each scan counts toward your [usage](</docs/en/costs>). If you want a managed service that monitors your repositories, or want to run scans on [Claude Mythos](<https://platform.claude.com/docs/en/about-claude/models/introducing-claude-fable-5-and-claude-mythos-5>), see the [Claude Security](<https://claude.com/product/claude-security>) product, available on the Enterprise plan. The plugin is also distinct from the review tools already in Claude Code: the [security guidance plugin](</docs/en/security-guidance>) reviews code as Claude writes it, [`/security-review`](</docs/en/commands#all-commands>) runs a single pass over your branch, and [Code Review](</docs/en/code-review>) reviews pull requests. For how the layers stack, see How the plugin fits with other security tools. ##
modified Configure cloud environments View current →
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -184,7 +184,7 @@ Archive an environment -To archive one of your own environments, open it for editing, select **Archive environment** , and confirm. If the environment is shared with your organization, an Owner archives it from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead, so ask an Owner unless you are one. You can’t delete an environment, only archive it. Archiving affects new sessions, not running ones: +To archive one of your own environments, open it for editing, then select **Archive environment** and confirm. If the environment is shared with your organization, an Owner archives it from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead, so ask an Owner unless you are one. Archiving affects new sessions, not running ones: * Sessions already running in the environment continue to work. * The environment disappears from the selector and from `/remote-env`, so you can’t pick it for new sessions. @@ -192,6 +192,8 @@ * No new session can start in an archived environment, on any surface: * **Saved CLI default** : if the environment was your saved CLI default, Claude Code starts CLI cloud sessions in the Anthropic-hosted environment when your list has one. Otherwise, it starts them in the first environment in your list that isn’t a Remote Control bridge environment. * **Configured explicitly** : anything configured with the environment explicitly, such as a [cloud scheduled task](</docs/en/routines#environments-and-network-access>), can’t start new sessions in it. Point it at another environment. + +When you no longer need an Anthropic-hosted environment, archive it. Neither the environment dialog nor the **Cloud environments** admin page has an option to delete an Anthropic-hosted environment. If the environment is [self-hosted](</docs/en/self-hosted-environments>), an Owner can delete it from the **Cloud environments** page in admin settings. If you aren’t an Owner, ask one to delete it. ### @@ -520,7 +522,7 @@ Install dependencies with a SessionStart hook -To install dependencies only in cloud sessions outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), pair a SessionStart hook with a script that checks where it’s running. First, add a SessionStart hook to your repo’s `.claude/settings.json`. This configuration tells Claude Code to run `scripts/install_pkgs.sh` from your repository whenever a session starts or resumes: +To install dependencies only in cloud sessions outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>)’s threads, pair a SessionStart hook with a script that checks where it’s running. First, add a SessionStart hook to your repo’s `.claude/settings.json`. This configuration tells Claude Code to run `scripts/install_pkgs.sh` from your repository whenever a session starts or resumes: { "hooks": {
modified Read and request reviews on a pull request View current →
--- a/code-review-pull-requests.md +++ b/code-review-pull-requests.md @@ -116,7 +116,7 @@ `@claude review`| Starts a single review without subscribing the PR to future pushes| You want one review now, such as on a pull request in a repository set to **Manual** , or another review right away in the other modes `@claude review always`| Starts a review and subscribes the PR to push-triggered reviews going forward| You want every subsequent push to start a fresh review, such as on a high-priority PR in a repository set to **Manual** `@claude review once`| Same as `@claude review`: starts a single review without subscribing| The same cases as `@claude review` -`@claude review stop`| Ends the PR’s subscription to push-triggered reviews, without starting a review or canceling one that’s already queued or running. Claude replies with a comment instead of a check run.| You subscribed a PR with `@claude review always` in a repository set to **Manual** or **Once after PR creation** , and no longer want each push to start a review +`@claude review stop`| Ends the PR’s subscription to push-triggered reviews, without starting a review or canceling one that’s already running. Claude replies with a comment instead of a check run.| You subscribed a PR with `@claude review always` in a repository set to **Manual** or **Once after PR creation** , and no longer want each push to start a review `@claude review off` or `@claude review pause`| Same as `@claude review stop`| The same cases as `@claude review stop` In a repository set to **After every push** , you can’t stop reviews with a comment, because pushes there start reviews with or without a subscription. To stop pushes from starting reviews on one pull request there, convert it to a draft. When you mark it ready for review again, a review starts. For any comment command to take effect, all of these conditions have to hold:
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -43,7 +43,7 @@ `/bug [report]`| Report a bug or share your conversation. You choose how much session history to include and confirm on a consent screen before anything is sent. When you’re signed in to Anthropic on a first-party connection, the report goes to Anthropic; on a third-party provider, or without Anthropic credentials, Claude Code writes the report to a [local archive under `~/.claude/feedback-bundles/`](</docs/en/data-usage#telemetry-services>) that you forward yourself. In the [VS Code extension](</docs/en/vs-code#use-the-prompt-box>), `/bug` opens the extension’s own feedback dialog instead; requires Claude Code v2.1.229 or later. When you run it while Claude is responding, Claude Code opens the dialog immediately. Before v2.1.232, Claude Code queued the command until the turn finished. Alias: `/share`. Before v2.1.212, `/bug` and `/share` were aliases of `/feedback` `/cd <path>`| Move this session to a new working directory, keeping the conversation. Type a partial path to see matching directory suggestions; press `Tab` to accept one. For what Claude Code applies from the new directory as soon as you move, and how `/cd` differs from `/add-dir`, see [Move the session to another directory](</docs/en/permissions#move-the-session-to-another-directory>) `/chrome`| Configure [Claude in Chrome](</docs/en/chrome>) settings -`/claude-api [migrate|upgrade|managed-agents-onboard|managed-agents-secure|prompt-audit|cost-optimize|build-eval|hillclimb|preserved-thinking-migration]`| **[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`. For what each subcommand does and the version it requires, see [Work on Claude API projects](</docs/en/skills#work-on-claude-api-projects>) +`/claude-api [migrate|upgrade|api-version|managed-agents-onboard|managed-agents-secure|prompt-audit|cost-optimize|build-eval|hillclimb|preserved-thinking-migration]`| **[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`. For what each subcommand does and the version it requires, see [Work on Claude API projects](</docs/en/skills#work-on-claude-api-projects>) `/claude-in-chrome [task]`| **[Skill](</docs/en/skills#bundled-skills>).** Have Claude carry out a task in your browser, such as testing a page, filling a form, or reading console logs, through [Claude in Chrome](</docs/en/chrome>). Available when Chrome integration is enabled for the session, for example with `claude --chrome`, or when Claude Code can offer to [install the extension](</docs/en/chrome#install-the-extension-when-claude-asks>) `/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>). Aliases: `/reset`, `/new` `/code-review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [--max-findings n|all|default] [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 have Claude apply the 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 locally with `/code-review`](</docs/en/code-review-local>) for the effort levels, targeting, and how it relates to `/simplify`. Alias: `/review`
modified Common workflows View current →
--- a/common-workflows.md +++ b/common-workflows.md @@ -383,7 +383,10 @@ * Directory references show file listings, not contents * You can reference multiple files in a single message (for example, “@file1.js and @file2.js”) -To stop `@` references from including file contents and directory listings in your message, set [`CLAUDE_CODE_DISABLE_FILE_MENTIONS=1`](</docs/en/env-vars#variables>) in your shell or user settings. Claude then receives the paths you referenced with a note to read them using its file tools. The variable requires Claude Code v2.1.299 or later, and Claude Code ignores it in project and local settings. +To stop `@` references from including file contents and directory listings, set [`CLAUDE_CODE_DISABLE_FILE_MENTIONS`](</docs/en/env-vars#variables>) to `1` in your shell or in the [`env` block](</docs/en/env-vars#set-variables-in-settings-files>) of user settings or [managed settings](</docs/en/managed-settings>). Claude then receives the paths you referenced with a note to read them using its file tools. The variable requires Claude Code v2.1.299 or later, and Claude Code ignores it in project and local settings. Your [`PreToolUse` hooks](</docs/en/hooks#pretooluse>) don’t run when Claude Code includes a file you reference with `@`, because it makes no tool call. If you rely on those hooks to control what Claude reads, block specific paths or stop `@` references from including files: + + * **Block specific paths** : add a [`Read` deny rule](</docs/en/permissions#read-and-edit>) for them. Claude Code doesn’t include a file that the rule matches. + * **Stop`@` references from including files**: set `CLAUDE_CODE_DISABLE_FILE_MENTIONS=1`, which stops `@` file and directory references in your messages from including content, even for paths your hooks don’t check. Your matching hooks then run before Claude opens a referenced path with a tool such as `Read`. * * *
modified Add components to a plugin View current →
--- a/components.md +++ b/components.md @@ -146,6 +146,7 @@ * **Supported fields** : `name`, `description`, `model`, `effort`, `maxTurns`, `autoCompactWindow`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, `omitClaudeMd`, `isolation`, `color`, and the `cacheTtl` key of `experimental`. The only valid `isolation` value is `"worktree"`. See [supported frontmatter fields](</docs/en/sub-agents#supported-frontmatter-fields>) for what each one does * **Ignored fields** : `permissionMode`, `hooks`, `mcpServers`, and `initialPrompt`. An agent file can’t add hooks or MCP servers on its own, so add those as plugin hooks and MCP servers instead + * **A`name` longer than 256 characters**: Claude Code ignores it and names the agent after its file, as it does when the field is missing * **Frontmatter that doesn’t parse** : the agent still loads with every field ignored. It’s named after the file, and its description reads `Agent from my-plugin plugin`. Run [`claude plugin validate`](</docs/en/plugins/cli-reference#plugin-validate>) in your shell to find these files For what each field does and the precedence rules, see [Subagents](</docs/en/sub-agents#supported-frontmatter-fields>).
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -363,10 +363,11 @@ cmd=$(echo "$input" | jq -r '.tool_input.command') # If running tests, filter to show only failures - if [[ "$cmd" =~ ^(npm test|pytest|go test) ]]; then + pattern='^(npm test|pytest|go test)( [^;&|<>`$#\\[:cntrl:]]*)?$' + if [[ "$cmd" =~ $pattern ]]; then filtered_cmd="$cmd 2>&1 | grep -A 5 -E '(FAIL|ERROR|error:)' | head -100" echo "$input" | jq --arg filtered "$filtered_cmd" \ - '{hookSpecificOutput: {hookEventName: "PreToolUse", permissionDecision: "allow", updatedInput: (.tool_input + {command: $filtered})}}' + '{hookSpecificOutput: {hookEventName: "PreToolUse", updatedInput: (.tool_input + {command: $filtered})}}' else echo "{}" fi
modified Create a Claude Code plugin View current →
--- a/create.md +++ b/create.md @@ -155,7 +155,7 @@ * `--plugin-dir`: loads a directory or `.zip` archive for one session. * `--plugin-url`: fetches a `.zip` archive from a URL for one session. - * `claude plugin init`: scaffolds a plugin under `~/.claude/skills/` that loads every session. + * `claude plugin init`: scaffolds a plugin under `~/.claude/skills/` that loads across sessions. If two plugins loaded in different ways share a name, see [Name conflicts](</docs/en/plugins/loading#name-conflicts>) for which one Claude Code keeps. @@ -216,7 +216,7 @@ Make a plugin load in every session -Your personal skills directory is `~/.claude/skills/`. Claude Code loads any folder there that contains a `.claude-plugin/plugin.json` as a plugin in every session, with no flag and no install step. `claude plugin init` scaffolds one of these plugins for you. +Your personal skills directory is `~/.claude/skills/`, and a folder there that contains a `.claude-plugin/plugin.json` is a skills-directory plugin. Unless your administrator has [blocked skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>), Claude Code loads each one when a session starts, with no flag and no install step. `claude plugin init` scaffolds one for you. #### @@ -252,7 +252,7 @@ Share the plugin through a repository -`claude plugin init` writes the plugin to your personal skills directory at `~/.claude/skills/`, so it loads for you in every project. To make a plugin load for everyone in one repository, create the same layout yourself at `<project>/.claude/skills/<name>/`, including its `.claude-plugin/plugin.json`. See [Plugins shared through a repository](</docs/en/plugins/loading#plugins-shared-through-a-repository>) for the conditions under which Claude Code loads it. +`claude plugin init` writes the plugin to your personal skills directory at `~/.claude/skills/`, which all your projects on this machine share. To make a plugin load for everyone in one repository, create the same layout yourself at `<project>/.claude/skills/<name>/`, including its `.claude-plugin/plugin.json`. See [Plugins shared through a repository](</docs/en/plugins/loading#plugins-shared-through-a-repository>) for the conditions under which Claude Code loads it. ## @@ -266,6 +266,7 @@ 2. In the running session, run `/reload-plugins` to apply edits you made on disk. It prints one `Reloaded:` line with counts. Then confirm a skill loaded by typing its `/plugin-name:skill` command, or by finding the plugin in the `/plugin` **Installed** tab. 3. In the same session, run `/plugin`. The **Installed** tab lists your plugin and, in the plugin’s details, the components Claude Code found. The **Errors** tab lists what failed to load and why, such as a path in your manifest that doesn’t exist. 4. Back in your shell, run `claude plugin list`. It prints session-only and skills-directory plugins in their own sections with `Status: ✔ loaded` or the load error. To include the plugin you’re developing, pass `--plugin-dir` with its path before `plugin list`. + 5. If your plugin is in a skills directory and `claude plugin list` doesn’t print it, with no error there or in `/plugin`, see [Skills-directory plugins blocked by managed settings](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>). To check an MCP server, run `/mcp` in the session to see the server’s status. When the server is healthy, `/mcp` lists it as connected. If it isn’t, see [MCP servers that don’t start](</docs/en/plugins/troubleshooting#invalid-mcp-server-config-for-and-mcp-servers-that-dont-start>). To check a hook, trigger the event it matches. For example, ask Claude to edit a file to trigger a `PostToolUse` hook. Then read the [debug log](</docs/en/hooks#debug-hooks>), which shows which hooks matched, their exit codes, and their output. The next sections cover the failures you’re most likely to hit while developing, and the [troubleshooting page](</docs/en/plugins/troubleshooting#build-a-plugin>) has the full entry for each.
modified Debug your configuration View current →
--- a/debug-your-config.md +++ b/debug-your-config.md @@ -55,6 +55,7 @@ * The hook is defined in a standalone file. Hooks go under the `"hooks"` key in a [settings file](</docs/en/settings#settings-files>). * The `matcher` value is an array instead of a single string. Claude Code lists the entry as an invalid setting when you start an interactive session and in `claude doctor`. If the array is under `PreToolUse` or `PermissionRequest`, none of that file’s other hooks load either. + * The hook is in a skill’s frontmatter, and neither you nor Claude has invoked the skill yet in this session. Invoke it or ask Claude to, then run `/hooks` again. If the hook still doesn’t appear, check for other causes, such as [frontmatter that didn’t parse](</docs/en/skills#skill-not-triggering>) or one of the [limits on skill hooks](</docs/en/hooks#limits-on-skill-hooks>). If the hook appears but doesn’t fire, the matcher is the usual cause. Check it for these mistakes:
modified Desktop application View current →
Show diff (185 lines)
--- a/desktop.md +++ b/desktop.md @@ -1,4 +1,4 @@ -The Claude Desktop app has three tabs: **Chat** for conversations, **Cowork** for [Dispatch and longer agentic work](<https://claude.com/product/cowork>), and **Code** for software development. This page is the reference for the Code tab. +In the Claude Desktop app, Claude Code is the **Code** tab. The app also has chat and [Cowork](<https://claude.com/product/cowork>), which handles Dispatch and longer agentic work. This page is the reference for the Code tab. ## Download for macOS @@ -220,7 +220,12 @@ Arrange your workspace -The Code tab is built around panes you can arrange in any layout: chat, diff, browser, terminal, file, plan, tasks, and subagent, along with the [iOS Simulator](</docs/en/desktop-ios-simulator>) on macOS. Drag a pane by its header to reposition it, or drag a pane edge to resize it. Press **Cmd+\** on macOS or **Ctrl+\** on Windows to close the focused pane. Click **Terminal** , **Changes** , or **Browser** in the session’s title bar to open the terminal, diff, or Browser pane. The **⋮** menu beside them opens more panes, such as **Files** , and holds those buttons when the window is too narrow to show them. To work across screens, pop a pane such as the diff or terminal out into its own window, and dock it back when you’re done. Claude keeps working in the main window. +The Code tab is built around panes you can arrange in any layout: chat, diff, browser, terminal, file, plan, tasks, and subagent, along with the [iOS Simulator](</docs/en/desktop-ios-simulator>) on macOS. Drag a pane by its header to reposition it, or drag a pane edge to resize it. Press **Cmd+\** on macOS or **Ctrl+\** on Windows to close the focused pane. To open another pane, click its icon button in the session’s title bar. Hover to see each button’s name, such as **Terminal** , **Changes** for the diff view, **Browser** , and **Files**. If the pane you want has no button in the title bar, select it from the **⋮** menu beside the buttons: + + * **When the window is narrow** : buttons that don’t fit move into the menu + * **For panes with no button** : panes such as **Background tasks** and **Plan** are listed once the session has something to show in those panes + +To work across screens, pop a pane such as the diff or terminal out into its own window, and dock it back when you’re done. Claude keeps working in the main window. The pane layout, terminal, file editor, and view modes in this section require Claude Desktop v1.2581.0 or later. Open **Claude > Check for Updates…** on macOS or **Help > Check for Updates…** on Windows to update. @@ -230,7 +235,7 @@ See session details -The session details panel is a set of cards beside the chat that show where the session runs, what it changed, and what it’s running. The panel appears after you start a session, while the chat is wide enough for it. +The session details panel is a set of cards beside the chat that show where the session runs, what it changed, what it’s running, and its context usage. The panel appears after you start a session, while the chat is wide enough for it. #### @@ -278,7 +283,7 @@ * **Attach as context** : add the file to your next prompt * **Open in** : open the file in an installed editor such as VS Code, Cursor, or Zed * **Show in Finder** on macOS, **Show in Explorer** on Windows: open the containing folder - * **Copy path** : copy the absolute path to your clipboard + * **Copy** : a submenu that copies the file’s **Absolute path** , **Relative path** , or **Filename** ### @@ -305,6 +310,7 @@ Press **Cmd+/** on macOS or **Ctrl+/** on Windows to see all shortcuts available in the Code tab. The table in this section shows the macOS keys. On Windows and Linux, change these keys: * **Cmd+Option** : press **Alt** + * **Cmd+Ctrl** : press **Ctrl+Alt** * **Cmd** : press **Ctrl** Session cycling, the terminal toggle, and the view-mode toggle use **Ctrl** on every platform. @@ -325,6 +331,7 @@ `Cmd` `Shift` `S`| Select an element in the Browser `Ctrl` ```| Toggle terminal pane `Cmd` `\`| Close focused pane +`Cmd` `Ctrl` `W`| Take focused session out of split view `Cmd` `;`| Open side chat `Ctrl` `O`| Cycle view modes `Cmd` `Shift` `M`| Open permission mode menu @@ -340,7 +347,12 @@ Check usage -Click the usage ring next to the model picker to see your current context window usage and your plan usage for the period. Context usage is per session; plan usage is shared across all your Claude Code surfaces. +To see how full this session’s context window is, find your Code tab layout: + + * **Current layout** : the header of the **Context** card in the session details panel shows it as a percentage. Open the card to see what is using the window by category. + * **Earlier layout** : click the usage ring next to the model picker. Its popover shows your context window usage. + +In either layout, type `/context` in the prompt box to print a per-category breakdown of this session’s context window in the chat. Both layouts have the usage ring next to the model picker. Click it to see your plan usage, which is shared across all your Claude Code surfaces. ## @@ -350,7 +362,7 @@ Computer use lets Claude open your apps, control your screen, and work directly on your machine the way you would. Ask Claude to interact with a desktop tool that has no CLI, or automate something that only works through a GUI. For running and testing iOS apps, Desktop opens the dedicated [iOS Simulator pane](</docs/en/desktop-ios-simulator>) instead of controlling your screen; the pane works without enabling computer use. -Computer use is a research preview on macOS and Windows that requires a Pro or Max plan. It is not available on Team or Enterprise plans. The Claude Desktop app must be running. +Computer use is a research preview on macOS and Windows that requires a Pro or Max plan. It is not available on Team or Enterprise plans. The Claude Desktop app must be running. On macOS, computer use requires macOS 14 or later. Computer use is off by default. Enable it in Settings before Claude can control your screen. On macOS, you also need to grant Accessibility and Screen Recording permissions. On macOS, computer use can also run in the background: Claude works in the apps you’ve approved while you keep working. @@ -436,7 +448,12 @@ Work in parallel with sessions -Click **\+ New** in the sidebar, or press **Cmd+N** on macOS or **Ctrl+N** on Windows, to work on multiple tasks in parallel. Press **Ctrl+Tab** and **Ctrl+Shift+Tab** to cycle through sessions in the sidebar. To view two sessions at once, hold **Cmd** on macOS or **Ctrl** on Windows and click a session in the sidebar. The session opens in a second pane alongside the one you already have open. While the split is active, clicking another sidebar session replaces whichever pane has focus. Press **Cmd+\** on macOS or **Ctrl+\** on Windows to close the focused pane and return to a single session. +Click **\+ New** in the sidebar, or press **Cmd+N** on macOS or **Ctrl+N** on Windows, to work on multiple tasks in parallel. Press **Ctrl+Tab** and **Ctrl+Shift+Tab** to cycle through sessions in the sidebar. You can also open a second session next to the current session or in a window of its own: + + * **Side by side** : hold **Option** on macOS or **Alt** on Windows and click a session in the sidebar, or right-click the session and select **Open in** , then **Split view** + * **In its own window** : hold **Cmd** on macOS or **Ctrl** on Windows and click a session, or right-click the session and select **Open in** , then **New window** + +In the split view, the pane you opened or clicked last has focus, and the other pane is dimmed. To change which session a pane shows, click in that pane to give it focus, then click a session in the sidebar. To take the focused session out of the split view, press **Cmd+Ctrl+W** on macOS or **Ctrl+Alt+W** on Windows. #### @@ -456,7 +473,7 @@ You can also set a **Branch prefix** in **Settings > Claude Code**. Desktop prepends it to every worktree branch name, which is useful for keeping Claude-created branches organized. To include gitignored files like `.env` in new worktrees, create a [`.worktreeinclude` file](</docs/en/worktrees#copy-gitignored-files-into-worktrees>) in your project root. See [What worktrees share with the main checkout](</docs/en/worktrees#what-worktrees-share-with-the-main-checkout>) for where a worktree session reads project settings, hooks, and skills. -Session isolation requires [Git](<https://git-scm.com/downloads>). Most Macs include Git by default. Run `git --version` in Terminal to check; if it prints a version number, Git is installed. If you run into Git errors, ask Claude in the [Cowork tab](<https://claude.com/product/cowork>) to help troubleshoot your setup. +Session isolation requires [Git](<https://git-scm.com/downloads>). Most Macs include Git by default. Run `git --version` in Terminal to check; if it prints a version number, Git is installed. If you run into Git errors, ask Claude in [Cowork](<https://claude.com/product/cowork>) to help troubleshoot your setup. ### @@ -540,14 +557,26 @@ Work across sessions -Claude can list your other Code tab sessions, read what each has been doing, and send messages between them. Ask in plain language: “which session touched the auth refactor?”, “what did the API session conclude?”, or “tell the payments session the schema changed”. You can also ask Claude to rename or archive a session. For example, ask it to archive the sessions whose PRs have merged. Through this surface, Claude sees only the sessions the desktop app runs itself: local, SSH, and [WSL](</docs/en/desktop-wsl>) sessions in the Code tab. Claude doesn’t see cloud sessions, or sessions you started from the terminal CLI or the VS Code extension, even in worktrees of the same project, so with nine terminal worktrees open and two desktop sessions, Claude answering in one of them reports the one other desktop session. Claude never lists the session you’re asking from. By default it sees the 20 most recently active sessions and skips archived sessions unless you ask for them. [Cross-session messaging](</docs/en/cross-session-messaging>) separately lets Claude message [your other Claude Code sessions](</docs/en/cross-session-messaging#see-which-sessions-claude-can-reach>), including terminal sessions. When Claude messages another session through this surface, Claude Code shows it there as a card labeled with the sending session’s title and a link back, so you can always tell where a message came from. If the receiving session is mid-task, Claude Code holds the message and Claude reads it once the current work finishes. The receiving Claude can reply, and Claude Code delivers the reply back through this surface. Claude can’t deliver to an archived session, and tells you when a message doesn’t go through. Claude Code applies four safety behaviors across sessions: +Claude can list your other Code tab sessions, read what each has been doing, and send messages between them. Ask in plain language: “which session touched the auth refactor?”, “what did the API session conclude?”, or “tell the payments session the schema changed”. You can also ask Claude to rename or archive a session. For example, ask it to archive the sessions whose PRs have merged. Through this surface, Claude sees only the sessions the desktop app runs itself: local, SSH, and [WSL](</docs/en/desktop-wsl>) sessions in the Code tab. Claude doesn’t see cloud sessions, or sessions you started from the terminal CLI or the VS Code extension, even in worktrees of the same project, so with nine terminal worktrees open and two desktop sessions, Claude answering in one of them reports the one other desktop session. Claude never lists the session you’re asking from. By default it sees the 20 most recently active sessions and skips archived sessions unless you ask for them. [Cross-session messaging](</docs/en/cross-session-messaging>) separately lets Claude message [your other Claude Code sessions](</docs/en/cross-session-messaging#see-which-sessions-claude-can-reach>), including terminal sessions. When Claude messages another session through this surface, Claude Code shows it there as a card labeled with the sending session’s title and a link back, so you can always tell where a message came from. If the receiving session is mid-task, Claude Code holds the message and Claude reads it once the current work finishes. The receiving Claude can reply, and Claude Code delivers the reply back through this surface. Claude can’t deliver to an archived session, and tells you when a message doesn’t go through. Claude Code applies three safety behaviors across sessions: * You get an approval card before Claude archives a session, except in Auto mode and Bypass permissions mode, where Claude can archive a session without one. To be asked, switch to Manual. - * Through this surface, Claude can’t send cross-session messages from a session nobody is watching, such as a scheduled-task run, and can’t deliver messages into one. * Claude Code checks each message from this surface against the receiving session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>), even when the receiving session doesn’t have [cross-session messaging](</docs/en/cross-session-messaging#availability>) itself. If you set [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) to `refuse` in the receiving session, Claude Code drops messages from this surface. Claude Code reports the refusal to the Claude desktop app. Before v2.1.234, Claude Code dropped every message from this surface to a receiving session without cross-session messaging. * Claude Code quotes each incoming message and attributes it to the session that sent it, and Claude still follows the receiving session’s own permission settings when acting on one. -Claude can also suggest new sessions. When it notices something worth fixing that’s out of scope for the current task, it offers the work as a task chip in the chat. Click the chip to start that work in a new session with its own worktree; Claude continues your current session uninterrupted. +### + +​ + +Start a task that Claude suggests + +When Claude notices something worth fixing outside your current task, it suggests that work as a task. In local and SSH sessions on the current layout, the suggestion is a card in the chat, and its buttons either start the task or keep it in this session: + + * **Start** : starts the task in another session. By default the task runs in the current session’s environment. The card then shows the started session’s state, and the sidebar lists the started session under the current session. + * **Do it here** : sends the task to the current session as a message + * **Options** : review or change settings such as the environment, model, worktree, and permissions before you click **Start** + * **Start all** : when the card lists several tasks, starts each task in its own session without waiting for one task to finish before starting the next + +In cloud sessions, and in local and SSH sessions on the earlier layout, the suggestion is a **Suggested task** card. To start the task where the card’s main button says, for example **Send to cloud** or **Start with worktree** , click that button. Click the caret beside the main button for other ways to start the task, including **Do it here**. ### @@ -600,7 +629,23 @@ Sessions from Dispatch -[Dispatch](<https://support.claude.com/en/articles/13947068>) is a persistent conversation with Claude that lives in the [Cowork](<https://claude.com/product/cowork>) tab. You message Dispatch a task, and it decides how to handle it. A task can end up as a Code session in two ways: you ask for one directly, such as “open a Claude Code session and fix the login bug”, or Dispatch decides the task is development work and spawns one on its own. Tasks that typically route to Code include fixing bugs, updating dependencies, running tests, or opening pull requests. Research, document editing, and spreadsheet work stay in Cowork. Either way, the Code session appears in the Code tab’s sidebar with a **Dispatch** badge. You get a push notification on your phone when it finishes or needs your approval. If you have computer use enabled, Dispatch-spawned Code sessions can use it too. App approvals in those sessions expire after 30 minutes and re-prompt, rather than lasting the full session like regular Code sessions. For setup, pairing, and Dispatch settings, see the [Dispatch help article](<https://support.claude.com/en/articles/13947068>). Dispatch requires a Pro or Max plan and is not available on Team or Enterprise plans. Dispatch is one of several ways to work with Claude when you’re away from your terminal. For a comparison with the other options, see [Platforms and integrations](</docs/en/platforms#work-when-you-are-away-from-your-terminal>). +[Dispatch](<https://support.claude.com/en/articles/13947068>) is a persistent conversation with Claude that lives in [Cowork](<https://claude.com/product/cowork>). You message Dispatch a task, and it decides how to handle it. A task can end up as a Code session in two ways: you ask for one directly, such as “open a Claude Code session and fix the login bug”, or Dispatch decides the task is development work and spawns one on its own. Tasks that typically route to Code include fixing bugs, updating dependencies, running tests, or opening pull requests. Research, document editing, and spreadsheet work stay in Cowork. + +#### + +​ + +Follow a session that Dispatch started + +The session that Dispatch starts appears in the Code tab’s sidebar with your other sessions. With the sidebar’s default grouping and sorting, look for the newest session in the group for the folder it runs in. You get a push notification on your phone when it finishes or needs your approval. If you have computer use enabled, Dispatch-spawned Code sessions can use it too. App approvals in those sessions expire after 30 minutes and re-prompt, rather than lasting the full session like regular Code sessions. + +#### + +​ + +Set up Dispatch + +For setup, pairing, and Dispatch settings, see the [Dispatch help article](<https://support.claude.com/en/articles/13947068>). Dispatch requires a Pro or Max plan and is not available on Team or Enterprise plans. Dispatch is one of several ways to work with Claude when you’re away from your terminal. For a comparison with the other options, see [Platforms and integrations](</docs/en/platforms#work-when-you-are-away-from-your-terminal>). ## @@ -608,7 +653,7 @@ Extend Claude Code -Connect external services, add reusable workflows, customize Claude’s behavior, and configure preview servers. To manage connectors, skills, and plugins in one place, click **Customize** in the sidebar. The [Cowork](<https://claude.com/product/cowork>) tab in the Desktop app sources its skills, plugins, and connectors from this Customize configuration, which syncs through your claude.ai account, not from the CLI’s `~/.claude` directory. Claude Code also loads the skills and plugins enabled for your claude.ai account in terminal sessions where you sign in with the same account. See [Skills synced from claude.ai](</docs/en/skills#how-synced-skills-behave>) and [Plugins synced from claude.ai](</docs/en/plugins/loading#synced-plugins>). +Connect external services, add reusable workflows, customize Claude’s behavior, and configure preview servers. To manage connectors, skills, and plugins in one place, click **Customize** in the sidebar. [Cowork](<https://claude.com/product/cowork>) in the Desktop app sources its skills, plugins, and connectors from this Customize configuration, which syncs through your claude.ai account, not from the CLI’s `~/.claude` directory. Claude Code also loads the skills and plugins enabled for your claude.ai account in terminal sessions where you sign in with the same account. See [Skills synced from claude.ai](</docs/en/skills#how-synced-skills-behave>) and [Plugins synced from claude.ai](</docs/en/plugins/loading#synced-plugins>). ### @@ -848,7 +893,7 @@ Create a saved environment -A saved environment is an entry in the environment selector that records where Claude runs, so you can start later sessions there. A local or SSH environment also holds the folders Claude works in. Saved local and SSH environments require Claude Desktop v2.37337.0 or later. +A saved environment is an entry in the environment selector that records where Claude runs, so you can start later sessions there. A local or SSH environment also holds the folders Claude works in. Saved local and SSH environments are part of the current layout, so if you don’t see them, check which layout you have and how to get the current one. 1 @@ -1961,7 +2006,8 @@ If a new session has no environment selector under the prompt box, you have the earlier layout: * **Desktop older than v2.37337.0** : update to get the current layout. Select **Claude > Check for Updates…** on macOS or **Help > Check for Updates…** on Windows. - * **[Third-party provider](</docs/en/third-party-integrations>)** : you keep the earlier layout, so there is nothing to do. + * **[Third-party provider](</docs/en/third-party-integrations>) with sessions on your computer**: the current layout requires Claude Desktop v3.1623.0 or later, so check your version. To update, select **Claude > Check for Updates…** on macOS or **Help > Check for Updates…** on Windows. If your organization turns off auto-updates, **Check for Updates…** is hidden, so ask your administrator for v3.1623.0 or later. + * **Third-party provider with sessions on your organization’s infrastructure** : when your organization runs sessions on its own infrastructure rather than on your computer, Desktop keeps the earlier layout, and updating doesn’t change the layout. If you don’t know where your sessions run, ask your administrator. In the earlier layout, choose the environment and project folder above the prompt box, and the permission mode and model in the row under it. The earlier layout lacks the session details panel and saved local and SSH environments.
modified Claude Desktop on Linux (beta) View current →
--- a/desktop-linux.md +++ b/desktop-linux.md @@ -19,13 +19,13 @@ Cowork requirements -Cowork is the desktop tab for [Dispatch and longer agentic work](<https://claude.com/docs/cowork/overview>). On Linux, Cowork runs those tasks in a virtual machine that the desktop app hosts with QEMU and KVM. To use Cowork, your machine needs: +Cowork is the part of the desktop app for [Dispatch and longer agentic work](<https://claude.com/docs/cowork/overview>). On Linux, Cowork runs those tasks in a virtual machine that the desktop app hosts with QEMU and KVM. To use Cowork, your machine needs: - * **Hardware virtualization** : turned on in your firmware settings. Without it, the Cowork tab reports “Cowork requires hardware virtualization (KVM)”. - * **QEMU and UEFI firmware** : `qemu-system-x86`, `ovmf`, and `virtiofsd` on x86_64, or `qemu-system-arm`, `qemu-efi-aarch64`, and `virtiofsd` on arm64. `apt install claude-desktop` installs them by default as recommended packages. If you installed with `--no-install-recommends`, or your system is a minimal image that skips recommended packages, the Cowork tab reports “Cowork requires QEMU” and shows the `apt install` command to run. Ubuntu 22.04 has no `virtiofsd` package; the app uses a bundled copy there. + * **Hardware virtualization** : turned on in your firmware settings. Without it, Cowork reports “Cowork requires hardware virtualization (KVM)”. + * **QEMU and UEFI firmware** : `qemu-system-x86`, `ovmf`, and `virtiofsd` on x86_64, or `qemu-system-arm`, `qemu-efi-aarch64`, and `virtiofsd` on arm64. `apt install claude-desktop` installs them by default as recommended packages. If you installed with `--no-install-recommends`, or your system is a minimal image that skips recommended packages, Cowork reports “Cowork requires QEMU” and shows the `apt install` command to run. Ubuntu 22.04 has no `virtiofsd` package; the app uses a bundled copy there. * **Access to`/dev/kvm`**: add your user to the `kvm` group with `sudo usermod -aG kvm $USER`, then log out and back in. Some desktop environments grant the logged-in user access to `/dev/kvm` without the group, but Cowork also needs `/dev/vhost-vsock`, which only `kvm` group members can open. Join the group even if `/dev/kvm` already works for you. -The app checks these requirements once at launch: restart it after installing packages, and log out and back in after joining the group. If `/dev/vhost-vsock` is missing and your running kernel has no module directory under `/lib/modules`, the Cowork tab reports that the kernel doesn’t include the virtualization support Cowork needs and that it can’t be added manually. This combination is common on ChromeOS and in container-based Linux environments. +The app checks these requirements once at launch: restart it after installing packages, and log out and back in after joining the group. If `/dev/vhost-vsock` is missing and your running kernel has no module directory under `/lib/modules`, Cowork reports that the kernel doesn’t include the virtualization support Cowork needs and that it can’t be added manually. This combination is common on ChromeOS and in container-based Linux environments. ## @@ -167,7 +167,7 @@ Cowork isn’t available -If the Cowork tab shows one of these messages, fix the requirement it names, then restart the app: +If Cowork shows one of these messages, fix the requirement it names, then restart the app: * **Cowork requires QEMU** : install the QEMU and UEFI firmware packages the message lists. * **Cowork requires hardware virtualization (KVM)** : turn on hardware virtualization in your firmware settings.
modified Get started with the desktop app View current →
--- a/desktop-quickstart.md +++ b/desktop-quickstart.md @@ -1,4 +1,4 @@ -The desktop app gives you Claude Code with a graphical interface, so you can ask Claude to work on the code in a folder on your computer and review its changes without using a terminal. This page walks through installing the app and starting your first session in the **Code** tab. Claude Code requires a [Pro, Max, Team, or Enterprise subscription](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=desktop_quickstart_pricing>). +The desktop app gives you Claude Code with a graphical interface. You can ask Claude to work on the code in a folder on your computer and review its changes without using a terminal. Claude Code is in the **Code** tab at the top of the app’s sidebar. This page walks through installing the app and starting your first session there. Claude Code requires a [Pro, Max, Team, or Enterprise subscription](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=desktop_quickstart_pricing>). ## Download for macOS @@ -18,14 +18,8 @@ * **Already set up** : see [Use Claude Code Desktop](</docs/en/desktop>) for everything the Code tab can do * **Want`claude` in your terminal**: [install the CLI](</docs/en/quickstart>) separately - -The desktop app has three tabs: - - * **Chat** : General conversation with no file access, similar to claude.ai. - * **Cowork** : An autonomous background agent that works on tasks independently while you do other work. - * **Code** : An interactive coding assistant with direct access to your local files. Depending on the permission mode, you approve each change as Claude proposes it or review the changes after Claude makes them. - -Chat and Cowork are covered in the [Claude Help Center](<https://support.claude.com/>); installing and deploying the desktop app is covered in the [Claude Desktop support articles](<https://support.claude.com/en/collections/16163169-claude-desktop>). This page focuses on the **Code** tab. + * **Using chat or Cowork** : see the [Claude Help Center](<https://support.claude.com/>) + * **Need more on installing or deploying the desktop app** : see the [Claude Desktop support articles](<https://support.claude.com/en/collections/16163169-claude-desktop>) ## @@ -43,7 +37,11 @@ Open the Code tab -Click the **Code** tab at the top center. If clicking Code prompts you to upgrade, you need to [subscribe to a paid plan](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=desktop_quickstart_upgrade>) first. If it prompts you to sign in online, complete the sign-in and restart the app. If you see a 403 error, see [authentication troubleshooting](</docs/en/desktop#403-or-authentication-errors-in-the-code-tab>). +Click the **Code** tab at the top of the sidebar. If the tabs show only icons, hover over one to see its name. If a prompt or an error appears after you click **Code** , follow the matching fix: + + * **Prompt to upgrade** : you need to [subscribe to a paid plan](<https://claude.com/pricing?utm_source=claude_code&utm_medium=docs&utm_content=desktop_quickstart_upgrade>) first + * **Prompt to sign in online** : complete the sign-in and restart the app + * **403 error** : see [authentication troubleshooting](</docs/en/desktop#403-or-authentication-errors-in-the-code-tab>) The desktop app includes Claude Code, so you don’t need to install Node.js or the CLI to use the Code tab. @@ -93,13 +91,13 @@ Check your [permission mode](</docs/en/desktop#choose-a-permission-mode>) in the row under the prompt box to see whether Claude waits for your approval: - * **Auto or Accept edits** : Claude applies its file changes, and an indicator such as `+12 -1` appears so you can review them in the diff view + * **Auto or Accept edits** : Claude applies its file changes, and an indicator such as `+12 -1` appears so you can review them in the [diff view](</docs/en/desktop#review-changes-with-diff-view>) * **Manual** : Claude proposes each change and waits for your approval before applying it In Manual mode, you’ll see: - 1. A [diff view](</docs/en/desktop#review-changes-with-diff-view>) showing exactly what will change in each file - 2. Accept/Reject buttons to approve or decline each change + 1. A diff showing exactly what will change + 2. Buttons to approve or decline each change 3. Real-time updates as Claude works through your request ##
modified Schedule recurring tasks in Claude Code Desktop View current →
--- a/desktop-scheduled-tasks.md +++ b/desktop-scheduled-tasks.md @@ -22,8 +22,8 @@ Access to local files| No (fresh clone)| Yes| Yes MCP servers| Connectors configured per task| [Config files](</docs/en/mcp>) and connectors| Inherits from session Permission prompts| No (runs autonomously)| Configurable per task| Inherits from session -Customizable schedule| Via `/schedule` in the CLI| Yes| Yes -Minimum interval| 1 hour| 1 minute| 1 minute +Customizable schedule| Yes| Yes| Yes +Minimum interval| 1 hour| 1 minute when Claude sets it, [1 hour in the forms](</docs/en/desktop-scheduled-tasks#schedule-options>)| 1 minute Use **cloud tasks** for work that should run reliably without your machine. Use **Desktop tasks** when you need access to local files and tools. Use **`/loop`** for quick polling during a session. @@ -65,7 +65,7 @@ Turn on Only on this computer -Skip past the **Trigger** card for now and expand **Advanced settings** below it. On the **General** tab, turn on **Only on this computer**. With it on, the task runs on your machine in a local folder, and the **Trigger** card offers the presets listed in Schedule options.If the switch is unavailable, clear the repository or the GitHub event or API trigger, because those make the task a [cloud scheduled task](</docs/en/routines>). +Skip past the **Trigger** card for now and expand **Advanced settings** below it. On the **General** tab, turn on **Only on this computer**. With it on, the task runs on your machine in a local folder.If the switch is unavailable, clear the repository or the GitHub event or API trigger, because those make the task a [cloud scheduled task](</docs/en/routines>). 6 @@ -91,7 +91,7 @@ Click **Create**. If you haven’t trusted the folder yet, Desktop asks you to trust it at this point. The task’s detail page opens. -On the detail page, click the pencil icon to open the **Edit** form. There you can change the **Description** that Desktop filled in from your instructions, select **Worktree** , or switch the schedule to **Manual**. You can also create a task by describing what you want in any session. For example, “set up a daily code review that runs every morning at 9am” creates a recurring task. A request like “remind me at 3pm tomorrow to check the deploy” creates a one-time task that disables itself after it fires. +On the detail page, click the pencil icon to open the **Edit** form. There you can change the **Description** that Desktop filled in from your instructions, select **Worktree** , or switch the schedule to **Manual** or **Custom**. You can also create a task by describing what you want in any session. For example, “set up a daily code review that runs every morning at 9am” creates a recurring task. A request like “remind me at 3pm tomorrow to check the deploy” creates a one-time task that disables itself after it fires. ### @@ -105,7 +105,7 @@ * **Description** : enter a description. **Create** stays unavailable until you do. * **The instructions box** : enter what Claude should do when the task runs. Select the permission mode and model from the menus in the box. * **Working folder** : select the folder the task runs in. **Create** stays unavailable until you select one. - * **Trigger** : select a schedule. **Custom** takes a cron expression. For the other presets, see Schedule options. + * **Trigger** : select a schedule. For the presets, see Schedule options. Click **Create**. The task’s detail page opens. @@ -115,15 +115,16 @@ Schedule options -When you turn on **Only on this computer** under **Advanced settings** , the **Trigger** card offers Hourly, Daily, Weekdays, and Weekly. The task’s **Edit** form also offers **Manual**. +When you turn on **Only on this computer** under **Advanced settings** , the **Trigger** card offers Hourly, Daily, Weekdays, and Weekly. To get **Manual** or **Custom** for such a task, open its **Edit** form after you create it. That form and the dialog with **Only on this computer** at the top offer these six options: * **Hourly** : runs every hour * **Daily** : runs every day at the local time you pick * **Weekdays** : same as Daily but skips Saturday and Sunday * **Weekly** : shows a time picker and a day picker * **Manual** : no schedule, only runs when you click **Run now**. Useful for saving a prompt you trigger on demand + * **Custom** : runs on a cron expression that you enter and that is evaluated in your local time, such as `0 9 * * *` for 9:00 AM each day. Write days of the week and months as numbers, since their names aren’t accepted. Sunday is `0`, not `7`. The form rejects an expression that runs more often than once per hour. -For intervals the picker doesn’t offer, such as every 15 minutes, the first of each month, or a single run at a specific future time, ask Claude in any Desktop session to set the schedule. Use plain language; for example, “schedule a task to run all the tests every 6 hours.” +You can also ask Claude in any Desktop session to set the schedule. Claude isn’t held to the once-per-hour limit and can set a single run at a future time. For example, ask “run the test suite every 30 minutes” or “next Monday at 9am, summarize the pull requests merged since Friday.” ## @@ -135,7 +136,18 @@ For tasks that need to run even when your computer is off, or that should trigger on an API call or GitHub event, create a [cloud scheduled task](</docs/en/routines>) instead. -When a local task fires, a new session appears under a **Scheduled** section in the sidebar. Open it to see what Claude did, review changes, or respond to permission prompts. Claude can edit files, run commands, create commits, and open pull requests, the same as in a session you start yourself. +### + +​ + +Find a run’s session + +To open the session a run started, go to the task’s detail page and click that run’s row in the **History** list. The sidebar’s session list can show a **Scheduled** group as well, with one row per task. To open the session of a task’s latest run, click the task’s row in that group. To show the group, [check which layout you have](</docs/en/desktop#check-which-layout-you-have>): + + * **Current layout** : open the [**Group and sort** menu](</docs/en/desktop#organize-and-find-sessions>), select **Show** , then select **Scheduled**. The group starts collapsed, so click its heading to expand it. **Show** lists **Scheduled** when at least one of your tasks is **Active** , the **Status** a task’s detail page shows. If it isn’t listed, use the **History** list, which works whether or not the group shows. + * **Earlier layout** : the group is in the session list with nothing to turn on + +In a run’s session, whichever way you reached it, you can see what Claude did, review changes, and respond to permission prompts. Claude can edit files, run commands, create commits, and open pull requests, the same as in a session you start yourself. ## @@ -151,7 +163,7 @@ Permissions for scheduled tasks -Each task has its own permission mode, which you set when creating or editing the task. Allow rules from `~/.claude/settings.json` also apply to scheduled task sessions. If a task runs in [Manual mode](</docs/en/desktop#choose-a-permission-mode>) and needs to run a tool it doesn’t have permission for, the run stalls until you approve it. The session stays open in the sidebar so you can answer later. To avoid stalls, click **Run now** after creating a task, watch for permission prompts, and select “always allow” for each one. Future runs of that task auto-approve the same tools without prompting. You can review and revoke these approvals from the task’s detail page. MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) prompt on every call and don’t offer an always-allow option. Runs that call these tools stall each time. +Each task has its own permission mode, which you set when creating or editing the task. Allow rules from `~/.claude/settings.json` also apply to scheduled task sessions. If a task runs in [Manual mode](</docs/en/desktop#choose-a-permission-mode>) and needs to run a tool it doesn’t have permission for, the run stalls until you approve it. To approve it, find the run’s session and answer the permission prompt there. To avoid stalls, click **Run now** after creating a task, watch for permission prompts, and select “always allow” for each one. Future runs of that task auto-approve the same tools without prompting. You can review and revoke these approvals from the task’s detail page. MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) prompt on every call and don’t offer an always-allow option. Runs that call these tools stall each time. ## @@ -166,7 +178,7 @@ * **Edit** : change the instructions, schedule, folder, or other settings * **Review history** : see every past run, including skipped runs. Hover a skipped entry to see why: your computer was asleep, the previous run was still in progress, or other scheduled tasks were already running. Click **Show more** to load older entries. * **Review allowed permissions** : see and revoke saved tool approvals for this task from the **Always allowed** panel - * **Delete** : remove the task and archive all sessions it created. An **Also delete files on disk** checkbox appears in the confirmation dialog; check it to also remove the task’s `SKILL.md` file and associated data from `~/.claude/scheduled-tasks/`. + * **Delete** : remove the task. The sessions the task created are [archived](</docs/en/desktop#organize-and-find-sessions>), not deleted. The folder holding the task’s `SKILL.md` file stays on disk at `~/.claude/scheduled-tasks/<task-name>/`, or at `scheduled-tasks/<task-name>/` under [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) if you set that variable. To remove that folder, delete it yourself. You can also list, create, edit, and pause tasks by asking Claude in any Desktop session. For example, “pause my dependency-audit task” or “show me my scheduled tasks.” To delete a task, use the **Delete** button on its detail page. A scheduled task can also modify its own schedule or prompt from within a running session using the `update_scheduled_task` MCP tool. This lets a task reschedule itself based on what it finds, for example, rescheduling a code review to run earlier when it detects a release branch has been created. To edit a task’s prompt on disk, open `~/.claude/scheduled-tasks/<task-name>/SKILL.md` (or under [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) if set). The file uses YAML frontmatter for `name` and `description`, with the prompt as the body. Changes take effect on the next run. Schedule, folder, model, and enabled state are not in this file: change them through the Edit form or ask Claude.
modified Development containers View current →
--- a/devcontainer.md +++ b/devcontainer.md @@ -60,7 +60,7 @@ Persist authentication and settings across rebuilds -By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`: +By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your account details, personal MCP servers, and per-project trust in a separate file outside that directory: [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>). To keep the directory and the file, mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`: devcontainer.json @@ -71,7 +71,11 @@ "CLAUDE_CONFIG_DIR": "/home/node/.claude" } -Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically. +Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one. + +If Claude Code repeats first-launch setup after each rebuild despite the mounted volume, check that `containerEnv` in `devcontainer.json` sets `CLAUDE_CONFIG_DIR` to the volume’s mount path. Without `CLAUDE_CONFIG_DIR`, `~/.claude.json` stays in the home directory and is discarded on rebuild, along with its record that you completed setup. + +To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically. ##
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -387,7 +387,7 @@ `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 -`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later +`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -441,7 +441,7 @@ `ENABLE_BETA_TRACING_DETAILED`| Set to `1`, and set `BETA_TRACING_ENDPOINT` to your OTLP/HTTP collector endpoint, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. For subscription users within included usage, Claude Code requests the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL separately for the main conversation and for requests outside it, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable -`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead +`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead. Has no effect on [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, even when the gateway routes to Amazon Bedrock `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset or `true` defers MCP tools, except in the [cases that keep tool search off](</docs/en/mcp#configure-tool-search>). `auto` turns tool search on once definitions reach 10% of the context window. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. If a gateway rejects tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -17,6 +17,7 @@ `Opus is experiencing high load` / `Fable is experiencing high load`| Server errors `Request timed out`| Server errors, or Network if the message mentions your internet connection `API Error: No response from API`| Server errors +`API Error: Stream idle timeout - no chunks received`| [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>), or [Long thinking ends in proxy timeouts](</docs/en/claude-apps-gateway-deploy#long-thinking-ends-in-proxy-timeouts>) behind a Claude apps gateway `Server error mid-response. The response above may be incomplete.`| Server errors `Connection lost mid-response` / `Your computer went to sleep mid-response` / `The response stopped arriving`| Server errors `Connection closed mid-response` / `Response stalled mid-stream`| Server errors @@ -25,6 +26,7 @@ `Connection lost before a response was produced` / `Your computer went to sleep before a response was produced` / `The response stalled before a response was produced`| Automatic retries `Connection closed while thinking` / `Response stalled while thinking`| Automatic retries `Connection lost while your computer was asleep`| Automatic retries +`The model's tool call could not be parsed (retry also failed).`| Automatic retries `<model> is temporarily unavailable, so auto mode cannot determine the safety of...`| Server errors `Auto mode could not evaluate this action and is blocking it for safety`| Server errors `Not run · auto mode's check had no usable answer`| Server errors @@ -386,6 +388,7 @@ `is a network path, which cannot be added as a working directory`| Configuration warnings `Remote managed settings failed to load (<cause>)`| Configuration warnings `Managed settings were not approved; exiting without applying them.`| Configuration warnings +`Your organization's managed settings need your approval, which couldn't be asked for here.`| Configuration warnings `Claude Code can't start: your organization's managed settings block the default model` / `Claude Code can't start: your organization allows only the models listed in "availableModels"`| Configuration warnings `Your organization's managed settings allow Claude Code to use: <providers>`| Configuration warnings `Your organization's managed settings allow Claude Code to use no API provider at all`| Configuration warnings @@ -437,6 +440,7 @@ * A request rejected because the input plus `max_tokens` exceeds the context limit. Re-sending it unchanged would fail the same way, so Claude Code retries with a reduced `max_tokens`, and stops retrying and compacts instead in two cases: * When no reduction can fit, for example when the conversation itself nearly fills the context window. * When a retry can’t shrink `max_tokens` any further. Before v2.1.218, Claude Code could re-send a reduced request that still didn’t fit, such as when the extended thinking budget exceeded the remaining context, until the retry budget ran out. + * A response that says Claude is calling a tool but contains no tool call. Claude Code retries by asking Claude for the tool call, up to two times. If both retries fail the same way, you see `The model's tool call could not be parsed (retry also failed).` and the turn ends. To try again, send another message. Before v2.1.307, Claude Code retried once before ending the turn. * An expired or missing Google Cloud credential on [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or AWS credentials that fail to load on your machine. Claude Code discards its cached credentials and retries up to two times, then reports the error so you can re-authenticate right away, as described under Could not load AWS or Google Cloud credentials. Before v2.1.228, Claude Code retried a failing Google Cloud credential through the full retry budget before showing the error. * A `401` or `403` from the Anthropic API, directly or through an [LLM gateway](</docs/en/llm-gateway>), while an [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>) script supplies the credential. Claude Code re-runs the script and retries with its fresh output, within the full retry budget. When the script itself fails on the re-run, Claude Code shows Your apiKeyHelper script is failing instead. @@ -2068,7 +2072,9 @@ * Trim large `CLAUDE.md` memory files, or move instructions into [path-scoped rules](</docs/en/memory#path-specific-rules>) that load only when relevant * Auto-compact is on by default and normally prevents this error. If you turned it off in `/config` or with [`DISABLE_AUTO_COMPACT`](</docs/en/env-vars>), turn it back on. If you keep it off, run `/compact` yourself before the window fills. * If the error appears near 200K tokens on a model that accepts more, one cause is a model ID that Claude Code doesn’t recognize. Claude Code assumes a 200K window for such an ID, so to keep working past that point, [give it the model’s real context window](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). + * If you use a custom [`ANTHROPIC_BASE_URL`](</docs/en/env-vars>) and the error starts with `Prompt is too long · automatic compaction failed`, [set the model’s context window](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) or [update](</docs/en/setup#update-claude-code>) to v2.1.299 or later. Before v2.1.299, Claude Code ended the turn with that message near the assumed 200K window instead of sending the request. * If the error appeared right after you stopped Claude while it was compacting the conversation, your conversation is unchanged and still large enough to need compacting. Run `/compact` and send your message again. To keep the error from recurring, [update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.304 or later. Before v2.1.304, stopping at that moment could end the turn with this error. + * On v2.1.305, with many MCP tools and a direct connection to the Anthropic API, this error can hide an unrelated 400 or 422 error from the API. [Update Claude Code](</docs/en/setup#update-claude-code>) to v2.1.306 or later to see the original error. See [Explore the context window](</docs/en/context-window>) for an interactive view of how context fills up. @@ -3048,7 +3054,7 @@ Could not read Claude Code config -You ran [`claude import`](</docs/en/cli-reference#cli-commands>) while Claude Code couldn’t parse `~/.claude.json`, the file where it stores your login and per-project state. The subcommand reads that file to check availability but doesn’t show the recovery dialog the interactive session shows, so it exits with code 1. Before v2.1.222, `claude import` with an unreadable config file started an interactive session, whose recovery dialog handled the file. +You ran [`claude import`](</docs/en/cli-reference#cli-commands>) while Claude Code couldn’t parse `~/.claude.json`, the file where it stores your account details and per-project state. The subcommand reads that file to check availability but doesn’t show the recovery dialog the interactive session shows, so it exits with code 1. Before v2.1.222, `claude import` with an unreadable config file started an interactive session, whose recovery dialog handled the file. Could not read Claude Code config — run `claude` with no arguments to recover it. @@ -5232,7 +5238,7 @@ Mapped drive letters and `\\wsl$` paths don’t count as network paths. **What to do:** - * On Windows, map the share to a drive letter, for example with `net use Z: \\server\share`, and pass the drive at launch with `claude --add-dir Z:\`. + * On Windows, map the share to a drive letter and pass the drive at launch. In PowerShell, for example, run `net use Z: \\server\share` and then `claude --add-dir Z:\`. * On macOS or Linux, mount the share at a local path and add that path instead. * If the path is in `permissions.additionalDirectories`, remove it from the settings file that lists it. @@ -5271,6 +5277,20 @@ * Start Claude Code again and approve the dialog to continue under your organization’s settings. A declined dialog isn’t remembered, so it appears again at the next start. * If you’re unsure about a setting the dialog lists, ask whoever maintains your organization’s managed settings before approving + +### + +​ + +Managed settings need your approval + +Your organization’s [server-managed settings](</docs/en/server-managed-settings>) include settings that need your approval in the [security approval dialog](</docs/en/server-managed-settings#security-approval-dialogs>). The `claude plugin` command you ran couldn’t read from the keyboard, so it couldn’t show that dialog. That happens when you pipe or redirect its input and, on macOS and Linux, it also can’t open `/dev/tty`. The command stopped before making any changes: + + Your organization's managed settings need your approval, which couldn't be asked for here. Run `claude` in a terminal and approve them, then run this command again. + +**What to do:** + + * Run `claude` in a terminal and approve the settings when the dialog appears, then run the same `claude plugin` command again. Claude Code keeps the approval and the approved settings in your [configuration directory](</docs/en/server-managed-settings#approval-memory>). If the command that stopped ran as another user or with `CLAUDE_CONFIG_DIR` set, run `claude` the same way so that both use the same directory. ###
modified Extend Claude Code View current →
--- a/features-overview.md +++ b/features-overview.md @@ -142,7 +142,7 @@ * **Subagents** are workers Claude spawns, each returning a summary to the conversation that spawned it * **[Dynamic workflows](</docs/en/workflows>)** are scripts Claude writes that run many subagents in the background and return one result -**Use a subagent** when you need a quick, focused worker: research a question, verify a claim, review a file. The subagent does the work and returns a summary, so your main conversation stays clean. Subagents that Claude named when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>).**Use a dynamic workflow** when a job [outgrows a handful of subagents](</docs/en/workflows#when-to-use-a-workflow>), or when you want the findings cross-checked before you see them, such as a codebase-wide audit, a large migration, or a plan drafted from several angles. To start one, [ask for a workflow in your prompt](</docs/en/workflows#ask-for-a-workflow-in-your-prompt>).**To pass a finding from one of your sessions to another** , ask the first session’s Claude to send it. Claude delivers it with [cross-session messaging](</docs/en/cross-session-messaging>). [Run agents in parallel](</docs/en/agents>) compares the other ways to run more than one Claude at once, including sessions you hand off and check back on later. +**Use a subagent** when you need a quick, focused worker: research a question, verify a claim, review a file. The subagent does the work and returns a summary, so your main conversation stays clean. Subagents that Claude [named](</docs/en/sub-agents#subagent-names>) when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>).**Use a dynamic workflow** when a job [outgrows a handful of subagents](</docs/en/workflows#when-to-use-a-workflow>), or when you want the findings cross-checked before you see them, such as a codebase-wide audit, a large migration, or a plan drafted from several angles. To start one, [ask for a workflow in your prompt](</docs/en/workflows#ask-for-a-workflow-in-your-prompt>).**To pass a finding from one of your sessions to another** , ask the first session’s Claude to send it. Claude delivers it with [cross-session messaging](</docs/en/cross-session-messaging>). [Run agents in parallel](</docs/en/agents>) compares the other ways to run more than one Claude at once, including sessions you hand off and check back on later. MCP connects Claude to external services. Skills extend what Claude knows, including how to use those services effectively.
modified Fullscreen rendering View current →
--- a/fullscreen.md +++ b/fullscreen.md @@ -18,6 +18,7 @@ * Your [permission mode](</docs/en/permission-modes>) and [effort level](</docs/en/model-config#adjust-effort-level>) * The model you last picked with [`/model`](</docs/en/model-config#setting-your-model>) * Rules you passed with [`--allowed-tools` or `--disallowed-tools`](</docs/en/cli-reference#cli-flags>), and your `--agent`, `--agents`, `--append-system-prompt`, and `--system-prompt-snapshot` flags + * A `--chrome` or `--no-chrome` flag you launched with, so [Chrome integration](</docs/en/chrome>) stays on or off as you chose for this session Claude Code declines to relaunch if the session has a restriction it can’t pass to the restarted process. Restrictions it can’t pass include:
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -916,6 +916,7 @@ The hook is configured but never executes. * Run `/hooks` and confirm the hook appears under the correct event + * For a hook in a skill’s frontmatter, invoke the skill or ask Claude to, then run `/hooks` again. `/hooks` doesn’t list hooks from a skill that hasn’t been invoked in the session. If `/hooks` still doesn’t list the hook, check for other causes, such as [frontmatter that didn’t parse](</docs/en/skills#skill-not-triggering>) or one of the [limits on skill hooks](</docs/en/hooks#limits-on-skill-hooks>) * Check that the matcher pattern matches the tool name exactly. Matchers are case-sensitive * Verify you’re triggering the right event type: `PreToolUse` fires before tool execution, `PostToolUse` fires after. A `PermissionRequest` hook fires when Claude Code is about to ask you for permission; see the limitations for the non-interactive cases
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -296,6 +296,14 @@ Block-wise visual mode with `Ctrl+V` is not supported. +### + +​ + +Cancel a question in vim mode + +When you’re typing your own answer in the `Other` row of a [question Claude asks](</docs/en/tools-reference#askuserquestion-tool-behavior>), press `Esc` twice to cancel the question. To cancel with a single key press instead, [bind another key to cancel the question](</docs/en/keybindings#cancel-a-question-with-one-key-press>). + ## ​ @@ -441,6 +449,17 @@ ​ +Background a session with messages queued + +When the session moves to the background after you [press `←`](</docs/en/agent-view#switch-sessions-without-leaving-the-terminal>), the messages you had queued move with it. Claude reads them there in the order you sent them. Commands and `!` shell commands can’t move, and neither can some messages, such as one with an [IDE selection](</docs/en/vs-code#the-built-in-ide-mcp-server>) attached. If you press `←` while one of them is queued, the session stays in the foreground and a notice that begins `Cannot open agents` appears. To background the session, get the entry out of the queue and then press `←` again: + + * **Commands and`!` shell commands**: wait for them to run at the end of the turn, or take them back and clear the input box. While anything else is queued, you can’t take `!` shell commands back, so wait for them to run. + * **Messages that can’t move** : wait until Claude has read them + +### + +​ + Take back what you queued Press `Up` from the first line of the input box to take back the queued messages and commands. Claude Code removes them from the queue and puts them in the input box, one per line, ahead of any text you had typed. Edit the text and press `Enter` to queue it again as one entry, or clear the input box to drop it. Claude Code takes back queued shell commands only when the input box is empty and you have nothing else queued, and it switches the input box to shell mode when it does. Otherwise it leaves them in the queue, listed with their `!` prefix, and runs them after the turn ends. If you take back queued text while `←` [waits to background the session](</docs/en/agent-view#switch-sessions-without-leaving-the-terminal>), the text stays in the input box and Claude Code cancels the switch. If you take it back at the moment the session moves, the text disappears with the foreground screen: it wasn’t sent. Each message you took back is saved as its own entry in command history. To recover one, reopen the session and press `Up` on an empty prompt with nothing queued.
modified Draw in the interface with a mod View current →
--- a/interface.md +++ b/interface.md @@ -558,7 +558,7 @@ key: 'new-note', label: 'Note', placeholder: 'Type a note and press Enter', - // Draw the field empty each time, which clears it after a submit + // The text the field starts with value: '', submitLabel: 'add', autoFocus: true, @@ -601,12 +601,13 @@ * **Add a note** : type a line and press Enter. The line appears as a new row, and the field empties. * **Delete a note** : press Tab until the note’s `x` button has the focus, then press Enter. The `x` is the button’s label and not a hotkey, so typing the letter doesn’t press it. -Each change follows the same render cycle as `hello-tabs`: the callback changes `notes`, calls `redraw`, and saves the list to `$.store`. The field empties after each submit because of its `value` prop. `value` is the text the field holds when it’s drawn, and the user’s typing replaces it until your hook draws the field again. The example always draws the field with `''`. The example saves the notes and doesn’t load them. To bring them back in the next session, read them in a `session.start` hook, the way `hello-tabs` reads `count`. These props make up the field’s line, `Note: Type a note and press Enter ⏎ add`: +Each change follows the same render cycle as `hello-tabs`: the callback changes `notes`, calls `redraw`, and saves the list to `$.store`. If your hook draws the pane again while the user is typing a note, the field keeps their text as long as the hook passes the same `value` each time. To replace their text with your own, pass a different `value`. The example saves the notes and doesn’t load them. To bring them back in the next session, read them in a `session.start` hook, the way `hello-tabs` reads `count`. These props make up the field’s line, `Note: Type a note and press Enter ⏎ add`: Prop| In the example| What it is ---|---|--- `label`| `Note`| The text before the field. The terminal draws `: ` after it. `placeholder`| `Type a note and press Enter`| Dim text that shows while the field is empty +`value`| `''`| The text the field starts with. It’s empty here, so the placeholder shows. `submitLabel`| `add`| The word after `⏎` that says what Enter does Submitting an `Input` doesn’t start a turn unless your callback calls [`$.prompt.submit`](</docs/en/plugins/mods/api#start-a-turn-from-a-background-job>).
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -785,6 +785,27 @@ In the `Other` row of a question Claude asks, Escape doesn’t cancel the question right away in vim mode. Except in [screen reader mode](</docs/en/accessibility>), the row starts in INSERT mode each time you focus it. When you press Escape in the `Other` row, the row switches to NORMAL mode or drops a half-typed vim command, and the question stays open. Press Escape again in NORMAL mode to cancel the question. +### + +​ + +Cancel a question with one key press + +To cancel a question with one key press in vim mode, bind another key to `select:cancel` in the `Select` context. You can cancel this way from the `Other` row of a question where you select one option. In [screen reader mode](</docs/en/accessibility>) or in a question where you can select several options, the bound key doesn’t cancel, so cancel with Escape instead. Pick a key that you press with Ctrl or Alt. A bare letter or digit goes to the `Other` row instead and doesn’t reach your bindings. For example, to bind `Ctrl+Q`, add this to `~/.claude/keybindings.json`: + + { + "bindings": [ + { + "context": "Select", + "bindings": { + "ctrl+q": "select:cancel" + } + } + ] + } + +After you save the file, press `Ctrl+Q` in the `Other` row of a question where you select one option. The question closes whether the row is in INSERT or NORMAL mode. + ## ​
modified Set up Claude Code in a monorepo or large codebase View current →
--- a/large-codebases.md +++ b/large-codebases.md @@ -139,7 +139,7 @@ * `"**/packages/legacy-*/**"`: excludes every package whose name matches the glob, including rules * `"/home/user/monorepo/legacy/CLAUDE.md"`: excludes one specific file by absolute path -Managed policy CLAUDE.md files cannot be excluded, so organization-wide instructions always apply. You can set `claudeMdExcludes` at any [settings scope](</docs/en/settings#where-settings-live>): user, project, local, or managed. Arrays merge across scopes, so a team can set project-level defaults while individuals add local overrides. For the full exclusion documentation, see [Exclude specific CLAUDE.md files](</docs/en/memory#exclude-specific-claude-md-files>). +You can set `claudeMdExcludes` at any [settings scope](</docs/en/settings#where-settings-live>): user, project, local, or managed. Arrays merge across scopes, so a team can set project-level defaults while individuals add local overrides. If your organization deploys a [managed CLAUDE.md file](</docs/en/memory#deploy-organization-wide-claude-md>), a pattern that matches it doesn’t skip it, whichever scope sets the pattern. For the full exclusion documentation, see [Exclude specific CLAUDE.md files](</docs/en/memory#exclude-specific-claude-md-files>). ## @@ -323,7 +323,7 @@ - Always wrap database tests in a transaction that rolls back - Mock external services in `src/__tests__/mocks/` -A different subdirectory holds different skills the same way: `packages/web/.claude/skills/component-patterns/` describes the frontend’s component conventions instead of testing. When Claude works on a file in `packages/api/`, it loads the api-testing skill. When it works in `packages/web/`, it loads component-patterns instead. Neither directory’s skills load during the other’s tasks. You can also scope a skill by file pattern instead of by placement. The [`paths` frontmatter field](</docs/en/skills#frontmatter-reference>) takes glob patterns, and Claude loads the skill automatically only when it works with matching files. Use this for a skill that lives in the repository root’s `.claude/skills/` but applies only to certain files wherever they appear, such as a database-migration skill scoped to `**/migrations/**`. For more on creating and organizing skills, see [Skills](</docs/en/skills>). +A different subdirectory holds different skills the same way: `packages/web/.claude/skills/component-patterns/` describes the frontend’s component conventions instead of testing. When Claude works on a file in `packages/api/`, it loads the api-testing skill. When it works in `packages/web/`, it loads component-patterns instead. Neither directory’s skills load during the other’s tasks. You can also scope a skill by file pattern instead of by placement. The [`paths` frontmatter field](</docs/en/skills#frontmatter-reference>) takes glob patterns, and Claude loads the skill automatically only when it works with matching files. Use this for a skill that lives in the repository root’s `.claude/skills/` but applies only to certain files, such as a database-migration skill scoped to `**/migrations/**`. For more on creating and organizing skills, see [Skills](</docs/en/skills>). ###
modified Claude Code gateway compatibility guide View current →
--- a/llm-gateway-protocol.md +++ b/llm-gateway-protocol.md @@ -107,7 +107,7 @@ Model IDs in requests by default| The provider’s form, such as `us.anthropic.claude-opus-4-8` on Amazon Bedrock| Anthropic IDs, such as `claude-opus-4-8`| Anthropic IDs `anthropic-beta` values sent| The subset Amazon Bedrock and Agent Platform accept| The full set described under feature pass-through, unless the developer sets `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| The subset Amazon Bedrock and Agent Platform accept Request fields for a model ID Claude Code doesn’t recognize, such as a gateway alias| Thinking with a fixed budget rather than adaptive reasoning, and no effort or context management fields. Claude Code still sends mid-conversation system messages| Everything current Claude models accept on the Claude API, including adaptive reasoning, effort, and context management, which an Amazon Bedrock or Agent Platform upstream can reject| Same as the Amazon Bedrock or Agent Platform format -One-hour [prompt cache TTL](</docs/en/prompt-caching#choose-the-ttl-yourself>) when a developer opts in| Requested through the `ttl` field in `cache_control`, with no beta value| Requested through the `ttl` field plus an `extended-cache-ttl` value in `anthropic-beta`, which you must forward| See the Claude apps gateway [availability and limitations](</docs/en/claude-apps-gateway#availability-and-limitations>) table +One-hour [prompt cache TTL](</docs/en/prompt-caching#choose-the-ttl-yourself>) when a developer opts in| Requested through the `ttl` field in `cache_control`, with no beta value| Requested through the `ttl` field plus an `extended-cache-ttl` value in `anthropic-beta`, which you must forward| Requested through the `ttl` field, with no beta value. See [One-hour prompt cache](</docs/en/claude-apps-gateway-config#one-hour-prompt-cache>) Model for [background tasks](</docs/en/costs#background-token-usage>) unless `ANTHROPIC_DEFAULT_HAIKU_MODEL` pins one| The default Sonnet model, or the main model once one is selected, as the [Amazon Bedrock](</docs/en/amazon-bedrock#4-pin-model-versions>) and [Agent Platform](</docs/en/google-vertex-ai#5-pin-model-versions>) pages describe| The main model, or the default Haiku model when `ANTHROPIC_API_KEY` or `apiKeyHelper` supplies an Anthropic Console key and `ANTHROPIC_AUTH_TOKEN` is unset| The main model For the features each connection supports and the telemetry it sends to Anthropic by default, see [Feature availability](</docs/en/feature-availability#availability-by-model-provider>) and [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>).
modified Plugin loading reference View current →
--- a/loading.md +++ b/loading.md @@ -11,6 +11,7 @@ * An update changed nothing: Versions and updates * You’re looking at the files under `~/.claude/plugins/`: Find plugins on disk * A `--plugin-dir` plugin didn’t load, or a same-named plugin loaded instead: Name conflicts + * A plugin under `~/.claude/skills/` or `.claude/skills/` didn’t load, and no error says why: Skills-directory plugins blocked by managed settings ## @@ -74,19 +75,50 @@ Plugins shared through a repository -To share a plugin through a repository, list it under `enabledPlugins` in `.claude/settings.json` or place it under `.claude/skills/`. Claude Code doesn’t scan a project’s `.claude/plugins/` directory. A cloud session doesn’t add the marketplaces a repository lists under [`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>), because that requires the workspace trust dialog, which a cloud session never shows. If a plugin in your repository’s `.claude/skills/` doesn’t load, check where you started the session and whether you trusted the folder: +To share a plugin through a repository, list it under `enabledPlugins` in `.claude/settings.json` or place it under `.claude/skills/`. Claude Code doesn’t scan a project’s `.claude/plugins/` directory. A cloud session doesn’t add the marketplaces a repository lists under [`extraKnownMarketplaces`](</docs/en/settings-reference#extraknownmarketplaces>), because that requires the workspace trust dialog, which a cloud session never shows. + +#### + +​ + +Trust check and component limits for repository plugins + +A project-scope plugin is checked into the repository and reaches every collaborator who clones it. Because that content comes from the repository rather than from you, it loads only after the same trust check that applies to project allow rules in `.claude/settings.json`. Trusting a parent folder or running with `-p` isn’t enough. Components that run code are restricted further: + + * MCP servers it declares go through the [same per-server approval](</docs/en/mcp>) as a project `.mcp.json` + * MCP servers it declares as an [MCP bundle](</docs/en/plugins/manifest-reference#mcpservers>), a `.mcpb` or `.dxt` file, or from a file outside the plugin directory are skipped. Declare them inline or in a `.mcp.json` inside the plugin directory + * [Background monitors](</docs/en/plugins/components#monitors>) do not load + +Neither the trust check nor these component limits apply to a plugin under your own `~/.claude/skills/`. For how to write `--plugin-dir` and skills-directory plugins, see [Create plugins](</docs/en/plugins/create>). + +#### + +​ + +Check why a repository plugin didn’t load + +If a plugin in your repository’s `.claude/skills/` doesn’t load, check for these causes: * **In a subdirectory** : a plugin at the repository root doesn’t load. Claude Code reads the `.claude/skills/` of the session’s [primary working directory](</docs/en/permissions#working-directories>) and, unlike plain skills and commands, doesn’t [search parent directories](</docs/en/skills#discovery-from-parent-and-nested-directories>) for plugins. Launch from the repository root instead, or [move the session there with `/cd`](</docs/en/permissions#move-the-session-to-another-directory>) on v2.1.246 or later * **From the desktop app, in a worktree** : the plugin loads from the main checkout’s `.claude/skills/` rather than the worktree’s. See [What worktrees share with the main checkout](</docs/en/worktrees#what-worktrees-share-with-the-main-checkout>) * **In a folder you haven’t trusted** : the plugin loads only after you accept the [workspace trust dialog](</docs/en/permissions#what-runs-before-you-trust-a-folder>) for that folder - -A project-scope plugin is checked into the repository and reaches every collaborator who clones it. Because that content comes from the repository rather than from you, it loads only after the same trust check that applies to project allow rules in `.claude/settings.json`. Trusting a parent folder or running with `-p` isn’t enough. Components that run code are restricted further: - - * MCP servers it declares go through the [same per-server approval](</docs/en/mcp>) as a project `.mcp.json` - * MCP servers it declares as an [MCP bundle](</docs/en/plugins/manifest-reference#mcpservers>), a `.mcpb` or `.dxt` file, or from a file outside the plugin directory are skipped. Declare them inline or in a `.mcp.json` inside the plugin directory - * [Background monitors](</docs/en/plugins/components#monitors>) do not load - -Personal-scope plugins have none of these restrictions. For how to write `--plugin-dir` and skills-directory plugins, see [Create plugins](</docs/en/plugins/create>). + * **In an organization that manages Claude Code** : see Skills-directory plugins blocked by managed settings + +### + +​ + +Skills-directory plugins blocked by managed settings + +If a plugin folder in `~/.claude/skills/` or a project’s `.claude/skills/` didn’t load and you see no error, your administrator may have blocked it through [managed settings](</docs/en/managed-settings>). These folders come from you or your repository rather than from a marketplace, so Claude Code skips them when your administrator sets one of these restrictions: + + * **Customization locked to plugins** : [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) set to `true` or to an array naming one or more kinds of customization to lock. The whole plugin is skipped when any one kind is locked, such as `mcp`, whichever components it has. + * **Marketplace sources restricted** : a [`strictKnownMarketplaces`](</docs/en/settings-reference#strictknownmarketplaces>) allowlist without a `{ "source": "skills-dir" }` entry, or a [`blockedMarketplaces`](</docs/en/settings-reference#blockedmarketplaces>) list with one. + +`/plugin` and `claude plugin list` show no plugin and no error for a skipped folder. Its `/<name>:<skill>` commands and agents are missing, as are its hooks and MCP servers. Unless skills are among the locked kinds, a `SKILL.md` at the folder’s root still loads as a plain skill. In that case `/<name>` keeps working, and the `/plugin` **Installed** tab lists that skill under **Skills**. + + * **Confirm the cause** : run `/status` in a Claude Code session. If the `Setting sources` line lists `Enterprise managed settings`, ask your administrator whether one of these settings applies to you. If it doesn’t, see Check why a repository plugin didn’t load for other causes. + * **Load the whole plugin** : add it to a [marketplace](</docs/en/plugins/create-marketplace#create-a-marketplace>) your organization allows and install it from there. To load it for one session instead, start `claude` from your shell with [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) and the folder’s path, which works unless your administrator has also turned off that flag. ### @@ -103,9 +135,17 @@ ​ +Sync timing in cloud Cowork sessions + +If you turn a plugin on or off for your claude.ai account during a Cowork session that runs in the cloud, keep working in that session. If nothing has changed after a few messages, start a new session. + +#### + +​ + Sync timing in terminal sessions -Because the terminal sync runs in the background, it can finish after your session has started. When it adds, updates, or removes a synced plugin in an interactive session, you see `Plugins changed. Run /reload-plugins to activate.` Run `/reload-plugins` to load the change in that session, or leave it for the next time you start Claude Code. If you enable a plugin on claude.ai while a session is running, the plugin downloads the next time you start Claude Code. +Because the terminal sync runs in the background, it can finish after your session has started. When it adds, updates, or removes a synced plugin in an interactive session, you see `Plugins changed. Run /reload-plugins to activate.` Run `/reload-plugins` to load the change in that session, or leave it for the next time you start Claude Code. If you turn a plugin on or off for your claude.ai account during a terminal session, Claude Code downloads or removes it the next time you start Claude Code. ####
modified Control MCP server access for your organization View current →
--- a/managed-mcp.md +++ b/managed-mcp.md @@ -23,7 +23,7 @@ **Fixed deployment**| Every user gets the same servers and can’t add others| `managed-mcp.json` with the servers you want **Provided servers**| Every user gets the remote servers you list and keeps their own| `managedMcpServers` in managed settings **Approved catalog**| Publish a list of approved servers; users add the ones they want, anything else is blocked| `allowedMcpServers` \+ `allowManagedMcpServersOnly: true` -**Plugin servers only**| Users can’t add servers through `~/.claude.json` or `.mcp.json`; plugin servers still load| [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) with `mcp` in the list +**Plugin servers only**| Users can’t add servers through `~/.claude.json` or `.mcp.json`; [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>) stop loading as plugins, and servers from other plugins still load| [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>) with `mcp` in the list **Soft allowlist**| Enforce an allowlist that users can broaden in their own settings| `allowedMcpServers` without `allowManagedMcpServersOnly` **Denylist only**| Block known-bad servers, allow everything else| `deniedMcpServers` **No restrictions**| Users add anything| Don’t deploy any managed MCP configuration
modified Deploy managed settings View current →
--- a/managed-settings.md +++ b/managed-settings.md @@ -82,7 +82,7 @@ * **On the user’s machine** : by default, Claude Code in a Cowork session reads the MDM or OS-level policy and the managed settings file on that device, so deploy policy there. * **In a full VM sandbox** : when your Claude Desktop managed configuration sets [`requireCoworkFullVmSandbox`](<https://claude.com/docs/third-party/claude-desktop/configuration#requirecoworkfullvmsandbox>), Claude Code runs inside a virtual machine where the device’s MDM policy and managed settings file aren’t present. * **Remote Cowork sessions** : these run on Anthropic-managed VMs, where Claude Code has no device policy to read. -Wherever the session runs, claude.ai applies the admin console’s [`strictKnownMarketplaces`](</docs/en/settings-reference#strictknownmarketplaces>) and [`blockedMarketplaces`](</docs/en/settings-reference#blockedmarketplaces>) lists itself when anyone adds a marketplace from a git repository on claude.ai or from **Customize** in the Cowork tab. [How restrictions work](</docs/en/plugins/org#restrict-what-users-can-install>) describes that check. The [surface coverage](</docs/en/model-config#surface-coverage>) table compares Cowork with the other surfaces. +Wherever the session runs, claude.ai applies the admin console’s [`strictKnownMarketplaces`](</docs/en/settings-reference#strictknownmarketplaces>) and [`blockedMarketplaces`](</docs/en/settings-reference#blockedmarketplaces>) lists itself when anyone adds a marketplace from a git repository on claude.ai or from **Customize** in Cowork. [How restrictions work](</docs/en/plugins/org#restrict-what-users-can-install>) describes that check. The [surface coverage](</docs/en/model-config#surface-coverage>) table compares Cowork with the other surfaces. * **Running sessions** : most changes reach a running session on the schedule in the delivery mechanism table, without a restart. * Changes to [`forceRemoteSettingsRefresh`](</docs/en/settings-reference#forceremotesettingsrefresh>), [`requiredMinimumVersion`](</docs/en/settings-reference#requiredminimumversion>), and [some user-editable keys](</docs/en/settings#when-edits-take-effect>) take effect at the next session start. * A new or changed [`policyHelper`](</docs/en/settings-reference#policyhelper>) entry takes effect at the next launch. If server-managed settings shadow the helper at that launch, the helper runs as soon as a fetch reports those settings removed.
modified Marketplace reference View current →
--- a/marketplace-reference.md +++ b/marketplace-reference.md @@ -386,7 +386,7 @@ `file`| `path`| A path to a `.json` file| Loads| Allows the same path| Blocks the same path `directory`| `path`| A path to a directory| Loads| Allows the same path| Blocks the same path `settings`| `name`, `plugins`, `owner`| Not produced| Loads| Allows an entry with the same `name` and identical `plugins`| Blocks the same `name` -`skills-dir`| none| Not produced| Fails to load: `Unsupported marketplace source type`| Keeps [skills-directory plugins](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) loading while an allowlist is set. See Source values valid only in policy lists| Stops skills-directory plugins from loading +`skills-dir`| none| Not produced| Fails to load: `Unsupported marketplace source type`| Allows [skills-directory plugins](</docs/en/plugins/org#keep-skills-directory-plugins-loading>). See Source values valid only in policy lists| Stops skills-directory plugins from loading `hostPattern`| `hostPattern`| Not produced| Fails to load: `Unsupported marketplace source type`| Allows `github`, `git`, and `url` sources whose host matches| Blocks those sources `pathPattern`| `pathPattern`| Not produced| Fails to load: `Unsupported marketplace source type`| Allows `file` and `directory` sources whose `path` matches| Blocks those sources @@ -423,7 +423,7 @@ `hostPattern`, `pathPattern`, `skills-dir`, and the `owner/*` form of `repo` are valid only in the two policy lists, `strictKnownMarketplaces` and `blockedMarketplaces`: * **`hostPattern` and `pathPattern`**: regular expressions Claude Code tests against a source before it fetches from it. - * **`skills-dir`** : not a source. If you set `strictKnownMarketplaces` at all, [skills-directory plugins](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) stop loading until you add `{"source": "skills-dir"}` to that list. + * **`skills-dir`** : not a source. If you set `strictKnownMarketplaces` without a `{"source": "skills-dir"}` entry, [skills-directory plugins](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) stop loading. If you lock any customization type with [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>), they stop loading whether or not the entry is present. * **`owner/*`** : as a `github` `repo` value, matches every repository under exactly that GitHub owner. Requires Claude Code v2.1.223 or later. For match order, exact-`ref` semantics, and recipes, see [Manage plugins for your organization](</docs/en/plugins/org>).
modified Connect to MCP servers View current →
--- a/mcp-quickstart.md +++ b/mcp-quickstart.md @@ -280,7 +280,7 @@ * **Claude Code desktop app** : add servers through the [Connectors UI](</docs/en/desktop#connect-external-tools>). * **Claude Desktop chat app** : a separate app from Claude Code. To copy servers from its `claude_desktop_config.json` into the CLI, run `claude mcp add-from-claude-desktop` on macOS or WSL. * **VS Code** : see [Connect to external tools with MCP](</docs/en/vs-code#connect-to-external-tools-with-mcp>). - * **Cloud sessions** : outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), commit a `.mcp.json` to your repository; a session with one repository loads it. Cloud threads in a project use your claude.ai connectors instead. See Edit .mcp.json directly and [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). + * **Cloud sessions** : outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>)’s threads, commit a `.mcp.json` to your repository; a session with one repository loads it. Cloud threads in a project use your claude.ai connectors instead. See Edit .mcp.json directly and [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>). * **Claude.ai** : connectors you add at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) load automatically in the CLI when you sign in with that account. See [Use MCP servers from Claude.ai](</docs/en/mcp#use-mcp-servers-from-claude-ai>). ##
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -198,7 +198,12 @@ - Use the standard error response format - Include OpenAPI documentation comments -Rules without a `paths` field are loaded unconditionally and apply to all files. A path-scoped rule loads when Claude uses the Read, Write, or Edit tool on a matching file. It also loads when Claude views a matching file with a Bash command that [counts as a read](</docs/en/tools-reference#edit-tool-behavior>), such as `cat` or `head` on a single file. Matching also works when Claude reaches a file through a symlinked path to the project directory, for example in a symlinked checkout. Use glob patterns in the `paths` field to match files by extension, directory, or any combination: +Rules without a `paths` field are loaded unconditionally and apply to all files. A path-scoped rule loads when Claude uses the Read, Write, or Edit tool on a matching file. It also loads when Claude views a matching file with a Bash command that [counts as a read](</docs/en/tools-reference#edit-tool-behavior>), such as `cat` or `head` on a single file. Matching also works when Claude reaches a file through a symlinked path to the project directory, for example in a symlinked checkout. Each pattern is relative to the rule’s base directory: + + * **Project rules** : the directory that contains the rule’s `.claude` folder + * **User-level rules** : the session’s [primary working directory](</docs/en/permissions#working-directories>) + +To have path-scoped rules load for files in a sibling git worktree, start Claude Code in that worktree or [move the session there with `/cd`](</docs/en/permissions#move-the-session-to-another-directory>). Use glob patterns in the `paths` field to match files by extension, directory, or any combination: Pattern| Matches ---|--- @@ -273,7 +278,7 @@ Deploy organization-wide CLAUDE.md -Organizations can deploy a centrally managed CLAUDE.md that applies to all users on a machine. This file cannot be excluded by individual settings. +Organizations can deploy a centrally managed CLAUDE.md that applies to all users on a machine. Developers can exclude other CLAUDE.md files with the `claudeMdExcludes` setting, but not this one. If a developer starts a session with CLAUDE.md loading turned off altogether, that session doesn’t load the managed content either. Use the file for guidance, and enforce rules with [managed settings](</docs/en/managed-settings>) such as `permissions.deny`. 1 @@ -289,7 +294,7 @@ Use MDM, Group Policy, Ansible, or similar tools to distribute the file across developer machines. See [managed settings](</docs/en/managed-settings>) for other organization-wide configuration options. -The `claudeMd` key lets you put managed CLAUDE.md content directly inside `managed-settings.json` instead of deploying a separate file. **Scope** : every Claude Code session on the machine, in every repository. For repository-specific guidance, commit a project CLAUDE.md instead. **Precedence** : same as a managed CLAUDE.md file. Loads before user and project CLAUDE.md. **Where it’s honored** : managed and policy settings only. Setting `claudeMd` in user, project, or local settings has no effect. The example below adds behavioral instructions directly in a managed settings file: +The `claudeMd` key lets you put managed CLAUDE.md content directly inside `managed-settings.json` instead of deploying a separate file. **Scope** : all users on the machine, in any repository. For repository-specific guidance, commit a project CLAUDE.md instead. **Precedence** : same as a managed CLAUDE.md file. Loads before user and project CLAUDE.md. **Where it’s honored** : managed and policy settings only. Setting `claudeMd` in user, project, or local settings has no effect. The example below adds behavioral instructions directly in a managed settings file: { "claudeMd": "Always run `make lint` before committing.\nNever push directly to main." @@ -315,7 +320,7 @@ Exclude specific CLAUDE.md files -In large monorepos, ancestor CLAUDE.md files may contain instructions that aren’t relevant to your work. The `claudeMdExcludes` setting lets you skip specific files by path or glob pattern. This example excludes a top-level CLAUDE.md and a rules directory from a parent folder. Add it to `.claude/settings.local.json` so the exclusion stays local to your machine: +In large monorepos, ancestor CLAUDE.md files may contain instructions that aren’t relevant to your work. The `claudeMdExcludes` setting lets you skip specific files by path or glob pattern. You can’t exclude a managed CLAUDE.md file with `claudeMdExcludes`. This example excludes a top-level CLAUDE.md and a rules directory from a parent folder. Add it to `.claude/settings.local.json` so the exclusion stays local to your machine: { "claudeMdExcludes": [ @@ -324,7 +329,7 @@ ] } -Patterns are matched against absolute file paths using glob syntax. You can configure `claudeMdExcludes` at any [settings layer](</docs/en/settings#where-settings-live>): user, project, local, or managed policy. Arrays merge across layers. To exclude a rules file you reach through a symlink, whether the file or its directory is the link, write the pattern against either path: the file’s path under `.claude/rules/` or its link target. A pattern that matches either path excludes the file. Before v2.1.239, only a pattern that matched the link target excluded the file. Managed policy CLAUDE.md files cannot be excluded. This ensures organization-wide instructions always apply regardless of individual settings. +Patterns are matched against absolute file paths using glob syntax. You can configure `claudeMdExcludes` at any [settings layer](</docs/en/settings#where-settings-live>): user, project, local, or managed policy. Arrays merge across layers. To exclude a rules file you reach through a symlink, whether the file or its directory is the link, write the pattern against either path: the file’s path under `.claude/rules/` or its link target. A pattern that matches either path excludes the file. Before v2.1.239, only a pattern that matched the link target excluded the file. ##
modified Monitoring View current →
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -1101,7 +1101,7 @@ * `plugin.scope`: provenance category for the plugin: `"official"`, `"community"`, `"org"`, `"user-local"`, or `"default-bundle"` * `enabled_via`: how the plugin came to be enabled: `"default-enable"`, `"org-policy"`, `"admin-install"`, `"seed-mount"`, or `"user-install"`. The `"admin-install"` value means the plugin is set to required or auto-install for your organization in [**Organization settings > Plugins & skills**](<https://claude.ai/admin-settings/skills?tab=inventory>). Before v2.1.246, Claude Code reported these plugins as `"user-install"` or `"seed-mount"` * `plugin_id_hash`: deterministic hash of the plugin name and marketplace, sent only to your configured exporter. Lets you count the distinct third-party plugins loaded across your fleet without recording their names. For [plugins synced from claude.ai](</docs/en/plugins/loading#synced-plugins>), Claude Code hashes the plugin name with the marketplace name that claude.ai reports for the plugin, or with `synced` otherwise. Before v2.1.246, Claude Code didn’t use the marketplace name claude.ai reports in the hash - * `has_hooks`: whether the plugin contributes hooks + * `has_hooks`: whether the plugin contributes hooks, through [hook configuration](</docs/en/plugins/components#hooks>) or as a [mod](</docs/en/plugins/mods/overview#how-a-mod-works>) * `has_mcp`: whether the plugin contributes MCP servers * `host_owned_mcp`: `true` when the SDK host manages this plugin’s MCP connections and Claude Code skipped reading the plugin’s MCP server configuration, `false` otherwise * `skill_path_count`: number of skill directories the plugin declares
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -171,7 +171,7 @@ Timer| Aborts when| Runs on| Default timeout ---|---|---|--- First-byte deadline| No response headers arrive after Claude Code sends the request| Direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), including through an HTTPS proxy, but not when `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL` routes them through a [gateway](</docs/en/gateways>). Opt-in on Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1`; doesn’t run on Google Cloud’s Agent Platform or Microsoft Foundry, or in a [Claude apps gateway](</docs/en/claude-apps-gateway>) session| 180 seconds on the direct Anthropic API, 300 seconds elsewhere, plus one second per 32KB of request body -Event-level watchdog| No response events parse. Where the byte-level watchdog runs on a connection other than Amazon Bedrock, arriving bytes, including keep-alive pings, also reset this watchdog, for up to about five minutes without a parsed event| Every provider| 300 seconds +Event-level watchdog| No response events parse. Where the byte-level watchdog runs on a connection other than Amazon Bedrock, arriving bytes, including keep-alive pings, also reset this watchdog, for a limited time without a parsed event. That time is about five minutes when bytes arrive at least every 10 seconds. On a Claude apps gateway’s 15-second pings it is about 7.5 minutes, so a pings-only stream ends after about 12.5 minutes at the default timeout.| Every provider| 300 seconds Byte-level watchdog| No bytes arrive on the wire, including SSE keep-alive pings| Direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and [gateway](</docs/en/gateways>) connections, including a custom `ANTHROPIC_BASE_URL`. Opt-in on Amazon Bedrock `vnd.amazon.eventstream` responses with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1`; doesn’t run on Google Cloud’s Agent Platform or Microsoft Foundry| 180 seconds on the direct Anthropic API. 300 seconds on Claude Platform on AWS, on Amazon Bedrock, in a [Claude apps gateway](</docs/en/claude-apps-gateway>) session, and through a custom `ANTHROPIC_BASE_URL` Body idle timeout| No bytes arrive for 5 minutes, counting the wait for response headers| Providers other than the direct Anthropic API, Claude Platform on AWS, and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set, unless [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) changes that| 5 minutes
modified Manage Claude Code plugins for your organization View current →
--- a/org.md +++ b/org.md @@ -189,7 +189,7 @@ `disableSideloadFlags`| Rejects `--plugin-dir`, `--plugin-url`, `--agents`, the Agent SDK `plugins` option, and non-SDK `--mcp-config` at startup, and rejects folders named in the [`CLAUDE_CODE_PLUGIN_DIRS`](</docs/en/env-vars#variables>) variable the same way| Doesn’t restrict `.mcp.json`, `claude mcp add`, or SDK-provided servers. Pair it with [`allowedMcpServers`](</docs/en/managed-mcp>) `disableCommandPluginSources`| Blocks plugins with a `command` source from installing, updating, or loading. A `command` source is one whose plugin directory is produced by running a command on the machine. When unset, it takes the value of `allowManagedHooksOnly`| Doesn’t affect other source types `allowManagedHooksOnly`| Restricts which hooks run. See [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>)| Doesn’t trust hooks from plugins users enable themselves -`strictPluginOnlyCustomization`| Blocks skills, agents, hooks, and MCP servers that don’t come from a plugin, managed settings, or Claude Code’s built-ins. Set `true` to cover all four types, or an array of `skills`, `agents`, `hooks`, and `mcp` values such as `["skills", "hooks"]` to cover some| Doesn’t restrict which plugins users install. Pair it with `strictKnownMarketplaces` +`strictPluginOnlyCustomization`| Blocks skills, agents, hooks, and MCP servers that don’t come from a plugin, managed settings, or Claude Code’s built-ins. It also stops skills-directory plugins loading. Set `true` to cover all four types, or an array of `skills`, `agents`, `hooks`, and `mcp` values such as `["skills", "hooks"]` to cover some| Doesn’t restrict which plugins users install. Pair it with `strictKnownMarketplaces` `pluginSuggestionMarketplaces`| Marketplaces whose plugins may appear as install suggestions. See Recommend plugins| Doesn’t affect the built-in tips `pluginTrustMessage`| Appends your text to the trust warning that `/plugin` shows before a plugin installs| Doesn’t change the warning’s own text `allowedChannelPlugins`| Replaces the default list of plugins allowed to push channel messages. Requires `channelsEnabled: true`| See [Restrict which channel plugins can run](</docs/en/channels#restrict-which-channel-plugins-can-run>) @@ -231,7 +231,7 @@ * **`file` and `directory`**: `{ "source": "file", "path": "/opt/marketplace/marketplace.json" }` or `{ "source": "directory", "path": "/opt/marketplace/plugins" }`, with absolute paths. * **`hostPattern`** : `{ "source": "hostPattern", "hostPattern": "^github\\.example\\.com$" }`, matched against the host of `github`, `git`, and `url` sources. The pattern matches anywhere in the hostname, so anchor it with `^` and `$` as shown to match the whole host. A `github` source always counts as `github.com`. Use a `hostPattern` entry for a GitHub Enterprise Server or GitLab host where developers create their own marketplaces. The [GHES page](</docs/en/github-enterprise-server#allowlist-ghes-marketplaces-in-managed-settings>) has the worked example. * **`pathPattern`** : `{ "source": "pathPattern", "pathPattern": "^/opt/approved/" }`, matched against the `path` of `file` and `directory` sources. The pattern matches anywhere in the path, so start it with `^` to pin a directory prefix. `".*"` allows every local path. - * **`skills-dir`** : `{ "source": "skills-dir" }` keeps skills-directory plugins loading while an allowlist is set, and matches no marketplace. + * **`skills-dir`** : `{ "source": "skills-dir" }` matches no marketplace. For what it does, see Keep skills-directory plugins loading. #### @@ -253,7 +253,7 @@ Keep skills-directory plugins loading -Skills-directory plugins are the plugins users keep under `~/.claude/skills/` or a project’s `.claude/skills/` in folders that carry a `.claude-plugin/plugin.json`. If you set any allowlist without a `{ "source": "skills-dir" }` entry, they stop loading. Plain [skills](</docs/en/skills>), meaning a `SKILL.md` without that manifest, keep loading. +Skills-directory plugins are the plugins users keep under `~/.claude/skills/` or a project’s `.claude/skills/` in folders that carry a `.claude-plugin/plugin.json`. If you set any allowlist without a `{ "source": "skills-dir" }` entry, they stop loading. If you lock any customization type with [`strictPluginOnlyCustomization`](</docs/en/settings-reference#strictpluginonlycustomization>), they stop loading whether or not the entry is present. The allowlist doesn’t apply to plain [skills](</docs/en/skills>), meaning a `SKILL.md` without that manifest. #### @@ -323,7 +323,7 @@ "disableSideloadFlags": true } -On a machine with this policy, adding any source outside the list, for example `/plugin marketplace add https://example.com/other-marketplace.git`, fails with a message containing `is blocked by enterprise policy` followed by the allowed sources. `claude --plugin-dir ./x` exits with a message naming `disableSideloadFlags`. The `{ "source": "skills-dir" }` entry keeps skills-directory plugins loading under this allowlist. Remove that entry and they stop loading. Register both marketplaces with explicit `extraKnownMarketplaces` entries, as this policy does, rather than relying on the allowlist or on the official marketplace registering itself: +On a machine with this policy, adding any source outside the list, for example `/plugin marketplace add https://example.com/other-marketplace.git`, fails with a message containing `is blocked by enterprise policy` followed by the allowed sources. `claude --plugin-dir ./x` exits with a message naming `disableSideloadFlags`. If you remove the `{ "source": "skills-dir" }` entry from this allowlist, skills-directory plugins stop loading. Register both marketplaces with explicit `extraKnownMarketplaces` entries, as this policy does, rather than relying on the allowlist or on the official marketplace registering itself: * **The allowlist doesn’t register anything** : an `extraKnownMarketplaces` entry does, and it must itself pass the allowlist. Claude Code refuses to register a managed marketplace whose source the allowlist doesn’t match. * **The official marketplace registers itself only in an interactive terminal session** : even there, it registers only when the allowlist permits it. A `-p` run or a terminal attached to a cloud session never registers it.
modified Choose a permission mode View current →
Show diff (111 lines)
--- a/permission-modes.md +++ b/permission-modes.md @@ -30,7 +30,7 @@ * Tools matched by an explicit [ask rule](</docs/en/permissions#manage-permissions>) * Connector tools your organization [set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), in sessions where that setting reaches Claude Code * Tools that require user interaction: the built-in `AskUserQuestion` tool and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) - * `rm` and `rmdir` removals targeting a critical path, which no allow rule or `PreToolUse` hook `"allow"` approves + * Recognized `rm` and `rmdir` critical-path removals, which no allow rule or `PreToolUse` hook `"allow"` approves * The cross-session messaging safeguards * Reads outside the working directories while [`permissions.blockReadsOutsideWorkingDirectories`](</docs/en/settings-reference#permissions-blockreadsoutsideworkingdirectories>) is on: recognized file-reading Bash commands prompt even in auto mode and `bypassPermissions` mode, and so does any [unsandboxed retry](</docs/en/sandboxing#the-unsandboxed-retry-escape-hatch>) that needs approval to run outside the sandbox. Requires Claude Code v2.1.257 or later. A command the shell parser can’t trace, such as one that changes directory more than once or runs a subshell, prompts the same way even when it names no outside path. This prompt doesn’t apply when the command runs in the [sandbox](</docs/en/sandboxing>) and the sandbox enforces the block. @@ -210,7 +210,7 @@ * **Auto** : appears when auto mode is available * **Bypass permissions** : requires the **Allow bypass permissions mode** toggle in Desktop settings on Pro and Max plans; on Team and Enterprise plans, organization policy controls it instead -The Cowork tab doesn’t use these modes. Cowork has its own permission modes, enabled separately, and the Cowork tab shows no mode selector at all until a mode beyond its default is enabled for your account. See the [Cowork docs](<https://claude.com/docs/cowork/overview>).For desktop-specific details, see [Choose a permission mode](</docs/en/desktop#choose-a-permission-mode>) in the Desktop guide.**As a default** : set `defaultMode` in [settings](</docs/en/settings#where-settings-live>). The desktop app reads the same settings files as the CLI and applies the permission mode to new local sessions.A mode you pick in the mode selector is remembered per folder and takes precedence over `defaultMode` for that folder. Plan is the exception: picking it applies to the current session only.For where `defaultMode` goes in a settings file, see the example under Start in a different permission mode. +Cowork doesn’t use these modes. It has its own permission modes, enabled separately, and shows no mode selector at all until a mode beyond its default is enabled for your account. See the [Cowork docs](<https://claude.com/docs/cowork/overview>).For desktop-specific details, see [Choose a permission mode](</docs/en/desktop#choose-a-permission-mode>) in the Desktop guide.**As a default** : set `defaultMode` in [settings](</docs/en/settings#where-settings-live>). The desktop app reads the same settings files as the CLI and applies the permission mode to new local sessions.A mode you pick in the mode selector is remembered per folder and takes precedence over `defaultMode` for that folder. Plan is the exception: picking it applies to the current session only.For where `defaultMode` goes in a settings file, see the example under Start in a different permission mode. On [claude.ai/code](<https://claude.ai/code>), use the mode dropdown next to the prompt box. In the mobile app, tap the **+** button in the prompt box, then **Permission**. Cloud sessions and Remote Control sessions offer different permission modes: @@ -229,7 +229,14 @@ Auto-approve file edits with acceptEdits mode -`acceptEdits` mode lets Claude create and edit files in your working directory without prompting. The status bar shows `⏵⏵ accept edits on` while this mode is active. In addition to file edits, `acceptEdits` mode auto-approves common filesystem Bash commands: `mkdir`, `touch`, `rm`, `rmdir`, `mv`, `cp`, and `sed`. These commands are also auto-approved when prefixed with safe environment variables such as `LANG=C` or `NO_COLOR=1`, or process wrappers such as `timeout`, `nice`, or `nohup`. Like file edits, auto-approval applies only to paths inside your working directory or `additionalDirectories`. Each path also goes through the [symlink check](</docs/en/permissions#symlinks>), so a write that resolves outside that scope isn’t auto-approved either. Paths outside that scope, writes to protected paths, `rm` and `rmdir` removals targeting a critical path, and all other Bash commands except the [built-in read-only set](</docs/en/permissions#read-only-commands>) still prompt. When the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled, `acceptEdits` mode also auto-approves `Set-Content`, `Add-Content`, `Clear-Content`, and `Remove-Item` on in-scope paths, along with their common aliases. The same scope and protected-path rules apply, and `Remove-Item` gets its own check. A positional argument that contains a quote character, such as the apostrophe in `Set-Content .\notes.txt "It's done"`, still prompts even on in-scope paths, because Claude Code can’t statically validate an argument whose quoted and unquoted readings differ. Pass the content through a named parameter such as `-Value` to avoid the prompt. Use `acceptEdits` when you want to review changes in your editor or via `git diff` after the fact rather than approving each edit inline. Press `Shift+Tab` once from Manual mode to enter it, or start with it directly: +`acceptEdits` mode lets Claude create and edit files in your working directory without prompting. The status bar shows `⏵⏵ accept edits on` while this mode is active. In addition to file edits, `acceptEdits` mode auto-approves common filesystem Bash commands: `mkdir`, `touch`, `rm`, `rmdir`, `mv`, `cp`, and `sed`. These commands are also auto-approved when prefixed with safe environment variables such as `LANG=C` or `NO_COLOR=1`, or process wrappers such as `timeout`, `nice`, or `nohup`. Like file edits, auto-approval applies only to paths inside your working directory or `additionalDirectories`. These still prompt: + + * Paths outside that scope + * Writes to protected paths + * Recognized `rm` and `rmdir` critical-path removals + * All other Bash commands except the [built-in read-only set](</docs/en/permissions#read-only-commands>) + +Each path also goes through the [symlink check](</docs/en/permissions#symlinks>), so a write that resolves outside that scope isn’t auto-approved either. When the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled, `acceptEdits` mode also auto-approves `Set-Content`, `Add-Content`, `Clear-Content`, and `Remove-Item` on in-scope paths, along with their common aliases. The same scope and protected-path rules apply, and `Remove-Item` gets its own check. A positional argument that contains a quote character, such as the apostrophe in `Set-Content .\notes.txt "It's done"`, still prompts even on in-scope paths, because Claude Code can’t statically validate an argument whose quoted and unquoted readings differ. Pass the content through a named parameter such as `-Value` to avoid the prompt. Use `acceptEdits` when you want to review changes in your editor or via `git diff` after the fact rather than approving each edit inline. Press `Shift+Tab` once from Manual mode to enter it, or start with it directly: claude --permission-mode acceptEdits @@ -279,7 +286,7 @@ Eliminate permission prompts with auto mode -Auto mode lets Claude execute without routine permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Explicit [ask rules](</docs/en/permissions#manage-permissions>) still force a prompt. With Claude Code v2.1.283 or later, auto mode is the built-in starting permission mode for interactive terminal and VS Code sessions on every plan and provider. On earlier versions, it’s the built-in starting permission mode only on Pro, Max, and Team plans. The classifier also reviews each message Claude sends to another agent with [`SendMessage`](</docs/en/tools-reference>), whether plain text or a structured [agent team](</docs/en/agent-teams>) message, before Claude Code delivers it, both in auto mode and in plan mode while the classifier reviews commands; the send review requires Claude Code v2.1.222 or later. By default, the classifier doesn’t review `rm` and `rmdir` removals targeting a critical path, such as `rm -rf /` or `rm -rf ~`. Critical paths covers what happens to them in each permission mode. Auto mode also nudges Claude to keep working without stopping for clarifying questions, though Claude still asks when your prompt or a skill explicitly relies on it. For stronger autonomous behavior in a mode that still prompts you, set the [Proactive output style](</docs/en/output-styles>) instead. +Auto mode lets Claude execute without routine permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Explicit [ask rules](</docs/en/permissions#manage-permissions>) still force a prompt. With Claude Code v2.1.283 or later, auto mode is the built-in starting permission mode for interactive terminal and VS Code sessions on every plan and provider. On earlier versions, it’s the built-in starting permission mode only on Pro, Max, and Team plans. The classifier also reviews each message Claude sends to another agent with [`SendMessage`](</docs/en/tools-reference>), whether plain text or a structured [agent team](</docs/en/agent-teams>) message, before Claude Code delivers it, both in auto mode and in plan mode while the classifier reviews commands; the send review requires Claude Code v2.1.222 or later. By default, the classifier doesn’t review recognized `rm` and `rmdir` critical-path removals, such as `rm -rf /` or `rm -rf ~`. Critical paths covers what happens to them in each permission mode. Auto mode also nudges Claude to keep working without stopping for clarifying questions, though Claude still asks when your prompt or a skill explicitly relies on it. For stronger autonomous behavior in a mode that still prompts you, set the [Proactive output style](</docs/en/output-styles>) instead. Auto mode reduces permission prompts but does not guarantee safety. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations. @@ -531,7 +538,7 @@ 1. Actions matching your [allow, ask, or deny rules](</docs/en/permissions#manage-permissions>) resolve immediately, with these exceptions: * Writes to protected paths route to the classifier even when an allow rule matches. When the protected path is the file that a symlinked settings file points to, the write can prompt you instead, as the protected paths list describes - * No allow rule approves `rm` and `rmdir` removals targeting a critical path + * No allow rule approves recognized `rm` and `rmdir` critical-path removals * MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) prompt you directly even when an allow rule matches, and so do connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code * A shell command that carries [per-command allowed domains](</docs/en/sandboxing#per-command-allowed-domains-in-auto-mode>) also routes to the classifier even when an allow rule matches, because a rule approves the command, not its hosts * Ask rules that match on a command’s content, such as `Bash(git push *)`, fall back to a permission prompt @@ -573,7 +580,12 @@ Allow only pre-approved tools with dontAsk mode -If you set `dontAsk` mode, Claude Code auto-denies every tool call that would otherwise prompt you, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve some of those calls. To check which calls a mod can approve, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Claude still runs actions that need no approval in Manual mode, such as file reads inside your working directories and [read-only Bash commands](</docs/en/permissions#read-only-commands>). Actions matching your `permissions.allow` rules and calls approved by a [PreToolUse hook](</docs/en/permissions#extend-permissions-with-hooks>) run too. Use this mode for CI pipelines or restricted environments where you pre-define what Claude may do; the session never waits for input. The status bar shows `⏵⏵ don't ask on` in this mode. Claude Code denies calls matching your explicit [`ask` rules](</docs/en/permissions#manage-permissions>) rather than prompting. It also denies the built-in `AskUserQuestion` tool even if your allow rules match it, and does the same to connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code. It denies MCP tools marked [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) the same way, because their approval card needs an answer this mode never collects. `rm` and `rmdir` removals targeting a critical path, such as `rm -rf /` and `rm -rf ~`, are denied even when an allow rule matches them or a `PreToolUse` hook allows them. A read from a [network path](</docs/en/permissions#network-paths>) is denied the same way. [Cloud sessions](</docs/en/claude-code-on-the-web>) ignore `defaultMode: "dontAsk"`; see bypassPermissions for details. Set it at startup with the flag: +If you set `dontAsk` mode, Claude Code auto-denies every tool call that would otherwise prompt you, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve some of those calls. To check which calls a mod can approve, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Claude still runs actions that need no approval in Manual mode, such as file reads inside your working directories and [read-only Bash commands](</docs/en/permissions#read-only-commands>). Actions matching your `permissions.allow` rules and calls approved by a [PreToolUse hook](</docs/en/permissions#extend-permissions-with-hooks>) run too. Use this mode for CI pipelines or restricted environments where you pre-define what Claude may do; the session never waits for input. The status bar shows `⏵⏵ don't ask on` in this mode. Claude Code denies calls matching your explicit [`ask` rules](</docs/en/permissions#manage-permissions>) rather than prompting. It also denies the built-in `AskUserQuestion` tool even if your allow rules match it, and does the same to connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code. It denies MCP tools marked [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) the same way, because their approval card needs an answer this mode never collects. An allow rule or `PreToolUse` hook can’t approve these: + + * Recognized `rm` and `rmdir` critical-path removals, such as `rm -rf /` and `rm -rf ~` + * Reads from a [network path](</docs/en/permissions#network-paths>) + +[Cloud sessions](</docs/en/claude-code-on-the-web>) ignore `defaultMode: "dontAsk"`; see bypassPermissions for details. Set it at startup with the flag: claude --permission-mode dontAsk @@ -588,7 +600,7 @@ * The [`isolatePeerMachines`](</docs/en/settings-reference#isolatepeermachines>) approval prompt for messages to your sessions beyond this machine still appears. * When no [`crossSessionInbound`](</docs/en/cross-session-messaging#control-inbound-messages>) value applies, Claude Code holds an inbound message from another of your sessions for your approval, and delivers without asking only when the sending session identifies itself as also bypassing permission prompts. If you leave the permission mode while messages are held, Claude Code re-applies the inbound rules and delivers any held message they now accept. -In interactive terminal sessions with bypass permissions available, Claude Code also doesn’t enforce plan mode’s blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and `rm` and `rmdir` removals targeting a critical path still prompt. Plan mode keeps its blocks wherever Claude Code runs without an interactive terminal, including [non-interactive runs](</docs/en/headless>) with `-p`, [Agent SDK](</docs/en/agent-sdk/permissions#plan-mode-plan>) sessions, and conversations in the [VS Code extension](</docs/en/vs-code>)’s chat panel. There, `--allow-dangerously-skip-permissions` makes `bypassPermissions` selectable later. +In interactive terminal sessions with bypass permissions available, Claude Code also doesn’t enforce plan mode’s blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and recognized `rm` and `rmdir` critical-path removals still prompt. Plan mode keeps its blocks wherever Claude Code runs without an interactive terminal, including [non-interactive runs](</docs/en/headless>) with `-p`, [Agent SDK](</docs/en/agent-sdk/permissions#plan-mode-plan>) sessions, and conversations in the [VS Code extension](</docs/en/vs-code>)’s chat panel. There, `--allow-dangerously-skip-permissions` makes `bypassPermissions` selectable later. Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system. @@ -628,6 +640,14 @@ Bypass permissions was requested at launch and ignored · if that was you, ~/.claude/settings.json needs "skipDangerousModePermissionPrompt": true Add `"skipDangerousModePermissionPrompt": true` to `~/.claude/settings.json`, then start a new background session. + +### + +​ + +`claude agents` shows the bypass permissions warning that interactive sessions skip + +If [`claude agents`](</docs/en/agent-view#dispatch-defaults>) shows the bypass permissions warning although your interactive sessions skip it, check whether `skipDangerousModePermissionPrompt` is set in `.claude/settings.local.json` or a `--settings` file. Interactive sessions count the key there as your acceptance of the warning, and `claude agents` doesn’t. Whether or not you find it there, accept the warning to add the key to `~/.claude/settings.json`, where `claude agents` looks for it. ## @@ -689,7 +709,17 @@ Critical paths -Critical paths are the directories Claude Code protects from `rm` and `rmdir` commands, such as the filesystem root, your home directory, and your working directory. Claude Code never lets a [`permissions.allow`](</docs/en/permissions#manage-permissions>) rule or a [`PreToolUse` hook](</docs/en/permissions#extend-permissions-with-hooks>) that returns `"allow"` approve an `rm` or `rmdir` command that targets a critical path, even in modes that skip other prompts. This circuit breaker guards against model error. A matching deny rule still blocks the command outright. What happens instead depends on your permission mode. `Remove-Item` and the `cmd` removal built-ins have their own checks, covered in Remove-Item in PowerShell. +Critical paths are the directories Claude Code protects from `rm` and `rmdir` commands, such as the filesystem root, your home directory, and your working directory. Claude Code checks these commands before they run, and no [allow rule](</docs/en/permissions#manage-permissions>) approves one whose target it recognizes as a critical path. The check can miss some commands, so it doesn’t replace an operating-system control such as [sandboxing](</docs/en/sandboxing>). A critical-path removal is an `rm` or `rmdir` command whose target Claude Code recognizes as a critical path. No [`PreToolUse` hook](</docs/en/permissions#extend-permissions-with-hooks>) that returns `"allow"` approves one either. An allow rule or `PreToolUse` hook can’t approve one even in the permission modes that skip other prompts. + +A command the check misses gets no special handling, so anything that approves Bash commands in your session can approve it with no prompt. That includes an allow rule, `bypassPermissions` mode, and the sandbox’s [auto-allow mode](</docs/en/sandboxing#auto-allow-mode>). The check applies to `rm` and `rmdir`, so other approved commands can delete critical paths too. + +These controls apply whether or not the check recognizes a command: + + * **Deny rules** : a [deny rule](</docs/en/permissions#manage-permissions>) that matches the command blocks it, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some of those calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>) + * **Sandboxing** : [sandboxing](</docs/en/sandboxing>) has the operating system limit which paths Bash commands can write to. Sandboxed commands can still delete your working directory + * **Strict sandbox mode** : by default a sandboxed command can be [retried outside the sandbox](</docs/en/sandboxing#the-unsandboxed-retry-escape-hatch>), and an allow rule or `bypassPermissions` mode can approve that retry with no prompt. [Strict sandbox mode](</docs/en/sandboxing#turn-off-the-retry-with-strict-sandbox-mode>) turns the retry off + +What happens to a removal that Claude Code recognizes depends on your permission mode. `Remove-Item` and the `cmd` removal built-ins have their own checks, covered in Remove-Item in PowerShell. ###
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -12,7 +12,7 @@ Hooks -Run [hooks](</docs/en/agent-sdk/hooks>) first. A hook can deny the call outright or pass it on. A hook that returns `allow` does not skip the deny and ask rules below; those are evaluated regardless of the hook result. A `PreToolUse` hook that returns `allow` also can’t approve an `rm` or `rmdir` removal targeting a [critical path](</docs/en/permission-modes#critical-paths>). For what that `allow` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). +Run [hooks](</docs/en/agent-sdk/hooks>) first. A hook can deny the call outright or pass it on. A hook that returns `allow` doesn’t skip the deny and ask rules below, which are evaluated regardless of the hook result.A `PreToolUse` hook that returns `allow` also can’t approve an `rm` or `rmdir` command whose target Claude Code recognizes as a [critical path](</docs/en/permission-modes#critical-paths>), such as `rm -rf ~`. For what that `allow` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). 2 @@ -32,7 +32,7 @@ Apply the active permission mode: - * In `bypassPermissions` mode, Claude Code approves everything that reaches this step except `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>), which fall through instead. + * In `bypassPermissions` mode, Claude Code approves everything that reaches this step except recognized [critical-path removals](</docs/en/permission-modes#critical-paths>), which fall through instead. * In `acceptEdits` mode, Claude Code approves the file operations listed under Accept edits mode. * In `plan` mode, Claude Code sends file-edit and shell-write tools to your `canUseTool` callback regardless of allow rules, so write operations can’t be auto-approved while planning. * In other modes, the request falls through. @@ -41,7 +41,7 @@ Allow rules -Check `allow` rules (from `allowed_tools` and settings.json). If a rule matches, the tool is approved. A call the tool approves on its own is resolved at this step too, with no rule needed: for example a file read inside your working directories or a [read-only Bash command](</docs/en/permissions#read-only-commands>).`rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>) are never approved by an allow rule. Whether they then reach your callback depends on the permission mode: in an Agent SDK session in `auto` mode, for example, Claude Code denies them by default without calling it. The [Critical paths](</docs/en/permission-modes#critical-paths>) mode table lists what each mode does with them.An allow rule doesn’t approve a read from a [network path](</docs/en/permissions#network-paths>). +Check `allow` rules (from `allowed_tools` and settings.json). If a rule matches, the tool is approved. A call the tool approves on its own is resolved at this step too, with no rule needed: for example a file read inside your working directories or a [read-only Bash command](</docs/en/permissions#read-only-commands>).Recognized [critical-path removals](</docs/en/permission-modes#critical-paths>) aren’t approved by an allow rule. Whether they then reach your callback depends on the permission mode: in an Agent SDK session in `auto` mode, for example, Claude Code denies them by default without calling it. The [Critical paths mode table](</docs/en/permission-modes#critical-path-removals-in-each-permission-mode>) lists what each mode does with them.An allow rule doesn’t approve a read from a [network path](</docs/en/permissions#network-paths>). 6 @@ -76,7 +76,7 @@ Allow rules accept tool-name globs only after a literal `mcp__<server>__` prefix. The server segment must be glob-free so the rule names a specific server you configured: `mcp__puppeteer__*` matches every tool from the `puppeteer` server, and `mcp__github__get_*` matches its `get_` tools. An unanchored entry like `allowed_tools=["*"]` or `allowed_tools=["mcp__*"]` is ignored and doesn’t auto-approve anything. Scoped rules for `Read` and `Edit` take a path pattern. `Edit(path)` rules govern all built-in tools that write files, including `Write` and `NotebookEdit`; a `Write(path)` rule is never matched by the file permission checks. Use `//path` for an absolute filesystem path: a deny rule of `Edit(//secrets/**)` blocks writes anywhere under `/secrets` on disk. With a single leading slash, `Edit(/secrets/**)` anchors at the rule’s source instead. For rules passed through `allowed_tools` or `disallowed_tools`, that means the session’s working directory, so the rule doesn’t block `/secrets` on disk. See [Read and Edit rules](</docs/en/permissions#read-and-edit>) for the four anchor forms and how rules from settings files resolve. -**Auto-approved tools never reach`canUseTool`.** A tool call approved at any earlier step, by `acceptEdits` or `bypassPermissions`, or by an allow rule, skips your `canUseTool` callback, so permission checks you put there are silently bypassed for that tool.An allow rule never auto-approves `AskUserQuestion`, MCP tools marked [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), or `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>). In `dontAsk` mode Claude Code denies these calls without invoking the callback. In other modes the first three reach the callback. Depending on the [permission mode](</docs/en/permission-modes#critical-paths>), a critical-path removal reaches the callback too or Claude Code denies it without calling it, as it does by default for an Agent SDK session in `auto` mode.Coverage depends on the entry’s form: a bare name like `Read` or `mcp__github__get_issue` auto-approves every call to that tool apart from those exceptions and [reads from network paths](</docs/en/permissions#network-paths>), while a scoped rule like `Bash(npm test *)` auto-approves only matching calls, and other `Bash` calls that need approval still fall through to the callback. For checks that must run on every tool call, use a [`PreToolUse` hook](</docs/en/agent-sdk/hooks>): hooks run before every other step, and a hook deny applies even in `bypassPermissions` mode. +**Auto-approved tools never reach`canUseTool`.** A tool call approved at any earlier step, by `acceptEdits` or `bypassPermissions`, or by an allow rule, skips your `canUseTool` callback, so permission checks you put there are silently bypassed for that tool.No allow rule auto-approves `AskUserQuestion`, MCP tools marked [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), or recognized `rm` and `rmdir` [critical-path removals](</docs/en/permission-modes#critical-paths>). In `dontAsk` mode Claude Code denies these calls without invoking the callback. In other modes the first three reach the callback. The [Critical paths mode table](</docs/en/permission-modes#critical-path-removals-in-each-permission-mode>) lists what each mode does with a critical-path removal. The check that recognizes these removals [can miss some commands](</docs/en/permission-modes#critical-paths>).Coverage depends on the entry’s form: a bare name like `Read` or `mcp__github__get_issue` auto-approves every call to that tool apart from those exceptions and [reads from network paths](</docs/en/permissions#network-paths>), while a scoped rule like `Bash(npm test *)` auto-approves only matching calls, and other `Bash` calls that need approval still fall through to the callback. For checks that must run on every tool call, use a [`PreToolUse` hook](</docs/en/agent-sdk/hooks>): hooks run before every other step, and a hook deny applies even in `bypassPermissions` mode. For a locked-down agent, pair `allowedTools` with `permissionMode: "dontAsk"`: @@ -110,7 +110,7 @@ Mode| Description| Tool behavior ---|---|--- `default`| Standard permission behavior| No mode-based auto-approvals; calls that need approval and match no allow rule trigger your `canUseTool` callback -`dontAsk`| Deny instead of prompting| Any call that would otherwise prompt is denied, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some of those calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Calls approved by `allowed_tools` or rules run, and so do calls that need no approval in `default` mode. Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) and tools that require user interaction are denied even if you’ve pre-approved them. [Reads from network paths](</docs/en/permissions#network-paths>) and `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>) are also denied even if you’ve pre-approved them. `canUseTool` is never called +`dontAsk`| Deny instead of prompting| Any call that would otherwise prompt is denied without calling `canUseTool`, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some of those calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Calls approved by `allowed_tools` or `settings.json` allow rules run, and so do calls that need no approval in `default` mode. Some calls, such as [reads from network paths](</docs/en/permissions#network-paths>), are denied even when `allowed_tools` or an allow rule matches them. For the list, see Don’t ask mode `acceptEdits`| Auto-accept file edits| File edits and filesystem operations (`mkdir`, `rm`, `mv`, etc.) are automatically approved `bypassPermissions`| Bypass permission checks| Tools run without permission prompts, except for the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>). Use with caution `plan`| Planning mode| Claude explores and plans without editing your source files; file edits are never auto-approved and prompt through your `canUseTool` callback @@ -239,7 +239,7 @@ * Works on a path outside that scope * Writes to a protected path - * Removes a [critical path](</docs/en/permission-modes#critical-paths>) with `rm` or `rmdir` + * Removes a path that Claude Code recognizes as a [critical path](</docs/en/permission-modes#critical-paths>) with `rm` or `rmdir` **Use when:** you trust Claude’s edits and want faster iteration, such as during prototyping or when working in an isolated directory. @@ -249,7 +249,7 @@ Don’t ask mode (`dontAsk`) -Converts any permission prompt into a denial, without calling `canUseTool`, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some of those calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Tools pre-approved by `allowed_tools`, `settings.json` allow rules, or a hook run as normal. Calls that need no approval in `default` mode also run, such as file reads inside your working directories and calls to `Agent`. Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), tools that require user interaction, [reads from network paths](</docs/en/permissions#network-paths>), and `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>) are denied even when an allow rule matches. A `PreToolUse` hook allow doesn’t clear a critical-path removal or a read from a network path either. **Use when:** you want a fixed, explicit tool surface for a headless agent and prefer a hard deny over silent reliance on `canUseTool` being absent. +Converts any permission prompt into a denial, without calling `canUseTool`, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some of those calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). Tools pre-approved by `allowed_tools`, `settings.json` allow rules, or a hook run as normal. Calls that need no approval in `default` mode also run, such as file reads inside your working directories and calls to `Agent`. Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), tools that require user interaction, [reads from network paths](</docs/en/permissions#network-paths>), and recognized [critical-path removals](</docs/en/permission-modes#critical-paths>) are denied even when an allow rule matches. A `PreToolUse` hook allow doesn’t clear a recognized critical-path removal or a read from a network path either. The check that recognizes these removals [can miss some commands](</docs/en/permission-modes#critical-paths>). **Use when:** you want a fixed, explicit tool surface for a headless agent and prefer a hard deny over silent reliance on `canUseTool` being absent. #### @@ -262,7 +262,7 @@ Use with extreme caution. Claude has full system access in this mode. Only use in controlled environments where you trust all possible operations.`allowed_tools` does not constrain this mode. Every tool is approved, not just the ones you listed. These controls still apply: * Deny rules, explicit `ask` rules, and hooks are evaluated before the mode check and can still block a tool. - * Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), tools that require user interaction, and `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>) still fall through to your `canUseTool` callback. + * Connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), tools that require user interaction, and recognized [critical-path removals](</docs/en/permission-modes#critical-paths>) still fall through to your `canUseTool` callback. The check that recognizes these removals [can miss some commands](</docs/en/permission-modes#critical-paths>). * The [cross-session messaging safeguards](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) still apply. ####
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -177,7 +177,12 @@ Compacting the conversation -[Compaction](</docs/en/context-window#what-survives-compaction>) replaces your message history with a summary. By design, this invalidates the conversation layer, since the next request has a new, shorter history that doesn’t share a prefix with the old one. Claude Code reuses the system prompt layer unless the conversation was resumed while keeping a system prompt that would otherwise have changed; in that case the first compaction switches to the current prompt and that layer rebuilds once. It reloads project context from disk, which cache-hits only if CLAUDE.md and memory are unchanged since the session started. To produce the summary, Claude Code sends a separate request with the same system prompt, tools, and history as your conversation, plus a summarization instruction appended as a final user message. While the cache is warm, that request reads your prefix from the cache, so a mid-session `/compact` costs a fraction of what the context size suggests and spends most of its time generating the summary. After a break longer than the cache lifetime, there is no cache left to read, so the summarization request reprocesses the full history as uncached input. This is why `/compact` costs the most when you [resume an old session](</docs/en/sessions#resume-a-session>). In both the warm and cold cases, the turn after compaction rebuilds the conversation cache for only the much shorter summary, so that turn is not the slow part. +[Compaction](</docs/en/context-window#what-survives-compaction>) replaces your message history with a summary. By design, this invalidates the conversation layer: the next request has a new, shorter history that doesn’t share a prefix with the old one. The system prompt and project context layers can stay cached: + + * **System prompt** : the next request reads this layer from the cache, unless a resumed conversation kept a system prompt that is now out of date. The first time that conversation is compacted, Claude Code switches it to the current prompt, and the next request rebuilds this layer’s cache once. + * **Project context** : Claude Code reloads this layer from disk. The next request reads it from the cache only if CLAUDE.md and memory are unchanged since the session started. + +To produce the summary, Claude Code sends a separate request. The request repeats your conversation’s system prompt, tools, and the history being summarized. It ends with a summarization instruction. While the cache is warm, that request reads your prefix from the cache. A mid-session `/compact` then costs a fraction of what the context size suggests and spends most of its time generating the summary. After a break longer than the cache lifetime, there is no cache left to read, so the summarization request reprocesses that history as uncached input. This is why `/compact` costs the most when you [resume an old session](</docs/en/sessions#resume-a-session>). In both the warm and cold cases, the turn after compaction rebuilds the conversation cache for only the much shorter summary, so that turn isn’t the slow part. Compaction works in your favor when the context you discard is content you no longer need. To choose when its overhead happens, run `/compact` at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task. If you’ve gone down a path you want to abandon entirely, `/rewind` to an earlier turn instead. Rewinding truncates back to a prefix that is already cached, rather than building a new one as compaction does. @@ -330,7 +335,11 @@ 5. `ENABLE_PROMPT_CACHING_1H=1`, which requests one hour for both buckets 6. The default for the request’s bucket -Set `FORCE_PROMPT_CACHING_5M=1` when you’re debugging cache behavior, comparing the two TTLs, or overriding a longer TTL set in [managed settings](</docs/en/managed-settings>). To confirm which TTL your main conversation’s cache writes used, run `claude -p "hello" --output-format json` and read `usage.cache_creation` in the result. Claude Code reports one-hour cache writes under `ephemeral_1h_input_tokens` and five-minute cache writes under `ephemeral_5m_input_tokens`. Through an LLM gateway you set with `ANTHROPIC_BASE_URL`, part of the one-hour request travels in the `anthropic-beta` header, so configure the gateway to [forward that header unchanged](</docs/en/llm-gateway-protocol#request-headers>). The one-hour TTL isn’t available through the [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>). On Amazon Bedrock, prompt caching support, minimum cacheable prefix length, and one-hour TTL availability all vary by model. If cache token counts stay at zero, check [supported models, regions, and limits](<https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models>) in the Amazon Bedrock documentation. +Set `FORCE_PROMPT_CACHING_5M=1` when you’re debugging cache behavior, comparing the two TTLs, or overriding a longer TTL set in [managed settings](</docs/en/managed-settings>). To confirm which TTL your main conversation’s cache writes used, run `claude -p "hello" --output-format json` and read `usage.cache_creation` in the result. Claude Code reports one-hour cache writes under `ephemeral_1h_input_tokens` and five-minute cache writes under `ephemeral_5m_input_tokens`. To get one hour through a gateway or on Amazon Bedrock: + + * **LLM gateway you set with`ANTHROPIC_BASE_URL`**: part of the one-hour request travels in the `anthropic-beta` header, so configure the gateway to [forward that header unchanged](</docs/en/llm-gateway-protocol#request-headers>) + * **[Claude apps gateway](</docs/en/claude-apps-gateway>)** : ask your administrator to request the one-hour TTL in a [gateway policy](</docs/en/claude-apps-gateway-config#one-hour-prompt-cache>) + * **Amazon Bedrock** : prompt caching support, minimum cacheable prefix length, and one-hour TTL availability all vary by model. If cache token counts stay at zero, check [supported models, regions, and limits](<https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models>) in the Amazon Bedrock documentation. ##
modified Publish and distribute a plugin View current →
--- a/publish.md +++ b/publish.md @@ -82,7 +82,7 @@ If the plugin is in a git repository, people can clone it and load the checkout, or start Claude Code from their shell with `--plugin-url` pointed at a `.zip` you attach to a release. To get your next version they pull or download again. If it isn’t in a repository, send them the directory or a `.zip` of it. They load it in one of two ways: * **For one session** : they start Claude Code from their shell with `claude --plugin-dir ./deploy-helper`, where the path is the clone, the unzipped folder, or the `.zip` itself. See [Flags that load a plugin for one session](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>). - * **For every session** : they move the plugin directory, with its `.claude-plugin/plugin.json`, under `~/.claude/skills/` so Claude Code [loads it in every session](</docs/en/plugins/loading#find-where-a-plugin-came-from>). + * **For every session** : they move the plugin directory, with its `.claude-plugin/plugin.json`, under `~/.claude/skills/`. From then on Claude Code loads it at startup, unless their administrator has [blocked skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>). Adding a `.claude-plugin/marketplace.json` to that same repository is what lets people install by name and update with a command; see Publish through your own marketplace.
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -2780,14 +2780,19 @@ "subagent_type": str | None, # The type of specialized agent to use "model": "sonnet" | "opus" | "haiku" | "fable" | None, # Model override for this agent "effort": "low" | "medium" | "high" | "xhigh" | "max" | None, # Reasoning effort for this agent - "run_in_background": bool | None, # Agents run in the background by default; set to False to run synchronously + "run_in_background": bool | None, # Default when omitted: your main agent's call runs the new agent in the background, and a subagent's call waits for it "name": str | None, # Name for the spawned agent "team_name": str | None, # Deprecated; ignored "mode": "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan" | None, # Deprecated; ignored. The subagent inheritance rules decide a subagent's permission mode "isolation": "worktree" | "remote" | None, # Isolation mode for the agent's changes } -Launches a new agent to handle complex, multi-step tasks autonomously. **Output (status:`"completed"`):** +Launches a new agent to handle complex, multi-step tasks autonomously. When Claude leaves `run_in_background` out of an `Agent` call, by default your main agent doesn’t wait for the new agent and a subagent waits: + + * **From your main agent** : the new agent runs in the background, and the result has `status: "async_launched"`. To make your main agent wait for the new agent instead, see [Choose whether Claude waits for subagents](</docs/en/agent-sdk/subagents#choose-whether-claude-waits-for-subagents>). + * **From one of your subagents** : the calling subagent [waits for the new agent](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>). The new agent runs in the background instead when its definition sets `background` to `True`, or when you [turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) by setting `CLAUDE_CODE_FORK_SUBAGENT` to `0`. + +Before Python SDK v0.2.169, agents that your subagents started also ran in the background by default. That release is the first to bundle Claude Code v2.1.302 or later. **Output (status:`"completed"`):** { "status": "completed",
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -18,6 +18,7 @@ Before using Remote Control, confirm that your environment meets these conditions: * **Subscription** : available on Pro, Max, Team, and Enterprise plans. API keys are not supported. On Team and Enterprise, an Owner must first enable the Remote Control toggle in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>). + * **Custom roles** : if your Enterprise organization manages your access with [custom roles](<https://support.claude.com/en/articles/13930452>), your roles must give you both the cloud sessions permission and the **Claude Code remote control** permission. If either is missing, starting Remote Control shows `Remote Control is disabled by your organization's policy`. Ask an Owner to check your roles and add what’s missing at [**Organization settings > Roles**](<https://claude.ai/admin-settings/roles>). * **Authentication** : run `claude` and use `/login` to sign in through claude.ai if you haven’t already. Without an eligible login, `claude remote-control` exits with an error, while `claude --remote-control` still starts an interactive session and shows a Remote Control failure notification shortly after launch. * **API endpoint** : not available in any of these configurations: * You use Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. @@ -25,7 +26,7 @@ * You sign in through an enterprise [Claude apps gateway](</docs/en/claude-apps-gateway>). * **Feature-flag evaluation** : if you set an [environment variable that turns off feature-flag evaluation](</docs/en/env-vars#features-that-need-feature-flag-fetching>), whether Remote Control is available depends on which one: * If you set `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK`, Remote Control is unavailable. Unset the variable wherever it’s set, in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings-reference#all-settings>), to use Remote Control. - * If you set only `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, Remote Control stays available unless your organization requires Trusted Devices. If it does, unset the variable to use Remote Control. Using Remote Control with either variable set requires Claude Code v2.1.283 or later. + * If you set only `DISABLE_TELEMETRY` or `DO_NOT_TRACK`, Remote Control stays available unless your organization requires Trusted Devices. If it does, unset the variable to use Remote Control. Using Remote Control with either variable set requires Claude Code v2.1.283 or later, or v2.1.304 or later in the Claude Desktop app. * **Workspace trust** : in a directory you haven’t trusted yet, `claude remote-control` prints what trusting it turns on and asks `Trust <directory>? [y/N]` before it starts. Answering `y` saves the choice, except in your home directory, where trust is never saved and the question returns on every run. When its standard input or output isn’t a terminal, the command can’t ask and exits with a [`Workspace not trusted`](</docs/en/errors#workspace-not-trusted-when-starting-remote-control>) error. ## @@ -181,7 +182,7 @@ Auto-connect with `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set -With only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set, your sessions don’t auto-connect through your organization’s admin default or Claude Code’s own default. If something else makes Remote Control unavailable for you, such as `DISABLE_GROWTHBOOK` or an LLM gateway, start with Requirements instead. Turning auto-connect on with only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set requires Claude Code v2.1.283 or later. To auto-connect, check whether your organization requires Trusted Devices: +With only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set, your sessions don’t auto-connect through your organization’s admin default or Claude Code’s own default. If something else makes Remote Control unavailable for you, such as `DISABLE_GROWTHBOOK` or an LLM gateway, start with Requirements instead. Before you turn auto-connect on with only `DISABLE_TELEMETRY` or `DO_NOT_TRACK` set, confirm that your Claude Code version meets the requirement for these variables. Then check whether your organization requires Trusted Devices: * **Not required** : set **Enable Remote Control for all sessions** to `true` in `/config`. * **Required** : Remote Control isn’t available while `DISABLE_TELEMETRY` or `DO_NOT_TRACK` is set. Unset whichever of the two variables you set. If your sessions still don’t auto-connect, set **Enable Remote Control for all sessions** to `true` in `/config`. @@ -461,7 +462,7 @@ An [environment variable](</docs/en/env-vars#features-that-need-feature-flag-fetching>) that turns off feature-flag evaluation is set, and the full message names the variable Claude Code found. On versions before 2.1.154, the same configuration produces “Remote Control is not yet enabled for your account” instead. What to do depends on the variable the message names: * **`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK`**: unset the variable wherever it’s set, in your shell environment or in the `env` block of a [`settings.json` file](</docs/en/settings-reference#all-settings>). - * **`DISABLE_TELEMETRY` or `DO_NOT_TRACK`**: on a Pro, Max, Team, or Enterprise plan with `DISABLE_GROWTHBOOK` unset, these variables leave Remote Control available unless your organization requires Trusted Devices. If it does, unset the variable wherever it’s set to use Remote Control. From v2.1.154 through v2.1.282, either variable produced this message, so update Claude Code to v2.1.283 or later. + * **`DISABLE_TELEMETRY` or `DO_NOT_TRACK`**: on a Pro, Max, Team, or Enterprise plan with `DISABLE_GROWTHBOOK` unset, these variables leave Remote Control available unless your organization requires Trusted Devices. If it does, unset the variable wherever it’s set to use Remote Control. On v2.1.154 through v2.1.282, you see this message with either variable set, so update Claude Code to a version that meets the requirement for these variables. ### @@ -482,6 +483,7 @@ * **The error mentions`disableRemoteControl`**: your IT administrator has disabled Remote Control on this device through [managed settings](</docs/en/managed-settings>), independent of the organization-wide toggle and of how you’re signed in. * **Your claude.ai plan is Pro or Max** : Claude Code is still signed in under a Team or Enterprise organization from an earlier login, so it checks that organization’s Remote Control policy. Run `/status` to see which plan and organization your sign-in uses. Run `claude auth logout` then `claude auth login` to sign in again under your current plan. * **The message doesn’t say to contact your organization admin** : your organization has the [HIPAA configuration](</docs/en/hipaa-setup>) applied, which turns Remote Control off. To confirm, run `/status` and look for `HIPAA` on the `Organization configuration` line. An Owner sees the **Remote Control** toggle grayed out in [admin settings](<https://claude.ai/admin-settings/claude-code>) and can’t turn it on. If you have questions about the configuration, ask an Owner, who can contact your organization’s Anthropic account team. Before v2.1.267, this case showed “Remote Control isn’t available for your organization due to its compliance policy” instead. + * **Remote Control works for others in your organization but not for you** : if your Enterprise organization manages your access with [custom roles](<https://support.claude.com/en/articles/13930452>), your roles can be the cause. Remote Control needs both the cloud sessions permission and the **Claude Code remote control** permission. Ask an Owner to check whether your roles include both and add what’s missing at [**Organization settings > Roles**](<https://claude.ai/admin-settings/roles>). * **Otherwise, an Owner hasn’t enabled it for your organization** : Remote Control is off by default on Team and Enterprise plans. An Owner can enable it at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) by turning on the **Remote Control** toggle. This toggle is a server-side organization setting. Before v2.1.281, this message also appeared when Claude Code hadn’t loaded your organization’s policy on this machine, for example after starting offline. Later versions report that state as `Couldn't verify your organization's policy for remote control` instead.
modified Automate work with scheduled tasks View current →
--- a/routines.md +++ b/routines.md @@ -15,7 +15,7 @@ Two other features schedule work on your machine instead of in the cloud: [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) and [`/loop`](</docs/en/scheduled-tasks>). To choose among all three, see [Compare scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>). -Team and Enterprise Owners can turn off scheduled tasks for all members with the **Scheduled tasks (Was Routines)** toggle at [**Organization settings > Capabilities > Remote sessions**](<https://claude.ai/admin-settings/capabilities>). When the toggle is off, existing scheduled tasks stop running and members can’t create new ones. +Team and Enterprise Owners can turn off scheduled tasks for all members with the **Scheduled tasks (Was Routines)** toggle at [**Organization settings > Capabilities > Remote sessions**](<https://claude.ai/admin-settings/capabilities>). When the toggle is off, existing scheduled tasks stop running and members can’t create new ones. If your Enterprise organization manages your access with [custom roles](<https://support.claude.com/en/articles/13930452>), you also need a role that includes the scheduled tasks permission. An Owner can add it in a role’s **Remote sessions** section at [**Organization settings > Roles**](<https://claude.ai/admin-settings/roles>). ## @@ -38,7 +38,7 @@ Create a scheduled task -Create a scheduled task from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a scheduled task you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Scheduled** in the sidebar or in the sidebar’s **More** menu, then **New task** , and continue with Create from the web. Scheduled tasks run autonomously as full Claude Code cloud sessions. You don’t choose a permission mode. The session runs shell commands, uses [skills](</docs/en/skills>), and calls any connectors you include, all without stopping for approval apart from some artifact actions. Outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), those skills include the ones committed to the cloned repository. What a scheduled task can reach is determined by: +Create a scheduled task from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a scheduled task you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Scheduled** in the sidebar or in the sidebar’s **More** menu, then **New task** , and continue with Create from the web. Scheduled tasks run autonomously as full Claude Code cloud sessions. You don’t choose a permission mode. The session runs shell commands, uses [skills](</docs/en/skills>), and calls any connectors you include, all without stopping for approval apart from some artifact actions. Outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>)’s threads, those skills include the ones committed to the cloned repository. What a scheduled task can reach is determined by: * The repositories you select * The [environment’s](</docs/en/cloud-environments>) network access and variables @@ -110,7 +110,7 @@ Create the task -Click **Create**. The dialog closes and the new task’s detail page opens. The task runs the next time one of its triggers matches. To start a run immediately, click **Run now** on the detail page.Each run creates a new session alongside your other sessions, where you can see what Claude did, review changes, and create a pull request. +Click **Create**. The dialog closes and the new task’s detail page opens. The task runs the next time one of its triggers matches. To start a run immediately, click **Run now** on the detail page.To see what a run did, click it in the **History** list on the detail page. The run opens as a full session, a new one for each run, where you can see what Claude did, review changes, and create a pull request. #### @@ -149,9 +149,9 @@ A schedule trigger runs the task on a recurring cadence, or once at a specific future time. In the task’s creation or edit dialog on the web, pick a preset frequency such as hourly, daily, or weekly: - * **Time zone** : times are entered in your local zone and converted automatically, so the task runs at that wall-clock time regardless of where the cloud infrastructure is located. * **Runs on the hour** : if you schedule a run exactly on the hour, such as 9:00, it can start several minutes late. To start close to the scheduled time, pick a few minutes past the hour, for example 9:07. - * **Custom intervals** : for a custom interval such as every two hours, pick the closest preset in the dialog, then run `/schedule update` in the CLI to set a specific cron expression. The minimum interval is one hour; expressions that run more frequently are rejected. + * **Custom intervals** : for a cadence the presets lack, create the task and select **Custom** in its edit dialog. Then enter a cron expression, such as `0 */2 * * *` for every two hours. To set one from the CLI, run `/schedule update`. Expressions that run more often than once per hour are rejected. + * **Time zone** : when you pick a preset frequency, enter the time in your local time zone. #### @@ -165,13 +165,13 @@ * Open a cleanup PR after a rollout finishes * Start follow-up work after an upstream change ships -After the task runs, it turns itself off and the web UI marks it as **Completed**. To run it again, open the task’s edit dialog on the web, which offers **One-time** for a one-off task, and set a new time. Create a one-off run from the CLI by describing the time in natural language. Claude resolves the phrase against the current time and confirms the absolute timestamp before saving. +After the task runs, it turns itself off and the web UI marks it as **Completed**. To run it again, open the task’s edit dialog on the web and select **One-time** or **Once** , whichever label your dialog shows. Then set a new date and time in your local time zone and save. Create a one-off run from the CLI by describing the time in natural language. Claude resolves the phrase against the current time and confirms the absolute timestamp before saving. /schedule tomorrow at 9am, summarize yesterday's merged PRs /schedule in 2 weeks, open a cleanup PR that removes the feature flag -The same local-to-UTC conversion as recurring schedules applies to one-off timestamps. One-off runs count against the same hourly limit as other scheduled runs. See Usage and limits for details. +One-off runs count against the same hourly limit as other scheduled runs. See Usage and limits for details. ### @@ -378,7 +378,7 @@ Scheduled tasks can use your connected MCP connectors to read from and write to external services during each run. For example, a task that triages support requests might read from a Slack channel and create issues in Linear. Connectors are the [claude.ai integrations](</docs/en/mcp#use-mcp-servers-from-claude-ai>) on your account. MCP servers you added locally in the CLI with `claude mcp add` are stored on your machine rather than your claude.ai account, so they do not appear in the connectors list. To use one of those servers in a scheduled task: * **As a connector** : add it as a connector at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) - * **In the repository** : for a scheduled task with one repository outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), you can instead declare the server in a committed [`.mcp.json`](</docs/en/mcp#project-scope>). A scheduled task in a project doesn’t load `.mcp.json`, so add the server as a connector + * **In the repository** : for a scheduled task with one repository, you can instead declare the server in a committed [`.mcp.json`](</docs/en/mcp#project-scope>), unless the task runs as threads in a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>). If it does, add the server as a connector. When you create a scheduled task, all of your currently connected connectors are included by default. Remove any that aren’t needed to limit which tools Claude has access to during the run. You can also add connectors directly from the task’s creation or edit dialog. To manage or add connectors outside of that dialog, visit [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) or use `/schedule update` in the CLI. @@ -490,8 +490,9 @@ * You are inside a cloud session, where submitting `/schedule` answers that the command isn’t available in that environment. Manage scheduled tasks from the [web UI](<https://claude.ai/code/routines>) instead * Your organization’s policy disables [cloud sessions](</docs/en/claude-code-on-the-web>), which scheduled tasks require. In this case, submitting `/schedule` answers [`Cloud sessions are disabled by your organization's policy`](</docs/en/errors#cloud-sessions-are-disabled-by-your-organizations-policy>) instead. Before v2.1.268, it returned `Unknown command: /schedule` * An Owner turned off scheduled tasks for your Team or Enterprise organization. Before v2.1.227, the command still appeared in this case, and claude.ai rejected the task when Claude tried to create or run it - -Unless your organization’s policy disables scheduled tasks or cloud sessions, you can create and manage scheduled tasks at [claude.ai/code/routines](<https://claude.ai/code/routines>) regardless of how the CLI is configured. + * Your Enterprise organization manages your access with [custom roles](<https://support.claude.com/en/articles/13930452>), and none of your roles includes the scheduled tasks permission under **Remote sessions**. Ask an Owner to add it to one of your roles + +If the cause is your CLI sign-in or being inside a cloud session, you can still create and manage scheduled tasks at [claude.ai/code/routines](<https://claude.ai/code/routines>). You need a Pro, Max, Team, or Enterprise account there. If scheduled tasks or cloud sessions are off for your organization or missing from your roles, you can’t create them on the web either. ###
modified Configure the sandboxed Bash tool View current →
--- a/sandboxing.md +++ b/sandboxing.md @@ -333,7 +333,7 @@ Because turning filesystem isolation off widens what sandboxed commands can do, Claude Code honors `filesystem.disabled` from these settings sources only: * User settings, managed settings, and the `--settings` CLI flag can set it. Project settings in `.claude/settings.json` and `.claude/settings.local.json` can’t, so a checked-out project can’t switch filesystem isolation off. - * When managed settings configure `sandbox.filesystem` at all, or list any `sandbox.credentials.files` entry with `"mode": "deny"`, only managed settings can set the key. This keeps administrator-deployed filesystem restrictions in force; to relax such a deployment, set `"disabled": true` in managed settings. + * When managed settings configure `sandbox.filesystem` at all, or list any `sandbox.credentials.files` entry with `"mode": "deny"`, only managed settings can set the key. This keeps developers from turning filesystem isolation off in such a deployment; to turn it off for everyone, set `"disabled": true` in managed settings. * When [`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`](</docs/en/env-vars>) is set, Claude Code ignores `filesystem.disabled` from every source, including managed settings, and keeps filesystem isolation on. A [valid](</docs/en/settings-reference#invalid-credential-entries-in-managed-settings>) `mask` entry doesn’t lock the key, even when Claude Code falls back to `deny` for it at startup. List a path that can’t be masked, such as a credential directory, as an explicit `deny` entry in managed settings, which locks the key. @@ -512,7 +512,11 @@ * **Files that would turn your working directory into a bare git repository** : `HEAD`, `objects`, and `refs` at the top level, plus existing `config` and `hooks` entries there when a `HEAD` sits beside them. A file named `config` is denied even with no `HEAD`. On Linux and WSL2, the sandbox deletes a top-level `HEAD` file or `objects` or `refs` directory that appears while a sandboxed command is running * **In`~/.claude`, or the directory `CLAUDE_CONFIG_DIR` points to**: most of its contents, plus `~/.claude.json` and the `.credentials.json` credential store -If a symlink appears at a protected settings file’s path during the session, the sandbox also denies writes to the file it points to, starting with the next command. There is no way to exempt one of these paths: an `allowWrite` entry or an `Edit` allow rule that covers the path doesn’t lift the protection. The only way to turn the protection off is `filesystem.disabled`, which turns off filesystem isolation for every path. To see most of these paths resolved for your machine, run `/sandbox` and open the **Config** tab, which lists them under **Denied within allowed** , mixed in with your own `denyWrite` entries. If `git merge` or `git checkout` fails with `unable to unlink old` on one of these paths, see A git command fails with `unable to unlink old`. +If a symlink appears at a protected settings file’s path during the session, the sandbox also denies writes to the file it points to, starting with the next command. If you add an `allowWrite` entry or an `Edit` allow rule that covers one of these paths, the protection still applies. To turn the protection off, set `filesystem.disabled`, which also turns off the rest of filesystem isolation. + +If you set [`allowNestedUserNamespaces`](</docs/en/settings-reference#sandbox-allownestedusernamespaces>) to `true` on Linux or WSL2, don’t rely on protected paths: code from a sandboxed command can end up running outside the sandbox. + +To see most of these paths resolved for your machine, run `/sandbox` and open the **Config** tab, which lists them under **Denied within allowed** , mixed in with your own `denyWrite` entries. If `git merge` or `git checkout` fails with `unable to unlink old` on one of these paths, see A git command fails with `unable to unlink old`. #### @@ -715,8 +719,9 @@ * [`network.allowAllUnixSockets`](</docs/en/settings-reference#sandbox-network-allowallunixsockets>) * [`network.allowLocalBinding`](</docs/en/settings-reference#sandbox-network-allowlocalbinding>) * [`allowAppleEvents`](</docs/en/settings-reference#sandbox-allowappleevents>), which a repository can’t turn on - -Set `allowManagedReadPathsOnly` to `true` in managed settings so that only `allowRead` entries from managed settings are honored. This prevents developers from widening read access beyond the organization-approved paths. To lock network domains to the managed values the same way, set [`allowManagedDomainsOnly`](</docs/en/settings-reference#sandbox-network-allowmanageddomainsonly>). With the lock on, only managed settings can set a proxy port. When managed settings configure `sandbox.filesystem` or list any `sandbox.credentials.files` entry with `"mode": "deny"`, only managed settings can set `filesystem.disabled`, so developers can’t switch off administrator-deployed filesystem restrictions. A [valid](</docs/en/settings-reference#invalid-credential-entries-in-managed-settings>) `mask` entry doesn’t lock the key. See Which settings can disable it. + * [`allowNestedUserNamespaces`](</docs/en/settings-reference#sandbox-allownestedusernamespaces>), which a repository can’t turn on + +Set `allowManagedReadPathsOnly` to `true` in managed settings so that only `allowRead` entries from managed settings are honored. This prevents developers from widening read access beyond the organization-approved paths. To lock network domains to the managed values the same way, set [`allowManagedDomainsOnly`](</docs/en/settings-reference#sandbox-network-allowmanageddomainsonly>). With `allowManagedDomainsOnly` on, only managed settings can set a proxy port. When managed settings configure `sandbox.filesystem` or list any `sandbox.credentials.files` entry with `"mode": "deny"`, only managed settings can set `filesystem.disabled`, so developers can’t turn filesystem isolation off with that key. A [valid](</docs/en/settings-reference#invalid-credential-entries-in-managed-settings>) `mask` entry doesn’t lock the key. See Which settings can disable it. #### @@ -842,6 +847,26 @@ ​ +Chromium or rootless Podman fails inside the sandbox on Linux + +On Linux and WSL2, commands in the sandbox can’t create user namespaces by default, so tools that rely on them fail: + + * Chromium exits with `No usable sandbox!` + * `unshare -U true` prints `unshare: unshare failed: Operation not permitted`. With [`allowAllUnixSockets`](</docs/en/settings-reference#sandbox-network-allowallunixsockets>) on, it can print `No space left on device` instead + * Rootless Podman prints `cannot clone: Operation not permitted`, or stops earlier with `read-only file system` on one of its own folders + +In a session with [`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`](</docs/en/env-vars#variables>) set to `1`, start Chromium or Electron with `--no-sandbox`, and run any other tool yourself outside Claude Code. In that session, every command runs sandboxed, and the settings that the other fixes below name have no effect. Each fix works for the tools it names and gives up some isolation: + + * For Chromium or Electron, start the browser with `--no-sandbox`. The Claude Code sandbox stays as it is, but the browser runs web content without its own sandbox. + * For rootless Podman, Buildah, or a script or test command that runs a browser or `unshare`, add a pattern to `sandbox.excludedCommands`, such as `podman *`. Commands that match run outside the sandbox with your full access, and Claude can edit a script in your working directory before running it. The pattern has to match the command Claude runs, so for a browser, match the test command rather than the browser. + * To keep Chromium’s or Electron’s own sandbox, or to run a nested bubblewrap or `unshare`, set [`sandbox.allowNestedUserNamespaces`](</docs/en/settings-reference#sandbox-allownestedusernamespaces>) to `true` in `~/.claude/settings.json`, not the project’s `.claude/settings.json`. Requires Claude Code v2.1.305 or later. A command that begins with `unshare` stays sandboxed whatever `excludedCommands` pattern you list, because `unshare` can start any other program. This setting alone isn’t enough for rootless Podman or Buildah, which the sandbox stops in other ways too. + +If you set `allowNestedUserNamespaces` to `true`, you turn off a security boundary: code from a sandboxed command can end up running outside the sandbox.Don’t rely on any of the sandbox’s restrictions, including protected paths and [`credentials.files`](</docs/en/settings-reference#sandbox-credentials-files>) entries, to stop a malicious command. In auto-allow mode, that command can run without a permission prompt. If your organization has a security team, check with them before you turn this setting on. + +### + +​ + `pbcopy`, `xclip`, or `wl-copy` doesn’t update the clipboard The `pbcopy`, `xclip`, and `wl-copy` 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. @@ -1020,6 +1045,7 @@ * **Filesystem permission escalation** : overly broad filesystem write permissions can enable privilege escalation attacks. Allowing writes to directories containing executables in `$PATH`, system configuration directories, or user shell configuration files such as `.bashrc` or `.zshrc` can lead to code execution in different security contexts when other users or system processes access these files. * **Linux sandbox strength** : the Linux implementation provides strong filesystem and network isolation but includes an `enableWeakerNestedSandbox` mode that enables it to work inside Docker environments without privileged namespaces. This option considerably weakens security and should only be used when additional isolation is otherwise enforced. * **Apple Events on macOS** : the macOS sandbox blocks Apple Events by default. The `allowAppleEvents` setting lifts this restriction so tools such as `open` and `osascript` work, but it removes code-execution isolation: sandboxed commands can launch other applications unsandboxed with no user prompt, and can send AppleScript commands to running applications, subject to the per-app macOS automation-consent prompt (TCC). It is only honored from user, managed, or CLI settings. Project settings cannot enable it. + * **User namespaces on Linux and WSL2** : by default, sandboxed commands can’t create user namespaces. If you set [`allowNestedUserNamespaces`](</docs/en/settings-reference#sandbox-allownestedusernamespaces>) to `true`, you turn off a security boundary: code from a sandboxed command can end up running outside the sandbox. Before you turn this setting on, read the warning in Chromium or rootless Podman fails inside the sandbox on Linux. ###
modified Run prompts on a schedule View current →
--- a/scheduled-tasks.md +++ b/scheduled-tasks.md @@ -24,8 +24,8 @@ Access to local files| No (fresh clone)| Yes| Yes MCP servers| Connectors configured per task| [Config files](</docs/en/mcp>) and connectors| Inherits from session Permission prompts| No (runs autonomously)| Configurable per task| Inherits from session -Customizable schedule| Via `/schedule` in the CLI| Yes| Yes -Minimum interval| 1 hour| 1 minute| 1 minute +Customizable schedule| Yes| Yes| Yes +Minimum interval| 1 hour| 1 minute when Claude sets it, [1 hour in the forms](</docs/en/desktop-scheduled-tasks#schedule-options>)| 1 minute Use **cloud tasks** for work that should run reliably without your machine. Use **Desktop tasks** when you need access to local files and tools. Use **`/loop`** for quick polling during a session. @@ -124,7 +124,18 @@ Stop a loop -To stop a self-paced `/loop` while it is waiting for the next iteration, press `Esc`. This clears the pending wakeup so the loop does not fire again. Tasks you scheduled by asking Claude directly are not affected by `Esc` and stay in place until you delete them. In self-paced mode, Claude can also end the loop on its own once the task is complete. Claude calls the [`ScheduleWakeup` tool](</docs/en/tools-reference>) with `stop: true`, which cancels the pending wakeup immediately. If an iteration ends without either rescheduling or stopping, Claude Code schedules one fallback wakeup about 20 minutes later and ends the loop when that iteration doesn’t reschedule either. Loops on a fixed interval keep running until you cancel them like any other scheduled task or seven days elapse. + * **Self-paced loop** : while the loop is waiting for its next iteration, press `Esc` to stop it. You can also stop it with `Ctrl+C` while Claude is idle, except in a background session you’ve attached to. A `Pending wakeup cancelled` notice confirms that the loop won’t fire again. + * **Fixed-interval loop** : to stop a loop such as `/loop 5m`, ask Claude to cancel it, for example `cancel the deploy check loop`. `Esc` and `Ctrl+C` don’t stop it, or any task you scheduled by asking Claude directly. A loop you don’t cancel ends when seven days elapse. + +In self-paced mode, Claude can also end the loop on its own once the task is complete. Claude calls the [`ScheduleWakeup` tool](</docs/en/tools-reference>) with `stop: true`, which cancels the pending wakeup immediately. If an iteration ends without either rescheduling or stopping, Claude Code schedules one fallback wakeup about 20 minutes later and ends the loop when that iteration doesn’t reschedule either. + +#### + +​ + +Detach without stopping a loop + +When you’re [attached to a background session](</docs/en/agent-view#attach-to-a-session>) and Claude is idle, press `Ctrl+C` twice on an empty prompt to detach. A self-paced loop waiting there for its next iteration keeps running, and that iteration starts on schedule. To stop the loop instead, press `Esc` before you detach. Detaching with `Ctrl+C` without stopping the loop requires Claude Code v2.1.295 or later. ## @@ -254,7 +265,10 @@ * Tasks only fire while Claude Code is running and idle. Closing the terminal or letting the session exit stops them firing. [Backgrounding the session](</docs/en/agent-view#from-inside-a-session>) carries `/loop` tasks over to a background session, which keeps running without a terminal. * No catch-up for missed fires. If a task’s scheduled time passes while Claude is busy on a long-running request, it fires once when Claude becomes idle, not once per missed interval. - * When you resume a session with `claude --resume` or `claude --continue`, Claude Code restores the tasks scheduled with `CronCreate`, except recurring tasks that have expired and one-shot tasks whose scheduled time has passed. A self-paced `/loop` isn’t restored, so run `/loop` again to restart it. Background Bash and monitor tasks are never restored on resume. + * In a [background session](</docs/en/agent-view#from-inside-a-session>), a self-paced loop stops if its next wakeup comes due while the session’s process isn’t running, such as after a crash. When the process starts again, the transcript shows a [notice that the wakeup won’t fire](</docs/en/errors#restarted-after-its-next-loop-wakeup-was-due>). To continue the loop, [reply to the session](</docs/en/agent-view#peek-and-reply>) and ask Claude to keep it running. + * When you resume a session with `claude --resume` or `claude --continue`, Claude Code restores the tasks scheduled with `CronCreate`, except recurring tasks that have expired and one-shot tasks whose scheduled time has passed. A self-paced `/loop` isn’t restored, so run `/loop` again to restart it. + * A restored recurring task doesn’t fire for the runs it missed while the session wasn’t running. Its next run is the first one due after you resume, and jitter applies to that run. + * When you resume with `claude --resume` or `claude --continue`, Claude Code doesn’t restart the background Bash commands and monitors that were running when the session ended. If you still need one, ask Claude to start it again. * With [feature-flag fetching off](</docs/en/env-vars#features-that-need-feature-flag-fetching>), Claude Code stores a task you asked to keep across sessions in the project’s `.claude/scheduled_tasks.json` file. When the `.claude` directory or that file is a symlink, Claude Code returns an error instead of scheduling the task. A saved task runs only in the project folder where you created it. If you copy the file into another folder, such as a new worktree, sessions there list the copied tasks but don’t run them, so create the task again in that folder. For cron-driven automation that needs to run unattended:
modified Customize sessions in self-hosted environments View current →
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -153,7 +153,7 @@ The hook fails when it exits non-zero, or exits 0 without leaving a usable checkout behind: - * **A repository the session pushes results to** : the runner fails the session, and on a non-zero exit surfaces the tail of the script’s stderr to the user. Write the reason to stderr as one short line, write it last, and then exit non-zero. Don’t print secrets to stderr, and remove `set -x` before you deploy the hook. + * **A repository the session pushes results to** : the runner fails the session, and on a non-zero exit surfaces the tail of the script’s stderr to the user. Write the reason to stderr as one short line, write it last, and then exit non-zero. Don’t print secrets to stderr, and remove `set -x` before you deploy the hook. If git’s `couldn't find remote ref` appears in roughly the last 4 KB of the hook’s stderr, the runner reports a deleted branch instead. The session’s error message then says the branch no longer exists on the remote and asks the user to restore it. If that branch exists, see [A session fails with `no longer exists on the remote` or `couldn't find remote ref`](</docs/en/self-hosted-environments-deploy#no-longer-exists-on-the-remote>). * **A repository the session only reads from** , such as a repository added to a running session: the runner logs a `[runner:warn]` line with the failure detail, posts a `Skipped` step to the session, removes whatever the hook left at the checkout path, and continues with the remaining repositories. If skipping leaves the session with no repository at all, the runner fails the session anyway. When the hook succeeds, the runner removes the checkout path after the session ends. @@ -671,7 +671,7 @@ * **Who authors them** : the control plane populates the scripts from fixed constants in its own deployment, never from per-session or third-party input. * **What still governs them** : hooks delivered through `--settings` enter the ordinary merged hook configuration, not the managed tier, so your managed settings still apply. `disableAllHooks` disables them, and they are not among the categories [`allowManagedHooksOnly`](</docs/en/settings-reference#allowmanagedhooksonly>) keeps loaded. -When a person starts their own session, Claude Code also downloads the [skills enabled for their claude.ai account](</docs/en/skills#skills-in-cowork-and-cloud-sessions>) into that session’s config directory. A [cloud scheduled task](</docs/en/routines>) run doesn’t get its owner’s skills, and a session that sends model requests to Bedrock or Agent Platform doesn’t download any. For a skill those sessions need, add it to your runner image or, outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), commit it to the repository’s `.claude/skills/`. Outside [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions, a session in a self-hosted environment runs with [auto memory](</docs/en/memory#auto-memory>) off by default. For instructions that should carry across sessions, use the `CLAUDE.md` in your runner image or in the repository. The runner’s snapshot of the host’s `~/.claude/` leaves out the `projects/` directory. Auto memory’s default storage location is under that directory. If you put memory files there, the runner doesn’t seed them into sessions, and they don’t turn auto memory on. +When a person starts their own session, Claude Code downloads the [skills enabled for their claude.ai account](</docs/en/skills#skills-in-cowork-and-cloud-sessions>) into that session’s config directory. A [cloud scheduled task](</docs/en/routines>) run doesn’t get its owner’s skills, and a session that sends model requests to Bedrock or Agent Platform doesn’t download any. For a skill those sessions need, add it to your runner image or, outside a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) thread, commit it to the repository’s `.claude/skills/`. Outside [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions, a session in a self-hosted environment runs with [auto memory](</docs/en/memory#auto-memory>) off by default. For instructions that should carry across sessions, use the `CLAUDE.md` in your runner image or in the repository. The runner’s snapshot of the host’s `~/.claude/` leaves out the `projects/` directory. Auto memory’s default storage location is under that directory. If you put memory files there, the runner doesn’t seed them into sessions, and they don’t turn auto memory on. ###
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -315,7 +315,7 @@ For git connections that carry a session’s token to Anthropic-managed git, the runner applies the two variables as follows. A [`command` hook](</docs/en/self-hosted-environments-configuration#command>) starts with the session’s environment, so it gets what git inside the session gets: * **`GIT_SSL_CAINFO`** : what git checks Anthropic-managed git against depends on where git runs: - * **Runner’s own clone and fetches** : run without the variable and check Anthropic-managed git against a per-session certificate file the runner writes. That file holds the runner host’s system CA bundle plus the certificates from your file. + * **Runner’s own clone and fetches** : run without the variable and check Anthropic-managed git against a per-session certificate file the runner writes. The runner builds that file from the runner host’s system CA bundle and the certificates in your file. * **Git inside the session** : gets `http.sslCAInfo` configuration naming your file in place of the variable, plus `http.<url>.sslCAInfo` entries that check Anthropic-managed git against the per-session file. * **`checkout` and `post-session` hooks**: inherit the variable unchanged. * **`GIT_SSL_NO_VERIFY`** : which certificate checks stay off depends on where git runs: @@ -705,7 +705,13 @@ * **Sessions fail to start on a runner that set`--use-anthropic-git-proxy`**: look in the runner’s log for `access denied by the git proxy`, or for a git error that names an `api.anthropic.com` address containing `/git_proxy/`. To tell whether Anthropic served the session and fix the cause, see When sessions fail to start on a runner with the git proxy. * **Sessions can’t reach the network through an authenticating egress proxy** : when the source you set with `--proxy-authorization-command` or `--proxy-authorization-file` fails, times out after 30 seconds, or yields an empty value, the runner answers that connection `502 Bad Gateway` and logs why. The runner redacts the command’s stderr in that log and never logs the header value. With `--proxy-authorization-command`, run the command yourself on the host to confirm it prints the whole header value on stdout. If the runner instead exits at startup with `could not start the proxy-authorization listener`, it couldn’t open its loopback listener. * **Runner logs`Poll failed` lines containing `rejecting the malformed poll response`**: the runner received a work-poll response whose body isn’t the queue’s expected JSON, most often because something between the runner and `api.anthropic.com`, such as an intercepting proxy or a captive portal, answered with its own page. The runner rejects the response, counts it under the `transport` kind of the `claude_code_self_hosted_runner_poll_errors_total` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>), and retries on the failed-poll schedule described in [Session lifecycle](</docs/en/self-hosted-environments#session-lifecycle>). The runner keeps serving its live sessions. Configure the proxy to pass responses from `api.anthropic.com` through unaltered. Before v2.1.246, the runner read such a response as an empty work queue, which could end its live sessions or make it exit. - * **A session’s branch no longer exists on the remote** : for a git source the session only reads from, the runner skips that source and continues on the remaining ones. For the source the session pushes results to, a deleted branch, typically because it was merged and auto-deleted, fails the session with an error naming the repository and branch and asking you to restore the branch and retry. The runner fails the session with the same error when skipping would leave it with no repository at all. Before v2.1.228, such a session started in an empty directory. + * **A session fails with`no longer exists on the remote` or `couldn't find remote ref`**: the runner reads git’s `couldn't find remote ref` as a deleted branch. The branch can still exist. Look for it on your git host, under exactly the name in the message, then check each cause that fits: + * **The branch is gone** : typically because it was merged and auto-deleted. Restore it, as the message asks. + * **The branch exists and you don’t administer the runner** : send the runner’s administrator the full message and tell them the branch exists. + * **The branch exists and the runner has a`checkout` hook**: a git command in your hook can print `couldn't find remote ref` to stderr before the hook exits non-zero. Find that command, and correct the ref it asks for or the remote it fetches from. The runner passes your hook the revision the session asked for as [`CLAUDE_RUNNER_REPO_REF`](</docs/en/self-hosted-environments-configuration#checkout>). + * **The branch exists and the runner has no`checkout` hook**: the runner fetches the branch itself. If a `--git-host-rewrite` applies to the repository, confirm that the host it rewrites to has the branch under the same name, and push the branch there if it doesn’t. + * **The branch exists and the runner is older than v2.1.301** : upgrade the runner as described in Pin the version, so that a different failure shows its own error. Before v2.1.301, other failures with `couldn't find remote ref` in their error output were also reported as a deleted branch. +Once the runner is upgraded or the cause is fixed, retry the session or start a new one. If none of these checks finds the cause, report an issue. For the source the session pushes results to, a deleted branch fails the session. For a git source the session only reads from, the runner skips that source and continues on the remaining ones. The runner fails the session with the same error when skipping would leave it with no repository at all. Before v2.1.228, such a session started in an empty directory. * **A session starts without one of its repositories** : on a runner with no [`checkout` hook](</docs/en/self-hosted-environments-configuration#checkout>), the git host can refuse the runner’s access check for a repository the session only reads from. The runner then skips that repository, logs a `[runner:warn] could not access context source` line naming the refusal, and starts the session on the remaining ones. The runner skips only a clear refusal: the host answers that the repository wasn’t found, git finds no credentials for the host, or authentication fails. A network failure, a timeout, or an HTTP `403` still fails the session start, as does a refusal for a repository the session pushes results to. The runner still fails a session that skipping would leave with no repository at all. With `--use-anthropic-git-proxy`, the runner skips only a repository the git proxy itself denies. The access check runs again each time the session starts on a runner, so once the runner’s git identity has read access, the next start clones the repository. Before v2.1.274, each of these refusals failed the session start. * **A session fails to start with`This runner couldn't read`**: the runner asked the git host for a repository with its git credentials and got a not-found answer. The repository doesn’t exist, or those credentials can’t reach the repository. * **If you administer the runner** : give its git credentials read access to the repository, then start a new session.
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -241,7 +241,7 @@ * **Shell command settings** : settings that execute shell commands, such as `apiKeyHelper`, `statusLine`, and `otelHeadersHelper` * **Sandbox binary settings** : `sandbox.bwrapPath`, `sandbox.socatPath`, and `sandbox.ripgrep`. Each of these settings points at an executable, and Claude Code runs that executable - * **Sandbox network and isolation settings** : [sandbox](</docs/en/sandboxing>) settings that let the sandbox proxy read, reroute, or authenticate traffic, or that weaken the sandbox’s isolation: `sandbox.network.tlsTerminate`, `sandbox.network.httpProxyPort`, `sandbox.network.socksProxyPort`, `sandbox.credentials`, `sandbox.allowAppleEvents`, `sandbox.enableWeakerNestedSandbox`, `sandbox.enableWeakerNetworkIsolation`, `sandbox.filesystem.disabled`, `sandbox.network.allowAllUnixSockets`, `sandbox.network.allowUnixSockets`, and `sandbox.network.allowMachLookup`. A `sandbox.credentials` block that contains only `deny` rules doesn’t need approval, since it restricts the sandbox without giving the proxy a credential. Before v2.1.251, Claude Code applied these settings without approval + * **Sandbox network and isolation settings** : [sandbox](</docs/en/sandboxing>) settings that let the sandbox proxy read, reroute, or authenticate traffic, or that weaken the sandbox’s isolation: `sandbox.network.tlsTerminate`, `sandbox.network.httpProxyPort`, `sandbox.network.socksProxyPort`, `sandbox.credentials`, `sandbox.allowAppleEvents`, `sandbox.allowNestedUserNamespaces`, `sandbox.enableWeakerNestedSandbox`, `sandbox.enableWeakerNetworkIsolation`, `sandbox.filesystem.disabled`, `sandbox.network.allowAllUnixSockets`, `sandbox.network.allowUnixSockets`, and `sandbox.network.allowMachLookup`. A `sandbox.credentials` block that contains only `deny` rules doesn’t need approval, since it restricts the sandbox without giving the proxy a credential. Before v2.1.251, Claude Code applied these settings without approval * **Custom environment variables** : delivered `env` variables that require the user’s approval, such as proxy and base-URL variables; see Environment variables and the approval dialog * **Hook configurations** : any hook definition @@ -268,6 +268,7 @@ * **An interactive session that can’t show the dialog** : Claude Code doesn’t apply the delivered settings and keeps the last-approved settings. The dialog appears in the next session that can show it. * **`claude install` or `claude update`**: Claude Code doesn’t show the dialog during either command. The command runs with the last-approved settings, and the dialog appears in your next interactive session. If Claude Code waits for the settings fetch at startup, such as with `forceRemoteSettingsRefresh` set or on a [Claude apps gateway](</docs/en/claude-apps-gateway>) deployment, it shows the dialog during the command instead, and an install run from a pipe fails; see [`Raw mode is not supported` during install](</docs/en/troubleshoot-install#raw-mode-is-not-supported-during-install>). Before v2.1.246, Claude Code tried to show the dialog during these commands too. + * **A`claude plugin` command that prints to a terminal but can’t read from the keyboard**: when Claude Code doesn’t wait for the settings fetch at startup, the command doesn’t apply the delivered settings. Without cached settings, a command that changes your plugins or marketplaces [stops with an error](</docs/en/errors#managed-settings-need-your-approval>). With cached settings, it runs with the last-approved settings. The dialog appears when you next run `claude` in a terminal. The command can’t read from the keyboard when you pipe or redirect its input and, on macOS and Linux, it also can’t open `/dev/tty`. If you pipe or redirect its output too, the run is non-interactive instead, and the delivered settings apply for that run only. * **An error closes the dialog before you answer** : Claude Code doesn’t apply the delivered settings and keeps the last-approved settings. It shows the dialog again in the next session that can show it. * **A non-interactive run** , such as `claude -p`, an Agent SDK session, or a session in the VS Code extension’s chat panel or the desktop app’s Code tab: Claude Code can’t show the dialog, so when the delivered settings would require approval, it applies them for that run only. It doesn’t record them as approved or write them to the local cache, and the next interactive session shows the dialog. Until a user approves in an interactive session, each non-interactive run fetches the settings again at startup. Before v2.1.207, a non-interactive run saved the settings as approved, so later interactive sessions never showed the dialog for them. @@ -281,11 +282,17 @@ * Feature and command toggles * Model selection and behavior settings, such as `ANTHROPIC_MODEL`, `DISABLE_PROMPT_CACHING`, and `CLAUDE_CODE_EFFORT_LEVEL` - * Context window and compaction settings, such as `DISABLE_AUTO_COMPACT` + * Context window and compaction settings, such as `DISABLE_AUTO_COMPACT`, but not `CLAUDE_CODE_DISABLE_1M_CONTEXT` * Terminal UI and accessibility options * Numeric limits, budgets, and timeouts -Other delivered variables can require the user’s approval before they take effect; a non-empty proxy, base-URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` value always does. When a delivered variable needs approval, the dialog names it, so the user sees exactly what the policy is asking to set. Before v2.1.218, Claude Code applied fewer variables without asking the user, so settings such as `DISABLE_AUTO_COMPACT` triggered the dialog at any non-empty value. Claude Code decides whether four privacy toggles need approval by the delivered value rather than by the variable name: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_ERROR_REPORTING`, `DISABLE_TELEMETRY`, and `DO_NOT_TRACK`. A truthy value such as `1` or `true` only turns tracking, reporting, or other nonessential traffic off, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.218, all of them except `DO_NOT_TRACK` applied without approval at any value, and `DO_NOT_TRACK` triggered the dialog at any non-empty value. Claude Code also decides whether [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) needs approval by the delivered value: a truthy value only turns the [body idle timeout](</docs/en/network-config#streaming-idle-watchdogs>) on, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.248, any non-empty value triggered the dialog. Whether [`ANTHROPIC_CUSTOM_HEADERS`](</docs/en/env-vars#variables>) needs approval also depends on the delivered value. Headers that only tag requests, such as `Accept-Language`, apply without the dialog. A line that names a credential, an org or tenant selector, a routing or host override, or an API-behavior header, such as `Authorization`, `X-Api-Key`, `Host`, `anthropic-beta`, or the `X-Amzn-Bedrock-*` headers, requires approval. A line also requires approval when its name isn’t a valid HTTP header token or its value contains a character an HTTP header can’t carry. The check matches words inside the header name, so `X-Client-Version`, which contains `client` and `version`, requires approval too. Before v2.1.251, any `ANTHROPIC_CUSTOM_HEADERS` value applied without it. A falsy value such as `0` or `false` for [`ENABLE_BETA_TRACING_DETAILED`](</docs/en/env-vars#variables>) or [`OTEL_LOG_RAW_API_BODIES`](</docs/en/env-vars#variables>) applies without the dialog, because it only turns detailed tracing or raw API body capture off. Any other non-empty value for either variable requires approval. +Other delivered variables can require the user’s approval before they take effect. For example, in interactive sessions these always do, at any non-empty value: + + * A proxy or base-URL variable + * `OTEL_EXPORTER_OTLP_ENDPOINT` + * `CLAUDE_CODE_DISABLE_1M_CONTEXT` + +When a delivered variable needs approval, the dialog names it, so the user sees exactly what the policy is asking to set. Before v2.1.218, Claude Code applied fewer variables without asking the user, so settings such as `DISABLE_AUTO_COMPACT` triggered the dialog at any non-empty value. Claude Code decides whether four privacy toggles need approval by the delivered value rather than by the variable name: `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_ERROR_REPORTING`, `DISABLE_TELEMETRY`, and `DO_NOT_TRACK`. A truthy value such as `1` or `true` only turns tracking, reporting, or other nonessential traffic off, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.218, all of them except `DO_NOT_TRACK` applied without approval at any value, and `DO_NOT_TRACK` triggered the dialog at any non-empty value. Claude Code also decides whether [`API_FORCE_IDLE_TIMEOUT`](</docs/en/env-vars>) needs approval by the delivered value: a truthy value only turns the [body idle timeout](</docs/en/network-config#streaming-idle-watchdogs>) on, so Claude Code applies it without asking the user. For any other non-empty value, Claude Code shows the dialog. Before v2.1.248, any non-empty value triggered the dialog. Whether [`ANTHROPIC_CUSTOM_HEADERS`](</docs/en/env-vars#variables>) needs approval also depends on the delivered value. Headers that only tag requests, such as `Accept-Language`, apply without the dialog. A line that names a credential, an org or tenant selector, a routing or host override, or an API-behavior header, such as `Authorization`, `X-Api-Key`, `Host`, `anthropic-beta`, or the `X-Amzn-Bedrock-*` headers, requires approval. A line also requires approval when its name isn’t a valid HTTP header token or its value contains a character an HTTP header can’t carry. The check matches words inside the header name, so `X-Client-Version`, which contains `client` and `version`, requires approval too. Before v2.1.251, any `ANTHROPIC_CUSTOM_HEADERS` value applied without it. A falsy value such as `0` or `false` for [`ENABLE_BETA_TRACING_DETAILED`](</docs/en/env-vars#variables>) or [`OTEL_LOG_RAW_API_BODIES`](</docs/en/env-vars#variables>) applies without the dialog, because it only turns detailed tracing or raw API body capture off. Any other non-empty value for either variable requires approval. ## @@ -305,7 +312,7 @@ * **OAuth token** : generate a token with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>), authorize it for your Team or Enterprise organization, and set it as `CLAUDE_CODE_OAUTH_TOKEN` in the job’s environment. Remove any credential that [takes precedence](</docs/en/authentication#authentication-precedence>) over the token from that environment, such as `ANTHROPIC_API_KEY`. * **Endpoint-managed settings** : deploy a [managed settings file](</docs/en/managed-settings#delivery-mechanisms>) to the machine that runs the job. -In a [Cowork](<https://claude.com/docs/cowork/overview>) session in the Claude Desktop app, Claude Code doesn’t fetch server-managed settings from the claude.ai admin console, even when the user signs in with a Team or Enterprise account. [Where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>) covers which policy reaches Cowork sessions on the user’s machine and remote Cowork sessions. claude.ai still applies your [`strictKnownMarketplaces`](</docs/en/settings-reference#strictknownmarketplaces>) and [`blockedMarketplaces`](</docs/en/settings-reference#blockedmarketplaces>) lists itself when a Cowork user adds a marketplace from a git repository on claude.ai or from **Customize** in the Cowork tab. [How restrictions work](</docs/en/plugins/org#restrict-what-users-can-install>) describes that check. If you export a `CLAUDE_CODE_USE_*` provider variable or a non-default `ANTHROPIC_BASE_URL` in your shell, Claude Code skips the settings fetch for your sessions. `claude doctor` and `/status` report the skipped fetch and its cause. You can’t clear the export with a server-managed `env` block, because the block arrives through the fetch that the export prevents. An [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) `env` block doesn’t restore the fetch either: Claude Code checks eligibility before it applies managed `env` blocks, so the endpoint-managed value changes the session’s provider selection but the fetch stays skipped. To restore server-managed delivery, remove the export from your shell, or set the variable to `""` in your user settings `env` block, which applies before the eligibility check. To enforce policy without relying on users to change their shells, deliver the settings through the endpoint-managed channel instead. For Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) deployments, a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>) provides the equivalent remote managed-settings delivery: gateway-signed-in clients fetch managed settings from the gateway instead of `api.anthropic.com`. The failure semantics differ at startup: a gateway client that can’t reach the gateway exits with an error instead of falling back to cached settings, while the hourly background refresh is fail-open on both channels. +In a [Cowork](<https://claude.com/docs/cowork/overview>) session in the Claude Desktop app, Claude Code doesn’t fetch server-managed settings from the claude.ai admin console, even when the user signs in with a Team or Enterprise account. [Where and when a policy applies](</docs/en/managed-settings#where-and-when-a-policy-applies>) covers which policy reaches Cowork sessions on the user’s machine and remote Cowork sessions. claude.ai still applies your [`strictKnownMarketplaces`](</docs/en/settings-reference#strictknownmarketplaces>) and [`blockedMarketplaces`](</docs/en/settings-reference#blockedmarketplaces>) lists itself when a Cowork user adds a marketplace from a git repository on claude.ai or from **Customize** in Cowork. [How restrictions work](</docs/en/plugins/org#restrict-what-users-can-install>) describes that check. If you export a `CLAUDE_CODE_USE_*` provider variable or a non-default `ANTHROPIC_BASE_URL` in your shell, Claude Code skips the settings fetch for your sessions. `claude doctor` and `/status` report the skipped fetch and its cause. You can’t clear the export with a server-managed `env` block, because the block arrives through the fetch that the export prevents. An [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) `env` block doesn’t restore the fetch either: Claude Code checks eligibility before it applies managed `env` blocks, so the endpoint-managed value changes the session’s provider selection but the fetch stays skipped. To restore server-managed delivery, remove the export from your shell, or set the variable to `""` in your user settings `env` block, which applies before the eligibility check. To enforce policy without relying on users to change their shells, deliver the settings through the endpoint-managed channel instead. For Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) deployments, a self-hosted [Claude apps gateway](</docs/en/claude-apps-gateway>) provides the equivalent remote managed-settings delivery: gateway-signed-in clients fetch managed settings from the gateway instead of `api.anthropic.com`. The failure semantics differ at startup: a gateway client that can’t reach the gateway exits with an error instead of falling back to cached settings, while the hourly background refresh is fail-open on both channels. ##
modified Settings files and precedence View current →
--- a/settings.md +++ b/settings.md @@ -50,7 +50,7 @@ On Windows, `~/.claude` means `%USERPROFILE%\.claude`. To keep the home-directory files somewhere else, set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>); Claude Code then stores your settings, session history, and plugins there instead. -Claude Code also keeps a fifth file, [`~/.claude.json`](</docs/en/claude-directory#ce-claude-json>), that it writes for itself; you don’t need to edit it. It holds your sign-in session, [MCP server](</docs/en/mcp>) configurations, per-project state such as trust decisions, and the [global config keys](</docs/en/settings-reference#global-config-settings>) that `/config` writes for you. +Claude Code also keeps a fifth file, [`~/.claude.json`](</docs/en/claude-directory#ce-claude-json>), that it writes for itself; you don’t need to edit it. It holds your account details, [MCP server](</docs/en/mcp>) configurations, per-project state such as trust decisions, and the [global config keys](</docs/en/settings-reference#global-config-settings>) that `/config` writes for you. ### @@ -358,11 +358,11 @@ 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: * **Cloud threads in a project** : in a cloud thread in a [project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>), none of a repository’s `.claude/settings.json` permission rules, hooks, or `env` apply, however many repositories the project has. [What threads pick up from your repositories](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) lists what to use instead. - * **Shared project settings** (`.claude/settings.json`): read in a session with one repository outside a project, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. + * **Shared project settings** (`.claude/settings.json`): read in a session with one repository outside a project’s threads, because the file is part of the clone and the session starts inside it. Commit a setting there to apply it in those sessions. * **Shared project settings with several repositories** : in an Anthropic-hosted environment, 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>). For a self-hosted environment, see [which repository’s settings apply](</docs/en/self-hosted-environments-configuration#repository-settings-in-sessions-with-several-repositories>). * **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** : a `managed-settings.json` file or MDM profile on your device doesn’t reach a cloud session. Your organization’s [server-managed settings](</docs/en/server-managed-settings>) do; [surface coverage](</docs/en/model-config#surface-coverage>) lists which cloud sessions receive them. 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. In a session with one repository outside a project, you can instead commit the key to that repository’s `.claude/settings.json`. + * **`/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. In a session with one repository outside a project’s threads, you can instead commit the key to that repository’s `.claude/settings.json`. [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) lists the rest: `CLAUDE.md`, skills, MCP servers, plugins, and credentials.
modified Example settings files View current →
--- a/settings-example.md +++ b/settings-example.md @@ -92,7 +92,7 @@ One team’s shared settings, committed to the repository so everyone who clones it gets the same permissions, hooks, and plugin marketplace. Save a file like this at `.claude/settings.json` at the top of the repository. What to know before you commit one: - * **Cloud sessions outside a[project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>) read it too.** A [cloud session](</docs/en/settings#settings-in-cloud-sessions>) with one repository starts inside the clone, so the committed file applies there as well. + * **Cloud sessions outside a[project](</docs/en/claude-projects#what-threads-pick-up-from-your-repositories>)’s threads read it too.** A [cloud session](</docs/en/settings#settings-in-cloud-sessions>) with one repository starts inside the clone, so the committed file applies there as well. * **Telemetry goes in managed or personal settings.** Claude Code ignores the [OpenTelemetry exporter variables](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) in a repository’s settings files, apart from some values that turn telemetry off. Set them in [managed settings](</docs/en/monitoring-usage#administrator-configuration>) for your organization, or in each person’s `~/.claude/settings.json`. * **Allow rules wait for trust.** Allow rules and `extraKnownMarketplaces` entries take effect after each person [trusts this folder itself](</docs/en/permissions#project-allow-rules-and-workspace-trust>), not only a parent folder; deny and ask rules apply in every session, trusted or not. * **The hook is a script in the repo.** This file’s hook runs `.claude/hooks/block-rm.sh`; [How a hook resolves](</docs/en/hooks#how-a-hook-resolves>) walks through writing it.
modified All settings View current →
Show diff (141 lines)
--- a/settings-reference.md +++ b/settings-reference.md @@ -165,6 +165,7 @@ `respondToBashCommands`| Stop Claude from responding after a [`!` shell command](</docs/en/interactive-mode#shell-mode-with-prefix>) runs| Interface and terminal| Any file `sandbox`| [Isolate Bash commands](</docs/en/sandboxing>) from your filesystem and network on macOS, Linux, and WSL2| Sandbox settings| Any file `sandbox.allowAppleEvents`| Let [sandboxed](</docs/en/sandboxing>) commands send Apple Events on macOS| Sandbox settings| User or managed +`sandbox.allowNestedUserNamespaces`| Let [sandboxed](</docs/en/sandboxing#chromium-or-rootless-podman-fails-inside-the-sandbox-on-linux>) commands create user namespaces on Linux and WSL2| Sandbox settings| User or managed `sandbox.allowUnsandboxedCommands`| Let Claude retry a blocked command outside the [sandbox](</docs/en/sandboxing#the-unsandboxed-retry-escape-hatch>), or forbid it| Sandbox settings| Any file `sandbox.autoAllowBashIfSandboxed`| Run [sandboxed](</docs/en/sandboxing#auto-allow-mode>) commands without a permission prompt| Sandbox settings| Any file `sandbox.bwrapPath`| Point the [sandbox](</docs/en/sandboxing>) at a bubblewrap binary outside `PATH`| Sandbox settings| Managed @@ -1286,7 +1287,7 @@ Isolate the Bash commands Claude runs from your filesystem and network with [sandboxing](</docs/en/sandboxing>). Turn the sandbox on with `enabled`, then narrow or widen what sandboxed commands can touch with the `filesystem`, `network`, and `credentials` sub-objects. The sandbox runs on macOS, Linux, and WSL2. * **Scope** : `Any file` - * **Type** : object with `enabled`, `failIfUnavailable`, `autoAllowBashIfSandboxed`, `excludedCommands`, `allowUnsandboxedCommands`, `enableWeakerNestedSandbox`, `enableWeakerNetworkIsolation`, `allowAppleEvents`, `bwrapPath`, `socatPath`, `ignoreViolations`, and `ripgrep`, plus the `filesystem`, `network`, and `credentials` objects + * **Type** : object with `enabled`, `failIfUnavailable`, `autoAllowBashIfSandboxed`, `excludedCommands`, `allowUnsandboxedCommands`, `enableWeakerNestedSandbox`, `enableWeakerNetworkIsolation`, `allowAppleEvents`, `allowNestedUserNamespaces`, `bwrapPath`, `socatPath`, `ignoreViolations`, and `ripgrep`, plus the `filesystem`, `network`, and `credentials` objects * **Default** : unset, so Claude Code runs commands without a sandbox This turns the sandbox on, skips permission prompts for sandboxed commands, runs `docker` outside the sandbox, opens two extra write paths, hides your AWS credentials file, and pre-allows GitHub and npm: @@ -1755,6 +1756,31 @@ } To keep isolation and still run one such tool, add it to `excludedCommands` instead. See [Apple Events on macOS](</docs/en/sandboxing#security-limitations>). + +### + +​ + +`sandbox.allowNestedUserNamespaces` + +Let sandboxed commands on Linux and WSL2 create user namespaces, which Chromium’s and Electron’s own sandbox, a nested bubblewrap, and `unshare` need. If you set this key to `true`, you turn off a security boundary: code from a sandboxed command can end up running outside the sandbox. For rootless Podman or Buildah, use `excludedCommands` instead, because the sandbox stops them in other ways too. Requires Claude Code v2.1.305 or later. + + * **Scope** : `User or managed`. A `true` counts from `~/.claude/settings.json`, JSON passed with `--settings`, or [managed settings](</docs/en/managed-settings>). Claude Code ignores a `true` in a project’s `.claude/settings.json` or `.claude/settings.local.json`. In a session with [`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`](</docs/en/env-vars#variables>) set to `1`, Claude Code ignores a `true` from every source. A `false` counts from any file, by [settings precedence](</docs/en/settings#settings-precedence>). + * **Type** : Boolean + * `true`: sandboxed commands can create user namespaces + * `false`: this key allows nothing extra, and the sandbox’s default applies + * **Default** : `false` + +settings.json + + { + "sandbox": { + "enabled": true, + "allowNestedUserNamespaces": true + } + } + +With this key on, don’t rely on any of the sandbox’s restrictions, including [protected paths](</docs/en/sandboxing#protected-paths>) and `credentials.files` entries, to stop a malicious command. In [auto-allow mode](</docs/en/sandboxing#auto-allow-mode>), that command can run without a permission prompt. If your organization has a security team, check with them before you turn the key on. To find the fix for your tool, see [Chromium or rootless Podman fails inside the sandbox on Linux](</docs/en/sandboxing#chromium-or-rootless-podman-fails-inside-the-sandbox-on-linux>). ### @@ -4445,7 +4471,7 @@ `directory`| `{ "source": "directory", "path": "/opt/acme-corp/approved-marketplaces" }`| `path` required, the absolute path to a directory containing `.claude-plugin/marketplace.json` `hostPattern`| `{ "source": "hostPattern", "hostPattern": "^github\\.example\\.com$" }`| `hostPattern` required, a regex matched anywhere in the marketplace host; anchor it with `^` and `$` to match the whole host `pathPattern`| `{ "source": "pathPattern", "pathPattern": "^/opt/approved/" }`| `pathPattern` required, a regex matched anywhere in the `path` of `file` and `directory` sources; start it with `^` to pin a prefix -`skills-dir`| `{ "source": "skills-dir" }`| No fields. Opts the `~/.claude/skills/` plugin scan back in +`skills-dir`| `{ "source": "skills-dir" }`| No fields Three source types carry rules beyond the table: @@ -4457,7 +4483,7 @@ `file` and `directory` sources have no host and never match a `hostPattern` entry. * **`pathPattern`** : use it to allow filesystem marketplaces alongside `hostPattern` entries for network sources. `".*"` allows every local path; a narrower pattern such as `"^/opt/approved/"` restricts to a directory. -Any allowlist, even an empty one, also stops Claude Code loading [`@skills-dir` plugins](</docs/en/plugins/loading#plugins-shared-through-a-repository>) from `~/.claude/skills/`. Add the `{ "source": "skills-dir" }` entry to keep loading them; the entry has no meaning outside this key and `blockedMarketplaces`. +Any allowlist, even an empty one, also stops Claude Code loading [`@skills-dir` plugins](</docs/en/plugins/loading#plugins-shared-through-a-repository>) from `~/.claude/skills/`. To keep loading them, add the `{ "source": "skills-dir" }` entry and leave `strictPluginOnlyCustomization` unset. The entry has no meaning outside this key and `blockedMarketplaces`. #### @@ -4579,7 +4605,7 @@ "strictPluginOnlyCustomization": ["skills", "hooks"] } -The four sub-key entries below list what each surface blocks and what still loads. Claude Code ignores surface names it doesn’t recognize rather than failing the settings file, so you can add new surface names before every client has updated. +If you lock any surface, Claude Code also stops loading [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>), the plugin folders that users keep under `~/.claude/skills/` or `.claude/skills/`. Users place those folders themselves rather than installing them from a marketplace, so Claude Code treats them as user customization under this setting. The four sub-key entries below list what else each surface blocks and what still loads. Claude Code ignores surface names it doesn’t recognize rather than failing the settings file, so you can add new surface names before every client has updated. ### @@ -4587,7 +4613,7 @@ `strictPluginOnlyCustomization.skills` -Lock the `skills` surface. Claude Code stops loading skills from `~/.claude/skills/` and `.claude/skills/`, custom commands from `~/.claude/commands/` and `.claude/commands/`, skills and commands under `--add-dir` directories, and skills synced from your claude.ai account. It keeps loading plugin skills, bundled skills, and skills in the managed policy directory. +Lock the `skills` surface. Claude Code stops loading skills from `~/.claude/skills/` and `.claude/skills/`, custom commands from `~/.claude/commands/` and `.claude/commands/`, skills and commands under `--add-dir` directories, and skills synced from your claude.ai account. It keeps loading bundled skills, skills in the managed policy directory, and skills from plugins other than [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>). * **Scope** : `Managed` * **Type** : the string `"skills"` in the `strictPluginOnlyCustomization` array @@ -4605,7 +4631,7 @@ `strictPluginOnlyCustomization.agents` -Lock the `agents` surface. Claude Code stops loading agents from `~/.claude/agents/`, `.claude/agents/`, and `--add-dir` directories. It keeps loading plugin agents, built-in agents, and agents in the managed policy directory. +Lock the `agents` surface. Claude Code stops loading agents from `~/.claude/agents/`, `.claude/agents/`, and `--add-dir` directories. It keeps loading built-in agents, agents in the managed policy directory, and agents from plugins other than [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>). * **Scope** : `Managed` * **Type** : the string `"agents"` in the `strictPluginOnlyCustomization` array @@ -4628,7 +4654,7 @@ * **Stops running** : * Hooks from user, project, and local `settings.json` * Frontmatter hooks in skills, custom commands, and agents, from the sources that a `skills` or `agents` lock would block - * **Keeps running** : plugin hooks and hooks in managed settings + * **Keeps running** : hooks in managed settings, and hooks from plugins other than [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>) Skills, custom commands, and agents whose frontmatter hooks stop running still load while their own surface isn’t locked. @@ -4648,7 +4674,7 @@ `strictPluginOnlyCustomization.mcp` -Lock the `mcp` surface. Claude Code stops loading MCP servers from `~/.claude.json` and `.mcp.json`, and keeps loading plugin MCP servers, [`managed-mcp.json`](</docs/en/managed-mcp>) servers, and servers from `managedMcpServers`. +Lock the `mcp` surface. Claude Code stops loading MCP servers from `~/.claude.json` and `.mcp.json`. It keeps loading [`managed-mcp.json`](</docs/en/managed-mcp>) servers, servers from `managedMcpServers`, and MCP servers from plugins other than [skills-directory plugins](</docs/en/plugins/loading#skills-directory-plugins-blocked-by-managed-settings>). * **Scope** : `Managed` * **Type** : the string `"mcp"` in the `strictPluginOnlyCustomization` array @@ -4928,7 +4954,7 @@ Allowlist the MCP servers people can add. Claude Code blocks any server that doesn’t match an entry wherever it’s defined, including plugin servers, servers a user passes with `--mcp-config`, and servers from claude.ai. Built-in servers such as Claude in Chrome, the `ide` server Claude Code connects to in a running [VS Code](</docs/en/vs-code#the-built-in-ide-mcp-server>) or [JetBrains](</docs/en/jetbrains#the-built-in-ide-mcp-server>) IDE, and servers the CLI itself configures are exempt from the allowlist, and the denylist still applies to them. On Claude Code v2.1.268 or later, a [Claude Tag](</docs/en/claude-tag>) session’s Slack tools are also exempt from the allowlist, and the denylist still applies to them. In-process `type: "sdk"` servers are exempt from both lists; the [app that started the session](</docs/en/mcp#how-connectors-reach-claude-code>) registers them. Servers your organization delivers are also exempt from the allowlist, and the denylist still applies to them. The exemption covers every `managedMcpServers` entry, and any [`managed-mcp.json`](</docs/en/managed-mcp#exclusive-control-with-managed-mcp-json>) entry whose values use no `${VAR}` expansion. See [How a server is evaluated](</docs/en/managed-mcp#how-a-server-is-evaluated>) for the full check order. Before v2.1.259, servers from `managed-mcp.json` had to match too. * **Scope** : `Any file`. Entries from every file merge into one allowlist unless `allowManagedMcpServersOnly` is set. Deploy it in managed settings to enforce it. - * **Type** : array of objects, each with exactly one key: `serverName`, a string limited to letters, numbers, hyphens, and underscores; `serverCommand`, an array of the command and its arguments matched exactly; or `serverUrl`, a URL pattern with `*` wildcards + * **Type** : array of objects, each with exactly one key. Use `serverName`, a string limited to letters, numbers, hyphens, and underscores; `serverCommand`, an array of the command and its arguments matched exactly; or `serverUrl`, a URL pattern with `*` wildcards * **Default** : unset, so every server is allowed; an empty array blocks every server users add This example allows only the stdio server that the listed `npx` command starts: @@ -5402,7 +5428,7 @@ `agentPushNotifEnabled` -Allow Claude to send a push notification to your phone when it decides one is worth sending, for example when a long task finishes. Claude Code syncs this choice to your account, and pushes arrive while [Remote Control](</docs/en/remote-control>) is connected. Appears in `/config` as **Push when Claude decides**. +Allow Claude to send a push notification to your phone when it decides one is worth sending, for example when a long task finishes. Claude can send one while [Remote Control](</docs/en/remote-control>) is connected. Appears in `/config` as **Push when Claude decides**. When you change it there, Claude Code also saves the value to your account. * **Scope** : `Any file`. Claude Code also reads a value left in `~/.claude.json` by older versions. * **Type** : Boolean @@ -5416,7 +5442,7 @@ "agentPushNotifEnabled": true } -See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). +If you run sessions under a [`claude remote-control`](</docs/en/remote-control#start-a-remote-control-session>) server, they follow the value saved to your account rather than this key. To change that value, run `/config` in a Claude Code session in your terminal and turn **Push when Claude decides** on or off. If the toggle already shows the value you want, change it and change it back so that Claude Code saves that value to your account. See [Mobile push notifications](</docs/en/remote-control#mobile-push-notifications>). ###
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -420,6 +420,13 @@ A `disallowedTools` entry with a specifier, such as `Bash(git push *)`, still removes the whole tool from the subagent, not only the matching commands. To keep Bash and block specific commands, add a [Bash deny rule](</docs/en/permissions#bash>) such as `Bash(git push *)` to `permissions.deny` in your settings. The rule applies to the main conversation and to subagents. +##### MCP server names that contain a double underscore + +If a subagent gets none of the tools from an MCP server whose name contains `__`, such as `reports__v2`, check the subagent’s `mcp__` entries: + + * **In`tools`**: write `mcp__` followed by the [server’s whole name](</docs/en/permissions#mcp>) and `__*`, as in `mcp__reports__v2__*`. Without the trailing `__*`, `mcp__reports__v2` matches none of that server’s tools. + * **In`disallowedTools`**: look for `mcp__reports` or `mcp__reports__*`, the entries that withhold a server named `reports`. With either entry, the subagent loses every `reports__v2` tool as well, because those tool names also begin with `mcp__reports__`. To withhold only the `reports` server’s tools, list them one by one instead, such as `mcp__reports__run_query`. + #### ​ @@ -863,7 +870,7 @@ Subagent names -Claude can give a subagent a name by passing a `name` parameter on the Agent tool call, and may do so on its own, without asking you first. The name makes the subagent addressable: Claude can message or resume it by name after it finishes. In an interactive session with [agent teams](</docs/en/agent-teams>) enabled, a subagent that Claude spawns from the main conversation with a `name` launches as a teammate instead, unless the call is a fork or passes `isolation` on the call itself. An `isolation` value in the subagent’s frontmatter doesn’t prevent it, and the teammate then runs in the main session’s working directory. See [How Claude starts agent teams](</docs/en/agent-teams#how-claude-starts-agent-teams>). +If you start a session with [agent teams](</docs/en/agent-teams#enable-agent-teams>) enabled, Claude can give a subagent a name by passing a `name` parameter on the Agent tool call. It may do so on its own, without asking you first. The name makes the subagent addressable: Claude can message or resume it by name after it finishes. In an interactive session with [agent teams](</docs/en/agent-teams>) enabled, a subagent that Claude spawns from the main conversation with a `name` launches as a teammate instead, unless the call is a fork or passes `isolation` on the call itself. An `isolation` value in the subagent’s frontmatter doesn’t prevent it, and the teammate then runs in the main session’s working directory. See [How Claude starts agent teams](</docs/en/agent-teams#how-claude-starts-agent-teams>). ### @@ -1030,7 +1037,7 @@ Resume subagents -Each subagent invocation creates a new instance rather than continuing an earlier one. To continue an existing subagent’s work instead of starting over, ask Claude to resume it. Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. If the subagent spawned background subagents of its own, that history includes the results they delivered while it ran. The subagent picks up exactly where it stopped rather than starting fresh. +Each subagent invocation creates a new instance rather than continuing an earlier one. To continue an existing subagent’s work instead of starting over, ask Claude to resume it. Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. If the subagent spawned background subagents of its own, that history includes the results they delivered while it ran. Before v2.1.304, a subagent that Claude messaged or resumed right after it finished could forget its most recent work. * When a subagent completes, Claude receives its agent ID. * The built-in Explore and Plan agents are one-shot and return no agent ID, so Claude can’t resume them. Use `general-purpose` or a custom subagent when you need to continue the work. @@ -1049,6 +1056,12 @@ * **Main conversation compaction** : when the main conversation compacts, subagent transcripts are unaffected. They’re stored in separate files. * **Session persistence** : subagent transcripts persist within their session. You can resume a subagent after restarting Claude Code by resuming the same session. * **Automatic cleanup** : Claude Code deletes subagent transcripts after the `cleanupPeriodDays` retention period, 30 days by default, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). + +##### Message a subagent by name after a restart + +For a subagent that launched as a teammate, see the [agent team limitations](</docs/en/agent-teams#limitations>) instead. + +If Claude can’t message a subagent by name after you restart Claude Code and resume the session, give Claude the subagent’s agent ID instead. Names Claude gave from the main conversation since its last [compaction](</docs/en/context-window#what-survives-compaction>) survive the restart. A name from before that compaction doesn’t. To find the ID for a name, look for that name in the `agent-{agentId}.meta.json` files in `~/.claude/projects/{project}/{sessionId}/subagents/`. After one message by ID, the subagent’s name works again, unless a newer agent has taken that name. Before v2.1.299, no name survived a restart, and a send by name was refused even when the agent ID still worked. ####
modified Subagents in the SDK View current →
--- a/subagents.md +++ b/subagents.md @@ -152,7 +152,7 @@ `tools`| `string[]`| No| Array of allowed tool names. If omitted, inherits every [tool available to subagents](</docs/en/sub-agents#available-tools>) `disallowedTools`| `string[]`| No| Array of tool names to remove from the agent’s tool set. MCP server-level patterns are also accepted: `mcp__server` or `mcp__server__*` removes every tool from that server, and `mcp__*` removes every MCP tool from any server `model`| `string`| No| Model override for this agent. Accepts an alias such as `'fable'`, `'opus'`, `'sonnet'`, `'haiku'`, `'inherit'`, or a full model ID. `'inherit'` uses the main model. When you omit it, Claude Code picks the model in the [subagent model order](</docs/en/sub-agents#choose-a-model>) -`skills`| `string[]`| No| List of skill names to preload into the agent’s context at startup. Unlisted skills remain invocable through the Skill tool +`skills`| `string[]`| No| List of skill names to preload into the agent’s context at startup. At most the [first 32 distinct names](</docs/en/sub-agents#preload-skills-into-subagents>) in the list are preloaded. Unlisted skills remain invocable through the Skill tool `memory`| `'user' | 'project' | 'local'`| No| Memory source for this agent `mcpServers`| `(string | object)[]`| No| MCP servers available to this agent, by name or inline config `initialPrompt`| `string`| No| Auto-submitted as the first user turn when this agent runs as the main thread agent. Ignored when the agent is invoked as a subagent @@ -339,7 +339,7 @@ Detect subagent invocation -Claude invokes subagents through the Agent tool. To detect when a subagent is invoked, check for `tool_use` blocks where `name` is `"Agent"`. Messages from within a subagent’s context include a `parent_tool_use_id` field. In TypeScript, each assistant and user message a subagent produces also carries [`agent_id`](</docs/en/agent-sdk/typescript#sdkassistantmessage>): the `task_id` of that subagent’s [task events](</docs/en/agent-sdk/typescript#sdktaskstartedmessage>). `agent_id` requires TypeScript Agent SDK v0.3.292 or later. +Claude invokes subagents through the Agent tool. To detect when a subagent is invoked, check for `tool_use` blocks where `name` is `"Agent"`. Messages from within a subagent’s context include a `parent_tool_use_id` field. In TypeScript, each assistant and user message a subagent produces also carries [`agent_id`](</docs/en/agent-sdk/typescript#sdkassistantmessage>): the `task_id` of that subagent’s [task events](</docs/en/agent-sdk/typescript#sdktaskstartedmessage>). `agent_id` stays the same when you resume the subagent. `agent_id` requires TypeScript Agent SDK v0.3.292 or later. The tool appears as `"Agent"` in `tool_use` blocks but as `"Task"` in the `system:init` tools list. Before Claude Code v2.1.63, `tool_use` blocks also named it `"Task"`. To keep detection working across SDK versions, match both values in `block.name`.
modified Tools reference View current →
--- a/tools-reference.md +++ b/tools-reference.md @@ -456,7 +456,15 @@ * `"shell": "powershell"` on individual [command hooks](</docs/en/hooks#command-hook-fields>): runs that hook in PowerShell. Hooks spawn PowerShell directly, so this works regardless of `CLAUDE_CODE_USE_POWERSHELL_TOOL`. * `shell: powershell` in [skill frontmatter](</docs/en/skills#frontmatter-reference>): runs `!`command`` blocks in PowerShell. Requires the PowerShell tool to be enabled. -PowerShell commands follow the same main-session working-directory reset behavior as Bash commands, including the `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` environment variable. PowerShell commands also receive the variables hooks persist through `CLAUDE_ENV_FILE`, under the conditions in [Persisted variables in PowerShell commands](</docs/en/hooks#persisted-variables-in-powershell-commands>). Requires Claude Code v2.1.296 or later. Exit code 1 from `grep`, `rg`, `egrep`, `fgrep`, `findstr`, and `git grep` means no matches. Exit code 1 from `git diff` means differences exist. Neither result is reported to Claude as a command failure. For `robocopy`, exit codes 0 through 7 are informational results, such as files copied or extra files detected. Exit codes of 8 or higher count as failures. +PowerShell commands follow the same main-session working-directory reset behavior as Bash commands, including the `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` environment variable. PowerShell commands also receive the variables hooks persist through `CLAUDE_ENV_FILE`, under the conditions in [Persisted variables in PowerShell commands](</docs/en/hooks#persisted-variables-in-powershell-commands>). Requires Claude Code v2.1.296 or later. + +### + +​ + +Exit code 1 from searches and `git diff` in PowerShell + +If a `grep` or `rg` search that matches nothing shows `Error: Exit code 1` when Claude runs it in the PowerShell tool, the search didn’t fail. You don’t need to do anything. The error can appear when the search is part of a longer command. For example, when `rg` exits with code 1, `rg foo | Out-Null` shows the error and `rg foo` doesn’t. The PowerShell tool can count exit code 1 as a normal result from `grep`, `rg`, `egrep`, `fgrep`, `findstr`, `git grep`, and `git diff`. The searches use exit code 1 to report no matches. From `git diff`, exit code 1 means the files differ. A command that shows the error when Claude runs it [counts as failed](</docs/en/skills#when-an-injected-command-fails>) in a skill with `shell: powershell`. ### @@ -468,7 +476,8 @@ * Claude Code encodes text piped to a native command’s standard input as UTF-8 * Claude Code captures error output without ANSI escape sequences * A command whose child process waits on standard input receives end-of-file instead of hanging - * Exit code 1 from `where.exe` means no match, and from `fc.exe` and `diff.exe` it means the files differ, so when the command produces output, Claude Code treats that exit code as a valid negative answer rather than a command error. Claude Code still reports a silenced form, such as `where.exe /Q` or a redirect to `$null`, as a failure on exit code 1 + * If `where.exe` finds no match, or `fc.exe` or `diff.exe` finds that the files differ, the result can show `Error: Exit code 1` though the command didn’t fail. You don’t need to do anything. + * If a `robocopy` exit code from 1 through 7 shows as an error, the copy didn’t fail and you don’t need to do anything. `robocopy` exits with code 0 through 7 to report a result, such as files copied, and with 8 or higher when it fails. ###
modified Troubleshoot a mod View current →
--- a/troubleshoot.md +++ b/troubleshoot.md @@ -106,7 +106,7 @@ `hooks module did not load` -The line starts with the mod’s name, then `hooks module did not load:` and a reason, which gives the file and line when the problem is in your code. Claude Code couldn’t load the module, for example because its top-level code threw. Fix the error the reason names. +The line starts with the mod’s name, then `hooks module did not load:` and a reason, which gives the file and line when the problem is in your code. Claude Code couldn’t load the module, for example because its top-level code threw. Fix the error the reason names. If the reason ends with `; the version loaded before is unloaded`, no version of the mod is running now. Once you fix the error, run [`/reload-plugins`](</docs/en/plugins/cli-reference#reload-plugins>) in the session to load the mod again. If you installed the mod and didn’t write it, ask its author to fix the error. ### @@ -123,6 +123,19 @@ `code nested too deep to scan: more than 2000 scopes` The line starts with the mod’s name, then `hooks module did not load:`, the file, and `code nested too deep to scan: more than 2000 scopes`. A file in a hooks module can’t nest scopes, such as functions, blocks, and loops, more than [2,000 deep](</docs/en/plugins/mods/reference#limits>). [`claude plugin validate`](</docs/en/plugins/mods/create#check-what-claude-code-reads-from-your-mod>) reports the same reason. Rewrite the code so its scopes nest less deeply. + +### + +​ + +`the parser stopped` or `the engine ran out of stack loading the file` + +Code in one file of the hooks module is nested so deeply that Claude Code ran out of stack reading it. The line starts with the mod’s name and `hooks module did not load:`, then gives that file’s name and one of these reasons: + + * `code nested too deep to scan (the parser stopped: <message>)` + * `the engine ran out of stack loading the file (code nested too deep): <message>` + +The reason gives no line number and doesn’t say what kind of code is nested, so look through the file yourself for its most deeply nested part. Rewrite that part to nest less. If you installed the mod and didn’t write it, ask its author to. ###
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -1082,6 +1082,28 @@ * `skills.skillFrontmatter` attributes the skill listing’s tokens to each included skill. The per-skill counts measure each skill’s listing entry as Claude Code actually sends it, which can be shorter than the skill’s full frontmatter. Compare `skills.totalSkills` with `skills.includedSkills` to see whether every discovered skill made it into the listing. `totalTokens` is the session’s current context usage, and `maxTokens` is the window that usage is measured against. That window is the model’s context window, or the lower auto-compaction window when one applies. `rawMaxTokens` carries the same value as `maxTokens`, and `percentage` is `totalTokens` as a rounded percentage of that window. `apiUsage` holds the usage from the latest API response, not a running total for the session. Claude Code leaves the optional `deferredBuiltinTools`, `systemTools`, and `systemPromptSections` diagnostics unset, so expect them to be absent even though the type declares them. + +#### + +​ + +Find a row by ID, a server’s instruction tokens, or an entry’s plugin and file + +MCP server instructions are the usage notes that connected servers supply and Claude Code adds to context, and the `mcp_instructions` row of `categories` counts their tokens. Use these `getContextUsage()` fields to pick out one `categories` row by `id`, split the `mcp_instructions` tokens by server, or find the plugin and file behind an agent or skill entry: + +Field| Found on| What it holds +---|---|--- +`id`| Each `categories` row| The row’s identifier, one of the values the response type lists, such as `mcp_instructions`. Match on `id` to pick out one row, or on `kind` to group rows. A later Claude Code version can send a value your installed types don’t list, so treat an `id` you don’t recognize as absent +`mcpInstructions`| The response| One `{ serverName, tokens }` entry per connected MCP server that supplies instructions, or an empty array when none does. The `tokens` values are estimates that add up to the `mcp_instructions` row’s `tokens`. `serverName` is the `name` that `mcpServerStatus()` reports for that server +`pluginId`| `agents` and `skills.skillFrontmatter` entries| Names the plugin the entry comes from, as an ID in the form `name@marketplace`, and is absent for an entry that doesn’t come from a plugin. When the plugin didn’t come from a marketplace, the part after `@` names [its origin](</docs/en/plugins/loading#find-where-a-plugin-came-from>) instead, such as `inline` for one you loaded through the `plugins` option +`path`| `agents` and `skills.skillFrontmatter` entries| Absolute path of the file that defines the agent or skill, on the machine where Claude Code runs. The field is absent when no file defines the entry, for example an agent from the `agents` option or a skill built into Claude Code + +As an example of matching on `id`, this sample finds the `mcp_instructions` row: + + // q is the Query object that query() returned + const usage = await q.getContextUsage(); + // undefined if no connected server supplies instructions + const row = usage.categories.find((c) => c.id === "mcp_instructions"); ### @@ -5585,6 +5607,7 @@ * **Servers the call doesn’t name** : outside a [cloud session](</docs/en/claude-code-on-the-web>), Claude Code disconnects the servers an earlier `setMcpServers()` call added and the in-process SDK servers, and lists them in `removed`. Other servers keep running and aren’t listed in `removed`, among them the stdio, HTTP, and SSE servers from the `mcpServers` option, servers from settings files, and plugin-provided servers. * **Servers the call names** : Claude Code replaces a stdio, HTTP, or SSE server that an earlier `setMcpServers()` call added only when its config differs from the one you passed. An in-process SDK server already registered under that name stays as it is, so to swap one, leave it out of one call and add it in the next. * **Built-in servers the CLI started at startup** : if the call names one, Claude Code drops that entry and reports it in `errors`. + * **Stdio, HTTP, or SSE servers that share a name with one from an MCP installation scope such as`.mcp.json`**: under that name the session uses your server’s tools rather than the [installation-scope server’s](</docs/en/mcp#mcp-installation-scopes>). Before Claude Code v2.1.305, Claude Code could disconnect your server and connect the installation-scope server when your app reloaded plugins. The promise resolves after newly added stdio, HTTP, and SSE servers connect or fail, so tools from servers that connected are available on the next turn. `added` lists the servers Claude Code added or replaced, whether or not they connected. A server that failed to connect appears in both `added` and `errors`, with the failure text under `errors` and a `failed` row in `mcpServerStatus()`. Before Claude Code v2.1.257, a server whose connection attempt threw was reported only under `errors`.
modified Use Claude Code in VS Code View current →
--- a/vs-code.md +++ b/vs-code.md @@ -124,7 +124,7 @@ * **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. Requires Claude Code v2.1.227 or later. 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. * **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. * **Bookmarks** : hover over a response and click **Bookmark response** to save it, or click **Remove bookmark** on a saved response to remove it. To review saved responses, open the Bookmarks panel. You can click the bookmark icon at the top of the Claude Code panel, select **Bookmarks** in the Context section of the command menu, or type `/bookmarks`. Requires Claude Code v2.1.286 or later. - * **Files Claude sends you** : when the session is connected to [Remote Control](</docs/en/remote-control#start-a-remote-control-session>) and Claude sends you files with the [`SendUserFile` tool](</docs/en/tools-reference>), the conversation shows a row such as **Sent report.md, chart.png**. Click a file’s name to open it in the editor. + * **Files Claude sends you** : when the session is connected to [Remote Control](</docs/en/remote-control#start-a-remote-control-session>) and Claude sends you files with the [`SendUserFile` tool](</docs/en/tools-reference>), the conversation shows a row such as **Sent report.md, chart.png**. Click a file’s name to open it in the editor. The row stays visible in Focus view. Requires Claude Code v2.1.295 or later. A file appears as a full path you can’t click, such as `\\server\share\report.md`, when its path names a network host. Claude Code doesn’t link that file because opening it would contact that host and, on Windows, [could send your Windows credentials to that host](</docs/en/permissions#read-only-commands>). * **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**.
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -52,6 +52,7 @@ * **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. To return later, run the `claude --worktree <name> --resume` command that Claude Code prints on exit. Removing deletes the worktree directory and its branch, along with all the work in them + * **Another branch is checked out** : if the worktree is on a branch other than its own that has commits past the worktree’s starting commit, Claude prompts you to keep or remove the worktree. Either answer keeps that other branch and its commits. Removing deletes the worktree directory and the worktree’s own branch, the one Claude created with it * **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.