modified Manage mods for your organization View current →
--- a/admin.md +++ b/admin.md @@ -51,12 +51,12 @@ * **Mods are on.** A user can install a plugin that contains a mod from any marketplace your plugin settings allow, or load one from a directory with `--plugin-dir`. * **A built-in guard runs first.** Claude Code loads a built-in mod named `sec-default@builtin` ahead of every mod a user installs. Users can’t turn it off. `/plugin` and the debug log list it as `cc-plugin-sec-default`. The guard loads when either of these is true: * The machine has managed settings - * The user is signed in to Claude Code with a Team or Enterprise plan -A user who authenticates with an API key, or through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, gets the guard only on a machine that has managed settings. + * The session runs on [`/login` credentials](</docs/en/authentication#authentication-precedence>) for a Team or Enterprise plan +A user who authenticates with an API key, or through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, gets the guard only on a machine that has managed settings. A session that runs on a long-lived [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/authentication#generate-a-long-lived-token>) doesn’t count as that login either, even when a Team or Enterprise login is stored on the machine. * **The guard protects what you manage.** A user’s mod can’t change what your managed hooks receive or decide, the system prompt, your managed `CLAUDE.md` and other managed instructions, what any mod reads as settings, or the tools and descriptions of your managed MCP servers. - * **Everything else is allowed.** The guard adds no other restrictions. A user’s mod can still read and write files, start processes, make network requests, rewrite tool calls and prompts, deny a tool call, approve one that would otherwise prompt, and draw in the interface, all with that user’s permissions. - * **Deny rules and your managed hooks take precedence.** Where the guard loads, a user’s mod can’t approve a call that a `deny` rule refuses, whichever settings file holds the rule. A block from a `PreToolUse` hook in managed settings is final too. Both apply to Claude’s tool calls. Neither applies to a mod’s own [`$.fs` and `$.process` calls](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>): with `Read(.env)` denied, a mod can still read that file with `$.fs.read` or start a program that does. To limit those calls, keep the mod from loading or handle the call in a policy mod. - * **Other permission checks can be overridden.** A user’s mod that approves tool calls can approve a call that an `ask` rule would prompt for, or that a `PreToolUse` hook outside managed settings blocked. In auto mode, a call the mod approves runs without a classifier check. For the prompts a mod’s `tool.check` approval doesn’t skip, see [Extend permissions with hooks](</docs/en/permissions#extend-permissions-with-hooks>). + * **Outside what you manage, a user’s mod acts as that user.** The mod keeps that user’s permissions: it can still read and write files, start processes, and make network requests. It can also rewrite tool calls and prompts, deny a tool call, and draw in the interface. + * **Permission rules and`PreToolUse` hooks take precedence over a user’s mod.** With the guard loaded, by default a user’s mod can’t approve a call that a `deny` rule refuses or an `ask` rule prompts for, whichever settings file holds the rule. The mod can’t approve a call that any `PreToolUse` hook blocked, either. Permission rules and `PreToolUse` hooks apply to Claude’s tool calls, not to a mod’s [`$.fs` and `$.process` calls](</docs/en/plugins/mods/api#reach-files-processes-and-the-network>). With `Read(.env)` denied, a mod can still read that file with `$.fs.read` or start a program that does. To limit a mod’s own `$.fs` and `$.process` calls, keep the mod from loading or handle them in a policy mod. + * **A user’s mod can still skip some prompts.** In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), a call the mod approves runs without a classifier check, unless the guard is loaded and the session runs with [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) or an Agent SDK [`canUseTool` callback](</docs/en/agent-sdk/user-input#handle-tool-approval-requests>). There the classifier checks the call first. For the prompts a mod’s approval doesn’t skip, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). The guard’s source is public in the [`mods/sec-default` directory of the Claude Code repository](<https://github.com/anthropics/claude-code/tree/main/mods/sec-default>). @@ -70,7 +70,7 @@ * **Settings hooks keep working.** Command, HTTP, prompt, and agent hooks in settings files and in plugins’ `hooks/hooks.json` run as before, alongside mods. * **Deny rules take precedence where the guard loads.** A user’s mod can’t approve a call that a `deny` rule refuses, unless you set `allowModsToOverrideDenyRules`. - * **Managed hooks run first.** A `PreToolUse` hook in managed settings runs before any mod sees the tool call, and its block is final. If a mod then rewrites the call, your managed hooks run again on the rewritten call, so a block still applies. `PreToolUse` hooks from other settings files and from plugins run after the last mod, so a mod that returns its own result in place of running the tool keeps those from running. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>). + * **Managed hooks run first.** A `PreToolUse` hook in managed settings runs before any mod’s [`tool.call`](</docs/en/plugins/mods/reference#tools>) hook, and when that managed hook blocks a tool call, no mod’s `tool.call` hook runs for that call. If the call goes ahead and a mod rewrites it, your managed hooks run again on the rewritten call, so they can still block it. `PreToolUse` hooks from other settings files and from plugins run after the last mod. If a mod answers the tool call itself, the tool never runs and neither do those hooks. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>). * **Network policy covers`$.http.fetch`.** * **Your organization’s policy doesn’t allow WebFetch** : Claude Code also refuses every mod’s `$.http.fetch` request. See [WebFetch availability](</docs/en/tools-reference#webfetch-availability>). * **You turn off the WebFetch tool with[`CLAUDE_CODE_DISABLE_WEB_FETCH`](</docs/en/env-vars#variables>) or a `WebFetch` [deny rule](</docs/en/permissions#tool-specific-permission-rules>), in managed settings or any other settings file**: mods can still make `$.http.fetch` requests. To stop them for every mod your users install, keep user-installed mods from loading, or hook `http.fetch` in a policy mod and refuse requests from users’ mods. Give that hook a [`.catch` handler](</docs/en/plugins/mods/events#handle-a-hook-that-fails>) that refuses too, because Claude Code skips a hook that fails and the request then goes ahead. If you only [restrict which plugins users can install](</docs/en/plugins/org#restrict-what-users-can-install>), fewer mods load, but those you allow still make these requests. @@ -311,7 +311,7 @@ * **The list replaces the default** : when you set `prependPlugins` in managed settings, name `sec-default@builtin` in it to keep the built-in guard. The guard is built in and needs no `enabledPlugins` entry. * **Your own ids must count as yours** : in managed settings, Claude Code skips an id whose plugin doesn’t meet the conditions for an organization’s mod - * **Repositories can’t set them** : Claude Code reads both settings from managed settings and never from a repository’s settings file. A user can set them in `~/.claude/settings.json` to order their own mods only on a machine with no managed settings, and only when they aren’t signed in with a Team or Enterprise plan. Anywhere else, Claude Code ignores both keys in user settings. A list there neither adds nor removes the built-in guard. + * **Repositories can’t set them** : Claude Code reads both settings from managed settings, never from a repository’s settings file. A user can set them in `~/.claude/settings.json` to order their own mods only on a machine with no managed settings, and only when the session’s credential isn’t a Team or Enterprise `/login`. Anywhere else, Claude Code ignores both keys in user settings. A list there neither adds nor removes the built-in guard. ###
modified Set up Claude Code for your organization View current →
--- a/admin-setup.md +++ b/admin-setup.md @@ -26,7 +26,7 @@ Google Cloud’s Agent Platform| You want to inherit existing GCP compliance controls and billing Microsoft Foundry| You want to inherit existing Azure compliance controls and billing -Some Claude Code features require a claude.ai account. [Cloud sessions](</docs/en/claude-code-on-the-web>), [Routines](</docs/en/routines>), [Code Review](</docs/en/code-review>), [Remote Control](</docs/en/remote-control>), and the [Chrome extension](</docs/en/chrome>) aren’t available through Console API keys or cloud-provider credentials alone. If you deploy through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, plan whether developers also need Claude for Teams or Enterprise seats. Each feature page lists its plan requirements. For the full provider comparison covering authentication, regions, and feature parity, see the [enterprise deployment overview](</docs/en/third-party-integrations>). Each provider’s auth setup is in [Authentication](</docs/en/authentication>). Proxy and firewall requirements in [Network configuration](</docs/en/network-config>) apply regardless of provider. If you want a single endpoint in front of multiple providers or centralized request logging, see [LLM gateway](</docs/en/llm-gateway>). +Some Claude Code features require a claude.ai account. [Cloud sessions](</docs/en/claude-code-on-the-web>), [cloud scheduled tasks](</docs/en/routines>), [Code Review](</docs/en/code-review>), [Remote Control](</docs/en/remote-control>), and the [Chrome extension](</docs/en/chrome>) aren’t available through Console API keys or cloud-provider credentials alone. If you deploy through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, plan whether developers also need Claude for Teams or Enterprise seats. Each feature page lists its plan requirements. For the full provider comparison covering authentication, regions, and feature parity, see the [enterprise deployment overview](</docs/en/third-party-integrations>). Each provider’s auth setup is in [Authentication](</docs/en/authentication>). Proxy and firewall requirements in [Network configuration](</docs/en/network-config>) apply regardless of provider. If you want a single endpoint in front of multiple providers or centralized request logging, see [LLM gateway](</docs/en/llm-gateway>). ##
modified How the agent loop works View current →
--- a/agent-loop.md +++ b/agent-loop.md @@ -247,7 +247,7 @@ `"default"`| Tool calls that need approval and aren’t covered by allow rules trigger your `canUseTool` callback; no callback means deny| Interactive applications with a custom approval callback `"acceptEdits"`| Auto-approves file edits and common filesystem commands (`mkdir`, `touch`, `mv`, `cp`, etc.); other Bash commands follow default rules| You trust Claude’s edits and want faster iteration, such as during prototyping or when working in an isolated directory `"plan"`| Claude explores and plans without editing your source files; file edits are never auto-approved and prompt through your `canUseTool` callback| You want Claude to propose changes without executing them, such as during code review or when you need to approve changes before they’re made -`"dontAsk"`| Never prompts. Tools pre-approved by [permission rules](</docs/en/settings-reference#permission-settings>) run, and so do calls that need no approval in `default` mode, such as file reads inside your working directories; every call that would otherwise prompt is denied. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and [reads from network paths](</docs/en/permissions#network-paths>) are denied even if you’ve allowed them| You want a fixed, explicit tool surface for a headless agent and prefer a hard deny over silent reliance on `canUseTool` being absent +`"dontAsk"`| Never prompts. Tools pre-approved by [permission rules](</docs/en/settings-reference#permission-settings>) run, and so do calls that need no approval in `default` mode, such as file reads inside your working directories. Every 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>). `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and [reads from network paths](</docs/en/permissions#network-paths>) are denied even if you’ve allowed them| You want a fixed, explicit tool surface for a headless agent and prefer a hard deny over silent reliance on `canUseTool` being absent `"auto"`| Uses a model classifier to review actions such as shell commands and network requests, allowing or blocking each one it reviews. See [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) for availability and the decision order| Autonomous agents that still want safety guardrails on tool use `"bypassPermissions"`| Runs all allowed tools without asking, except tools matched by an explicit [`ask` rule](</docs/en/settings-reference#permission-settings>), connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and tools that require user interaction. The [cross-session messaging safeguards](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) still apply. See [How permissions are evaluated](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>) for the precedence order. In the TypeScript SDK, also requires `allowDangerouslySkipPermissions: true` in `options`. Can’t be used when running as root on Unix. Use only in isolated environments where the agent’s actions can’t affect systems you care about| CI, containers, or other isolated environments @@ -281,7 +281,7 @@ ---|---|--- **System prompt**| Every request| Small fixed cost, always present **CLAUDE.md files**| Session start, via [`settingSources`](</docs/en/agent-sdk/claude-code-features>)| Full content in every request (but prompt-cached, so only the first request pays full cost) -**Tool definitions**| Every request; MCP schemas deferred by default| Built-in tool schemas load every request. [Tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default, falling back to upfront loading on unsupported models and certain platforms. See [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) for the full matrix +**Tool definitions**| Every request for core built-in tools such as Bash, Read, and Edit; on demand for MCP tools and other built-in tools, which [tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers by default| Every schema loads upfront in the cases under [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) **Conversation history**| Accumulates over turns| Grows with each turn: prompts, responses, tool inputs, tool outputs **Skill descriptions**| Session start, via setting sources| Short summaries; full content loads only when invoked @@ -321,7 +321,7 @@ A few strategies for long-running agents: - * **Use subagents for subtasks.** Each subagent starts with a fresh conversation (no prior message history, though it does load its own system prompt and project-level context like CLAUDE.md). It does not see the parent’s turns, and only its final response returns to the parent. The main agent’s context grows by that summary, not by the full subtask transcript. See [What subagents inherit](</docs/en/agent-sdk/subagents#what-subagents-inherit>) for details. + * **Use subagents for subtasks.** A subagent returns only its final response, so your main agent’s context grows by a summary, not by the subtask’s transcript. * **Be selective with tools.** Every tool definition takes context space. Use the `tools` field on [`AgentDefinition`](</docs/en/agent-sdk/subagents#agentdefinition-configuration>) to scope subagents to the minimum set they need. * **Watch MCP server costs.** [MCP tool search](</docs/en/agent-sdk/mcp#mcp-tool-search>) defers MCP tool schemas by default and loads them on demand. When tool search is off or has fallen back to upfront loading, each MCP server adds all its tool schemas to every request, so a few servers with many tools can consume significant context before the agent does any work. See [Configure tool search](</docs/en/agent-sdk/tool-search#configure-tool-search>) for the configurations where the fallback applies. * **Use lower effort for routine tasks.** Set effort to `"low"` for agents that only need to read files or list directories. This reduces token usage and cost.
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -519,7 +519,7 @@ * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. * **One team per session** : a session has exactly one team, scoped to that session. You can’t create additional named teams or share a team across sessions. * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. - * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground, as described in [how Claude Code picks foreground or background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). + * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : teammates start with the permission mode described under Permissions. You can change an individual teammate’s permission mode after spawning, but you can’t set per-teammate permission modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -375,7 +375,7 @@ Copy the session with /fork -Run `/fork` to copy the current conversation into a new background session while the original keeps running. The copy starts with everything in the conversation up to that point; see the bullets below for where the copy runs. It also carries over the model, permission mode, effort level, and any directories or “don’t ask again” permission grants you added during the session. The copy appears as its own row in agent view. After the fork, the two conversations are independent: nothing the copy does enters the original conversation on its own, though in sessions where [cross-session messaging](</docs/en/cross-session-messaging>) is enabled, either session’s Claude can explicitly message the other. Copying the session requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211, `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead, which is now `/subtask`. When agent view is turned off, `/fork` keeps the forked-subagent behavior and `/subtask` isn’t available. Pass a prompt such as `/fork open a draft pull request with the work so far` and the copy starts working on it immediately. Without a prompt the copy waits for its first instruction: select its row in `claude agents` and press `Space` to send one, or run `claude attach <id>`. The selected row shows `space to send it a prompt` while it waits. The `/fork` confirmation is one line showing the copy’s state, such as `session running`, the name of its agent-view row, and its session ID for `claude attach`. Click the name to switch into the copy: this session moves to the background, the same as pressing `←`, and agent view opens the copy’s session. Except when the copy edits in place, Claude Code instructs it to create a worktree of its own before making code changes. Outside a git repository, only a copy moved out of a hook-created worktree gets the instruction; with no [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>), the copy edits in place. A copy moved out of your worktree is also told never to edit, run commands in, or enter that worktree, whatever the isolation setting. Where the copy starts depends on where the current session is running: +Run `/fork` to copy the current conversation into a new background session while the original keeps running. The copy starts with everything in the conversation up to that point; see the bullets below for where the copy runs. It also carries over the model, permission mode, effort level, and any directories or “don’t ask again” permission grants you added during the session. The copy appears as its own row in agent view. After the fork, the two conversations are independent: nothing the copy does enters the original conversation on its own, though in sessions where [cross-session messaging](</docs/en/cross-session-messaging>) is enabled, either session’s Claude can explicitly message the other. When agent view is turned off, `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead of copying the session. Pass a prompt such as `/fork open a draft pull request with the work so far` and the copy starts working on it immediately. Without a prompt the copy waits for its first instruction: select its row in `claude agents` and press `Space` to send one, or run `claude attach <id>`. The selected row shows `space to send it a prompt` while it waits. The `/fork` confirmation is one line showing the copy’s state, such as `session running`, the name of its agent-view row, and its session ID for `claude attach`. Click the name to switch into the copy: this session moves to the background, the same as pressing `←`, and agent view opens the copy’s session. Except when the copy edits in place, Claude Code instructs it to create a worktree of its own before making code changes. Outside a git repository, only a copy moved out of a hook-created worktree gets the instruction; with no [`WorktreeCreate` hook](</docs/en/hooks#worktreecreate>), the copy edits in place. A copy moved out of your worktree is also told never to edit, run commands in, or enter that worktree, whatever the isolation setting. Where the copy starts depends on where the current session is running: * Like any dispatched session, the copy moves into its own worktree before editing files. In that case the confirmation doesn’t mention where the copy runs. * When your session moved into its linked [worktree](</docs/en/worktrees>) after it started, the copy starts back where the session was before the move and, unless it edits in place, makes its code changes in a worktree of its own there. When your worktree is checked out on a branch, that instruction also tells a copy whose task builds on your work to base its new branch on yours, since your branch stays checked out in your worktree. The confirmation ends with `runs in the origin tree`. @@ -765,6 +765,14 @@ * **Automatic artifact replies** : Claude is [replying to comments on an artifact on its own](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Those replies continue in the background session, and the dialog says so. Run `/tasks` to see everything that’s running, then confirm to background anyway or choose `Stay` to let the work finish first. See What carries over when you background for which kinds of work carry over and which Claude Code stops. + +### + +​ + +The conversation says a background agent `was carried into this session and not resumed` + +This notice names a background [subagent](</docs/en/sub-agents>) that isn’t running in this session. Claude sees the notice and replies on its own, so you don’t need to prompt it. If you still need that subagent’s work after reading Claude’s reply, ask Claude for it. ###
modified Run agents in parallel View current →
--- a/agents.md +++ b/agents.md @@ -18,7 +18,7 @@ * A [background bash command](</docs/en/interactive-mode#background-bash-commands>) runs one shell command without blocking the conversation. It doesn’t spawn an agent. * A [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) is a subagent that inherits your full conversation context instead of starting fresh. It’s a way to spawn a subagent, not a separate surface. Start one with `/subtask`. Claude also spawns one itself where [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>) is on. To copy the whole session into a new [background session](</docs/en/agent-view#from-inside-a-session>) that runs alongside it, use `/fork`. With [agent view turned off](</docs/en/agent-view#turn-off-agent-view>), the forked-subagent command is `/fork` instead and `/subtask` isn’t available. - * A [routine](</docs/en/routines>) runs a session on a schedule in the cloud, not in parallel on your machine. + * A [cloud scheduled task](</docs/en/routines>) runs a session on a schedule in the cloud, not in parallel on your machine. Running several sessions or subagents at once multiplies token usage. See [Costs](</docs/en/costs>) for usage and rate-limit details.
modified Claude Code on Amazon Bedrock View current →
--- a/amazon-bedrock.md +++ b/amazon-bedrock.md @@ -114,7 +114,7 @@ export AWS_PROFILE=your-profile-name -Claude Code requests role credentials from the IAM Identity Center region named by the profile’s `sso_region`, which doesn’t need to match the region you run Amazon Bedrock in. In v2.1.207, the Amazon Bedrock region overrode `sso_region`, so a profile whose IAM Identity Center instance is in a different region failed to authenticate with a `Session token not found or invalid` error. +Claude Code requests role credentials from the IAM Identity Center region named by the profile’s `sso_region`, which doesn’t need to match the region you run Amazon Bedrock in. ####
modified Use the mods API View current →
--- a/api.md +++ b/api.md @@ -228,6 +228,97 @@ Timers stop when the module reloads. For long-running work inside a hook, [`next.signal`](</docs/en/plugins/mods/reference#the-hook-function>) is an `AbortSignal` that aborts when the event your hook is handling is abandoned, for example when the user interrupts, so pass it to anything long-running. +### + +​ + +Calls and background work after the user interrupts a turn + +The reason `the session was stopped and nobody has sent input since` in a result or error means the user stopped a running turn, such as with Esc or **Stop**. After that interruption, calls that start new work in the session are refused until the user’s next input, such as a message at the prompt. Apart from `$.prompt.submit` and `$.command.run`, this handling of calls and background work after an interruption requires Claude Code v2.1.304 or later. + +#### + +​ + +Retry a refused or dropped call + +Make a refused or dropped call again from a [`turn.complete`](</docs/en/plugins/mods/events#follow-a-turn>) hook. Calls stay refused until the user’s next input, and nothing queues or repeats them for you. When a call’s result or error contains one of these strings, keep its arguments for a later retry: + + * **`the session was stopped and nobody has sent input since`** : the call was refused + * **`was removed from the queue before it ran`** : the prompt or command left the queue without running and was dropped, for example when the user stopped the turn + +In this example, call `submitPrompt` from your background job in place of `$.prompt.submit`. When the result or the error carries one of those strings, `submitPrompt` keeps the text in `pendingText` for the `turn.complete` hook to submit again: + + // The text of the last refused or dropped prompt, or null + let pendingText = null + + async function submitPrompt($, text) { + let reason + try { + const result = await $.prompt.submit({ text }) + reason = result?.drop ?? '' + } catch (error) { + reason = String(error?.message ?? error) + } + if (reason.includes('the session was stopped and nobody has sent input since') || + reason.includes('was removed from the queue before it ran')) { + pendingText = text + } + // Any other result or error isn't retried + } + + on('turn.complete', async ($, e, next) => { + if (pendingText !== null) { + const text = pendingText + // Empty pendingText before retrying, so that a second run of this hook + // doesn't submit the same text. + pendingText = null + // Not awaited: the hook would stay open until the new turn starts + submitPrompt($, text) + } + return next(e) + }) + +Before the user’s next input, `turn.complete` can fire for the interrupted turn itself and for a subagent’s turn, and calls made then are refused again. In that case `submitPrompt` keeps the text for a later `turn.complete`. For a call that rejects, such as `$.command.run`, catch the error and test its message the way `submitPrompt` tests `reason`. + +#### + +​ + +What refused calls return + +In the results, `<reason>` stands for `the session was stopped and nobody has sent input since`: + +Some refused calls| Result until the user’s next input +---|--- +`$.prompt.submit`| Resolves with `{ drop: '<reason>' }` and queues no prompt +`$.command.run`| Rejects with an error whose message ends with `<reason>` +[`$.agent.spawn`](</docs/en/plugins/mods/reference#mods-api-methods>)| Resolves with `{ deny: '<reason>' }` and starts no subagent +`$.session.send` to a subagent that finished| Resolves with `{ isDelivered: false, reason: 'Agent "<id>" was not resumed: <reason>.' }`, where `<id>` is the subagent’s id. A subagent that’s still running receives the message. +`$.session.send` to an [agent team](</docs/en/agent-teams>) teammate| Resolves with `{ isDelivered: false, reason: 'Teammate "<name>" was not messaged: <reason>.' }`, where `<name>` is the teammate’s name +[`$.tool.call`](</docs/en/plugins/mods/reference#mods-api-methods>) of Bash with `run_in_background: true`, Monitor, or CronCreate| Resolves with `{ deny: '<tool> was not run: it starts background work, a schedule or a goal, and <reason>' }`, where `<tool>` is the tool’s name + +Along with these `$.session.send` and `$.tool.call` results, the user can see the [`Stopped:` toast](</docs/en/plugins/mods/troubleshoot#stopped-type-a-message-to-continue>). + +#### + +​ + +Work your mod started before the interruption + +After the user stops a running turn, for example with Esc, some work your mod had already started is dropped and some waits for the user’s next input. + +Work| What happens until the user’s next input| What to do +---|---|--- +A prompt from `$.prompt.submit` still in the queue| Dropped. The call resolves with `{ drop: 'the prompt was removed from the queue before it ran' }`.| Submit it again as Retry a refused or dropped call shows +A command from `$.command.run` still in the queue| Dropped. The call rejects with an error whose message includes `the command was removed from the queue before it ran`.| Run it again as Retry a refused or dropped call shows +A one-time job scheduled with a tool such as CronCreate that comes due before the user’s next input| Starts no turn then, and runs after that input| Nothing needed +A recurring job scheduled with a tool such as CronCreate that comes due before the user’s next input| Starts no turn then. The job loses that run and keeps its schedule.| Nothing needed +An event from a monitor your mod started| The monitor keeps running. An event the monitor raises before the user’s next input is dropped, except the notice that the monitor ended, which arrives after that input.| Nothing can be done +A subagent your mod spawned and later resumed with `$.session.send` that finishes before the user’s next input| Its finish notice waits, and reaches the conversation after that input| Nothing needed + +When a scheduled job comes due or a monitor raises an event before the user’s next input, the user can see the [`Stopped:` toast](</docs/en/plugins/mods/troubleshoot#stopped-type-a-message-to-continue>). + ## ​
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -61,7 +61,7 @@ The session is in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>)| Asks before the first publish of each artifact The publish declares runtime capabilities for the page, such as connector calls or file downloads| Asks before that publish You shared the artifact publicly| Asks once per conversation before changing it -Claude publishes in a turn that a [scheduled task](</docs/en/scheduled-tasks>) firing in your session started, rather than a prompt you typed| Asks before the first publish of each artifact +Claude publishes in a turn that a [session-scoped scheduled task](</docs/en/scheduled-tasks>) firing in your session started, rather than a prompt you typed| Asks before the first publish of each artifact Claude can’t read the file without your approval| Asks before publishing it. An allow rule for the `Artifact` tool doesn’t skip this prompt In [Manual](</docs/en/permission-modes>) or `acceptEdits` mode, Claude makes a small change to an artifact’s file it can’t edit without your approval, such as a project file in Manual mode| Asks before publishing the change. You’re asked even if an allow rule covers the `Artifact` tool, because the edit to the file needs your approval @@ -87,7 +87,7 @@ Find an artifact again -Run `/artifacts` in Claude Code to list the artifacts you own and the ones shared with you. The current session’s artifacts come first, under **This session**. Requires Claude Code v2.1.208 or later. Select an artifact, then press one of these keys: +Run `/artifacts` in Claude Code to list the artifacts you own and the ones shared with you. The current session’s artifacts come first, under **This session**. Select an artifact, then press one of these keys: * **`Enter`** : opens it in your browser when it’s already attached to the current session, and attaches it when it isn’t. Before v2.1.216, `Enter` opened it in your browser * **`o`** : opens it in your browser
modified Configure auto mode View current →
--- a/auto-mode-config.md +++ b/auto-mode-config.md @@ -275,7 +275,7 @@ claude auto-mode defaults -To read one rule’s full wording without piping through `jq`, pass `--label` with the start of the rule’s label, such as `claude auto-mode defaults --label 'Git Destructive'`. Matching is a case-insensitive prefix on each rule’s label, and sections with no match print as empty lists. Requires Claude Code v2.1.208 or later. Print what the classifier actually uses as JSON, with your settings applied where set and defaults otherwise: +To read one rule’s full wording without piping through `jq`, pass `--label` with the start of the rule’s label, such as `claude auto-mode defaults --label 'Git Destructive'`. Matching is a case-insensitive prefix on each rule’s label, and sections with no match print as empty lists. Print what the classifier actually uses as JSON, with your settings applied where set and defaults otherwise: claude auto-mode config @@ -303,7 +303,7 @@ claude auto-mode critique -If you’ve written custom rules, `claude auto-mode critique` reviews them and flags entries that are ambiguous, redundant, or likely to cause false positives. To discard your customizations and return to the built-in defaults, run the reset subcommand. It requires Claude Code v2.1.212 or later and removes the `autoMode` section from your user settings file: +If you’ve written custom rules, `claude auto-mode critique` reviews them and flags entries that are ambiguous, redundant, or likely to cause false positives. To discard your customizations and return to the built-in defaults, run the reset subcommand, which removes the `autoMode` section from your user settings file: claude auto-mode reset
modified Best practices for Claude Code View current →
--- a/best-practices.md +++ b/best-practices.md @@ -513,7 +513,7 @@ Test on a few files, then run on all of them -Refine your prompt based on what goes wrong with the first 2-3 files, then run on the full set. The `--allowedTools` flag pre-approves the tools the migration needs, and [`--permission-mode dontAsk`](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>) denies anything else that would need approval, which matters when you’re running unattended. +Refine your prompt based on what goes wrong with the first 2-3 files, then run on the full set. The `--allowedTools` flag pre-approves the tools the migration needs. [`--permission-mode dontAsk`](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>) denies anything else that would need approval, which matters when you’re running unattended, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve some of those calls. You can also integrate Claude into existing data/processing pipelines:
modified Claude Code changelog View current →
Show diff (101 lines)
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,98 @@ 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.304 + +October 19, 2026 + +**Added** + + * Added a transcript line when a plugin that runs first skips one of your mod’s hooks, naming the event and the plugin + * Added `decider: "person"` to a mod’s `tool.check` answer: only the permission dialog or a host’s callback can approve the ask, and it is refused with the mod’s reason where nobody can be asked + * Added `e.isReadOnly` to a mod’s `tool.check` event, set when the tool call is read-only + * Added `/auto-mode-setup`: a guided setup that reads your project and recent sessions to teach auto mode about your environment, now also available on Bedrock, Vertex, Foundry, Claude apps gateway and telemetry-disabled sessions + * Added `/claude-api managed-agents-secure`, which compares a Managed Agents agent’s settings with Anthropic’s published security guide, without changing anything + * Added the names of the tools called earlier to the compaction summary in the transcript view (Ctrl+O) + * Added a warning on Pro and Max plans when resuming an inactive conversation would use a noticeable share of your 5-hour usage limit: resume anyway, or start a new conversation and Claude can look up the previous one if you refer to it + * [VSCode] Added mod drawing in the chat panel for sessions on Amazon Bedrock, Google Vertex AI and Microsoft Foundry, behind an LLM gateway, or with telemetry turned off + * [Code Review] Added review levels to Code Review: Owners choose Quick, Standard (the default), or Deep for the organization, and can give individual repositories their own level + * [Code Review] Added an option in Code Review admin settings to review every repository in a GitHub organization, including ones added later, without selecting them one by one + +**Changed** + + * Changed mods’ `settings.read` hooks to receive each settings layer and rewrite the merged settings, so a managed mod can make an organization’s setting a ceiling, including the `cleanupPeriodDays` the retention sweep uses + * Changed the `/artifacts` delete confirmation to show numbered choices: 1 or Enter keeps the artifact, 2 deletes it, and y, n and Esc still work + * Changed the question that turns on the mods Claude writes in a session to plain text with no link or session id; it stays up when a new turn starts, and Claude tells you what loaded when you turn them on + * Changed tool search to be on by default behind a custom `ANTHROPIC_BASE_URL`; a 400 or 422 from the gateway is retried without it + * Changed compaction to send Claude the skill list again afterwards; `/reload-skills` now sends only new or changed skills + * Changed skill hooks: the skills of one source (a repo, your own folder, or a plugin) can register at most 1,024 hooks and 16,384 matcher characters per session + * Changed skills under a policy that allows hooks from plugins only: a skill used in the main conversation whose hooks are kept out no longer gets its `allowed-tools` + * Updated the /claude-api skill to use the `ant` CLI on Claude Platform on AWS instead of falling back to the SDK or curl + * Removed the notes from `claude plugin validate` that predicted where a mod’s hooks would run + * Removed the “(research preview)” label from the `/fast` dialog title on Opus 5.5 + * [VSCode] Changed background sub-agents to show as one status line under their Agent card instead of streaming every step into the chat; the full transcript stays in /tasks + +Show 12 improvements + + * Improved `/usage` to say when a rate limit on usage data ends instead of “try again in a moment” + * Improved the lines shown when a mod written in the session loads, reloads or fails to load + * Improved artifacts with several views: when you ask for links to them, Claude now writes out each view’s link and explains that the address bar stays the same as you switch views + * Improved cloud sessions: a new conversation’s first turn no longer waits for the local (stdio) MCP servers of plugins synced from claude.ai, unless a server sets `alwaysLoad: true` + * Improved how a remote session recovers its status when the server refuses a status update that carried other session data + * Improved session file size in auto mode: the safety classifier’s context is no longer stored with every request + * Improved the `claude -p` invalid-settings warning: a file that did not load lists only what stopped it, and long lists are capped per file + * Improved resume of large compacted sessions in SDK and headless mode: the first request after resuming is sent sooner + * Improved responsiveness and throughput when many subagents are running at the same time + * Improved memory use when sending requests in long or resumed conversations + * Self-hosted runner: Improved the error shown when the git host answers “not found” for a session’s repository: it now names the repository and whom to ask + * Windows: Improved git command start-up with a standard Git for Windows install by running its git.exe directly instead of through its cmd launcher + +Show 43 bug fixes + + * Fixed the organization policy not refreshing until the hourly check after approving an `ANTHROPIC_API_KEY` at startup or switching “Use custom API key” in `/config` + * Fixed sandboxed commands failing to start on Linux when a `sandbox.filesystem.denyRead` glob contains brackets that are not a character class, such as a `[user-id]` route folder + * Fixed `rm -r` of a mounted drive or a folder at its top level (`/Volumes`, `/media`, WSL’s `/mnt/c`) not getting the safety prompt that `rm -rf /Applications` gets + * Fixed `CLAUDE_CODE_TRANSCRIPT_LOCAL_GC` dropping messages from the saved transcript when the disk filled up while the file was being trimmed + * Fixed a plugin keeping a headless run going past `--max-turns`, Stop, or ended input by spawning subagents or re-running a finished one + * Fixed a failed mod reload removing the tools and commands of the version that stays loaded, and its messages being wrong or silent about whether the previous version is still loaded + * Fixed a click on a mod’s button being lost when buttons with the same label and no `key` were redrawn unchanged + * Fixed mod sharing in the built-in `plugin-authoring` skill stopping at the secret scan on machines with managed settings and on Team and Enterprise plans + * Fixed scheduled Cowork cloud sessions waiting five minutes again for each subagent whose WebFetch needed a URL approval that nobody was there to give + * Fixed Write results and rejected edits showing a file outside the working directory as `../../…`; they now show `~/…` or the full path + * Fixed a claude.ai Directory plugin’s skills not running as commands when picked from the ”/” menu in Cowork cloud sessions + * Fixed Remote Control permanently withholding a desktop conversation’s history when a different account was signed in to the terminal + * Fixed Remote Control failing to start from Claude Desktop when DISABLE_TELEMETRY or DO_NOT_TRACK is set on a paid plan + * Fixed model switches, messages and interrupts waiting behind a context usage check in SDK and desktop sessions + * Fixed `context_management: Extra inputs are not permitted` errors behind LLM gateways; Claude Code now resends the request without that field + * Fixed OpenTelemetry settings delivered through server-managed settings being ignored for the whole session after signing in during first-run setup or the first start after /logout + * Fixed unsandboxed Bash commands in Claude Desktop Code tab sessions on macOS and Linux not seeing environment variables exported in shell startup files such as ~/.zshrc + * Fixed the Consumer Terms notice being skipped for a day or longer after a server error + * Fixed `/privacy-settings` offering choices that may not apply to you after a network or server error + * Fixed a “Context limit reached” or “Prompt is too long” error after stopping a turn while Claude Code was compacting a conversation the API had rejected as too long + * Fixed subagents sometimes forgetting their most recent work when they were messaged or resumed right after finishing + * Fixed `claude --help` text for `--tools`, `--resume`, `--debug`, `--json-schema`, `--disable-slash-commands`, `--system-prompt-snapshot` and `claude update` to match actual behavior + * Fixed `claude --worktree` removing the worktree and its branch without asking at exit when HEAD was detached or on another branch, which could lose commits + * Fixed resumed and cloud sessions sending Claude the whole skill list again each time plugins reloaded at startup + * Fixed an interrupt not ending a Read that waits on an idle pipe or device named like an image + * Fixed `/effort status`, `/effort ultracode` and the prompt’s effort indicator showing a guessed effort level when `CLAUDE_CODE_EFFORT_LEVEL` is `auto` or `unset` and no level is sent + * Fixed a PreToolUse hook’s deny reason being replaced by a timeout error when an Agent SDK callback hook on the same tool call timed out + * Fixed Bash and PowerShell deleting a large command’s output file when it could not be copied to the session’s tool-results folder, unless the disk is full + * Fixed notes typed into a multiple-choice question with previews being cut off with ”…” in terminals under about 100 columns, hiding what was typed (anthropics/claude-code#82768) + * Fixed self-paced `/loop` wakeups scheduled at the 1-hour maximum firing just after the 1-hour prompt cache expired, so those wakeups no longer re-read the conversation uncached + * Fixed agent teams: approving a shutdown request from the main session no longer exits the whole CLI + * Fixed a skill’s `once` hook also removing another skill’s identical hook after it ran + * Fixed transcript mode’s `{` and `}` landing the prompt on an inconsistent row, or off screen, instead of the transcript’s first row + * Fixed `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200k` silently setting a 100K window: the variable now accepts `k` and `M` suffixes like `--autocompact`, and warns when a value is out of range or ignored + * Fixed Ctrl+C in the agents view clearing a text selection without copying it when pressed before the mouse button was released + * [VSCode] Fixed one cause of sessions failing to start with “Subprocess initialization did not complete within 60000ms”: time a SessionStart command hook spends running no longer counts toward the limit, up to 10 minutes in total + * [VSCode] Fixed a session closed while it was starting keeping its Claude Code process running until the start ended + * [VSCode] Fixed a mod’s drawings disappearing from a long-open panel until the next turn on machines that also run an older Claude Code + * [VSCode] Fixed Past conversations hiding sessions when `claudeCode.claudeProcessWrapper` is set + * [Cloud sessions] Fixed folders in the composer’s @ list showing no name in cloud sessions, where picking one added only a space instead of a mention + * [Claude Tag] Fixed Claude going silent in a thread when its channel becomes shared across Enterprise Grid workspaces mid-task; it now posts a one-time note to @-mention it in a new thread + * [Claude Tag] Fixed `@Claude !fork` typed outside a thread getting no visible reply; Claude now shows you a private note saying to run it from inside a thread + * [Code Review] Fixed pull requests opened within a minute or two of an admin turning on Code Review being silently skipped; they are now retried and reviewed ​
modified Push events into a running session with channels View current →
--- a/channels.md +++ b/channels.md @@ -351,4 +351,4 @@ * [Build your own channel](</docs/en/channels-reference>) for systems that don’t have plugins yet * [Remote Control](</docs/en/remote-control>) to drive a local session from your phone instead of forwarding events into it - * [Scheduled tasks](</docs/en/scheduled-tasks>) to poll on a timer instead of reacting to pushed events + * [Session-scoped scheduled tasks](</docs/en/scheduled-tasks>) to poll on a timer instead of reacting to pushed events
modified Use Claude Code with Chrome View current →
--- a/chrome.md +++ b/chrome.md @@ -91,7 +91,7 @@ Enable Chrome by default -To connect Chrome without passing `--chrome` each time, run `/chrome` in a CLI session and select **Enabled by default**. In the [VS Code extension](</docs/en/vs-code#automate-browser-tasks-with-chrome>), type `/chrome` in the prompt box and turn on the **Enabled by default** switch. The two share one setting, so turning it on in either place turns it on for both the CLI and VS Code. With the setting on and Claude Code v2.1.287 or later, each VS Code session connects to your browser as it starts, so Claude can use it before you type `@browser`. On earlier versions, or with the setting off, a VS Code session connects when you type `@browser`. Claude Code starts normally when Chrome isn’t running. Before v2.1.211, startup could hang when Chrome integration was enabled but Chrome wasn’t running. +To connect Chrome without passing `--chrome` each time, run `/chrome` in a CLI session and select **Enabled by default**. In the [VS Code extension](</docs/en/vs-code#automate-browser-tasks-with-chrome>), type `/chrome` in the prompt box and turn on the **Enabled by default** switch. The two share one setting, so turning it on in either place turns it on for both the CLI and VS Code. With the setting on and Claude Code v2.1.287 or later, each VS Code session connects to your browser as it starts, so Claude can use it before you type `@browser`. On earlier versions, or with the setting off, a VS Code session connects when you type `@browser`. Claude Code starts normally when Chrome isn’t running. Enabling Chrome by default increases context usage since the browser tools and their instructions are always loaded. If you notice increased context consumption, turn the setting off and connect only when needed, with `--chrome` in the CLI or by typing [`@browser`](</docs/en/vs-code#automate-browser-tasks-with-chrome>) in the VS Code prompt box. @@ -174,7 +174,7 @@ Upload files to web pages -Claude can attach files from your machine to upload fields on a page. Claude Code reads the file and sends its contents to the browser, so uploads work in both local and remote sessions. Requires Claude Code v2.1.211 or later. This example attaches a log file to a form: +Claude can attach files from your machine to upload fields on a page. Claude Code reads the file and sends its contents to the browser, so uploads work in both local and remote sessions. This example attaches a log file to a form: Open the bug tracker at bugs.example.com, create a new issue, and attach logs/session.log to it @@ -249,7 +249,7 @@ Take a screenshot of the checkout page and save it to disk -Claude saves the image to disk and reports the file path. Before v2.1.211, the screenshot tool’s `save_to_disk` option didn’t write a file. +Claude saves the image to disk and reports the file path. ##
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 @@ -1,4 +1,4 @@ -The Claude apps gateway is designed for organizations that must, or prefer to, route inference through their own cloud provider, for example to meet [data residency](</docs/en/claude-apps-gateway-deploy#compliance-posture>) requirements. If you don’t have this requirement, and want access to other features such as SCIM provisioning or Claude Code on web and mobile, Claude Enterprise may be a better fit. See the [feature availability](</docs/en/feature-availability>) page for a full comparison of all deployment methods. +The Claude apps gateway is designed for organizations that must, or prefer to, route inference through their own cloud provider, for example to meet [data residency](</docs/en/claude-apps-gateway-deploy#compliance-posture>) requirements. If you don’t have this requirement, and want access to other features such as SCIM provisioning or Claude Code on web and mobile, Claude Enterprise may be a better fit. See the [feature availability](</docs/en/feature-availability>) page for a full comparison of all deployment methods.Claude Code uses one sign-in at a time: a gateway sign-in takes the place of a Claude for Teams or Enterprise login. Gateway sessions don’t fetch the [server-managed settings](</docs/en/server-managed-settings>) you set in the claude.ai admin console, so deliver them from the gateway’s [`managed` block](</docs/en/claude-apps-gateway-config#managed>). Leave `forceLoginMethod` and `forceLoginOrgUUID` out of that block, or [some signed-in sessions exit at startup](</docs/en/claude-apps-gateway-config#client-side-managed-settings>). See Availability and limitations for what gateway sessions lose. Claude apps gateway is a self-hosted service that sits between your developers’ Claude Code clients and your model provider. Developers sign in with your corporate identity provider (IdP) instead of holding API keys or cloud credentials. The gateway holds the upstream credential, enforces model access and [managed settings](</docs/en/managed-settings>) by IdP group, and relays usage telemetry to your own observability stack. It is included in the `claude` binary, so the same executable that runs Claude Code on a laptop runs the gateway server with `claude gateway --config gateway.yaml`. This page covers: @@ -15,7 +15,7 @@ Why Claude apps gateway -The [gateway overview](</docs/en/gateways>) covers what a gateway does and why you’d run one. Claude apps gateway is Anthropic’s own gateway, built into the `claude` binary and tested alongside each Claude Code release, so it forwards the headers and request fields Claude Code sends without operators maintaining a separate allowlist. Once deployed it gives you: +The [gateway overview](</docs/en/gateways>) covers what a gateway does and why you’d run one. Claude apps gateway is Anthropic’s own gateway, built into the `claude` binary and tested alongside each Claude Code release, so it forwards the `anthropic-beta` values and request fields Claude Code sends without operators maintaining a separate allowlist. Once deployed it gives you: * **Credentials** : the upstream API key or cloud credential lives only in your infrastructure. Developers authenticate with corporate SSO and receive short-lived bearer tokens, so offboarding happens in your IdP. Deprovision a user and their gateway access expires within the session lifetime, one hour by default. * **Access control** : your IdP groups map to model allowlists and [managed settings](</docs/en/managed-settings>) policies. The gateway enforces model access server-side, rejecting requests for non-granted models, and selects each group’s managed settings policy, which the CLI applies at the [managed settings tier](</docs/en/settings#settings-precedence>). Different teams get different models, tools, and permissions, and a developer can’t override what their policy locks. @@ -34,6 +34,8 @@ Other gateway implementations If you already run an LLM gateway or API gateway that meets your needs, keep using it; [Other LLM gateways](</docs/en/llm-gateway>) covers configuring Claude Code against it. The [gateway compatibility guide](</docs/en/llm-gateway-protocol>) documents what Claude Code expects from any gateway: the endpoints it calls, the headers and body fields to forward, and what stops working when they’re stripped. A running Claude apps gateway also serves its own protocol reference at `GET /protocol`, which describes the endpoints it exposes to Claude Code clients: SSO sign-in, inference, managed settings delivery, model discovery, and telemetry. Fetch it with `curl https://claude-gateway.internal.example.com/protocol` from any deployed gateway, such as the one the quickstart below produces. Breaking changes to the protocol are announced in advance, but indefinite backwards compatibility isn’t guaranteed. + +A gateway sign-in token identifies the developer who approved the sign-in, not the program that uses it. Claude Code signs in without a client ID or secret of its own, so a gateway has no way to verify which program is signing in. Any client can set `User-Agent` and other request fields, so use them for routing or metrics, not as proof that a request comes from Claude Code. ## @@ -426,7 +428,7 @@ CI pipelines and remote machines -There is no service-token flow for unattended pipelines. Gateway sign-in always runs the browser device flow, so a CI job with no developer to approve the sign-in can’t authenticate; configure those against your provider directly. Once a developer has signed in, each Claude Code session on that machine uses the gateway session, including non-interactive `claude -p` runs and sessions started by the Agent SDK. Claude Code applies the [gateway policy](</docs/en/claude-apps-gateway-config#managed>) to each of them. The device flow separates the polling CLI from the approving browser, so a remote development box with no display still works: the developer runs `/login` over SSH on the remote machine and opens the verification link in the browser on their laptop. +There is no service-token flow for unattended pipelines. Gateway sign-in always runs the browser device flow, so a CI job with no developer to approve the sign-in can’t authenticate; configure those against your provider directly. Deploy `forceLoginMethod` and `forceLoginGatewayUrl` to developer machines and leave them off CI runners. On a machine whose managed settings set them, a session that authenticates with `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, or `apiKeyHelper` [exits at startup](</docs/en/errors#administrator-policy-requires-a-cloud-gateway-sign-in>). Once a developer has signed in, each Claude Code session on that machine uses the gateway session, including non-interactive `claude -p` runs and sessions started by the Agent SDK. Claude Code applies the [gateway policy](</docs/en/claude-apps-gateway-config#managed>) to each of them. The device flow separates the polling CLI from the approving browser, so a remote development box with no display still works: the developer runs `/login` over SSH on the remote machine and opens the verification link in the browser on their laptop. ###
modified Claude apps gateway configuration View current →
--- a/claude-apps-gateway-config.md +++ b/claude-apps-gateway-config.md @@ -304,7 +304,9 @@ `x-claude-gateway-user-id`| The developer’s IdP subject, from the token’s `sub` claim. `x-claude-gateway-user-email`| The developer’s email, when the IdP supplied one. -When the IdP token carries no email, the gateway sends only `x-claude-gateway-user-id` and omits the two email headers. If your IdP puts the email in a different claim, set `oidc.email_claim` to that claim. When your proxy answers `429` to a request that carried the developer’s email, the gateway returns that response to the developer as-is instead of failing over to the next upstream, so your proxy’s per-user budget or rate limit holds. The proxy’s other responses follow the ordinary failover rules. If a developer’s IdP token carries no email, the gateway forwards their requests without the email headers, so a `429` to one of those requests counts as upstream capacity and fails over. Before v2.1.267 on the gateway server, every `429` failed over. Set `forward_user_identity` only on an upstream whose `base_url` is a proxy you operate. The gateway sends developer emails to whatever server that `base_url` names. If the `base_url` is the Anthropic API, which is the default, the gateway refuses to start. +When the IdP token carries no email, the gateway sends only `x-claude-gateway-user-id` and omits the two email headers. If your IdP puts the email in a different claim, set `oidc.email_claim` to that claim. Your proxy doesn’t receive the [`x-claude-code-*` headers](</docs/en/llm-gateway-protocol#request-headers>) that Claude Code sends, such as `x-claude-code-session-id`. The gateway doesn’t pass them to any upstream, so group requests by developer with the headers in the table above. When your proxy answers `429` to a request that carried the developer’s email, the gateway returns that response to the developer as-is instead of failing over to the next upstream, so your proxy’s per-user budget or rate limit holds. The proxy’s other responses follow the ordinary failover rules. If a developer’s IdP token carries no email, the gateway forwards their requests without the email headers, so a `429` to one of those requests counts as upstream capacity and fails over. Before v2.1.267 on the gateway server, every `429` failed over. Set `forward_user_identity` only on an upstream whose `base_url` is a proxy you operate. The gateway sends developer emails to whatever server that `base_url` names. If the `base_url` is the Anthropic API, which is the default, the gateway refuses to start. + +If you set `forward_user_identity` on an Amazon Bedrock upstream, the gateway exits at startup with `Unrecognized key(s) in object: 'forward_user_identity'`. If your proxy sits in front of Bedrock, list it as a `provider: anthropic` upstream instead. The gateway sends that upstream the Anthropic Messages format, so your proxy has to [translate requests for Bedrock](</docs/en/llm-gateway-protocol#format-mismatch-with-the-upstream>). To name each developer to AWS instead, see Per-developer AWS cost attribution. #### @@ -975,7 +977,7 @@ * The model list, from `availableModels`. Extended context in Claude Desktop covers each model’s 1M context option * Disabled tools, from bare tool-name `permissions.deny` entries. If you set `disabledBuiltinTools` in the policy’s `desktop` block, the gateway serves the union of your value and the derived list, so you can disable more tools this way but can’t re-enable one you disabled through `permissions.deny` - * The egress allowlist, from `sandbox.network.allowedDomains`. If you set `coworkEgressAllowedHosts` in the policy’s `desktop` block, the gateway uses that value instead of the derived list + * The egress allowlist, from `sandbox.network.allowedDomains`. If you set `coworkEgressAllowedHosts` in the policy’s `desktop` block, the gateway uses that value instead of the derived list. If the allowlist the gateway serves includes `*` and the gateway doesn’t also serve Claude Desktop’s [`allowedWorkspaceFolders`](<https://claude.com/docs/third-party/claude-desktop/code#applied-as-managed-policy>), Claude Desktop doesn’t turn on the [Bash sandbox](</docs/en/sandboxing>) in the Code tab * An OTLP endpoint that points at the gateway itself, and the signed-in user’s identity attributes. The gateway relays the exports it receives at that endpoint to your `forward_to` destinations. It includes the endpoint and the attributes when you set both `telemetry.forward_to` and `listen.public_url`. Claude Desktop exports every signal with one encoding: `http/protobuf`, or `http/json` when you set `OTEL_EXPORTER_OTLP_PROTOCOL` or one of its per-signal variants to `http/json` in the policy’s `env`. Before Claude Code v2.1.261 on the gateway server, the response set `http/json` regardless, so a collector that accepts only protobuf rejected Claude Desktop’s exports To set `disabledBuiltinTools`, `coworkEgressAllowedHosts`, or Claude Desktop’s own `managedMcpServers` setting in a policy’s `desktop` block, you need Claude Code v2.1.232 or later on the gateway server. Claude Desktop’s `managedMcpServers` takes an array value rather than an object. The gateway omits keys with no Claude Desktop equivalent, such as `hooks` and scoped permission rules like `Bash(npm *)`, from the bootstrap response. @@ -1137,6 +1139,21 @@ * **Locally configured endpoints** : with OTLP/HTTP export enabled, the CLI ignores any locally configured endpoint, whether or not the gateway pushed the telemetry variables. Its exports go to the gateway unless a policy names your collector as the endpoint. Without a `forward_to` destination for a signal, the gateway accepts and discards it. If developers already export Claude Code telemetry to one of your collectors, add it as a `forward_to` destination, with logs or traces enabled if they export those, so it keeps receiving their data after they sign in. To skip the relay instead, name the collector in a policy. [Traces](</docs/en/monitoring-usage#traces-beta>) also require `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1` on each client. Set it in a managed policy’s `env` block, since the gateway doesn’t push it. Developers approve it in the same security approval dialog that the pushed endpoint already triggers. Set it to `1` only in the policies whose groups you want traced. A policy that doesn’t set it inherits the value from your `match: {}` catch-all policy if that policy sets one, per the merge rules. To keep a group’s clients from sending traces even when a developer sets the variable locally, set it to `0` in that group’s policy. Both protobuf and JSON OTLP encodings are relayed, and any OpenTelemetry-compatible backend works as a destination. + +#### + +​ + +Send cumulative metrics + +If your collector accepts only cumulative metrics, set [`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`](</docs/en/monitoring-usage#common-configuration-variables>) to `cumulative`. Claude Code sends delta metrics by default, and the gateway relays them without converting them. Set the variable where each kind of session reads it: + + * **Terminal sessions** : in the `env` block under a policy’s `cli` or `code` key + * **Cowork sessions that[run on the user’s machine](</docs/en/managed-settings#where-and-when-a-policy-applies>)**: in the `env` block of the client-side managed settings on that machine + * **Code tab sessions under a`code` policy**: in the policy’s `env` block, once you meet the conditions for `code` settings to apply + * **Code tab sessions under a`cli` policy**: in the `env` block of the client-side managed settings on the machine that runs the session. Over SSH, that’s the remote host. + +If you add the variable to a machine’s managed settings, also set [`parentSettingsBehavior: "merge"`](</docs/en/claude-apps-gateway#set-the-opt-in>) in the highest-priority source on that machine. Without it, Cowork sessions and Code tab sessions under a `cli` policy run without the egress allowlist and other policy that Claude Desktop passes them as parent settings. ####
modified Use Claude Code in the cloud View current →
--- a/claude-code-on-the-web.md +++ b/claude-code-on-the-web.md @@ -6,7 +6,7 @@ * **Mobile** : the **Code** tab in the [Claude app](</docs/en/mobile>) * **Desktop app** : select **Cloud** instead of **Local** when you [start a session](</docs/en/desktop#run-long-running-tasks-in-the-cloud>) * **Terminal** : `claude --cloud` - * **Routines** : [scheduled and triggered runs](</docs/en/routines>) each run as a cloud session + * **Cloud scheduled tasks** : [scheduled and triggered runs](</docs/en/routines>) each run as a cloud session Once you’re set up, use this page to move work between your terminal and the cloud, manage and share sessions, turn on auto-fix for pull requests, and troubleshoot. @@ -470,7 +470,9 @@ * **Time limits** : commands Claude runs and SessionStart hooks have default timeouts you can change, and a setup script is cached only when it finishes in roughly five minutes. See [Time limits](</docs/en/cloud-environments#time-limits>) * **Repository authentication** : you can only pull a cloud session into your terminal when you are authenticated to the same account * **Platform restrictions** : repository cloning and pull request creation require GitHub. Self-hosted [GitHub Enterprise Server](</docs/en/github-enterprise-server>) instances are supported for Team and Enterprise plans. You can send a GitLab, Bitbucket, or other non-GitHub repository to a cloud session as a local bundle by setting `CCR_FORCE_BUNDLE=1`, but the session can’t push results back to that remote - * **Organization IP allowlist** : cloud sessions call the Anthropic API from Anthropic-managed infrastructure, not your network, while sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) call it from your own network. If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled, every Anthropic-hosted cloud session fails with an authentication error. The same applies to [Code Review](</docs/en/code-review>) and to [routines](</docs/en/routines>) that run on Anthropic-hosted environments; a routine routed to a self-hosted environment calls the API from your own network. Contact [Anthropic support](<https://support.claude.com/>) to exempt Anthropic-hosted services from your organization’s IP allowlist. + * **Organization IP allowlist** : cloud sessions call the Anthropic API from Anthropic-managed infrastructure, not your network, while sessions in a [self-hosted environment](</docs/en/self-hosted-environments>) call it from your own network. If your organization has [IP allowlisting](<https://support.claude.com/en/articles/13200993-restrict-access-to-claude-with-ip-allowlisting>) enabled, every Anthropic-hosted cloud session fails with an authentication error. + * **Code Review and scheduled tasks** : the same applies to [Code Review](</docs/en/code-review>) and to [cloud scheduled tasks](</docs/en/routines>) that run on Anthropic-hosted environments. A scheduled task routed to a self-hosted environment calls the API from your own network. + * **Getting an exemption** : contact [Anthropic support](<https://support.claude.com/>) to exempt Anthropic-hosted services from your organization’s IP allowlist. ## @@ -481,7 +483,7 @@ * [Cloud environments](</docs/en/cloud-environments>): configure network access, environment variables, and setup scripts for cloud sessions * [Projects](</docs/en/claude-projects>): one conversation where Claude coordinates parallel cloud sessions on your repositories and reports back * [Ultrareview](</docs/en/ultrareview>): run a deep multi-agent code review in a cloud sandbox - * [Routines](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events + * [Cloud scheduled tasks](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events * [Hooks configuration](</docs/en/hooks>): run scripts at session lifecycle events * [All settings](</docs/en/settings-reference>): all configuration options * [Security](</docs/en/security>): isolation guarantees and data handling
modified Explore the .claude directory View current →
--- a/claude-directory.md +++ b/claude-directory.md @@ -263,7 +263,12 @@ claude purge ~/work/my-repo --yes -Pass `--all` instead of a path to purge state for every project at once, which deletes `history.jsonl` outright rather than filtering it. Pass `-i` to step through the deletion plan one item at a time. The command leaves `shell-snapshots/` and `backups/` alone because those are not project-scoped, and warns about them in the plan output. If anyone ran [`/heapdump`](</docs/en/troubleshooting#high-cpu-or-memory-usage>) on the machine, delete the `.heapsnapshot` files it wrote too. A heap snapshot contains the full conversation and any credentials the process held, and neither the retention sweep nor the purge touches it. You can also delete any of the application-data paths above by hand, apart from the state files to keep. New sessions are unaffected. The table below shows what you lose for past sessions. +Other options: + + * Pass `--all` instead of a path to purge state for every project at once, which deletes `history.jsonl` outright rather than filtering it. + * Pass `-i` to step through the deletion plan one item at a time. + +The command leaves `shell-snapshots/` and `backups/` alone because those are not project-scoped, and warns about them in the plan output. If anyone ran [`/heapdump`](</docs/en/troubleshooting#high-cpu-or-memory-usage>) on the machine, delete the `.heapsnapshot` files it wrote too. A heap snapshot contains the full conversation and any credentials the process held, and neither the retention sweep nor the purge touches it. You can also delete any of the application-data paths above yourself, apart from the state files to keep. Delete| You lose ---|--- @@ -279,7 +284,7 @@ `~/.claude/remote-settings.json`| Nothing. Re-fetched on next launch. `~/.claude/cache/changelog.md`| Nothing. Refreshed in the background. `~/.claude/policy-limits.json`| Nothing. Refreshed automatically. -`~/.claude/tasks/`| Task lists that a resumed session would pick up +`~/.claude/tasks/`| Your [task lists](</docs/en/interactive-mode#task-list>), including any still in use `~/.claude/skills/.trash/`, `~/.claude/plugins/.trash/`| The chance to recover [synced skills](</docs/en/skills#how-synced-skills-behave>) and [synced plugins](</docs/en/plugins/loading#synced-plugins>) that Claude Code removed `~/.claude/plugins/installed_plugins.set-aside.<date>.<hash>.json`, `~/.claude/plugins/installed_plugins.unreadable.<date>.<hash>.kept`| The copies of plugin install records that Claude Code dropped or couldn’t read. Nothing reads them back `~/.claude/debug/`, `~/.claude/plans/`, `~/.claude/session-env/`, `~/.claude/shell-snapshots/`, `~/.claude/backups/`| Nothing user-facing
modified Let Claude coordinate ongoing work with Projects View current →
--- a/claude-projects.md +++ b/claude-projects.md @@ -21,7 +21,7 @@ * **A build or migration bigger than a session** : “Build what `docs/spec.md` describes” or “Move the app off the deprecated ORM.” The work splits into threads that each take a part, decisions you ask Claude to remember early on reach the later cloud threads, and the spec changes and bugs you find during the build go into the same conversation. * **Work that isn’t code** : a folder of contracts or a support-ticket export you keep coming back to with new questions, such as “find the ten most common integration mistakes in these tickets.” Upload the documents instead of adding a repository, and threads deliver each write-up as a file on the project’s **Library** tab. -In any of them you can send a batch of tasks, tell Claude to start without asking you to confirm, walk away, and find the threads that need you under **Waiting on you** when you’re back, or ask Claude to put part of the work on a schedule as a [routine](</docs/en/routines>). If one of these is your situation, create a project. +In any of them you can send a batch of tasks, tell Claude to start without asking you to confirm, and walk away. When you’re back, you can find the threads that need you under **Waiting on you**. You can also ask Claude to put part of the work on a schedule as a [cloud scheduled task](</docs/en/routines>). If one of these is your situation, create a project. ### @@ -33,7 +33,7 @@ * **One task that fits in a session** : “Fix the flaky login test.” Start a [cloud session](</docs/en/claude-code-on-the-web>) yourself. * **Work where every task needs your machine** : a local database, a device emulator, or an API behind your VPN. Use a local session, or [agent view](</docs/en/agent-view>) to run several at once. If the work only needs local files, upload them to the project instead. - * **One task that repeats on a schedule with no conversation around it** : “Post a dependency report every Monday.” Create a [routine](</docs/en/routines>) on its own. + * **One task that repeats on a schedule with no conversation around it** : “Post a dependency report every Monday.” Create a [cloud scheduled task](</docs/en/routines>) on its own. * **Several people giving Claude work and steering it together in a Slack channel** : see [Claude Tag](<https://claude.com/docs/claude-tag/overview>). A project draws on the same plan limits as your other Claude Code sessions and uses them faster. Usage and cost covers what draws on your plan and how to keep it down. @@ -53,7 +53,7 @@ * The `CLAUDE.md` and skills in each of the project’s repositories, and in a project with one repository, that repository’s permission rules and hooks too * The connectors on your claude.ai account * A cloud environment that sets its network access, environment variables, network secrets, and installed tools - * **The Overview pane** : where you see all the threads at once and which of them need you. Its other tabs are **Library** for the files you added and the files threads produced, **Pull requests** for the ones threads opened, and **Routines** for scheduled work in the project. + * **The Overview pane** : where you see all the threads at once and which of them need you. Its other tabs are **Library** for the files you added and the files threads produced, **Pull requests** for the ones threads opened, and **Scheduled tasks** for scheduled work in the project. Cloud threads don’t pick up anything from the Claude Code setup on your own machine. Get skills, plugins, connectors, and tools into threads covers how to give them what they’d otherwise be missing. Here is how those parts connect, from you through the conversation to the threads doing the work, with **Overview** tracking their state: @@ -115,7 +115,7 @@ Click **Create project**. The project’s conversation opens with a message box at the bottom, where you describe work for Claude.On your first project, Claude takes a turn of its own as soon as the project is created, unless you send a message first. That turn uses your plan. In it, Claude may: * Start one thread that explores the repository without changing anything and proposes next steps, if the project has a repository it can read. - * Post **Setup recommendations** drawn from your recent cloud sessions: repositories to add, routines to create, and threads it could start. Every recommended repository and routine starts switched on. Switch off the ones you don’t want, then click **Update setup** to add the rest, or ignore the recommendations and describe work yourself. + * Post **Setup recommendations** drawn from your recent cloud sessions: repositories to add, scheduled tasks to create, and threads it could start. Every recommended repository and scheduled task starts switched on. Switch off the ones you don’t want, then click **Update setup** to add the rest, or ignore the recommendations and describe work yourself. The project is now listed under **Projects** in the sidebar, and its conversation is open. Your first batch covers what to set up before you send it work. @@ -232,7 +232,11 @@ **Idle**| Threads that finished and aren’t waiting on anything **Resolved**| Threads marked done: by you from the thread’s menu, by Claude once you’ve taken the last step, such as merging its pull request, or automatically after a week with no activity. You can reopen one from the same menu -The pane’s other tabs are **Library** for the files and folders you added and the files threads produced, **Pull requests** once threads have opened any, and **Routines** for the [routines](</docs/en/routines>) Claude set up from this project. +The pane’s other tabs are: + + * **Library** : the files and folders you added and the files threads produced + * **Pull requests** : shown once threads have opened any + * **Scheduled tasks** : the [cloud scheduled tasks](</docs/en/routines>) Claude set up from this project ### @@ -463,9 +467,9 @@ All three controls are at the bottom of **Project settings > General**: - * **Pause** : stops everything at once. Every running thread and the conversation are interrupted, no new threads start, routines don’t run, and the project doesn’t accept messages until you resume it. Click **Resume** in the same place or on the banner above the project’s message box; a paused thread continues when you send it a message after that. - * **Archive** : hides the project from the sidebar and archives its threads, which stops any thread that was running or watching a pull request. Routines in the project don’t run while it’s archived. To bring the project back, open it from the Projects page and click **Unarchive**. Its threads stay archived until you unarchive them individually from the session list. - * **Delete** : permanently removes the project along with its threads, its memory, and its files, and turns off the project’s routines. This can’t be undone. Branches and pull requests the threads pushed to GitHub aren’t affected. + * **Pause** : stops everything at once. Every running thread and the conversation are interrupted, no new threads start, scheduled tasks don’t run, and the project doesn’t accept messages until you resume it. Click **Resume** in the same place or on the banner above the project’s message box; a paused thread continues when you send it a message after that. + * **Archive** : hides the project from the sidebar and archives its threads, which stops any thread that was running or watching a pull request. Scheduled tasks in the project don’t run while it’s archived. To bring the project back, open it from the Projects page and click **Unarchive**. Its threads stay archived until you unarchive them individually from the session list. + * **Delete** : permanently removes the project along with its threads, its memory, and its files, and turns off the project’s scheduled tasks. This can’t be undone. Branches and pull requests the threads pushed to GitHub aren’t affected. ## @@ -511,7 +515,7 @@ * **Claude Tag** : [Claude Tag](<https://claude.com/docs/claude-tag/overview>) is Claude in your team’s Slack channels, on Team and Enterprise plans. Anyone in a channel can give it work, everyone in the channel sees and steers it, and it uses connections an admin set up for that channel. A project is yours alone: you’re the only one who sends it work or sees its threads, it uses your own GitHub access and connectors, and it’s on Pro and Max. [How Claude Tag differs from Cowork and Claude Code](<https://claude.com/docs/claude-tag/concepts/how-it-works#how-claude-tag-differs-from-cowork-and-claude-code>) has the side-by-side. * **Cloud sessions** : every thread is a [cloud session](</docs/en/claude-code-on-the-web>) unless you ask Claude to run it on your machine. Either way, Claude starts and tracks it instead of you. A cloud session you started yourself can become a project or feed one through **Continue as project** or **Move to project**. - * **Routines** : when you ask for scheduled work in a project, Claude creates a [routine](</docs/en/routines>) that runs as threads in that project and appears on its **Routines** tab. Routines you create outside a project keep working on their own. + * **Scheduled tasks** : when you ask for scheduled work in a project, Claude creates a [cloud scheduled task](</docs/en/routines>) that runs as threads in that project and appears on its **Scheduled tasks** tab. Scheduled tasks you create outside a project keep working on their own. * **Remote Control** : [Remote Control](</docs/en/remote-control>) connects claude.ai to a Claude Code session running on your machine. When you ask Claude in a project to run a thread on your computer, the project uses Remote Control to do it. * **Local sessions and agent view** : a session you start yourself in your terminal, IDE, or the desktop app’s local environment can’t be added to a project. [Agent view](</docs/en/agent-view>) is a screen for tracking several local sessions side by side, and you still start each one and give it its task yourself. * **Worktrees** : a [worktree](</docs/en/worktrees>) gives each local session its own working copy of a repository. Cloud threads don’t need them: each clones its repositories into its own cloud sandbox and works on its own branch. @@ -590,7 +594,7 @@ A thread hit the usage limit -When a thread or the project conversation reaches your plan’s five-hour or weekly limit, it keeps retrying on its own and continues when the limit resets. While it waits, the thread shows **Service is busy** with “Claude is still retrying and will continue automatically.” You don’t need to do anything for the work to continue. If you’d rather it not use your next usage window, click **Stop** in the thread, or pause the project to hold every thread. A thread that a routine started doesn’t wait: its turn stops with a limit error, and you send it a message after the limit resets. [Usage limit errors](</docs/en/errors#youve-hit-your-session-limit>) explain the limits and when they reset. +When a thread or the project conversation reaches your plan’s five-hour or weekly limit, it keeps retrying on its own and continues when the limit resets. A thread that a scheduled task started doesn’t wait: its turn stops with a limit error, and you send it a message after the limit resets. While a thread waits, it shows **Service is busy** with “Claude is still retrying and will continue automatically.” You don’t need to do anything for the work to continue. If you’d rather it not use your next usage window, click **Stop** in the thread, or pause the project to hold every thread. [Usage limit errors](</docs/en/errors#youve-hit-your-session-limit>) explain the limits and when they reset. ### @@ -636,6 +640,6 @@ * [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>): how the cloud sessions behind each cloud thread work, including GitHub access options and auto-fix on pull requests * [Configure cloud environments](</docs/en/cloud-environments>): change what cloud threads can reach on the network, give them environment variables and network secrets, and install tools with a setup script - * [Automate work with routines](</docs/en/routines>): schedules, triggers, and management for routines, including the ones Claude creates from a project + * [Automate work with scheduled tasks](</docs/en/routines>): schedules, triggers, and management for scheduled tasks, including the ones Claude creates from a project * [Manage multiple agents with agent view](</docs/en/agent-view>): run and track several sessions on your own machine when the work needs tools or services only your machine can reach * [Projects redesigned: from folder to conversation](<https://claude.com/blog/projects-redesigned>): the launch announcement, with the thinking behind making a project a conversation with Claude
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -111,9 +111,9 @@ `--no-session-persistence`| Disable session persistence so sessions are not saved to disk and cannot be resumed. Print mode only. The [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](</docs/en/env-vars>) environment variable does the same in any mode| `claude -p --no-session-persistence "query"` `--output-format`| Specify output format for print mode (options: `text`, `json`, `stream-json`)| `claude -p "query" --output-format json` `--permission-mode`| Begin in a specified [permission mode](</docs/en/permission-modes>). Accepts `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, `bypassPermissions`, or `manual` as an alias for `default`. The `manual` alias selects the permission mode the UI labels Manual and requires Claude Code v2.1.200 or later; `claude --help` lists it in place of `default`, and both values work. Overrides `defaultMode` from settings files. Without this flag or `--dangerously-skip-permissions`, a new session starts in the permission mode described in [which permission mode a session starts in](</docs/en/permission-modes#which-mode-a-session-starts-in>), which also covers what a `-p` run starts in| `claude --permission-mode plan` -`--permission-prompt-tool`| Specify an MCP tool to handle permission prompts in non-interactive mode. Claude Code waits for that tool’s MCP server to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default. +`--permission-prompt-tool`| Specify an MCP tool to handle permission prompts in non-interactive mode. Pass the full name, such as `mcp__<server>__<tool>`, of a tool on an MCP server that the run loads. Claude Code waits for that tool’s MCP server to connect before running the first turn, up to the [`MCP_TIMEOUT`](</docs/en/env-vars>) startup timeout, 30 seconds by default. -The prompt tool can’t approve an MCP tool marked as [requiring user interaction](</docs/en/mcp#require-approval-for-a-specific-tool>): Claude Code converts an `allow` result for one to a deny. This restriction requires Claude Code v2.1.199 or later| `claude -p --permission-prompt-tool mcp_auth_tool "query"` +The prompt tool can’t approve an MCP tool marked as [requiring user interaction](</docs/en/mcp#require-approval-for-a-specific-tool>): Claude Code converts an `allow` result for one to a deny. This restriction requires Claude Code v2.1.199 or later| `claude -p --mcp-config ./mcp.json --permission-prompt-tool mcp__permissions__approve "query"` `--permission-prompts`| Set who answers permission prompts in print mode. With the default `host`, Claude Code sends them to the Agent SDK host or the `--permission-prompt-tool` tool. Pass `none` when nobody can answer, and Claude Code denies them instead. See [Turn off permission prompts in unattended runs](</docs/en/headless#turn-off-permission-prompts-in-unattended-runs>). Requires Claude Code v2.1.259 or later| `claude -p --permission-prompts none "query"` `--plugin-dir`| Load a plugin from a directory or `.zip` archive, or several from a [folder of plugins](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>), for this session only. Each flag takes one path. Repeat the flag for more paths: `--plugin-dir A --plugin-dir B.zip`. Passing a folder of plugins requires Claude Code v2.1.265 or later| `claude --plugin-dir ./my-plugin` `--plugin-url`| Fetch a plugin `.zip` archive from a URL for this session only. Repeat the flag for multiple plugins, or pass space-separated URLs in a single quoted value| `claude --plugin-url https://example.com/plugin.zip`
modified Configure cloud environments View current →
--- a/cloud-environments.md +++ b/cloud-environments.md @@ -1,6 +1,15 @@ Cloud environments apply to [cloud sessions](</docs/en/claude-code-on-the-web>), which are available on Pro, Max, and Team plans, and for Enterprise users with [premium seats or Chat + Claude Code seats](<https://support.claude.com/en/articles/11845131-use-claude-code-with-your-team-or-enterprise-plan>). -Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, store network secrets that sessions use without seeing them, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: the [Desktop app](</docs/en/desktop>), the [Claude mobile app](</docs/en/mobile>), your browser at [claude.ai/code](<https://claude.ai/code>), the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>), [routines](</docs/en/routines>), and [Claude Tag](<https://claude.com/docs/claude-tag/overview>). Each of these surfaces can also route to a [self-hosted environment](</docs/en/self-hosted-environments>). [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers what Claude can’t use yet when a Claude Tag session runs in one. +Each [cloud session](</docs/en/claude-code-on-the-web>) runs in a cloud environment. You can configure an environment to allow or deny network access, set environment variables for the session, store network secrets that sessions use without seeing them, and run a setup script before Claude starts working. The same environments apply wherever you start a cloud session: + + * The [Desktop app](</docs/en/desktop>) + * The [Claude mobile app](</docs/en/mobile>) + * Your browser at [claude.ai/code](<https://claude.ai/code>) + * The terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>) + * [Cloud scheduled tasks](</docs/en/routines>) + * [Claude Tag](<https://claude.com/docs/claude-tag/overview>) + +Each of these surfaces can also route to a [self-hosted environment](</docs/en/self-hosted-environments>). [Availability and limitations](</docs/en/self-hosted-environments#availability-and-limitations>) covers what Claude can’t use yet when a Claude Tag session runs in one. [Remote Control](</docs/en/remote-control>) sessions connect the web and mobile interfaces to a session on your own machine, which uses your machine’s network and files, not a cloud environment. Claude Tag channel sessions use organization-level environments only, either shared environments or [self-hosted environments](</docs/en/self-hosted-environments>). @@ -180,7 +189,9 @@ * 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. * Network secrets on the environment stay attached in its running sessions. Delete any you no longer want before you archive. - * No new session can start in an archived environment, on any surface. If the environment was your saved CLI default, Claude Code starts CLI cloud sessions in the Anthropic-hosted environment when your list has one, and otherwise in the first environment in your list that isn’t a Remote Control bridge environment. Anything configured with the environment explicitly, such as a [routine](</docs/en/routines#environments-and-network-access>), can’t start new sessions in it. Point it at another environment. + * 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. ### @@ -191,7 +202,7 @@ On Team and Enterprise plans, an Owner can create cloud environments that are shared with every member of the organization. The same role manages everything else on the **Cloud environments** admin page, including [self-hosted environments](</docs/en/self-hosted-environments>); the Admin role can’t open the page. The full list of roles that can open it is the one for [managing server-managed settings](</docs/en/server-managed-settings#access-control>). Shared environments appear in each member’s environment selector under an **Organization** heading, after the member’s own environments under **Personal** , so a team can standardize on one configuration instead of each member recreating it. Selecting a shared environment’s settings icon there opens a read-only summary of its configuration for every member, Owners included. An Owner makes an environment available to the organization in one of two ways: * **Create a shared environment** : use the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>), which is also where Owners edit and archive shared environments. Each one has a name, a network access level, environment variables in `.env` format, and a setup script. - * **Share a personal environment** : open one of your own environments for editing in the environment selector, then share it from the **Who can use it** row. The environment keeps its ID, so sessions and routines that already use it aren’t affected, and every member can then see it and start sessions in it. + * **Share a personal environment** : open one of your own environments for editing in the environment selector, then share it from the **Who can use it** row. The environment keeps its ID, so sessions and scheduled tasks that already use it aren’t affected, and every member can then see it and start sessions in it. Owners choose the organization’s default environment separately, at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). To give a shared environment’s sessions a key they can’t read, add a network secret when you edit the environment on the **Cloud environments** page. Don’t include secrets in its variables, because every member’s sessions read them. @@ -212,9 +223,9 @@ Network access -Each environment sets one network access level, which controls the outbound connections its sessions can make. The default level, **Trusted** , allows package registries and other allowlisted domains; **Custom** takes your own domain list. To change an environment’s network access, open it for editing and use the **Network access** selector in the dialog. A shared environment opens read-only there, so an Owner changes its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead. The control that opens the selector appears on the app surfaces listed under The Default environment and in the [routine editor](</docs/en/routines#environments-and-network-access>); personal environments don’t have a separate page in your claude.ai account settings. When you change an Anthropic-hosted environment’s network access, its existing sessions follow the new setting within about a minute, for requests that go through the session’s network allowlist. You don’t need to start a new session. - -MCP connectors you enable on a session or routine work without adding their hosts to **Allowed domains** , because connector traffic travels through Anthropic’s servers rather than the session’s network. This relies on the same Anthropic-bound channel noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>). Turn off any connector you don’t need to limit which tools Claude can reach. +Each environment sets one network access level, which controls the outbound connections its sessions can make. The default level, **Trusted** , allows package registries and other allowlisted domains; **Custom** takes your own domain list. To change an environment’s network access, open it for editing and use the **Network access** selector in the dialog. A shared environment opens read-only there, so an Owner changes its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead. The control that opens the selector appears on the app surfaces listed under The Default environment and in the [cloud scheduled task editor](</docs/en/routines#environments-and-network-access>). Personal environments don’t have a separate page in your claude.ai account settings. When you change an Anthropic-hosted environment’s network access, its existing sessions follow the new setting within about a minute, for requests that go through the session’s network allowlist. You don’t need to start a new session. + +MCP connectors you enable on a session or scheduled task work without adding their hosts to **Allowed domains** , because connector traffic travels through Anthropic’s servers rather than the session’s network. This relies on the same Anthropic-bound channel noted under [Security and isolation](</docs/en/claude-code-on-the-web#security-and-isolation>). Turn off any connector you don’t need to limit which tools Claude can reach. ### @@ -840,7 +851,7 @@ * [Cloud sessions reference](</docs/en/claude-code-on-the-web>): start, manage, and share cloud sessions * [Cloud sessions quickstart](</docs/en/web-quickstart>): connect GitHub and start your first cloud session * [Claude Tag](<https://claude.com/docs/claude-tag/overview>): sessions Claude starts from Slack run in the same environments - * [Routines](</docs/en/routines>): scheduled runs use the same environments and network access levels + * [Cloud scheduled tasks](</docs/en/routines>): scheduled runs use the same environments and network access levels * [Remote Control](</docs/en/remote-control>): run sessions on your own machine’s network and files instead * [Self-hosted environments](</docs/en/self-hosted-environments>): run cloud sessions on your organization’s own infrastructure * [SessionStart hooks](</docs/en/hooks#sessionstart>): repo-committed setup that runs in local and cloud sessions
modified Review locally with /code-review View current →
--- a/code-review-local.md +++ b/code-review-local.md @@ -135,9 +135,9 @@ Claude can start `/code-review` on its own, without you typing the command: * **When you ask in plain language** : ask Claude to review your changes and it can run the skill - * **From a scheduled task** : a [scheduled task](</docs/en/scheduled-tasks>) with `/code-review` as its prompt runs the review + * **From a scheduled task** : a [session-scoped scheduled task](</docs/en/scheduled-tasks>) with `/code-review` as its prompt runs the review -A scheduled task never launches the cloud review, so schedule `/code-review` without the `ultra` argument. To stop both Claude and scheduled tasks from starting the review while keeping `/code-review` available for you to type, add a [`skillOverrides`](</docs/en/skills#override-skill-visibility-from-settings>) entry to a [settings file](</docs/en/settings#where-settings-live>) such as `~/.claude/settings.json`: +A session-scoped scheduled task never launches the cloud review, so schedule `/code-review` without the `ultra` argument. To stop both Claude and scheduled tasks from starting the review while keeping `/code-review` available for you to type, add a [`skillOverrides`](</docs/en/skills#override-skill-visibility-from-settings>) entry to a [settings file](</docs/en/settings#where-settings-live>) such as `~/.claude/settings.json`: { "skillOverrides": {
modified Set up Code Review View current →
--- a/code-review-setup.md +++ b/code-review-setup.md @@ -117,7 +117,7 @@ * **The repository is set to Manual** : how to request a review with a comment * **The pull request comes from a fork** : that a maintainer can request the review - * **A bot, or someone without write access, comments`@claude review`**: that no review was started, and who can request one + * **A bot, or someone without write access who isn’t the pull request’s author, comments`@claude review`**: that no review was started, and who can request one * **The GitHub organization isn’t linked to your Claude organization** : that reviews are paused, and how to link it Turn the setting off to stop these comments.
modified Troubleshoot Code Review View current →
--- a/code-review-troubleshooting.md +++ b/code-review-troubleshooting.md @@ -36,7 +36,7 @@ * **Code Review isn’t on for this repository** : Claude posts no comment and no check run in response to the command. Ask an Owner to [add the repository](</docs/en/code-review-setup#add-more-repositories>). * **The comment doesn’t meet a condition** : it was an inline comment or a review body rather than a new top-level comment, or the command wasn’t at the start of the comment. Editing an earlier comment instead of posting a new one doesn’t count either, and the pull request has to be open. See the [conditions for comment commands](</docs/en/code-review-pull-requests#comment-commands>) and post a new comment that meets them. - * **You don’t have write access** : you need write, maintain, or admin permission on the repository, and on a pull request from a fork the permission that counts is on the base repository. If your organization has tips turned on, Claude replies “No review was started: manual reviews can only be requested by someone with write access to this repository.” Ask someone with write access to comment instead. + * **You don’t have write access** : you need write, maintain, or admin permission on the repository. On a pull request from a fork, the permission that counts is on the base repository. Unless the pull request is yours, Claude can reply with a [tip](</docs/en/code-review-setup#turn-tip-comments-on-or-off>): “No review was started: manual reviews can only be requested by someone with write access to this repository.” Ask someone with write access to comment instead. * **The budget ran out** : Claude posts a comment that begins with “⚠️ Code review skipped”. See Review didn’t run and the PR shows a budget message. ###
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -39,7 +39,7 @@ `/background [prompt]`| Detach the current session to run as a [background agent](</docs/en/agent-view>) and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with `claude agents`. To copy the conversation into a new background session while this one keeps running, use `/fork`. Alias: `/bg` `/batch <instruction>`| **[Skill](</docs/en/skills#bundled-skills>).** Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one [background subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) per unit in an isolated [worktree](</docs/en/worktrees>). Each subagent implements its unit, runs tests, and publishes its change. Requires a git repository or a [`WorktreeCreate` hook](</docs/en/worktrees#non-git-version-control>) that creates the worktrees. Outside a git repository, `/batch` requires Claude Code v2.1.281 or later. Example: `/batch migrate src/ from JavaScript to TypeScript` `/branch [name]`| Create a branch of the current conversation at this point, so you can try a different direction without losing the conversation as it stands. Switches you into the branch and preserves the original, which you can return to with `/resume`. To run a copy as a separate [background session](</docs/en/agent-view>) instead of switching into it, use `/fork`; to hand a side task to a [subagent](</docs/en/sub-agents>) that reports back into this conversation, use `/subtask` -`/btw [question]`| Ask a [side question](</docs/en/interactive-mode#side-questions-with-%2Fbtw>) about the current session without adding to the conversation. If you run `/btw` without a question, Claude Code shows your most recent side question so you can browse earlier answers; if you haven’t asked one yet, Claude Code prints a usage line. Before v2.1.212, `/btw` required a question +`/btw [question]`| Ask a [side question](</docs/en/interactive-mode#side-questions-with-%2Fbtw>) about the current session without adding to the conversation. If you run `/btw` without a question, Claude Code shows your most recent side question so you can browse earlier answers; if you haven’t asked one yet, Claude Code prints a usage line `/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 @@ -69,13 +69,13 @@ `/feedback [report]`| Send product feedback about Claude Code. Opens the same dialog as `/bug`, with the same consent step, sending rules, and mid-turn behavior. In sessions with [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), `/feedback` with no argument opens the drafts queue instead, where you review, edit, send, or discard the drafts Claude queued; the queue includes an option to write a new report in the dialog. With an argument, and for `/bug` always, the dialog opens directly `/fewer-permission-prompts`| **[Skill](</docs/en/skills#bundled-skills>).** Scan your transcripts for common read-only Bash and MCP tool calls, then add a prioritized allowlist to project `.claude/settings.json` to reduce permission prompts `/focus`| Toggle the focus view, which shows only your last prompt, a one-line tool-call summary with edit diffstats, and the final response. The tool-call summary also counts the subagents launched in the turn and collapses completed background-task notifications into a single count. The selection persists across sessions; set [`viewMode`](</docs/en/settings-reference#viewmode>) in settings to override it. Only available in [fullscreen rendering](</docs/en/fullscreen>). From a [Remote Control](</docs/en/remote-control>) client, run `/focus [on|off]` to turn the focus view on or off for the current session only, without changing your saved selection; this requires Claude Code v2.1.281 or later. The [VS Code extension](</docs/en/vs-code#use-the-prompt-box>) offers its own Focus view as a command-menu toggle, stored as an extension setting, independent of `viewMode` -`/fork [prompt]`| [Copy the current conversation](</docs/en/agent-view#copy-the-session-with-%2Ffork>) into a new background session and keep working here. Pass a prompt and the copy starts working on it immediately; without one it waits in agent view for its first prompt. Except when the copy [edits in place](</docs/en/agent-view#how-file-edits-are-isolated>), Claude Code instructs it to create a worktree of its own before making code changes; the isolation instruction requires Claude Code v2.1.221 or later. To hand a side task to a subagent whose result comes back into this conversation, use `/subtask`; to switch into a copy yourself, use `/branch`. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211, and whenever [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead +`/fork [prompt]`| [Copy the current conversation](</docs/en/agent-view#copy-the-session-with-%2Ffork>) into a new background session and keep working here. Pass a prompt and the copy starts working on it immediately; without one it waits in agent view for its first prompt. Except when the copy [edits in place](</docs/en/agent-view#how-file-edits-are-isolated>), Claude Code instructs it to create a worktree of its own before making code changes; the isolation instruction requires Claude Code v2.1.221 or later. To hand a side task to a subagent whose result comes back into this conversation, use `/subtask`; to switch into a copy yourself, use `/branch`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/fork` starts a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>) instead `/goal [condition|clear]`| Set a [goal](</docs/en/goal>): Claude keeps working across turns until the condition is met or the goal [clears for another reason](</docs/en/goal#how-evaluation-works>). With no argument, shows the current or most recently achieved goal. `clear`, `stop`, `off`, `reset`, `none`, or `cancel` removes an active goal early `/heapdump`| Write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`, or your home directory on Linux without a Desktop folder, for diagnosing high memory usage. Attach only the `-diagnostics.json` file when reporting a memory issue; the `.heapsnapshot` contains your full conversation and credentials, so don’t share it. Hidden from the command menu; type it in full. See [what to do with the output](</docs/en/troubleshooting#high-cpu-or-memory-usage>) `/help`| Show help and available commands `/hooks`| View [hook](</docs/en/hooks#the-%2Fhooks-menu>) configurations `/ide`| Manage IDE integrations and show status -`/import [codex|gemini|cursor] [--dry-run] [--yes]`| Bring configuration from OpenAI Codex, Google Gemini CLI, or Cursor on your machine into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS, or through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>). Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Requires Claude Code v2.1.213 or later. Importing from Cursor requires v2.1.265 or later +`/import [codex|gemini|cursor] [--dry-run] [--yes]`| Bring configuration from OpenAI Codex, Google Gemini CLI, or Cursor on your machine into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In [non-interactive mode](</docs/en/headless>) with `-p`, `/import` lists what it found and gives you the command that confirms the import. Add `--dry-run` to preview without writing anything, or `--yes` to skip the interactive picker. Not available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or Claude Platform on AWS, or through a [Claude apps gateway](</docs/en/claude-apps-gateway#availability-and-limitations>). Also unavailable when you turn off [feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). Importing from Cursor requires v2.1.265 or later `/init`| Initialize project with a `CLAUDE.md` guide. Set `CLAUDE_CODE_NEW_INIT=1` for an interactive flow that also walks through skills, hooks, and personal memory files. If `/init` finds OpenAI Codex or Google Gemini CLI configuration, it offers to carry it over with `/import` `/insights`| Generate an HTML report analyzing your recent sessions on this machine: which projects you work in, how you use Claude Code, where things go wrong, and features to try. Not available in [cloud sessions](</docs/en/claude-code-on-the-web>). See [Analyze your usage patterns](</docs/en/costs#analyze-your-usage-patterns>) for the report location, retention, and cost `/install-github-app`| Install the Claude GitHub App for a repository, with an optional step to set up [GitHub Actions](</docs/en/github-actions>) workflows and secrets. Walks you through selecting a repo and configuring the integration. Works only with github.com repositories. When your repository’s git remote is on gitlab.com or bitbucket.org, the command prints a notice and exits instead of starting setup. To run Claude Code from GitLab pipelines, see [GitLab CI/CD](</docs/en/gitlab-ci-cd>) @@ -113,7 +113,7 @@ `/run`| **[Skill](</docs/en/skills#bundled-skills>).** Launch and drive your project’s app to see a change working, not only passing tests. See [Run and verify your app](</docs/en/skills#run-and-verify-your-app>) `/run-skill-generator`| **[Skill](</docs/en/skills#bundled-skills>).** Teach `/run` and `/verify` how to build, launch, and drive your project’s app from a clean environment by writing a per-project [skill](</docs/en/skills#run-and-verify-your-app>) `/sandbox`| Toggle [sandbox mode](</docs/en/sandboxing>). Available on supported platforms only -`/schedule [description]`| Create, update, list, or run [routines](</docs/en/routines>), which execute in the cloud. Claude walks you through the setup conversationally. You can also ask about a [routine’s recent runs](</docs/en/routines#manage-routines-from-the-cli>). Alias: `/routines` +`/schedule [description]`| Create, update, list, or run [cloud scheduled tasks](</docs/en/routines>), formerly routines. Claude walks you through the setup conversationally. You can also ask about a [scheduled task’s recent runs](</docs/en/routines#manage-scheduled-tasks-from-the-cli>). Alias: `/routines` `/scroll-speed`| Adjust mouse wheel [scroll speed](</docs/en/fullscreen#mouse-wheel-scrolling>) interactively. Available in [fullscreen rendering](</docs/en/fullscreen>) only and not in the JetBrains IDE terminal `/security-review`| Analyze the changes on your current branch for security vulnerabilities. Reviews the diff between your branch and origin’s default branch, identifying risks like injection, auth issues, and data exposure. Needs an `origin` remote; if the review fails with an `ambiguous argument` error, see the [error reference](</docs/en/errors#security-review-fails-without-origin-head>) `/setup-bedrock`| Configure [Amazon Bedrock](</docs/en/amazon-bedrock>) authentication, region, and model pins through an interactive wizard. Hidden from the command menu until `CLAUDE_CODE_USE_BEDROCK=1` is set; type it in full. First-time Amazon Bedrock users can also access this wizard from the login screen @@ -127,9 +127,9 @@ `/statusline`| Configure Claude Code’s [status line](</docs/en/statusline>). Describe what you want, or run without arguments to auto-configure from your shell prompt `/stickers`| Order Claude Code stickers `/stop`| Stop the [background session](</docs/en/agent-view>) you’re attached to, or the one you send it to as a [peek reply](</docs/en/agent-view#peek-and-reply>); the transcript and any worktree are kept. To detach without stopping, use `/exit` or press `←` -`/subtask <task>`| Spawn a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>): a background subagent that inherits the full conversation and works on the task while you keep working. Its result returns to this conversation when it finishes. To copy the conversation into a separate background session instead, use `/fork`. Requires Claude Code v2.1.212 or later; on v2.1.161 through v2.1.211 this command is `/fork`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` keeps the forked-subagent behavior +`/subtask <task>`| Spawn a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>): a background subagent that inherits the full conversation and works on the task while you keep working. Its result returns to this conversation when it finishes. To copy the conversation into a separate background session instead, use `/fork`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` spawns the forked subagent instead `/tasks`| View and manage background work in the current session, including subagents that have finished. Also available as `/bashes` -`/team-onboarding`| Generate a team onboarding guide from your Claude Code usage history. Claude analyzes your sessions, commands, and MCP server usage from the past 30 days and produces a markdown guide a teammate can paste as a first message to get set up quickly. For claude.ai subscribers on Pro, Max, Team, and Enterprise plans, also returns a share link teammates can open directly in Claude Code +`/team-onboarding`| Generate a team onboarding guide from your Claude Code usage history. Claude analyzes your sessions, commands, and MCP server usage from the past 30 days. It produces a markdown guide a teammate can paste as a first message to get set up quickly. For claude.ai subscribers on Team and Enterprise plans, also returns a share link teammates can open directly in Claude Code `/teleport`| Pull a [cloud session](</docs/en/claude-code-on-the-web#from-cloud-to-terminal>) into this terminal. Opens a picker, then fetches the branch and conversation. Also available as `/tp`. Requires a claude.ai subscription `/terminal-setup`| [Install a Shift+Enter keybinding for newlines](</docs/en/terminal-config#enter-multiline-prompts>) in VS Code, Cursor, Devin Desktop, Alacritty, or Zed. In Apple Terminal, [enable Option+Enter for newlines and turn off the audible bell](</docs/en/terminal-config#enable-option-key-shortcuts-on-macos>) instead. In iTerm2, [turn on clipboard access so that `/copy` works](</docs/en/terminal-config#enable-option-key-shortcuts-on-macos>) `/theme`| Change the color theme. Includes an `auto` option that matches your terminal’s light or dark background, light and dark variants, colorblind-accessible (daltonized) themes, ANSI themes that use your terminal’s color palette, and any [custom themes](</docs/en/terminal-config#create-a-custom-theme>) from `~/.claude/themes/` or plugins. Select **New custom theme…** to create one
modified Common workflows View current →
--- a/common-workflows.md +++ b/common-workflows.md @@ -397,7 +397,7 @@ Option| Where it runs| Best for ---|---|--- -[Routines](</docs/en/routines>)| Cloud, Anthropic-managed by default| Tasks that should run even when your computer is off. Can also trigger on API calls or GitHub events in addition to a schedule. Configure at [claude.ai/code/routines](<https://claude.ai/code/routines>). +[Cloud scheduled tasks](</docs/en/routines>)| Cloud, Anthropic-managed by default| Tasks that should run even when your computer is off. Can also trigger on API calls or GitHub events in addition to a schedule. Configure at [claude.ai/code/routines](<https://claude.ai/code/routines>). [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>)| Your machine, via the desktop app| Tasks that need direct access to local files, tools, or uncommitted changes. [GitHub Actions](</docs/en/github-actions>)| Your CI pipeline| Tasks tied to repo events like opened PRs, or cron schedules that should live alongside your workflow config. [`/loop`](</docs/en/scheduled-tasks>)| The current CLI session| Quick polling while a session is open. `--resume` and `--continue` restore unexpired fixed-interval loops.
modified Explore the context window View current →
--- a/context-window.md +++ b/context-window.md @@ -26,6 +26,7 @@ System prompt and output style| Both still apply Project-root CLAUDE.md and unscoped rules| Re-injected from disk Auto memory| Re-injected from disk +Skill descriptions| Rebuilt from your current [skills](</docs/en/skills>) and re-injected. Requires Claude Code v2.1.304 or later [Git status snapshot](</docs/en/settings-reference#includegitinstructions>)| If the session started with one, Claude Code reads a fresh one from your repository The plan Claude wrote in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>)| Re-injected from disk Rules with `paths:` frontmatter| Claude Code reloads them [on demand](</docs/en/memory#path-specific-rules>)
modified Run Claude Code behind a corporate launcher View current →
--- a/corporate-launcher.md +++ b/corporate-launcher.md @@ -102,15 +102,17 @@ When the launcher can’t run, Claude Code refuses to start the process instead of starting it unwrapped. On Windows, the variable is ignored and processes start unwrapped. Claude Code holds the script to these rules: * **End with`exec "$@"`.** A launcher that forks a child and exits leaves an orphaned Claude Code process the background service can’t track. Agent view marks such a session failed with a message naming the launcher, and the service reaps what the launcher left behind. - * **Don’t reorder, absorb, or prepend arguments.** The first argument is the Claude Code binary and everything after it is its argv. + * **Don’t reorder, absorb, or add to Claude Code’s arguments.** Remove the launcher’s own arguments, which come first, and pass the rest to `exec` as it arrived. * **Pass every inherited environment variable through to`exec`.** Adding variables, such as injected credentials, is fine; dropping inherited ones is not. * The per-session authentication tokens, the model and provider selection, and `CLAUDE_CODE_PROCESS_WRAPPER` itself all travel on the inherited environment, so a launcher that rebuilds it from an allow list breaks the sessions it starts, and `/status` reports a launcher mismatch. * If the launcher must enter a namespace or sandbox that resets the environment, re-export the inherited environment inside it verbatim. - * **Reach`exec` within about three seconds each time the launcher runs.** A cold background dispatch runs the launcher twice in series before the first byte of output, so do slow work such as a single sign-on exchange lazily or from a cache. + * **Reach`exec` within about three seconds each time the launcher runs.** A background session can run the launcher three times in series before its first output. Do slow work such as a single sign-on exchange lazily or from a cache, and give any step that waits on the network its own time limit. * **Tolerate being invoked from inside itself.** Claude Code applies the launcher to every nested self-spawn, so a launcher that acquires an exclusive resource must detect that it already holds it. - * **Don’t write to the terminal before Claude Code starts.** Anything printed before the `exec` is reported as the crash cause if the session dies before initializing. + * **Don’t write to the terminal or standard output before Claude Code starts.** Anything printed before the `exec` is reported as the crash cause if the session dies before initializing. Text on standard output also reaches a program that reads Claude Code’s output, such as a script that parses `claude -p` results. * **Don’t depend on how arguments are spelled.** A flag’s value can arrive as its own argument, `--flag value`, or joined to the flag, `--flag=value`. Which form a flag uses can change between versions. * **Run`exec` from the directory the launcher started in.** Claude Code works in the directory it starts in, so a launcher that changes directory can start a session in the wrong project. If the launcher must enter a namespace or sandbox that resets the working directory, change back to the starting directory inside it, before the `exec`. + * **Don’t read standard input.** A command that reads it before the `exec`, such as one that asks for a password, can wait for input that doesn’t come and leave the session stuck. It can also take input meant for Claude Code, and the session can then run without that input and report no error. Redirect such a command’s input from `/dev/null`. + * **Call other programs by absolute path.** The launcher can start with a `PATH` that lacks the directories your shell profile adds. ### @@ -120,11 +122,29 @@ `CLAUDE_CODE_PROCESS_WRAPPER` and the `processWrapper` setting take the same format. For most launchers, the value is the script’s absolute path, like `/opt/corp/launcher`. To pass your launcher arguments of its own, write them after the path. Claude Code parses the value as an argument list, not a shell command: - * Whitespace separates tokens, and double quotes group a token that contains spaces. + * Whitespace separates tokens, and double quotes group a token that contains spaces. A single quote is an ordinary character, so `'a b'` is two tokens. * A value that starts with `[` is read as a JSON string array, such as `["/opt/corp/launcher", "--profile", "cc"]`. * Shell syntax doesn’t work: there is no variable expansion or globbing, and an unquoted operator such as `;`, `|`, `&`, or `$(` is rejected as a configuration error rather than reinterpreted. -When the value can’t be used, Claude Code refuses to start the affected process and [reports the reason](</docs/en/errors#claude_code_process_wrapper-launcher-errors>). +When the value can’t be used, Claude Code refuses to start the affected process and [reports the reason](</docs/en/errors#claude_code_process_wrapper-launcher-errors>). In a settings file, write the array form inside a JSON string and escape its quotes: `"[\"/opt/corp/launcher\", \"--profile\", \"cc\"]"`. + +### + +​ + +Pass arguments to the launcher + +Write the launcher’s own arguments after its path in the value, and remove them in the script before the `exec` call. They reach the script first, ahead of the Claude Code command. The following script, written for the value `/opt/corp/launcher --profile cc`, saves the profile name and then removes both arguments with `shift`: + + #!/bin/sh + if [ "$1" = "--profile" ]; then + profile="$2" + shift 2 + fi + # Your organization's setup for "$profile". + exec "$@" + +Use the Verify step to see the launch command Claude Code resolved from the value. ##
modified Manage costs effectively View current →
--- a/costs.md +++ b/costs.md @@ -53,7 +53,9 @@ * **Attribution** : recent usage attributed to skills, subagents, plugins, and individual MCP servers, each shown as a percentage of the total. An MCP server’s share counts only the requests that consumed one of its tool results. Before v2.1.222, after one call to an MCP server, Claude Code attributed every subsequent request to that server, overstating its share. * **Behavior flags** : behaviors such as long context or cache misses, flagged when one accounts for 10% or more of recent usage. - * **Loops** : a row for each of the heaviest [`/loop` or other scheduled tasks](</docs/en/scheduled-tasks>) that ran recently, ordered by total tokens, with a count of the rest. Claude Code reports how often each task fires, how many times it ran, its total and per-run tokens, and when it last ran. Claude Code keys a row by the task’s prompt, so a loop you stop and re-create stays one row. Requires Claude Code v2.1.242 or later. + * **Loops** : a row for each of the heaviest [`/loop` or other session-scoped scheduled tasks](</docs/en/scheduled-tasks>) that ran recently, ordered by total tokens, with a count of the rest. Requires Claude Code v2.1.242 or later. + * **What each row reports** : how often the task fires, how many times it ran, its total and per-run tokens, and when it last ran + * **Stopped and re-created loops** : Claude Code keys a row by the task’s prompt, so a loop you stop and re-create stays one row Press `d` or `w` to switch between the last 24 hours and the last 7 days. The figures are approximate and computed from local session history on this machine, so usage from other devices or claude.ai is not included. In the [VS Code extension](</docs/en/vs-code#check-account-and-usage>), the attribution shares and behavior flags appear in the Account & usage dialog with a Day and Week toggle, without the Loops rows. @@ -426,7 +428,7 @@ * **Long context** : Claude Code sends your full conversation with every request, and each time Claude uses tools it sends another request carrying that batch of tool results. With [prompt caching](</docs/en/prompt-caching>), Claude Code re-reads that history at the [cached token rate](<https://platform.claude.com/docs/en/about-claude/pricing>), so a one-line question in a session that has been open all day still draws usage for the whole conversation. See Manage context proactively for ways to keep your context small * **Cache misses** : your first message after a break longer than the [cache lifetime](</docs/en/prompt-caching#cache-lifetime>) misses the cache and reprocesses your full context. The lifetime is an hour on a subscription and drops to five minutes once you’re drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>); on an API key or cloud provider, it’s five minutes by default. To keep the one-hour lifetime while drawing on usage credits, [choose the TTL yourself](</docs/en/prompt-caching#choose-the-ttl-yourself>) - * **Scheduled tasks** : a [scheduled task](</docs/en/scheduled-tasks>) fires on its interval even while the session is idle, sending your full context each time + * **Scheduled tasks** : a [session-scoped scheduled task](</docs/en/scheduled-tasks>) fires on its interval even while the session is idle, sending your full context each time * **Cross-session messages** : Claude Code delivers a [message from another of your sessions](</docs/en/cross-session-messaging>) as a new turn when this session sits idle, sending your full context each time. To hold inbound messages instead of delivering them, set [`crossSessionInbound`](</docs/en/settings-reference#crosssessioninbound>) to `hold` * **Goal check-ins** : while background work keeps an active [goal](</docs/en/goal>) waiting, Claude Code [asks Claude to check on that work](</docs/en/goal#background-work-defers-evaluation>) even when the session sits idle, starting a new turn that sends your full context. Claude Code starts at most three idle check-ins per goal between your prompts. Before v2.1.246, idle check-ins were uncapped. To turn check-ins off, set [`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`](</docs/en/env-vars>) to `0`. Idle check-ins require Claude Code v2.1.236 or later * **Subagents and workflows** : every subagent, and every agent a [dynamic workflow](</docs/en/workflows#cost>) spawns, sends its own requests on top of the main conversation’s. The attribution breakdown shows the subagent share
modified Give Claude custom tools View current →
--- a/custom-tools.md +++ b/custom-tools.md @@ -155,7 +155,7 @@ Call a custom tool -Pass the MCP server you created to `query` via the `mcpServers` option. Each tool’s [fully qualified name](</docs/en/agent-sdk/mcp#tool-naming-convention>) is `mcp__{server_name}__{tool_name}`, where `{server_name}` is the key you give the server in `mcpServers`. If the key contains characters such as `.` or spaces, replace them with `_` when you write `{server_name}`. List the fully qualified name in `allowedTools` so the tool runs without a permission prompt. These snippets reuse the `weatherServer` from the weather tool example to ask Claude what the weather is in a specific location. +Pass the MCP server you created to `query` via the `mcpServers` option, and list each tool’s [fully qualified name](</docs/en/agent-sdk/mcp#tool-naming-convention>) in `allowedTools` so the tool runs without a permission prompt. That name is `mcp__{server_name}__{tool_name}`, where `{server_name}` is the key you give the server in `mcpServers`. If the key contains characters such as `.` or spaces, replace them with `_` when you write `{server_name}`. These snippets reuse the `weatherServer` from the weather tool example to ask Claude what the weather is in a specific location. Python
modified Desktop application View current →
Show diff (707 lines)
--- a/desktop.md +++ b/desktop.md @@ -32,12 +32,15 @@ Start a session -Before you send your first message, configure four things in the prompt area: - - * **Environment** : choose where Claude runs. Select **Local** for your machine, **Cloud** for a cloud session that continues after you close the app, an **SSH connection** for a remote machine you manage, or on Windows a [**WSL distribution**](</docs/en/desktop-wsl>). A task in an SSH session can keep going while Desktop is disconnected, but with a Claude account it can stop when its sign-in expires. See environment configuration. - * **Project folder** : select the folder or repository Claude works in. For cloud sessions, you can add multiple repositories. - * **Model** : pick a [model](</docs/en/model-config#available-models>) from the dropdown next to the send button. You can change this during the session. - * **Permission mode** : choose how much autonomy Claude has from the mode selector. You can change this during the session. +Before you send your first message, choose the environment, project folder, permission mode, and model in the row under the prompt box: + + * **Environment** : use the environment selector, the first control in the row, to choose where Claude runs. See environment configuration. + * If a new session has no environment selector under the prompt box, follow the earlier layout’s steps. + * **Project folder** : click the project folder control, next to the environment selector, to choose the folder Claude works in. + * **Cloud session** : select repositories instead of a folder + * **Saved local or SSH environment** : the environment already holds its folders, so the row shows no project folder control. To change the folders, edit the environment. + * **Permission mode** : use the mode selector to choose how much autonomy Claude has. You can change the permission mode during the session. + * **Model** : pick a [model](</docs/en/model-config#available-models>) from the model picker toward the right end of the row. You can change the model during the session. Type your task and press **Enter** to start. Each session tracks its own context and changes independently. @@ -55,7 +58,7 @@ Use the prompt box -Type what you want Claude to do and press **Enter** to send. Claude reads your project files, makes changes, and runs commands based on your permission mode. You can redirect Claude at any point: click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Claude reads the correction as soon as the current action completes and adjusts before its next step. The **+** button next to the prompt box gives you access to file attachments, skills, connectors, and plugins. +Type what you want Claude to do and press **Enter** to send. Claude reads your project files, makes changes, and runs commands based on your permission mode. You can redirect Claude at any point: click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Claude reads the correction as soon as the current action completes and adjusts before its next step. Click the **+** button next to the prompt box for file attachments, skills, connectors, and plugins. ### @@ -76,10 +79,12 @@ Add files and context to prompts -The prompt box supports two ways to bring in external context: - - * **@mention files** : type `@` followed by a filename to add a file to the conversation context. Claude can then read and reference that file. @mention is not available in cloud or WSL sessions. - * **Attach files** : attach images, PDFs, and other files to your prompt using the attachment button, or drag and drop files directly into the prompt. This is useful for sharing screenshots of bugs, design mockups, or reference documents. +To give Claude a file, @mention it or attach it in the prompt box: + + * **@mention files** : type `@` followed by a filename to add a file to the conversation context. + * **In a cloud session** : `@` can list files only after you send your first message. If `@` lists none, send your first message without the file, then @mention the file in your next message. + * **Attach files** : attach images, PDFs, and other files to your prompt from the **+** button next to the prompt box, or drag and drop files directly into the prompt. This is useful for sharing screenshots of bugs, design mockups, or reference documents. + * **In a[WSL session](</docs/en/desktop-wsl>)**: if the **+** menu shows **Add image** instead of **Add files or photos** , you can attach only images. To give Claude any other file from the session’s folder, @mention it. ### @@ -87,7 +92,7 @@ Choose a permission mode -Permission modes control how much autonomy Claude has during a session: whether it asks before editing files, running commands, or both. You can switch permission modes at any time using the mode selector next to the send button. To approve each change yourself, switch to Manual. To set a default mode for new local sessions, add `permissions.defaultMode` to your [settings file](</docs/en/settings#where-settings-live>). The desktop app reads the same settings files as the CLI. A mode you pick in the selector is remembered per folder and takes precedence over `defaultMode` for that folder, except Plan, which applies to the current session only. +Permission modes control how much autonomy Claude has during a session: whether it asks before editing files, running commands, or both. You can switch permission modes at any time using the mode selector in the row under the prompt box. To approve each change yourself, switch to Manual. To set a default mode for new local sessions, add `permissions.defaultMode` to your [settings file](</docs/en/settings#where-settings-live>). The desktop app reads the same settings files as the CLI. A mode you pick in the selector is remembered per folder and takes precedence over `defaultMode` for that folder, except Plan, which applies to the current session only. Mode| Settings key| Behavior ---|---|--- @@ -117,11 +122,11 @@ Preview your app -Claude can start a dev server and open it in the Browser pane to verify its changes. This works for frontend web apps as well as backend servers: Claude can test API endpoints, view server logs, and iterate on issues it finds. In most cases, Claude starts the server automatically after editing project files. You can also ask Claude to preview at any time. By default, Claude auto-verifies changes after every edit. The Browser pane can also open static HTML files, PDFs, images, and videos from your project. Click an HTML, PDF, image, or video path in the chat to open it there. +Claude can start a dev server and open it in the Browser pane to verify its changes. This works for frontend web apps as well as backend servers: Claude can test API endpoints, view server logs, and iterate on issues it finds. In most cases, Claude starts the server automatically after editing project files. You can also ask Claude to preview at any time. By default, Claude auto-verifies changes after every edit. In a local session, click an HTML, PDF, or video path in the chat to open it in the Browser pane. In an SSH session, Claude can’t open your app in the Browser pane, because it doesn’t have the pane’s tools there. To look at the app yourself, forward its port to your computer. -From the Browser pane, you can: +If the Browser pane isn’t open after Claude starts a server in a local session, click **Open** on the server’s card in the chat. From the Browser pane, you can: * Interact with your running app directly in the Browser pane * Watch Claude verify its own changes automatically: it takes screenshots, inspects the DOM, clicks elements, fills forms, and fixes issues it finds @@ -171,7 +176,7 @@ Review changes with diff view -After Claude makes changes to your code, the diff view lets you review modifications file by file before creating a pull request. When Claude changes files, a diff stats indicator appears showing the number of lines added and removed, such as `+12 -1`. Click this indicator to open the diff viewer, which displays a file list on the left and the changes for each file on the right. To comment on specific lines, click any line in the diff to open a comment box. Type your feedback and press **Enter** to add the comment. After adding comments to multiple lines, submit all comments at once: +After Claude makes changes to your code, the diff view lets you review modifications file by file before creating a pull request. To open the diff view, click the line counts, such as `+12 -1`, in the **Changes** card of the session details panel. You can also click **Changes** in the session’s title bar. To comment on specific lines, click any line in the diff to open a comment box. Type your feedback and press **Enter** to add the comment. After adding comments to multiple lines, submit all comments at once: * **macOS** : press **Cmd+Enter** * **Windows** : press **Ctrl+Enter** @@ -197,12 +202,15 @@ Monitor pull request status -After you open a pull request, a CI status bar appears in the session. Claude Code uses the GitHub CLI to poll check results and surface failures. - - * **Auto-fix CI & address comments**: when enabled, Claude automatically attempts to fix failing CI checks by reading the failure output and iterating. In a local session, Claude also addresses new review comments that someone other than you leaves, when the author is the repository’s owner, an organization member, a collaborator, or a GitHub App. - * **Auto-merge when ready** : when enabled, Claude merges the PR once all checks pass. The merge method is squash. Enable auto-merge in your [GitHub repository settings](<https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository>) first; without it, Claude can’t merge the PR. - -To turn these on, click **CI** in the status bar. To archive the session automatically once the PR merges or closes, turn on auto-archive in **Settings > Claude Code**. +To have Claude fix failing checks, or to have GitHub merge the pull request, turn on **Auto-fix** or **Merge when ready**. After you open a pull request, it appears in the **Changes** card of the session details panel with the status of its CI checks. Open the **⋮** menu beside its title: + + * **Auto-fix** : in a local session, Claude also addresses new review comments that someone other than you leaves. The comment’s author has to be the repository’s owner, an organization member, a collaborator, or a GitHub App. + * **Merge when ready** : turns on GitHub’s auto-merge for the PR. In a local session, Desktop requests a squash merge unless the base branch uses a merge queue. + * **In SSH and WSL sessions** : **Merge when ready** is disabled, so turn on auto-merge for the pull request on GitHub + * **If the repository doesn’t allow auto-merge** : **Merge when ready** doesn’t turn on, so enable auto-merge in your [GitHub repository settings](<https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository>) first + * **Earlier layout** : once the session has a pull request, click **CI** on its status bar. + +To archive the session automatically once the PR merges or closes, turn on auto-archive in **Settings > Claude Code**. PR monitoring requires the [GitHub CLI (`gh`)](<https://cli.github.com/>) to be installed and authenticated on your machine. If `gh` is not installed, Desktop prompts you to install it the first time you try to create a PR.In an SSH session, set up `git` and `gh` on the remote machine before you click **Create PR** , because Claude pushes the branch and runs `gh pr create` there. Install `gh` there yourself, because Desktop doesn’t prompt you to in an SSH session. Then check there that `git push` works and that `gh auth status` reports that you are logged in. @@ -214,7 +222,23 @@ 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 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. +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. + +### + +​ + +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. + +#### + +​ + +Hide or show the session details panel + +To hide or show the panel, click **Hide session rail** or **Show session rail** in the session’s title bar, or in the bar’s **⋮** menu when the window is narrow. If you still don’t see the panel, check which Code tab layout you have. ### @@ -222,7 +246,7 @@ Run commands in the terminal -The integrated terminal lets you run commands alongside your session without switching to another app. Click **Terminal** in the session’s title bar or press **Ctrl+`** on macOS or Windows. The terminal opens in your session’s working directory and shares the same environment as Claude, so commands like `npm test` or `git status` see the same files Claude is editing. To open a second terminal tab, click **+** in the terminal pane header or right-click a folder in the chat to choose **Open in terminal**. The terminal is available in local and SSH sessions, with a limit on Windows remote machines. +The integrated terminal lets you run commands alongside your session without switching to another app. Click **Terminal** in the session’s title bar or press **Ctrl+`** on macOS or Windows. The terminal opens in your session’s working directory and shares the same environment as Claude, so commands like `npm test` or `git status` see the same files Claude is editing. To open a second terminal tab, click **+** in the terminal pane header or right-click a folder in the chat to choose **Open in terminal**. If a WSL session has no terminal, see [If the terminal or connectors are unavailable](</docs/en/desktop-wsl#check-for-the-terminal-and-connectors>). The terminal is available in local and SSH sessions, with a limit on Windows remote machines. ### @@ -230,7 +254,18 @@ Open and edit files -Click a file path in the chat or diff viewer to open it in the file pane. HTML, PDF, image, and video paths open in the Browser pane instead. Make spot edits and click **Save** to write them back. If the file changed on disk since you opened it, the pane warns you and lets you override or discard. Click **Discard** to revert your edits, or click the path in the pane header to copy the absolute path. The file pane is available in local and SSH sessions. For cloud sessions, ask Claude to make the change. +To open a file Claude mentions, click its path in the chat. To edit a file yourself, use the file pane: + + * **Local sessions** : you can edit files inside the session’s working directory, except some view-only ones such as `.mcp.json` and `.claude/settings.json`. To change one, open it in another app. + * **Cloud, SSH, and WSL sessions** : the file pane is view-only, so ask Claude to make edits. + +#### + +​ + +Save edits in the file pane + +By default, your edits in the file pane save on their own, so the pane shows no **Save** button. To save your edits yourself, uncheck **Auto save** in the pane’s **⋮** menu. With **Auto save** off, click **Save** after you change a file to write your edits, or **Cancel** to revert them. If the pane warns that the file changed on disk, click **Override** to write your edits over the version on disk, or **Discard** to drop your edits. ### @@ -267,12 +302,19 @@ Keyboard shortcuts -Press **Cmd+/** on macOS or **Ctrl+/** on Windows to see all shortcuts available in the Code tab. On Windows, use **Ctrl** in place of **Cmd** for the shortcuts below. Session cycling, the terminal toggle, and the view-mode toggle use **Ctrl** on every platform. +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** : press **Ctrl** + +Session cycling, the terminal toggle, and the view-mode toggle use **Ctrl** on every platform. Shortcut| Action ---|--- `Cmd` `/`| Show keyboard shortcuts `Cmd` `N`| New session +`Cmd` `Option` `1`–`9`| On the new session screen in the current layout, select an environment +`Cmd` `Option` `0`| On the new session screen in the current layout, open the **New environment** dialog `Cmd` `W`| Close session `Ctrl` `Tab` / `Ctrl` `Shift` `Tab`| Next or previous session `Cmd` `Shift` `]` / `Cmd` `Shift` `[`| Next or previous session @@ -394,16 +436,87 @@ Work in parallel with sessions -Click **\+ New session** 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. For Git repositories, select the **worktree** option next to the branch name to give the session its own isolated copy of your project using [Git worktrees](</docs/en/worktrees>). 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. Worktrees are stored in `<project-root>/.claude/worktrees/` by default. You can change this to a custom directory: +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. + +#### + +​ + +Run a session in its own worktree + +In a project that’s a Git repository, turn on **Worktree** before you start a session to run it in its own [Git worktree](</docs/en/worktrees>), an isolated copy of the project. By default, **Worktree** is off and Claude works in the project folder itself. Click the project folder control in the row under the prompt box and turn on **Worktree**. + + * **With asaved environment**: set **Worktree** when you create or edit the environment + * **Earlier layout** : select the **worktree** checkbox beside the branch name, above the prompt box + +Worktrees are stored in `<project-root>/.claude/worktrees/` by default. To store them in a custom directory instead: * **Local sessions** : set **Worktree location** in **Settings > Claude Code** * **SSH sessions** : set **Worktree folder** on the SSH connection -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 remove a worktree when you’re done, hover over the session in the sidebar and click the archive icon. To have sessions archive themselves when their pull request merges or closes, turn on **Auto-archive after PR merge or close** in **Settings > Claude Code**. Auto-archive only applies to local sessions that have finished running. 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. +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. -Use the controls at the top of the sidebar to filter sessions by status, project, or environment, and to group sessions by project. To rename a session, click the session title in the toolbar at the top of the active session. To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session. For sessions that belong to a [project](</docs/en/claude-projects#see-what-needs-you-in-overview>), you get the project’s notifications instead. +### + +​ + +Add folders to a session + +Add folders before the session starts or while it runs: + + * **Before a local session starts** : add the folders under **Folders** when you create a saved environment or edit one, then start the session from that saved environment. + * **While a local orSSH session runs**: click **+** next to the prompt box and select **Add folder**. Claude works in that folder itself, with no worktree. + +### + +​ + +Archive a session + +Before you archive a session whose worktree has uncommitted changes, see Keep uncommitted changes when a session is archived. To archive a session, hover over it in the sidebar, open its menu, and select **Archive**. The session moves to your archived sessions. To have sessions archive themselves when their pull request merges or closes, turn on **Auto-archive after PR merge or close** in **Settings > Claude Code**. Cloud sessions and sessions that are still running don’t archive themselves. + +#### + +​ + +Keep uncommitted changes when a session is archived + +You can lose uncommitted changes in a session’s worktree when the session is archived, so commit what you want to keep first: + + * **If Desktop asks about the changes** : select **Archive anyway** to discard them, or cancel and commit them + * **If the only changes are untracked files** : commit the ones you want to keep before a pull request that Claude opened in the session merges, because Desktop can then delete them without asking + * **In any other case** : the worktree stays on disk with its changes. For a local session, Desktop removes both about 30 days after the session is archived or you last open it, whichever is later. To keep the changes, open the session from the **Archived** tab and select **Unarchive** + +### + +​ + +Organize and find sessions + +You group, sort, and find sessions from an icon in the sidebar’s session list: + + * **Current layout** : hover over a heading in the session list to show the **Group and sort** icon, then click it. To find archived sessions, select **View all** , the menu’s last row, then open the **Archived** tab. + * **Earlier layout** : the **Filter** icon shows without hovering. Click it to arrange the list with **Group by** or **Sort by**. To show archived sessions, select **Status** , then **Archived**. + +To rename a session, open it and click the session title in the title bar. + +### + +​ + +Check and free up context + +To check context usage, see Check usage. When context fills up, Claude automatically summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](</docs/en/how-claude-code-works#the-context-window>) for details on how compaction works. + +### + +​ + +Get notified when a session finishes + +The desktop app sends an OS notification when a Code session finishes a task and you aren’t currently viewing that session. For sessions that belong to a [project](</docs/en/claude-projects#see-what-needs-you-in-overview>), you get the project’s notifications instead. ### @@ -427,7 +540,7 @@ 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. Claude archives a session the same way the sidebar’s archive icon does, so ask it to clean up 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 four 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. @@ -442,7 +555,12 @@ Run long-running tasks in the cloud -For large refactors, test suites, migrations, or other long-running tasks, select **Cloud** instead of **Local** when starting a session. Cloud sessions run on Anthropic-managed infrastructure by default and continue even if you close the app or shut down your computer. Check back anytime to see progress or steer Claude in a different direction. You can also monitor cloud sessions from [claude.ai/code](<https://claude.ai/code>) or the [Claude mobile app](</docs/en/mobile>). Cloud sessions also support multiple repositories. After selecting a cloud environment, click the **+** button next to the selected repository to add more repositories to the session. Each repo gets its own branch selector. This is useful for tasks that span multiple codebases, such as updating a shared library and its consumers. See [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) for more on how cloud sessions work. When one body of work needs many cloud sessions, select **Projects** in the sidebar to create a [project](</docs/en/claude-projects>), where Claude starts and tracks the sessions for you from one conversation. +For large refactors, test suites, migrations, or other long-running tasks, select an environment under **Cloud** in the environment selector when starting a session. Cloud sessions run on Anthropic-managed infrastructure by default and continue even if you close the app or shut down your computer. Check back anytime to see progress or steer Claude in a different direction. You can also monitor cloud sessions from [claude.ai/code](<https://claude.ai/code>) or the [Claude mobile app](</docs/en/mobile>). Cloud sessions also support multiple repositories. Choose the repositories: + + * **Current layout** : in the row under the prompt box, once you select a cloud environment. + * **Earlier layout** : above the prompt box. To add another repository, click **+** beside the selected one. + +See [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) for more on how cloud sessions work. When one body of work needs many cloud sessions, select **Projects** in the sidebar to create a [project](</docs/en/claude-projects>), where Claude starts and tracks the sessions for you from one conversation. A task in an SSH session can also keep going while Desktop is disconnected, but with a Claude account it can stop when its sign-in expires. @@ -468,7 +586,7 @@ * **You turn it on for that session** : with the session’s **Remote Control** switch, or by typing `/remote-control` in its prompt box. * **It connects when it starts** : new sessions connect automatically while **Connect new sessions to Remote Control** is on in **Settings > Claude Code**. If you’ve never changed that setting, Desktop follows [`remoteControlAtStartup`](</docs/en/settings-reference#remotecontrolatstartup>) in your user or managed settings, then your organization’s default. -To see whether a session is connected, look at the laptop icon before the session title in the toolbar. The icon is highlighted while the session is connected or connecting. Click it to open the session’s **Remote Control** switch. To keep sessions off your other devices, turn Remote Control off at the level you need: +To see whether a session is connected, check the **Remote Control** switch in the **Environment** card of its session details panel. To keep sessions off your other devices, turn Remote Control off at the level you need: * **One session** : turn off its **Remote Control** switch. In a session that connected when it started, typing `/remote-control` leaves Remote Control on and shows `Remote Control is already on. This session connected automatically when it started.` Click **Turn off** on that line to disconnect. * **New Desktop sessions on this computer** : turn off **Connect new sessions to Remote Control** in **Settings > Claude Code**. If it already shows off, turn it on and then off so Desktop saves your choice. Once saved, it takes precedence over `remoteControlAtStartup` and the defaults. @@ -498,7 +616,14 @@ Connect external tools -For local and SSH sessions, click the **+** button next to the prompt box and select **Connectors** to add integrations like Google Calendar, Slack, GitHub, Linear, Notion, and more. You can add connectors before or during a session. The **+** button is not available in cloud or WSL sessions, but [routines](</docs/en/routines>) configure connectors at routine creation time. To manage or disconnect connectors, go to Settings → Connectors in the desktop app, or select **Manage connectors** from the Connectors menu in the prompt box. Once connected, Claude can read your calendar, send messages, create issues, and interact with your tools directly. You can ask Claude what connectors are configured in your session. Connectors are [MCP servers](</docs/en/mcp>) with a graphical setup flow. Use them for quick integration with supported services. For integrations not listed in Connectors, add MCP servers manually via [settings files](</docs/en/mcp#installing-mcp-servers>). You can also [create custom connectors](<https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp>). +Connectors are [MCP servers](</docs/en/mcp>) with a graphical setup flow. Click **+** next to the prompt box, before or during the session, to add connectors in a local or SSH session with a Claude account. Select **Add connectors** to open the connector directory. If the menu shows **Connectors** instead, select it, then **Browse connectors**. + +These cases are covered on other pages: + + * **Connectors is grayed out in a WSL session** : see [If the terminal or connectors are unavailable](</docs/en/desktop-wsl#check-for-the-terminal-and-connectors>) + * **Cloud sessions** : see [How connectors reach Claude Code](</docs/en/mcp#how-connectors-reach-claude-code>) + +Once connected, Claude can read your calendar, send messages, create issues, and interact with your tools directly. You can ask Claude what connectors are configured in your session. To manage or disconnect connectors, go to **Settings > Connectors** in the desktop app. For integrations not listed in Connectors, add MCP servers manually via [settings files](</docs/en/mcp#installing-mcp-servers>). You can also [create custom connectors](<https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp>). ### @@ -514,7 +639,7 @@ Install plugins -[Plugins](</docs/en/plugins/overview>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. For local and SSH sessions, click the **+** button next to the prompt box and select **Plugins** to see your installed plugins and their skills. To add a plugin, select **Add plugin** from the submenu to open the plugin browser, which shows available plugins from your configured [marketplaces](</docs/en/plugins/overview>) including the official Anthropic marketplace. Select **Manage plugins** to enable, disable, or uninstall plugins. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI, except the ones the desktop app [withholds under `disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>). The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions. A cloud session also doesn’t install plugins that the repository’s `.claude/settings.json` declares, as [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) explains. Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins/overview>). +[Plugins](</docs/en/plugins/overview>) are reusable packages that add skills, agents, hooks, MCP servers, and LSP configurations to Claude Code. You can install plugins from the desktop app without using the terminal. In a local session or an SSH session, click **+** next to the prompt box and select **Add plugins** to open the plugin browser. If the menu shows **Plugins** instead, select it, then **Browse plugins** , or **Manage plugins** to enable, disable, or uninstall plugins. You can scope plugins to your user account, a specific project, or local-only. If your organization manages plugins centrally, those plugins are available in desktop sessions the same way they are in the CLI, except the ones the desktop app [withholds under `disableSideloadFlags`](</docs/en/settings-reference#disablesideloadflags>). The plugin browser is not available in cloud sessions, and plugins you install from the desktop app aren’t available for cloud sessions. A cloud session also doesn’t install plugins that the repository’s `.claude/settings.json` declares, as [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) explains. Plugins aren’t available in WSL sessions. For the full plugin reference including creating your own plugins, see [plugins](</docs/en/plugins/overview>). ### @@ -576,7 +701,7 @@ `runtimeArgs`| string[]| Arguments passed to `runtimeExecutable`, such as `["run", "dev"]` `port`| number| The port your server listens on. Defaults to 3000 `cwd`| string| Working directory relative to your project root. Defaults to the project root. Use `${workspaceFolder}` to reference the project root explicitly -`env`| object| Additional environment variables as key-value pairs, such as `{ "NODE_ENV": "development" }`. Don’t put secrets here since this file is committed to your repo. To pass secrets to your dev server, set them in the local environment editor instead. +`env`| object| Additional environment variables as key-value pairs, such as `{ "NODE_ENV": "development" }`. Don’t put secrets here since this file is committed to your repo. For secrets, see Set environment variables for dev servers. `autoPort`| boolean| How to handle port conflicts. See Port conflicts `program`| string| A script to run with `node`. See when to use `program` vs `runtimeExecutable` `args`| string[]| Arguments passed to `program`. Only used when `program` is set @@ -721,9 +846,139 @@ ​ +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. + +1 + +Open the New environment dialog + +Open the environment selector under the prompt box and select **New environment** at the bottom of its menu. + +2 + +Choose where Claude runs + +Select the **Local** , **SSH** , or **Cloud** tab and fill in the form on that tab. On the **SSH** tab, choose a connection and a folder on the remote machine. + +3 + +Save the environment + +Select **Create environment** , or **Add environment** on the **Cloud** tab. + +#### + +​ + +Environments that Desktop creates for you + +If the environment selector lists local or SSH environments you didn’t create, Desktop created them for you. The first time you open the Code tab in the current layout, Desktop creates up to eight environments. The environments come from the local and SSH folders you used most in the last month. You can edit or delete them. + +#### + +​ + +Use, edit, or remove a saved environment + +Find the environment’s entry in the environment selector: + + * **Start a session** : select the entry. + * **Edit or delete** : hover over the entry and click the gear icon. To delete a local or SSH environment, click **Delete environment** in **Edit environment**. + * **Archive cloud environments** : see [Archive an environment](</docs/en/cloud-environments#archive-an-environment>). + +### + +​ + Local sessions -The desktop app does not always inherit your full shell environment. On macOS, when you launch the app from the Dock or Finder, it reads your shell profile, such as `~/.zshrc` or `~/.bashrc`, to give Claude Code `PATH` and a fixed set of Claude Code variables, but not other variables you export there. On Windows, the app inherits user and system environment variables but does not read PowerShell profiles. To set environment variables for local sessions and dev servers on any platform, open the environment dropdown in the prompt box, hover over **Local** , and click the gear icon to open the local environment editor. Variables you save here are stored encrypted on your machine and apply to every local session and preview server you start. You can also add variables to the `env` key in your `~/.claude/settings.json` file, though these reach Claude sessions only and not dev servers. See [environment variables](</docs/en/env-vars>) for the full list of supported variables. [Extended thinking](</docs/en/model-config#extended-thinking>) is enabled by default, which improves performance on complex reasoning tasks but uses additional tokens. On the Anthropic API, set `MAX_THINKING_TOKENS` to `0` in the local environment editor to turn thinking off; this has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which always use extended thinking. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), Claude Code ignores the number itself in a positive `MAX_THINKING_TOKENS` value because adaptive reasoning controls thinking depth instead. On Opus 4.6 and Sonnet 4.6, set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` to `1` to use a fixed thinking budget; Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later always use adaptive reasoning and have no fixed-budget mode. +The desktop app does not always inherit your full shell environment. On macOS, when you launch the app from the Dock or Finder, it reads your shell profile, such as `~/.zshrc` or `~/.bashrc`, to give Claude Code `PATH` and a fixed set of Claude Code variables, but not other variables you export there. On Windows, the app inherits user and system environment variables but does not read PowerShell profiles. + +#### + +​ + +Set environment variables for local sessions + +Add the variables to a saved local environment and start your sessions from it. Desktop sets some variables itself, such as `API_TIMEOUT_MS`, and your sessions get its value for those instead of yours. + +If your environment selector is above the prompt box, you have the earlier layout, which has no saved local environments. Use the local environment editor instead. + +1 + +Open the environment's form + +Open **New environment** or **Edit environment**. + +2 + +Enter the variables + +Select **Environment variables** , enter one `KEY=value` per line, and select **Done**. + +3 + +Save the environment + +Select **Create environment** or **Save**. + +Only sessions you start from that environment get the variables. To set a variable for every local session, add it to the [`env` key](</docs/en/env-vars#set-variables-in-settings-files>) in your `~/.claude/settings.json` file. Claude Code [ignores the value](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) if that variable is already in the environment Desktop starts the session with. See [environment variables](</docs/en/env-vars>) for the full list of supported variables. + +#### + +​ + +Set environment variables for dev servers + +To give a dev server a secret without committing it to `launch.json`, set it in one of these places, then restart Desktop: + + * **macOS and Linux** : export it in your shell profile + * **Windows** : add it to your user or system environment variables + * **Any platform** : save it in the local environment editor, if you can open it + +Dev servers don’t get the variables you add to a saved environment or to `~/.claude/settings.json`. + +#### + +​ + +Use the local environment editor + +To open the local environment editor, click the gear icon on the entry for your own computer, not the one on a saved environment: + + * **Selector under the prompt box** : hover over the entry for your computer, the first under **Local**. If a gear icon appears, click it. If not, the editor isn’t available, so set the variable for local sessions or dev servers another way. + * **Selector above the prompt box** : hover over **Local** and click the gear icon + +Enter one `KEY=value` per line and select **Save changes**. Variables you save here are stored encrypted on your machine. Local sessions get them, except any variable that Desktop sets itself, such as `API_TIMEOUT_MS`. Restart Desktop to give your variables to dev servers. + +#### + +​ + +Environment variables Desktop sets itself + +If you set `API_TIMEOUT_MS` or `ANTHROPIC_BASE_URL` and nothing changed in your local sessions, it’s because Desktop sets those [variables](</docs/en/env-vars#variables>), among others, itself. A local session gets Desktop’s value whether you set yours in your shell profile, your Windows user or system variables, the local environment editor, or a saved environment. Moving yours to a settings file doesn’t help, because Claude Code [ignores that value](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) in a local session. + + * `API_TIMEOUT_MS`: a local session gets `900000`, which is 15 minutes. For a longer timeout, [install the Claude Code CLI](</docs/en/quickstart>) and use it instead of Desktop. [Set the variable in your shell](</docs/en/env-vars#set-variables-in-your-shell>) and run `claude` in your terminal. + * `ANTHROPIC_BASE_URL`: a local session gets Anthropic’s API host when you’re signed in with a Claude account. To use a gateway, set up Desktop’s [third-party inference configuration](</docs/en/llm-gateway-connect#desktop-app>) instead. + +#### + +​ + +Turn off extended thinking + +[Extended thinking](</docs/en/model-config#extended-thinking>) is enabled by default, which improves performance on complex reasoning tasks but uses additional tokens. To turn it off, set `MAX_THINKING_TOKENS` to `0` in a saved local environment or the local environment editor. Thinking then turns off on the Anthropic API, except on Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models, which always use extended thinking. On Opus 5, also select effort `high` or lower before you start the session. In the current layout, open the model picker and select a level under **Effort**. If you started the session at a higher level, start a new one at `high` or lower. + +#### + +​ + +Fixed thinking budgets + +On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), Claude Code ignores the number itself in a positive `MAX_THINKING_TOKENS` value because adaptive reasoning controls thinking depth instead. On Opus 4.6 and Sonnet 4.6, set `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` to `1` to use a fixed thinking budget; Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later always use adaptive reasoning and have no fixed-budget mode. #### @@ -731,7 +986,7 @@ Local sessions on managed devices -Your administrator can turn off local sessions with the `disableDesktopLocalSessions` managed setting. When they have, **Local** stays in the environment dropdown but is grayed out and can’t be selected, with a tooltip saying your organization turned it off, and on Windows the [WSL](</docs/en/desktop-wsl>) entry, whose availability on managed devices is [governed separately](</docs/en/admin-setup#wsl-sessions-in-claude-code-desktop>), is grayed out the same way. New sessions default to the first SSH connection if one is configured, and Desktop shows a message that local sessions aren’t available on this device if you try to continue an existing one. Choose an SSH or cloud environment instead, or contact your IT team. +If the entry for your computer is grayed out in the environment selector, with the tooltip **Disabled by your organization** , your administrator has turned off local sessions. On Windows the [WSL](</docs/en/desktop-wsl>) entry, whose availability on managed devices is [governed separately](</docs/en/admin-setup#wsl-sessions-in-claude-code-desktop>), is grayed out the same way. New sessions default to the first SSH connection if one is configured. If you try to continue an existing local session, Desktop shows a message that local sessions aren’t available on this device. Saved local environments show this error when you select one: `Couldn’t switch environments: the Local environment isn’t available anymore.` Choose an SSH or cloud environment instead, or contact your IT team. ### @@ -739,9 +994,9 @@ Cloud sessions -Cloud sessions continue in the background even if you close the app. Usage counts toward your [subscription plan limits](</docs/en/costs>) with no separate compute charges. You can create custom cloud environments with different network access levels and environment variables. To manage them, open the environment dropdown in the prompt box and select **Cloud** : - - * **Add an environment** : select **Add cloud environment** +Cloud sessions continue in the background even if you close the app. Usage counts toward your [subscription plan limits](</docs/en/costs>) with no separate compute charges. To add, edit, or [archive](</docs/en/cloud-environments#archive-an-environment>) a cloud environment, open the environment selector: + + * **Add an environment** : select **New environment** at the bottom of the selector’s menu, then the **Cloud** tab of the **New environment** dialog * **Edit or archive one of your own environments** : hover over it and click the gear icon See [Configure cloud environments](</docs/en/cloud-environments>) for details on configuring network access and environment variables. @@ -756,15 +1011,35 @@ If you use Desktop with a [third-party provider](</docs/en/third-party-integrations>), SSH sessions need their own setup. See [SSH remote sessions in Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/ssh-remote-sessions>). -To add an SSH connection, open the environment dropdown in the prompt box before you start a session, then select **SSH > Add SSH connection…** and fill in the connection details: - - * **Name** : a friendly label for this connection - * **SSH host** : `user@hostname` or a host defined in `~/.ssh/config` - * **SSH port** : defaults to 22 if left empty, or uses the port from your SSH config +Add an SSH connection in the **New environment** dialog, then start a session on that connection. If a new session has no environment selector under the prompt box, you have the earlier layout. See Check which layout you have. + +1 + +Open the New environment dialog + +Before you start a session, open the environment selector under the prompt box and select **New environment** at the bottom of its menu. + +2 + +Add the connection + +On the **SSH** tab of the **New environment** dialog, open the **Host** list, select **Add SSH connection…** , and fill in the connection details: + + * **Name** : a friendly label for this connection. + * **SSH host** : `user@hostname` or a host defined in `~/.ssh/config`. + * **SSH port** : defaults to 22 if left empty, or uses the port from your SSH config. * **SSH key (optional)** : path to your private key, such as `~/.ssh/id_ed25519`. Leave empty to use your SSH config or SSH agent. * **Worktree folder** : a folder on the remote machine, such as `~/worktrees`, where new sessions create their worktrees. Leave empty to use the remote machine’s default. -Once added, the connection appears under **SSH** in the environment dropdown. Select it to start a session on that machine. Claude runs on the remote machine with access to its files and tools. The remote machine can run Linux, macOS, or Windows. Desktop installs Claude Code on the remote machine automatically the first time you connect. Once connected, SSH sessions support permission modes, connectors, plugins, and MCP servers. +Then select **Add SSH connection**. + +3 + +Start a session on the connection + +Select a folder on the remote machine and click **Create environment**. You keep the machine and folder together as a saved environment for later sessions. Desktop selects it for the new session, so type your task and press **Enter**. + +The remote machine can run Linux, macOS, or Windows. Desktop installs Claude Code on the remote machine automatically the first time you connect. Once connected, SSH sessions support permission modes, connectors, plugins, and MCP servers. #### @@ -1124,13 +1399,35 @@ Choose where SSH session worktrees go -Unless your organization restricts which folders sessions may use, new SSH sessions create their worktrees in the first of these that is set: +Unless your organization restricts which folders sessions may use, new SSH sessions create their worktrees in the first of these locations that is set: 1. **Worktree folder** on the SSH connection 2. [`worktree.location`](</docs/en/settings-reference#worktree-location>) in `~/.claude/settings.json` on the remote machine 3. `<project-root>/.claude/worktrees/`, the default -Each project gets its own subfolder in the folder you set, so with `~/worktrees` a worktree’s path is `~/worktrees/<project>-<id>/<worktree-name>`. If the folder you set is inside the project, Desktop ignores it for that project and uses the default. On a Windows remote machine, Desktop always uses the default. To set **Worktree folder** on a connection you added earlier or one your organization manages, hover over it in the environment dropdown and click the gear icon. The field requires Claude Desktop v1.44121.0 or later. If your organization restricts which folders sessions may use, Desktop hides the field and keeps worktrees inside the project. +Each project gets its own subfolder in the folder you set, so with `~/worktrees` a worktree’s path is `~/worktrees/<project>-<id>/<worktree-name>`. If the folder you set is inside the project, Desktop ignores it for that project and uses the default. On a Windows remote machine, Desktop always uses the default. + +##### Set the worktree folder on an existing connection + +Set **Worktree folder** in the settings of a connection you added earlier or one your organization manages. The field requires Claude Desktop v1.44121.0 or later. If your organization restricts which folders sessions may use, Desktop hides the field and keeps worktrees inside the project. + +1 + +Find the connection + +Open the environment selector and find the connection under **SSH**. + +2 + +Open the connection's settings + +Hover over the connection and click the gear icon. If the dialog that opens shows **Edit connection…** next to **Host** , select **Edit connection…**. + +3 + +Set the folder + +In **Worktree folder** , enter a folder on the remote machine, such as `~/worktrees`, and select **Save changes**. #### @@ -1175,7 +1472,7 @@ ##### End one session’s process -To end one session’s Claude Code process, archive the session in Desktop while Desktop is connected to the remote machine. The process keeps running after its task is done and after you quit Desktop. Before you archive a session that has a worktree, see Work in parallel with sessions. +To end one session’s Claude Code process, archive the session in Desktop while Desktop is connected to the remote machine. The process keeps running after its task is done and after you quit Desktop. Before you archive a session whose worktree has uncommitted changes, see Keep uncommitted changes when a session is archived. ##### See which user the processes run as @@ -1286,7 +1583,12 @@ Pre-configure SSH connections for your team -Administrators can distribute SSH connections to team members by setting `sshConfigs` in [managed settings](</docs/en/managed-settings>). Connections defined this way appear in each user’s environment dropdown automatically and are shown as managed. Users can select them and set their own **Worktree folder** for them, but can’t edit anything else or delete them in the app. The following example pre-configures a single connection: +Administrators can distribute SSH connections to team members by setting `sshConfigs` in [managed settings](</docs/en/managed-settings>). + + * **What users see** : connections defined this way appear in each user’s environment selector automatically. + * **What users can change** : users can select a managed connection and set their own **Worktree folder** for it. They can’t edit its other fields or delete it in the app. + +The following example pre-configures a single connection: { "sshConfigs": [ @@ -1360,9 +1662,18 @@ 1 -Check the environment dropdown - -Quit and reopen Desktop, then open the environment dropdown in the prompt box. **Local** is grayed out, and **Shared Dev VM** appears under **SSH**. If **Local** is still available, check the Desktop version, that the file is valid JSON, and which managed source the computer reads. +Check the environment selector + +Quit and reopen Desktop, then open the environment selector. The settings applied if it shows: + + * The entry for that computer, in gray + * **Shared Dev VM** under **SSH**. If it isn’t listed there, click the single **SSH** row, or **More** at the end of the group. + +If the entry for the computer is still available, check for these causes: + + * **Desktop version** : update Desktop if it’s earlier than v1.37937.0. + * **Managed settings file** : make sure that the file is valid JSON. + * **Managed source** : make sure that the computer reads the [managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>) that holds the keys. 2 @@ -1410,7 +1721,7 @@ `browserExternalPageTools`| set to `"disabled"` to prevent Claude from using tools to read or act on external pages in the Browser pane. Users can still navigate to external sites themselves, and local dev server previews are unaffected. `disableMobileSimulatorTools`| set to `true` to block Claude’s tools for controlling and capturing devices in the [iOS Simulator pane](</docs/en/desktop-ios-simulator#turn-off-simulator-access>). The pane stays usable for the user’s own taps; only Claude’s access is removed. The value must be the JSON boolean `true`; the string `"true"` is ignored. `disableBrowserExternalNavigation`| set to `true` to turn off external browsing in the Browser pane entirely. Neither users nor Claude can navigate to external sites, and localhost dev server previews are unaffected. The value must be the JSON boolean `true`; the string `"true"` is ignored. -`sshConfigs`| pre-configure SSH connections that appear in the environment dropdown. Users can’t delete managed connections or edit anything but their own **Worktree folder**. +`sshConfigs`| pre-configure SSH connections that appear in the environment selector. Users can’t delete managed connections or edit anything but their own **Worktree folder**. `sshHostAllowlist`| restrict SSH sessions to hosts whose resolved hostname matches one of these patterns. Read from managed settings only. `disableDesktopLocalSessions`| set to `true` to turn off Code sessions that run on the device, leaving SSH sessions to other hosts and cloud sessions available. The value must be the JSON boolean `true`. Read from managed settings only. Requires Claude Desktop v1.37937.0 or later. `disableSshSavedPasswords`| set to `true` to stop Desktop from offering to remember SSH passwords and from using or showing the ones it saved earlier. Turning it on doesn’t delete them. Read from managed settings only. Requires Claude Desktop v1.49585.0 or later. @@ -1536,16 +1847,16 @@ CLI| Desktop equivalent ---|--- -`--model sonnet`| Model dropdown next to the send button +`--model sonnet`| Model picker in the row under the prompt box `--resume`, `--continue`| Click a session in the sidebar, or type `/resume` in the prompt box to pick up a session you started from the CLI -`--permission-mode`| Mode selector next to the send button +`--permission-mode`| Mode selector in the row under the prompt box `--dangerously-skip-permissions`| Bypass permissions mode. On Pro and Max plans, enable it in Settings → Claude Code → “Allow bypass permissions mode”; on Team and Enterprise plans, organization policy controls it -`--add-dir`| Add multiple repos with the **+** button in cloud sessions +`--add-dir`| Add folders to a session in local and SSH sessions, or select several repositories in a cloud session `--allowedTools`, `--disallowedTools`| No per-session equivalent. Permission rules in [settings files](</docs/en/settings>) still apply. `--verbose`| Verbose view mode `--print`, `--output-format`| Not available. Desktop is interactive only. -`ANTHROPIC_MODEL` env var| Model dropdown next to the send button -`MAX_THINKING_TOKENS` env var| Set in the local environment editor. See environment configuration. +`ANTHROPIC_MODEL` env var| Model picker in the row under the prompt box +`MAX_THINKING_TOKENS` env var| See Turn off extended thinking ### @@ -1559,7 +1870,7 @@ * **[MCP servers](</docs/en/mcp>)** configured in `~/.claude.json` or `.mcp.json` work in both * **[Hooks](</docs/en/hooks>)** and **[skills](</docs/en/skills>)** defined in settings apply to both * **[Settings](</docs/en/settings>)** in `~/.claude.json` and `~/.claude/settings.json` are shared. Permission rules, allowed tools, and other settings in `settings.json` apply to Desktop sessions. - * **Models** : the same [models](</docs/en/model-config#available-models>) are available in both. In Desktop, select the model from the dropdown next to the send button. You can change the model mid-session from the same dropdown. + * **Models** : the same [models](</docs/en/model-config#available-models>) are available in both. In Desktop, select the model from the model picker in the row under the prompt box. You can change the model mid-session from the same picker. #### @@ -1585,9 +1896,9 @@ [Third-party providers](</docs/en/third-party-integrations>)| Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry| Anthropic’s API by default. For gateway routing, see [connect the desktop app to a gateway](</docs/en/llm-gateway-connect#desktop-app>). To run the Code tab on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, or a self-hosted LLM gateway, see [Claude Desktop on 3P](<https://claude.com/docs/third-party/claude-desktop/overview>). [MCP servers](</docs/en/mcp>)| Configure in settings files| Connectors UI for local and SSH sessions, or settings files [Plugins](</docs/en/plugins/overview>)| `/plugin` command| Plugin manager UI -@mention files| Text-based| With autocomplete; local and SSH sessions only +@mention files| Text-based| With autocomplete, except for a cloud session’s first message File attachments| Not available| Images, PDFs -Session isolation| [`--worktree`](</docs/en/cli-reference>) flag| **worktree** option when starting a session +Session isolation| [`--worktree`](</docs/en/cli-reference>) flag| Run a session in its own worktree Multiple sessions| Separate terminals| Sidebar tabs Recurring tasks| Cron jobs, CI pipelines| [Scheduled tasks](</docs/en/desktop-scheduled-tasks>) Computer use| [Enable via `/mcp`](</docs/en/computer-use>) on macOS| App and screen control on macOS and Windows @@ -1617,7 +1928,7 @@ Troubleshooting -The sections below cover issues specific to the desktop app. For runtime API errors that appear in the chat such as `API Error: 500`, `529 Overloaded`, `429`, or `Prompt is too long`, see the [Error reference](</docs/en/errors>). Those errors and their fixes are the same across the CLI, desktop, and web. +The sections below cover issues specific to the desktop app. For runtime API errors that appear in the chat such as `API Error: 500`, `529 Overloaded`, `429`, or `Prompt is too long`, see the [Error reference](</docs/en/errors>). ### @@ -1638,7 +1949,20 @@ Claude Code version in the Code tab -To see which version of Claude Code a session runs, type `/status` in a local session in the **Code** tab and read the **Claude Code** row, which shows a version such as `2.1.286`. To get a newer version for local sessions, open **Claude → Check for Updates** on macOS or **Help → Check for Updates** on Windows, then start a new session. In a local session, the **Code** tab runs its own copy of Claude Code, which has its own version number. The desktop app downloads and updates that copy, so it can differ from the `claude` command in your terminal, and updating one doesn’t update the other. +To see which version of Claude Code a session runs, type `/status` in a local session in the **Code** tab and read the **Claude Code** row, which shows a version such as `2.1.286`. To get a newer version for local sessions, open **Claude > Check for Updates…** on macOS or **Help > Check for Updates…** on Windows, then start a new session. In a local session, the **Code** tab runs its own copy of Claude Code, which has its own version number. The desktop app downloads and updates that copy, so it can differ from the `claude` command in your terminal, and updating one doesn’t update the other. + +### + +​ + +Check which layout you have + +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. + +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 Test iOS apps in the simulator View current →
--- a/desktop-ios-simulator.md +++ b/desktop-ios-simulator.md @@ -152,7 +152,7 @@ * Confirm Xcode and the iOS simulators are installed and that you’re using a recommended Xcode version. * If your organization manages Claude Code, the simulator tools may be disabled by policy. * If you’re in an Enterprise organization that has a HIPAA configuration enabled, the simulator pane isn’t available to you. - * The simulator pane requires Claude Desktop v1.24012.0 or later. Open **Claude → Check for Updates** , then restart the app. + * The simulator pane requires Claude Desktop v1.24012.0 or later. Open **Claude > Check for Updates…**, then restart the app. ### @@ -170,5 +170,5 @@ * [Computer use in Desktop](</docs/en/desktop#let-claude-use-your-computer>): screen control for apps without a dedicated pane * [Computer use from the CLI](</docs/en/computer-use>): how the CLI reaches the iOS Simulator - * [Work in parallel with sessions](</docs/en/desktop#work-in-parallel-with-sessions>): how sessions isolate changes + * [Run a session in its own worktree](</docs/en/desktop#run-a-session-in-its-own-worktree>): how sessions isolate changes * [Get started with Claude Code Desktop](</docs/en/desktop-quickstart>)
modified Get started with the desktop app View current →
--- a/desktop-quickstart.md +++ b/desktop-quickstart.md @@ -59,21 +59,21 @@ Choose an environment and folder -Select **Local** to run Claude on your machine using your files directly. Click **Select folder** and choose your project directory. +In the [row under the prompt box](</docs/en/desktop#start-a-session>), click the first control, the environment selector, and select the top entry in the **Local** group. Then click the project folder control beside the environment selector, select **Open folder…** , and choose your project’s directory.If no environment selector appears under your prompt box, you have the earlier layout. See [Check which layout you have](</docs/en/desktop#check-which-layout-you-have>). Start with a small project you know well. It’s the fastest way to see what Claude Code can do. You can also select: * **Cloud** : Run sessions in the cloud that continue even if you close the app. See [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) for how cloud sessions work. - * **SSH** : Connect to a remote machine over SSH, such as your own servers, cloud VMs, or dev containers. Desktop installs Claude Code on the remote machine automatically the first time you connect. A running task can [keep going while Desktop is disconnected](</docs/en/desktop#keep-a-task-running-while-desktop-is-disconnected>), but with a Claude account it can stop when its sign-in expires. + * **SSH** : Connect to a remote machine over SSH, such as your own servers, cloud VMs, or dev containers. [Add a connection](</docs/en/desktop#ssh-sessions>) first. Desktop installs Claude Code on the remote machine automatically the first time you connect. A running task can [keep going while Desktop is disconnected](</docs/en/desktop#keep-a-task-running-while-desktop-is-disconnected>), but with a Claude account it can stop when its sign-in expires. * **WSL** (Windows): Run the session inside a [WSL 2 distribution](</docs/en/desktop-wsl>); Claude Code, tools, and git execute on the Linux side with native paths. 2 Choose a model -Select a model from the dropdown next to the send button. See [models](</docs/en/model-config#available-models>) for a comparison of the available models. You can change the model later from the same dropdown. +Select a model from the model picker toward the right end of the row under the prompt box. See [models](</docs/en/model-config#available-models>) for a comparison of the available models. You can change the model later from the model picker. 3 @@ -91,10 +91,10 @@ Review and accept changes -What happens next depends on the [permission mode](</docs/en/desktop#choose-a-permission-mode>) shown in the selector next to the send button: +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 - * **Manual** : Claude proposes each change and waits for your approval before applying it. Your files aren’t modified until you accept, and if you reject a change, Claude asks how you’d like to proceed instead + * **Manual** : Claude proposes each change and waits for your approval before applying it In Manual mode, you’ll see: @@ -108,14 +108,14 @@ Now what? -You’ve made your first edit. For the full reference on everything Desktop can do, see [Use Claude Code Desktop](</docs/en/desktop>). Here are some things to try next. **Interrupt and steer.** You can redirect Claude at any point. Click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Either way, you don’t have to wait for it to finish or start over. **Give Claude more context.** Type `@filename` in the prompt box to pull a specific file into the conversation, attach images and PDFs using the attachment button, or drag and drop files directly into the prompt. The more context Claude has, the better the results. See [Add files and context](</docs/en/desktop#add-files-and-context-to-prompts>). **Use skills for repeatable tasks.** Type `/` or click **+** → **Slash commands** to browse [built-in commands](</docs/en/commands>), [custom skills](</docs/en/skills>), and plugin skills. Skills are reusable prompts you can invoke whenever you need them, like code review checklists or deployment steps. **Review changes before committing.** After Claude edits files, a `+12 -1` indicator appears. Click it to open the [diff view](</docs/en/desktop#review-changes-with-diff-view>), review modifications file by file, and comment on specific lines. Claude reads your comments and revises. To have Claude review the changes itself, enter [`/code-review`](</docs/en/desktop#review-your-code>) in the prompt box. **Adjust how much control you have.** Your [permission mode](</docs/en/desktop#choose-a-permission-mode>) sets how much Claude can do without asking for approval: +You’ve made your first edit. For the full reference on everything Desktop can do, see [Use Claude Code Desktop](</docs/en/desktop>). Here are some things to try next. **Interrupt and steer.** You can redirect Claude at any point. Click the stop button to interrupt immediately, or type a correction and press **Enter** to send it without stopping the running action. Either way, you don’t have to wait for it to finish or start over. **Give Claude more context.** Type `@filename` in the prompt box to pull a specific file into the conversation. The more context Claude has, the better the results. See [Add files and context](</docs/en/desktop#add-files-and-context-to-prompts>). **Use skills for repeatable tasks.** Type `/` or click **+** → **Slash commands** to browse [built-in commands](</docs/en/commands>), [custom skills](</docs/en/skills>), and plugin skills. Skills are reusable prompts you can invoke whenever you need them, like code review checklists or deployment steps. **Review changes before committing.** After Claude edits files, a `+12 -1` indicator appears. Click it to open the [diff view](</docs/en/desktop#review-changes-with-diff-view>), review modifications file by file, and comment on specific lines. Claude reads your comments and revises. To have Claude review the changes itself, enter [`/code-review`](</docs/en/desktop#review-your-code>) in the prompt box. **Adjust how much control you have.** Your [permission mode](</docs/en/desktop#choose-a-permission-mode>) sets how much Claude can do without asking for approval: * **Auto** : a classifier reviews actions in the background and blocks the risky ones instead of asking you. * **Manual** : Claude asks before editing files or running commands. * **Accept edits** : Claude auto-accepts file edits for faster iteration. * **Plan** : Claude proposes an approach without editing any files, which is useful before a large refactor. -**Add plugins for more capabilities.** Click the **+** button next to the prompt box and select **Plugins** to browse and install [plugins](</docs/en/desktop#install-plugins>) that add skills, agents, MCP servers, and more. **Arrange your workspace.** Drag the chat, diff, terminal, file, and browser panes into whatever layout you want. Open the terminal with **Ctrl+`** to run commands alongside your session, or click a file path to open it in the file pane. See [Arrange your workspace](</docs/en/desktop#arrange-your-workspace>). **Preview your app.** When you run your dev server in the desktop, your app opens in the Browser pane, which can also [open external sites](</docs/en/desktop#browse-external-sites>). Claude can view the running app, test endpoints, inspect logs, and iterate on what it sees. See [Preview your app](</docs/en/desktop#preview-your-app>). **Track your pull request.** After opening a PR, Claude Code monitors CI check results and can automatically fix failures or merge the PR once all checks pass. See [Monitor pull request status](</docs/en/desktop#monitor-pull-request-status>). **Put Claude on a schedule.** Set up [scheduled tasks](</docs/en/desktop-scheduled-tasks>) to run Claude automatically on a recurring basis: a daily code review every morning, a weekly dependency audit, or a briefing that pulls from your connected tools. **Scale up when you’re ready.** Open [parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>) from the sidebar to work on multiple tasks at once, optionally each in its own Git worktree, and open the [tasks pane](</docs/en/desktop#watch-background-tasks>) to watch the subagents and background commands a session has running. Open a [side chat](</docs/en/desktop#ask-a-side-question-without-derailing-the-session>) to ask a question without derailing the main thread. Send [long-running work to the cloud](</docs/en/desktop#run-long-running-tasks-in-the-cloud>) so it continues even if you close the app, or [move a session you already started to the cloud](</docs/en/desktop#continue-in-another-surface>) if a task takes longer than expected. [Connect external tools](</docs/en/desktop#extend-claude-code>) like GitHub, Slack, and Linear to bring your workflow together. +**Add plugins for more capabilities.** Install [plugins](</docs/en/desktop#install-plugins>) that add skills, agents, MCP servers, and more. **Arrange your workspace.** Drag the chat, diff, terminal, file, and browser panes into whatever layout you want. Open the terminal with **Ctrl+`** to run commands alongside your session, or click a file path to open it. See [Arrange your workspace](</docs/en/desktop#arrange-your-workspace>). **Preview your app.** When you run your dev server in the desktop, your app opens in the Browser pane, which can also [open external sites](</docs/en/desktop#browse-external-sites>). Claude can view the running app, test endpoints, inspect logs, and iterate on what it sees. See [Preview your app](</docs/en/desktop#preview-your-app>). **Track your pull request.** After opening a PR, Claude Code monitors CI check results and can automatically fix failures. See [Monitor pull request status](</docs/en/desktop#monitor-pull-request-status>). **Put Claude on a schedule.** Set up [scheduled tasks](</docs/en/desktop-scheduled-tasks>) to run Claude automatically on a recurring basis: a daily code review every morning, a weekly dependency audit, or a briefing that pulls from your connected tools. **Scale up when you’re ready.** Open [parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>) from the sidebar to work on multiple tasks at once, optionally each in its own Git worktree, and open the [tasks pane](</docs/en/desktop#watch-background-tasks>) to watch the subagents and background commands a session has running. Open a [side chat](</docs/en/desktop#ask-a-side-question-without-derailing-the-session>) to ask a question without derailing the main thread. Send [long-running work to the cloud](</docs/en/desktop#run-long-running-tasks-in-the-cloud>) so it continues even if you close the app, or [move a session you already started to the cloud](</docs/en/desktop#continue-in-another-surface>) if a task takes longer than expected. [Connect external tools](</docs/en/desktop#extend-claude-code>) like GitHub, Slack, and Linear to bring your workflow together. ##
modified Schedule recurring tasks in Claude Code Desktop View current →
Show diff (157 lines)
--- a/desktop-scheduled-tasks.md +++ b/desktop-scheduled-tasks.md @@ -1,4 +1,9 @@ -Scheduled tasks start a new session automatically at a time and frequency you choose. Use them for recurring work like daily code reviews, dependency update checks, or morning briefings that pull from your calendar and inbox. The Desktop app’s **Routines** page lets you create both local scheduled tasks and remote [routines](</docs/en/routines>). A local task runs on your machine with direct access to your files and tools, but only fires while the app is open and your computer is awake. A remote routine runs in the cloud even when your computer is off, and can also fire on API calls or GitHub events. This page covers local scheduled tasks; for remote routines and their trigger options, see [Routines](</docs/en/routines>). +Scheduled tasks start a new session automatically at a time and frequency you choose. Use them for recurring work like daily code reviews, dependency update checks, or morning briefings that pull from your calendar and inbox. The Desktop app’s **Scheduled tasks** page lists both local scheduled tasks and [cloud scheduled tasks](</docs/en/routines>), formerly routines: + + * **Local task** : runs on your machine with direct access to your files and tools, but only fires while the app is open and your computer is awake + * **Cloud task** : runs even when your computer is off, and can also start on API calls or GitHub events + +This page covers local scheduled tasks; for cloud scheduled tasks and their trigger options, see [Automate work with scheduled tasks](</docs/en/routines>). ## @@ -22,7 +27,7 @@ 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. -By default, scheduled tasks run against whatever state your working directory is in, including uncommitted changes. Enable the worktree toggle when creating the task to give each run its own isolated Git worktree, the same way [parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>) work. +By default, local scheduled tasks run against whatever state your working directory is in, including uncommitted changes. To give each run its own [isolated Git worktree](</docs/en/desktop#run-a-session-in-its-own-worktree>) instead, select **Worktree** in the task’s **Edit** form after you create it. The checkbox is available when the task’s folder is a Git repository. ## @@ -30,16 +35,79 @@ Create a scheduled task -On Claude Desktop before 1.1.5368, local scheduled tasks aren’t available. In the [**Code** tab](</docs/en/desktop>), click **Routines** in the sidebar or in the sidebar’s **More** menu, then click **New routine** and choose **Local**. Configure these fields: +Local scheduled tasks require Claude Desktop 1.1.5368 or later. -Field| Description ----|--- -Name| Identifier for the task. Converted to lowercase kebab-case and used as the folder name on disk. Must be unique across your tasks. -Description| Short summary shown in the task list. -Instructions| What Claude should do when the task runs. Write this the same way you’d write any message in the prompt box. The instructions input includes pickers for the permission mode and model, and below it you select the working folder and whether to run in an isolated worktree. -Schedule| How often the task runs. See schedule options below. +1 -A folder is required before you can save the task. If you haven’t trusted that folder yet, Desktop prompts you to trust it before saving. 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, and “remind me at 3pm tomorrow to check the deploy” creates a one-time task that disables itself after it fires. +Open the Scheduled tasks page + +In the [**Code** tab](</docs/en/desktop>), click **Scheduled** in the sidebar or in the sidebar’s **More** menu. + +2 + +Start a new task + +Click **New task**. If a menu opens with **Create with Claude** and **Set up manually** , select **Set up manually**. The **New scheduled task** dialog opens. If **Only on this computer** is at the top of the dialog, go to Dialog with Only on this computer at the top before you enter anything. + +3 + +Name the task + +Enter a name in the **Name** field. Desktop converts it to lowercase kebab-case and uses it as the task’s folder name on disk, so the name must be unique across your tasks. + +4 + +Write the instructions + +In the box below the name, enter what Claude should do when the task runs. + +5 + +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>). + +6 + +Pick the local folder + +In the **Local folder** row, select a folder. **Create** stays unavailable until you pick one. + +7 + +Set the schedule + +Back in the **Trigger** card, select a schedule preset. + +8 + +Choose the permission mode and model + +In the instructions box’s toolbar, select a permission mode and model. If you leave them unchanged, runs use your Claude Code settings and the default model. + +9 + +Create the task + +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. + +### + +​ + +Dialog with Only on this computer at the top + +If **Only on this computer** is at the top of the **New scheduled task** dialog when it opens, turn it on before you enter anything. When you turn it on, a separate blank form for a local task replaces the form. Then fill in the local form’s fields: + + * **Name** : enter a name, as in the steps to create a scheduled task. + * **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. + +Click **Create**. The task’s detail page opens. ## @@ -47,13 +115,13 @@ Schedule options -Pick a preset from the Schedule control: +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**. - * **Manual** : no schedule, only runs when you click **Run now**. Useful for saving a prompt you trigger on demand * **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 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.” @@ -63,7 +131,11 @@ How scheduled tasks run -Scheduled tasks run on your machine. Desktop checks the schedule every minute while the app is open and starts a fresh session when a task is due, independent of any manual sessions you have open. Each task gets a small delay of a few minutes after the scheduled time to stagger API traffic. The delay is deterministic: the same task always starts at the same offset. When a task fires, you get a desktop notification and 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, but can’t send or receive [messages between your desktop sessions](</docs/en/desktop#work-across-sessions>) through the desktop app’s session surface. Tasks only run while the desktop app is running and your computer is awake. If your computer sleeps through a scheduled time, the run is skipped. To prevent idle-sleep, turn on **Keep computer awake** in **Settings > This computer > System**. Closing the laptop lid still puts it to sleep. 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 remote [routine](</docs/en/routines>) instead. +Local scheduled tasks run on your machine. Desktop checks the schedule every minute while the app is open and starts a fresh session when a task is due, independent of any manual sessions you have open. Each task gets a small delay of a few minutes after the scheduled time to stagger API traffic. The delay is deterministic: the same task always starts at the same offset. Tasks only run while the desktop app is running and your computer is awake. If your computer sleeps through a scheduled time, the run is skipped. To prevent idle-sleep, turn on **Keep computer awake** in **Settings > This computer > System**. Closing the laptop lid still puts it to sleep. + +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. ## @@ -87,7 +159,7 @@ Manage scheduled tasks -In the **Code** tab, click a task in the **Routines** list to open its detail page. From here you can: +In the **Code** tab, click **Scheduled** in the sidebar, then click a task in the list to open its detail page. From here you can: * **Run now** : start the task immediately without waiting for the next scheduled time * **Status** : toggle between Active and Paused to pause or resume scheduled runs without deleting the task @@ -104,7 +176,7 @@ Related resources - * [Routines](</docs/en/routines>): run tasks in the cloud on a schedule, via API call, or in response to GitHub events, even when your computer is off + * [Cloud scheduled tasks](</docs/en/routines>): run tasks in the cloud on a schedule, via API call, or in response to GitHub events, even when your computer is off * [Run prompts on a schedule](</docs/en/scheduled-tasks>): session-scoped scheduling with `/loop` in the CLI * [Claude Code GitHub Actions](</docs/en/github-actions>): run Claude on a schedule in CI instead of on your machine * [Use Claude Code Desktop](</docs/en/desktop>): the full Desktop app guide
modified Claude Code Desktop in WSL View current →
--- a/desktop-wsl.md +++ b/desktop-wsl.md @@ -20,7 +20,7 @@ Pick a distribution -Start a new session in the Code tab and open the environment picker. Your installed WSL 2 distributions appear in a **WSL** section. Pick one. +Start a new session in the Code tab and open the [environment selector](</docs/en/desktop#start-a-session>) under the prompt box, or above it in the [earlier layout](</docs/en/desktop#check-which-layout-you-have>). Your installed WSL 2 distributions appear under **WSL**. Pick one. 2 @@ -34,7 +34,7 @@ The first session in a folder shows the workspace trust dialog. You grant trust per distribution and folder. A folder you trust in one distribution isn’t trusted in another distribution or at the same path on Windows. -The first session in a distribution takes a little longer while Claude sets up inside it. You can also open a `\\wsl.localhost\...` folder from the normal folder picker, and it reopens inside that distribution. Folders you’ve used recently appear in the picker per distribution, so reconnecting to a project is one click. +The first session in a distribution takes a little longer while Claude sets up inside it. You can also open a `\\wsl.localhost\...` folder from the normal folder picker, and it reopens inside that distribution. ## @@ -42,7 +42,23 @@ What works in a WSL session -Parallel sessions, side chats, visual diff review, branch and pull request status, and worktrees all work, backed by the git and toolchain inside the distribution. “Open in editor” opens VS Code connected to the distribution through [Remote - WSL](<https://code.visualstudio.com/docs/remote/wsl>). A few features aren’t available in WSL sessions yet: the integrated terminal, connectors and plugins, session forking, the file browser pane, and file suggestions when you type `@` in the composer. +Parallel sessions, side chats, visual diff review, branch and pull request status, and worktrees all work, backed by the git and toolchain inside the distribution. “Open in editor” opens VS Code connected to the distribution through [Remote - WSL](<https://code.visualstudio.com/docs/remote/wsl>). If a Desktop feature is unavailable or limited in a WSL session, check whether it’s one of these: + + * **Terminal and connectors** : your session may lack the [integrated terminal](</docs/en/desktop#run-commands-in-the-terminal>), [connectors](</docs/en/desktop#connect-external-tools>), or both. See If the terminal or connectors are unavailable. + * **[Plugins](</docs/en/desktop#install-plugins>)** : not available in WSL sessions + * **File editing** : you can view files in the [file pane](</docs/en/desktop#open-and-edit-files>) but can’t edit them there, so ask Claude to make the changes + * **Attachments** : if the **+** menu shows **Add image** in place of **Add files or photos** , you can attach only images. See [Add files and context to prompts](</docs/en/desktop#add-files-and-context-to-prompts>). + +### + +​ + +If the terminal or connectors are unavailable + +You can’t turn on the integrated terminal or connectors for a WSL session yourself: + + * **Claude account** : the two features are rolling out separately. Select **Help > Check for Updates…**, and if a feature is still missing after you update, there’s nothing to do. + * **[Third-party provider](</docs/en/third-party-integrations>)** : WSL sessions don’t get the terminal or connectors, and updating Desktop doesn’t change that ##
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -160,7 +160,7 @@ `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here -`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). A streaming request has to receive its response headers within it. Increase this when requests time out on slow networks or when routing through a proxy +`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers (default: 600000, or 10 minutes; maximum: 2147483647). It doesn’t limit how long a streaming response runs after that. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) @@ -192,8 +192,9 @@ `CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from applying small changes to an [artifact’s](</docs/en/artifacts#update-an-artifact>) file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, how full the context gets before compaction, from `100000` to `1000000` tokens. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting +`CLAUDE_CODE_AUTO_MODE_MODEL`| Sets the model for the classifier requests Claude Code sends in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Use a full model ID such as `claude-sonnet-4-6`. For the cases where Claude Code ignores it, see [Choose the classifier model](</docs/en/permission-modes#choose-the-classifier-model>). Requires Claude Code v2.1.302 or later `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies on Amazon Bedrock, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later @@ -205,7 +206,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) -`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` +`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` instead. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to turn off [1M context window](</docs/en/model-config#extended-context>) support. Claude Code removes `[1m]` model variants from the model picker and holds models that run with the 1M window by default to a 200K window. See [Turn off 1M context](</docs/en/model-config#turn-off-1m-context>). Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) @@ -226,7 +227,7 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files -`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session +`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the time limit on [critical-path removal](</docs/en/permission-modes#critical-paths>) prompts. In `auto` mode Claude Code then sends these removals to the classifier instead, and in `bypassPermissions` mode the prompt waits for your answer. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later @@ -238,6 +239,7 @@ `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later +`CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later @@ -268,7 +270,7 @@ `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 -`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep that pause from applying until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later @@ -280,7 +282,7 @@ `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders but is not auto-detected. See [which terminals Claude Code detects](</docs/en/plugins/mods/gallery#image-and-client>) and why it doesn’t help inside tmux or screen -`CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on +`CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later @@ -304,7 +306,7 @@ `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap -`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server; in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later @@ -555,7 +557,6 @@ * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) - * See what a [mod](</docs/en/plugins/mods/overview#where-mods-run>) draws in the VS Code extension’s chat panel; the mod’s hooks still run * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) @@ -571,12 +572,10 @@ First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. That session can also start in a different [permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) than your later sessions do. When Claude Code fetches the flags during that session, it saves them on the machine, so your next session on that machine has the feature and the usual starting permission mode. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>), but it doesn’t always wait for them. In setups such as these, sessions after the first also start without freshly fetched flags: +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. When Claude Code fetches its feature flags during that session, it saves them on the machine, so your next session on that machine has the feature. In setups such as these, sessions after the first also start without freshly fetched flags: * **A clean environment on every run** : if each run starts in a CI container, or any other environment without the flags an earlier session saved, every run is a first session * **A gateway token with no API key** : if you authenticate with `ANTHROPIC_AUTH_TOKEN` and no API key, and `ANTHROPIC_BASE_URL` points at a host other than Anthropic’s, such as an [LLM gateway](</docs/en/llm-gateway>), Claude Code has no credential to fetch the flags with - -To choose the permission mode that sessions in these setups start in, see [Start in a different permission mode](</docs/en/permission-modes#start-in-a-different-mode>). ##
modified Error reference View current →
Show diff (186 lines)
--- a/errors.md +++ b/errors.md @@ -31,6 +31,7 @@ `Auto mode classifier transcript exceeded context window`| Server errors `Agent aborted: auto mode classifier request refused by the safety safeguard`| Server errors `The server-side auto mode classifier gave no verdict`| Server errors +`<tool> was not reviewed and did not run: the conversation is too long for auto mode's classifier`| Server errors `Auto mode is unavailable — the server returned no safety verdict for the last 10 responses`| Server errors `Agent terminated early due to an API error`| Server errors `You've hit your session limit` / `You've hit your weekly limit` / `You've hit your Opus limit` / `You've hit your Sonnet limit`| Usage limits @@ -121,7 +122,7 @@ `SSL certificate verification failed`| Network `SSL certificate error (...)` during login or startup| Network `unable to get local issuer certificate`| Network -`403` with `x-deny-reason: host_not_allowed` in a cloud or routine session| Network +`403` with `x-deny-reason: host_not_allowed` in a cloud session or cloud scheduled task| Network `proxy refused the connection`| Network `403` with `GitHub GraphQL is not available from Claude Code sessions` in a cloud session| [GitHub proxy](</docs/en/cloud-environments#github-proxy>) `The cloud environments service returned an empty response` / `The cloud environments service returned a response in an unexpected format`| Network @@ -457,7 +458,7 @@ [`CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`](</docs/en/env-vars>)| unset| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later. [`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`](</docs/en/env-vars>)| 500| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 32000, to spread the retries over a longer window when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later. [`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`](</docs/en/env-vars>)| 32000| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error. Raise it, up to 64000, so that later retries keep spreading apart when the API is at capacity. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later. -[`API_TIMEOUT_MS`](</docs/en/env-vars>)| 600000| Per-request timeout in milliseconds. Raise it for slow networks or proxies. It also caps how long Claude Code waits for response headers, described in No response from API. +[`API_TIMEOUT_MS`](</docs/en/env-vars>)| 600000| Time in milliseconds that each request attempt has to receive its response headers. It doesn’t limit how long a streaming response runs after that. Raise it for slow networks or proxies. For how it caps the first-byte deadline, see No response from API. [`CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`](</docs/en/env-vars>)| unset| Limit on re-sends of a non-streaming request that times out. At the limit, the request fails. A response from Claude that takes longer than the timeout to generate times out again on every re-send, so set a low number such as `0` to fail sooner. Each non-streaming attempt times out after 300 seconds in a local session, or after `API_TIMEOUT_MS` when you set a positive value. Requires Claude Code v2.1.285 or later. [`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`](</docs/en/env-vars>)| unset| Deadline in milliseconds for the first response byte of a streaming request. Requires Claude Code v2.1.242 or later. For how Claude Code picks the deadline when this is unset, see No response from API. @@ -511,7 +512,7 @@ Request timed out -This can happen during periods of high load or when the model is generating a very large response. The default request timeout is 10 minutes. **What to do:** +The default request timeout is 10 minutes. **What to do:** * Retry the request * If a slow network or proxy is the cause, raise `API_TIMEOUT_MS` as described in Automatic retries @@ -593,11 +594,12 @@ <model> is temporarily unavailable, so auto mode cannot determine the safety of <tool> right now. Wait a moment and then try this action again. -In an interactive session, a dim `Not run · auto mode's check had no usable answer` row appears under the tool call instead of this message. Press `Ctrl+O` to read the message in the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>). The denials under The server returned no safety verdict show the same row. Before v2.1.296, the message appeared under the call as a red error. When Claude Code can determine the failure category, it names the category in parentheses after `temporarily unavailable`, for example `<model> is temporarily unavailable (rate-limited), so auto mode cannot determine the safety of <tool> right now`. The categories are `(rate-limited)`, `(overloaded)`, `(server error)`, `(timed out)`, and `(connection failed)`. If `(timed out)` or `(connection failed)` repeats, check your connection; see Unable to connect to API. Before v2.1.229, the message never named a category and read `Wait briefly and then try this action again`. When no category fits, the message appears with no category in parentheses; more than one failure produces that form. On [Amazon Bedrock](</docs/en/amazon-bedrock>), including the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), it also appears when your AWS account can’t invoke the model named in the message, and that failure repeats on every retry until your account is granted access to the model. **What to do:** +In an interactive session, a dim `Not run · auto mode's check had no usable answer` row appears under the tool call instead of this message. Press `Ctrl+O` to read the message in the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>). The `gave no verdict` denials under The server returned no safety verdict show the same row. Before v2.1.296, the message appeared under the call as a red error. When Claude Code can determine the failure category, it names the category in parentheses after `temporarily unavailable`, for example `<model> is temporarily unavailable (rate-limited), so auto mode cannot determine the safety of <tool> right now`. The categories are `(rate-limited)`, `(overloaded)`, `(server error)`, `(timed out)`, and `(connection failed)`. If `(timed out)` or `(connection failed)` repeats, check your connection; see Unable to connect to API. Before v2.1.229, the message never named a category and read `Wait briefly and then try this action again`. When no category fits, the message appears with no category in parentheses; more than one failure produces that form. On [Amazon Bedrock](</docs/en/amazon-bedrock>), including the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), it also appears when your AWS account can’t invoke the model named in the message, and that failure repeats on every retry until your account is granted access to the model. **What to do:** * Retry after a few seconds; Claude sees the same message and usually retries on its own. A transient failure is unrelated to [auto mode eligibility](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>); you don’t need to change settings * If retries keep failing, continue with read-only tasks and come back to the blocked action later * On Amazon Bedrock, if the message returns on every retry, check that your account can invoke the model it names: for standard Amazon Bedrock models, confirm your [IAM policy](</docs/en/amazon-bedrock#iam-configuration>) allows invoking it; for Mantle model IDs, [contact your AWS account team](</docs/en/amazon-bedrock#mantle-endpoint-errors>) + * If the message returns on every retry and names the model you set in [`CLAUDE_CODE_AUTO_MODE_MODEL`](</docs/en/permission-modes#choose-the-classifier-model>), check that the API or cloud provider your session runs on serves that model ID. If it doesn’t, set the variable to a model ID it serves, or unset the variable to use the [default classifier model](</docs/en/permission-modes#default-classifier-model>). When a classifier request fails because your OAuth token expired or was rotated by another session, Claude Code refreshes the token and retries the request once, so a routine token expiry doesn’t surface as this message. Before v2.1.216, an expired or rotated token failed each classifier request, and auto mode denied every checked action with this message until the token was refreshed. When the classifier returned an unparseable response: @@ -624,7 +626,7 @@ * In an interactive session, switch to a different [permission mode](</docs/en/permission-modes>) so you can approve the action when prompted * Start a fresh conversation without the triggering content -When the conversation has grown larger than the classifier’s context window: +When the conversation is too long for Claude Code’s classifier request and Claude Code can’t compact it on its own: Auto mode classifier transcript exceeded context window — falling back to manual approval (try /compact to reduce conversation size) @@ -661,12 +663,34 @@ **What to do:** + * In an interactive session, press `Ctrl+O` to read the denial text in the [transcript viewer](</docs/en/interactive-mode#transcript-viewer>). + * If the denial names `(the conversation is too long for the check)`, run `/compact` at the Claude Code prompt to shorten the conversation. Until the conversation is shorter, sending another message gets the same denial. If you turned [auto-compact](</docs/en/settings-reference#autocompactenabled>) off, turn it back on so Claude Code compacts on its own next time. * Send another message to have Claude try again. The count of responses starts over. * If the stop repeats and your requests go through an [LLM gateway or proxy](</docs/en/llm-gateway>), check whether it cuts streaming responses short or rewrites them. [Server-side classifier review](</docs/en/permission-modes#server-side-classifier-review>) says which gateway behavior causes denials, and the [gateway compatibility guide](</docs/en/llm-gateway-protocol#feature-pass-through>) lists what to pass through unchanged. * Set `CLAUDE_CODE_AUTO_MODE_SERVER=0` before you start Claude Code to use its own classifier requests instead. Before v2.1.281, Claude Code didn’t read the variable on a direct connection to the Anthropic API. * To approve the actions yourself instead, [switch out of auto mode](</docs/en/permission-modes#switch-permission-modes>) -Before v2.1.280, Claude Code denied each action from a response without a verdict immediately and never stopped the turn. +Before v2.1.280, Claude Code denied each action from a response without a verdict immediately and never stopped the turn. Before v2.1.302, on a direct connection to the Anthropic API, Claude Code didn’t compact a conversation that had grown too long for the server’s check. + +### + +​ + +Was not reviewed and did not run + +A `was not reviewed and did not run` denial means the conversation is too long for the [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier to check the action, so the action didn’t run. Claude Code returns this message to Claude: + + <tool> was not reviewed and did not run: the conversation is too long for auto mode's classifier. Claude Code will try to compact the conversation before the next request; if this action is still needed after that, issue it again and it will be reviewed normally. + +If the compaction fails, later actions the classifier can’t check get one of two other messages: + + * A `gave no verdict (the conversation is too long for the check)` denial + * The `Auto mode classifier transcript exceeded context window` message + +**What to do:** + + * If the compaction the message announces succeeds, you don’t need to do anything. + * If you see either of those two messages, run `/compact` at the Claude Code prompt to shorten the conversation yourself. If you turned [auto-compact](</docs/en/settings-reference#autocompactenabled>) off, turn it back on so Claude Code compacts on its own next time. ### @@ -1033,14 +1057,13 @@ Routines are disabled by your organization’s policy -An Owner in your Team or Enterprise organization has turned off routines at the organization level. The error appears when you try to create or run a routine, for example from the [Routines](</docs/en/routines>) UI on claude.ai/code. On Claude Code v2.1.227 or later, the same setting also [hides `/schedule`](</docs/en/routines#troubleshooting>) in the CLI. +An Owner in your Team or Enterprise organization has turned off [cloud scheduled tasks](</docs/en/routines>), formerly routines, at the organization level. The error appears when you try to create or run one, for example at [claude.ai/code/routines](<https://claude.ai/code/routines>). On Claude Code v2.1.227 or later, the same setting also [hides `/schedule`](</docs/en/routines#troubleshooting>) in the CLI. Routines are disabled by your organization's policy. This is a server-side setting, so it can’t be overridden from local settings, environment variables, or CLI flags. **What to do:** - * Ask an Owner in your organization to enable the **Routines** toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>) - * For one-off scheduled work that does not require organization-level routines, see [scheduled tasks](</docs/en/scheduled-tasks>) + * Ask an Owner in your organization to turn on the **Scheduled tasks (Was Routines)** toggle at [**Organization settings > Capabilities > Remote sessions**](<https://claude.ai/admin-settings/capabilities>) ### @@ -1801,14 +1824,19 @@ Host not allowed in a cloud session -An outbound HTTP request from a cloud session or routine was blocked by the environment’s network policy. +An outbound HTTP request from a cloud session or cloud scheduled task was blocked by the environment’s network policy. HTTP 403 x-deny-reason: host_not_allowed -You may also see a TLS certificate that doesn’t match the destination’s real certificate. Cloud sessions route outbound traffic through a proxy that enforces the network policy, so a mismatched certificate means the proxy terminated the connection, not the destination. This is not a client-side network problem. Cloud sessions and [routines](</docs/en/routines>) run inside a sandboxed VM whose outbound traffic through the session’s network is filtered to the [cloud environment’s](</docs/en/cloud-environments>) allowlist; [GitHub operations](</docs/en/cloud-environments#github-proxy>) and MCP connector traffic use separate channels, which is why they can keep working while other hosts are blocked. The **Default** environment uses **Trusted** access, which permits the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains and blocks other domains on that path. **What to do:** These steps change one of your own environments. An [organization-shared environment](</docs/en/cloud-environments#organization-shared-environments>) opens read-only in the selector, so ask an Owner to change its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). - - * Open your environment for editing, either from the [routine’s form](</docs/en/routines#environments-and-network-access>) or from the [environment selector](</docs/en/cloud-environments#configure-your-environment>) where you start cloud sessions. +You may also see a TLS certificate that doesn’t match the destination’s real certificate. Cloud sessions route outbound traffic through a proxy that enforces the network policy, so a mismatched certificate means the proxy terminated the connection, not the destination. This error is not a client-side network problem. Cloud sessions and [cloud scheduled tasks](</docs/en/routines>) run inside a sandboxed VM whose outbound traffic through the session’s network is filtered to the [cloud environment’s](</docs/en/cloud-environments>) allowlist: + + * **GitHub and connector traffic** : [GitHub operations](</docs/en/cloud-environments#github-proxy>) and MCP connector traffic use separate channels, which is why they can keep working while other hosts are blocked + * **Default environment** : the **Default** environment uses **Trusted** access, which permits the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains and blocks other domains on that path + +**What to do:** These steps change one of your own environments. An [organization-shared environment](</docs/en/cloud-environments#organization-shared-environments>) opens read-only in the selector, so ask an Owner to change its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>). + + * Open your environment for editing, either from the [cloud scheduled task’s form](</docs/en/routines#environments-and-network-access>) or from the [environment selector](</docs/en/cloud-environments#configure-your-environment>) where you start cloud sessions. * In the **Edit cloud environment** dialog, change **Network access** from **Trusted** to **Custom** , then add the blocked domain to **Allowed domains**. Enter one domain per line. Check **Also include default list of common package managers** to keep the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) alongside your custom domains. Select **Full** instead if you want unrestricted access. * Click **Save changes**. The next run uses the updated allowlist. For a cloud session that’s already open, see [when a network access change reaches existing sessions](</docs/en/cloud-environments#network-access>). @@ -3284,9 +3312,9 @@ * [Agent SDK](</docs/en/agent-sdk/overview>) applications * The Code tab of the [Desktop app](</docs/en/desktop>) * The chat panel of the [VS Code extension](</docs/en/vs-code>) - * [Cloud sessions](</docs/en/claude-code-on-the-web>) and [routines](</docs/en/routines>) - -For a built-in command that can’t run in one of those sessions, Claude Code still answers that the command isn’t available instead of sending it to Claude. Before v2.1.274, only cloud sessions and routines sent an unmatched name to Claude. Before v2.1.273, they answered `Unknown command` too. Claude Code doesn’t treat every prompt that starts with `/` as a command. It sends the prompt to Claude as a normal message when the first word after the `/` starts with punctuation, such as the `/--` that opens a Lean doc comment, or is a path such as `/var/log/syslog`. Before v2.1.236, if you pressed `Enter` while the command menu listed a near match for the name you typed, Claude Code ran that match, so a typo such as `/hepl` ran `/help` instead of producing this message. **What to do:** + * [Cloud sessions](</docs/en/claude-code-on-the-web>) and [cloud scheduled tasks](</docs/en/routines>) + +For a built-in command that can’t run in one of those sessions, Claude Code still answers that the command isn’t available instead of sending it to Claude. Before v2.1.274, only cloud sessions and cloud scheduled tasks sent an unmatched name to Claude. Before v2.1.273, they answered `Unknown command` too. Claude Code doesn’t treat every prompt that starts with `/` as a command. It sends the prompt to Claude as a normal message when the first word after the `/` starts with punctuation, such as the `/--` that opens a Lean doc comment, or is a path such as `/var/log/syslog`. Before v2.1.236, if you pressed `Enter` while the command menu listed a near match for the name you typed, Claude Code ran that match, so a typo such as `/hepl` ran `/help` instead of producing this message. **What to do:** * Run the suggested name, or type `/` followed by part of the name to see what’s available in this session * If Claude Code reports a documented command as unknown, check its row in the [commands reference](</docs/en/commands>) for the requirement it names @@ -3416,7 +3444,7 @@ GitHub isn't connected to your Claude account, so this repository can't be cloned in the cloud. Run /web-setup to connect with your GitHub CLI login, or connect on the web at https://claude.ai/connect-github -When you create a routine with [`/schedule`](</docs/en/routines>), the same message appears as a setup note that names the repository; the note doesn’t block creating the routine. **What to do:** +When you create a cloud scheduled task with [`/schedule`](</docs/en/routines>), the same message appears as a setup note that names the repository; the note doesn’t block creating the task. **What to do:** * Run `/web-setup` to connect your GitHub CLI login to your Claude account, or connect an account at [claude.ai/connect-github](<https://claude.ai/connect-github>). See [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>) for how the two differ. * Rerun the command a minute after connecting @@ -3658,14 +3686,14 @@ /recap only runs when you ask for it yourself -The [`/recap`](</docs/en/interactive-mode#session-recap>) request didn’t come from your own input. It arrived in a message relayed into the session from a Slack, Teams, or [project](</docs/en/claude-projects>) thread, or in a prompt that a [routine](</docs/en/routines>) or another program sent. A relayed message gets the notice even when you wrote it yourself. Claude Code can’t tell that a relayed or automated message came from the person whose account runs the session, so it answers with this notice instead of a summary: +The [`/recap`](</docs/en/interactive-mode#session-recap>) request didn’t come from your own input. It arrived in a message relayed into the session from a Slack, Teams, or [project](</docs/en/claude-projects>) thread, or in a prompt that a [cloud scheduled task](</docs/en/routines>) or another program sent. A relayed message gets the notice even when you wrote it yourself. Claude Code can’t tell that a relayed or automated message came from the person whose account runs the session, so it answers with this notice instead of a summary: /recap only runs when you ask for it yourself in this session: from the terminal, the Claude app or claude.ai/code, or over Remote Control. A message relayed from Slack, Teams or a project thread, or sent by a routine or another program, can't request it. A `/recap` you pass to `claude -p`, or that your own [Agent SDK](</docs/en/agent-sdk/overview>) application sends to a session it launched, counts as your own input. **What to do:** * Open the session yourself and run `/recap` there: in its terminal, in the [Desktop app](</docs/en/desktop>) or the [mobile app](</docs/en/mobile>), at [claude.ai/code](<https://claude.ai/code>), or over [Remote Control](</docs/en/remote-control>) - * If a routine or another program sent it, remove `/recap` from that prompt + * If a cloud scheduled task or another program sent it, remove `/recap` from that prompt ## @@ -3987,7 +4015,8 @@ * Correct each entry the error names against the [tools available to subagents](</docs/en/sub-agents#available-tools>) * Remove entries for tools the session doesn’t have, such as MCP tools from a server that isn’t connected * If the entry names a connected MCP server, compare the entry with that server’s name as the server’s [tool names](</docs/en/permissions#mcp>) spell it, such as `reports__v2` in `mcp__reports__v2__get_totals`. For that server, write `mcp__reports__v2__*`, which is `mcp__` followed by the whole name and `__*`. With the shorter `mcp__reports`, which names a server called `reports`, the subagent gets none of the `reports__v2` tools - * For a tool that [background subagents drop](</docs/en/sub-agents#available-tools>), such as `CronCreate`, remove the entry. To keep the tool, [turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) and ask Claude to run the subagent in the foreground + * For a tool that [background subagents drop](</docs/en/sub-agents#available-tools>), such as `CronCreate`, remove the entry + * To keep a tool such as `CronCreate` instead, [let Claude wait for the subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>), since a subagent Claude waits for runs in the foreground and keeps the tool. If the definition sets `background: true`, remove that field first, because it keeps the subagent in the background * Delete the `tools` field instead of listing tools to give the subagent every [tool available to subagents](</docs/en/sub-agents#available-tools>) * For a `tools` list that contains only `Agent`, raise the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) or give the agent at least one other tool: Claude Code withholds `Agent` at that limit, so a list with nothing else in it resolves to no tools
modified React to events with a mod View current →
--- a/events.md +++ b/events.md @@ -128,7 +128,7 @@ * **Answer the call yourself** : return an object with a `result` field, without calling `next`, and for a built-in tool, give `result` the shape that tool’s own result has in [the types for your build](</docs/en/plugins/mods/create#get-the-types-for-your-build>). No permission prompt appears and the tool doesn’t run, so the result you return is all Claude learns about what happened. * **Withhold the result from Claude** : return `{ deny: reason }` after `await next(e)`. Claude reads your reason in place of what `next` returned. When the tool ran, the deny keeps its result from Claude and undoes nothing the tool did. When the tool ran and succeeded, the reason follows a note such as `Bash ran, and a plugin withheld its result:`. -Hooks in your organization’s [managed settings](</docs/en/server-managed-settings>) run before any mod’s `tool.call` hook, and a block from one of them is final. +Hooks in your organization’s [managed settings](</docs/en/server-managed-settings>) run before any mod’s `tool.call` hook. When a managed hook blocks the call, no mod’s `tool.call` hook runs for that call. #### @@ -191,7 +191,9 @@ * **On`main`**: the hook returns `deny`, even when a rule allows `git push` * **On another branch, and for other commands** : the call gets the decision it would get without the mod -The hook matches the text of the command, so treat it as a reminder for Claude. To block pushes to `main` for everyone, protect the branch on your Git host. A hook can return `allow`, `ask`, or `deny`, so it can also approve a call that a `PreToolUse` hook outside managed settings blocked. In [plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>), for a call that isn’t read-only, such as a file edit, your hook can tighten the decision `next(e)` returns but can’t loosen it. [Extend permissions with hooks](</docs/en/permissions#extend-permissions-with-hooks>) lists which decisions hold over a mod. +The hook matches the text of the command, so treat it as a reminder for Claude. To block pushes to `main` for everyone, protect the branch on your Git host. + +A `tool.check` hook can also return `allow` or `ask`. In [plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>), for a call that isn’t read-only, such as a file edit, your hook can tighten the decision `next(e)` returns but can’t loosen it. For the permission rules and `PreToolUse` hook decisions your hook’s `allow` can’t replace, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). ### @@ -299,10 +301,10 @@ The `PreToolUse` hooks configured in settings files also run during a tool call, at fixed points in the chain of mods: - * **`PreToolUse` hooks from managed settings**: run before the first mod’s `tool.call` hook, and a block from one of them is final, so no mod sees the call. + * **`PreToolUse` hooks from managed settings**: run before the first mod’s `tool.call` hook. When a managed hook blocks the call, no mod’s `tool.call` hook runs for that call. * **`PreToolUse` hooks from every other settings file and from plugins’ `hooks/hooks.json`**: run after the last mod calls `next`, as part of Claude Code’s own behavior. A mod that answers `tool.call` without calling `next` keeps them from running, and a mod that calls `next` sees their decision in the result it returns. -A `tool.check` hook can approve a call that a `PreToolUse` hook outside managed settings blocked, because `tool.check` fires after those hooks and the permission rules have decided. In plan mode, a `tool.check` hook can approve such a call when it’s read-only, but not a file edit or another call that isn’t read-only. +`tool.check` fires after the permission rules and both groups of `PreToolUse` hooks have decided. To learn which of those decisions a `tool.check` hook’s `allow` can’t replace, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). ###
modified Speed up responses with fast mode View current →
--- a/fast-mode.md +++ b/fast-mode.md @@ -25,7 +25,7 @@ * A small `↯` icon appears next to the prompt while fast mode is active * Run `/fast` again at any time to check whether fast mode is on or off -Opus 5.5 is the fast mode default in Claude Code v2.1.280 and later. Before v2.1.280, fast mode defaulted to Opus 5 from v2.1.219, to Opus 4.8 on v2.1.154 through v2.1.218, and to Opus 4.7 on v2.1.142 through v2.1.153. When you disable fast mode with `/fast` again, you remain on Opus. To switch to a different model, use `/model`. +Opus 5.5 is the fast mode default in Claude Code v2.1.280 and later. Before v2.1.280, fast mode defaulted to Opus 5 from v2.1.219, and to Opus 4.8 on v2.1.154 through v2.1.218. When you disable fast mode with `/fast` again, you remain on Opus. To switch to a different model, use `/model`. ###
modified Feature availability View current →
--- a/feature-availability.md +++ b/feature-availability.md @@ -50,7 +50,7 @@ * [Cloud sessions](</docs/en/claude-code-on-the-web>) and Claude Code on mobile * [Claude Code in Slack](</docs/en/slack>): Pro and Max plans * [Claude Code Desktop](</docs/en/desktop>) - * [Routines](</docs/en/routines>) (`/schedule`) + * [Cloud scheduled tasks](</docs/en/routines>) (`/schedule`) * [Ultrareview](</docs/en/ultrareview>) * [Code Review](</docs/en/code-review>): Team and Enterprise plans * [Remote Control](</docs/en/remote-control>) @@ -162,7 +162,7 @@ Feature| Pro| Max| Team| Enterprise ---|---|---|---|--- [Cloud sessions](</docs/en/claude-code-on-the-web>)| ✓| ✓| ✓| ✓ 6 -[Routines](</docs/en/routines>)| ✓| ✓| ✓| ✓ +[Cloud scheduled tasks](</docs/en/routines>)| ✓| ✓| ✓| ✓ [Remote Control](</docs/en/remote-control>)| ✓| ✓| Admin-enabled| Admin-enabled [Channels](</docs/en/channels>)| ✓| ✓| Admin-enabled| Admin-enabled [Computer use](</docs/en/computer-use>)| ✓| ✓| ✗| ✗
modified Fullscreen rendering View current →
--- a/fullscreen.md +++ b/fullscreen.md @@ -83,7 +83,7 @@ * **Click in the prompt input** to position your cursor anywhere in the text you’re typing. * **Click a suggestion in the`/` command or `@` file list** to accept it. Hovering highlights the row under your cursor. * **Click an option in a select menu** to choose it. This covers permission prompts, `/model`, `/config`, and other dialogs that show a list of options. - * **Click an option in a multi-select menu** to toggle it, and click the submit button to confirm your choices. Clicking a free-text row, such as the `Other` row in a multiple-choice question, focuses its input field so you can type an answer. Requires Claude Code v2.1.208 or later. + * **Click an option in a multi-select menu** to toggle it, and click the submit button to confirm your choices. Clicking a free-text row, such as the `Other` row in a multiple-choice question, focuses its input field so you can type an answer. * **Click a setting’s value in the`/config` panel** to change it, and scroll the settings list with the mouse wheel. Requires Claude Code v2.1.271 or later. * **Scroll a select or multi-select menu with the mouse wheel** when it has more options than it shows at once, such as the `/model` list in a short terminal window. The wheel scrolls the list while the pointer is over its options. Requires Claude Code v2.1.280 or later. * **Scroll an overflowing list with its scrollbar.** In list panels such as `/skills`, `/mcp`, and `/plugin`’s Installed list, a scrollbar appears beside a list with more rows than fit while the pointer is over it. Click the track to jump to that point, or drag the thumb. Requires Claude Code v2.1.281 or later. @@ -124,7 +124,7 @@ `Ctrl+End`| Jump to the latest message and re-enable auto-follow Mouse wheel| Scroll a few lines at a time -You can scroll back to the start of the session even after [compaction](</docs/en/context-window#what-survives-compaction>). Claude continues working from the compaction summary, but Claude Code keeps every earlier message in the fullscreen scrollback across repeated compactions. On keyboards without dedicated `PgUp`, `PgDn`, `Home`, or `End` keys, like MacBook keyboards, hold `Fn` with the arrow keys: `Fn+↑` sends `PgUp`, `Fn+↓` sends `PgDn`, `Fn+←` sends `Home`, and `Fn+→` sends `End`. `Ctrl+Fn+→` doesn’t reach Claude Code on macOS, so a MacBook keyboard has no working jump-to-bottom chord by default. Instead, use one of these options: +If you close a [compacted](</docs/en/context-window#what-survives-compaction>) session and [resume](</docs/en/sessions#what-a-resumed-session-restores>) it, scrolling up stops at the `Conversation compacted` row, and your earlier messages stay on disk in the [transcript file](</docs/en/sessions#where-transcripts-are-stored>). To get a detail from those messages, ask Claude to look it up in that file. On keyboards without dedicated `PgUp`, `PgDn`, `Home`, or `End` keys, like MacBook keyboards, hold `Fn` with the arrow keys: `Fn+↑` sends `PgUp`, `Fn+↓` sends `PgDn`, `Fn+←` sends `Home`, and `Fn+→` sends `End`. `Ctrl+Fn+→` doesn’t reach Claude Code on macOS, so a MacBook keyboard has no working jump-to-bottom chord by default. Instead, use one of these options: * Click the jump-to-bottom button. * Scroll to the bottom with the mouse wheel to resume following.
modified Run Claude Code through a gateway View current →
--- a/gateways.md +++ b/gateways.md @@ -32,7 +32,7 @@ Claude apps gateway -Claude apps gateway is Anthropic’s self-hosted gateway, included in the `claude` binary. It routes to Amazon Bedrock, Claude Platform on AWS, Google Cloud, Microsoft Foundry, or the Anthropic API as the upstream. Developers sign in with your corporate identity provider through `/login`, the gateway enforces model access and [managed settings](</docs/en/managed-settings>) by IdP group, and it emits [OpenTelemetry Protocol (OTLP)](</docs/en/monitoring-usage>) usage metrics to your own observability stack. Because it is built and tested alongside each Claude Code release, it forwards the headers and request fields Claude Code sends. A gateway maintained separately needs its [forwarding rules updated](</docs/en/llm-gateway-protocol#forward-as-open-lists>) as those headers and fields change with each release; Claude apps gateway releases with the CLI, so there is no list to keep current. See [Availability and limitations](</docs/en/claude-apps-gateway#availability-and-limitations>) for the small set of features that behave differently on a gateway session. The gateway sign-in is a browser SSO step, and there is no service-token flow, so a CI pipeline with no developer to approve the sign-in can’t authenticate through it; configure those against your provider directly. Agent SDK sessions and `claude -p` runs on a machine where a developer has signed in use that machine’s gateway session and are governed by its policies. See [CI pipelines and remote machines](</docs/en/claude-apps-gateway#ci-pipelines-and-remote-machines>). See [Claude apps gateway](</docs/en/claude-apps-gateway>) to deploy it. +Claude apps gateway is Anthropic’s self-hosted gateway, included in the `claude` binary. It routes to Amazon Bedrock, Claude Platform on AWS, Google Cloud, Microsoft Foundry, or the Anthropic API as the upstream. Developers sign in with your corporate identity provider through `/login`, the gateway enforces model access and [managed settings](</docs/en/managed-settings>) by IdP group, and it emits [OpenTelemetry Protocol (OTLP)](</docs/en/monitoring-usage>) usage metrics to your own observability stack. Because it is built and tested alongside each Claude Code release, it forwards the `anthropic-beta` values and request fields Claude Code sends. A gateway maintained separately needs its [forwarding rules updated](</docs/en/llm-gateway-protocol#forward-as-open-lists>) as those change with each release; Claude apps gateway releases with the CLI, so there is no list to keep current. See [Availability and limitations](</docs/en/claude-apps-gateway#availability-and-limitations>) for the small set of features that behave differently on a gateway session. The gateway sign-in is a browser SSO step, and there is no service-token flow, so a CI pipeline with no developer to approve the sign-in can’t authenticate through it; configure those against your provider directly. Agent SDK sessions and `claude -p` runs on a machine where a developer has signed in use that machine’s gateway session and are governed by its policies. See [CI pipelines and remote machines](</docs/en/claude-apps-gateway#ci-pipelines-and-remote-machines>). See [Claude apps gateway](</docs/en/claude-apps-gateway>) to deploy it. ###
modified Claude Code with GitHub Enterprise Server View current →
--- a/github-enterprise-server.md +++ b/github-enterprise-server.md @@ -112,7 +112,7 @@ claude --cloud "Add retry logic to the payment webhook handler" -The session clones your repository from GHES and pushes changes back to a branch. Monitor progress at [claude.ai/code](<https://claude.ai/code>). See [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) for the full cloud session workflow including diff review, auto-fix, and routines. +The session clones your repository from GHES and pushes changes back to a branch. Monitor progress at [claude.ai/code](<https://claude.ai/code>). See [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) for the full cloud session workflow including diff review, auto-fix, and cloud scheduled tasks. ###
modified Glossary View current →
--- a/glossary.md +++ b/glossary.md @@ -136,7 +136,7 @@ Cloud session -A Claude Code session that keeps running after you close your laptop, because it runs on cloud infrastructure instead of your machine: Anthropic-managed by default, or a [self-hosted environment](</docs/en/self-hosted-environments>) your organization operates. You start one from claude.ai/code, the Claude mobile app, the Desktop app with **Cloud** selected, `claude --cloud`, or a [routine](</docs/en/routines>). A session in your terminal, IDE, or the Desktop app with **Local** selected is a local session; to reach a local session from another device, use Remote Control. Learn more: [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) +A Claude Code session that keeps running after you close your laptop, because it runs on cloud infrastructure instead of your machine. That infrastructure is Anthropic-managed by default, or a [self-hosted environment](</docs/en/self-hosted-environments>) your organization operates. You start one from claude.ai/code, the Claude mobile app, the Desktop app with **Cloud** selected, `claude --cloud`, or a [cloud scheduled task](</docs/en/routines>). A session in your terminal, IDE, or the Desktop app with **Local** selected is a local session; to reach a local session from another device, use Remote Control. Learn more: [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>) ###
modified Keep Claude working toward a goal View current →
--- a/goal.md +++ b/goal.md @@ -21,7 +21,7 @@ `/goal` and a Stop hook both fire after every turn. `/goal` is a session-scoped shortcut: you type a condition and it’s active for the current session only. A Stop hook lives in your settings file, applies to every session in its scope, and can run a script for deterministic checks or a prompt for model-evaluated ones. [Auto mode](</docs/en/auto-mode-config>) on its own approves tool calls within a single turn but doesn’t start a new one. Claude stops when it judges the work done. `/goal` adds a separate evaluator that checks your condition after every turn, so completion is decided by a fresh model rather than the one doing the work. The two are complementary: auto mode removes per-tool prompts, and `/goal` removes per-turn prompts. -The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud routines and desktop scheduled tasks. +The approaches above keep the current session running. You can also schedule work that runs independent of any open session, such as nightly tests or morning triage. See [scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>) for cloud and Desktop scheduled tasks. ##
modified Run Claude Code programmatically View current →
--- a/headless.md +++ b/headless.md @@ -110,7 +110,7 @@ Piped stdin is capped at 10MB. If you exceed the cap, Claude Code exits with a clear error and a non-zero status. To work with larger inputs, write the content to a file and reference the file path in your prompt instead of piping it. -If Claude Code can’t read stdin, for example because the process that started it disconnected its end, Claude Code prints a warning to stderr and continues with the prompt from the command line. Before v2.1.211, an unreadable stdin on Windows crashed the session or made it exit silently with no output. +If Claude Code can’t read stdin, for example because the process that started it disconnected its end, Claude Code prints a warning to stderr and continues with the prompt from the command line. ### @@ -173,7 +173,7 @@ claude -p "Explain recursion" --output-format stream-json --verbose --include-partial-messages -The last line of the stream is a `result` message with the final response text, cost, and session metadata. If your consumer reads the stream slowly, Claude Code waits for the queued output to drain before exiting, scaling the wait with how much is still queued, capped at 30 seconds. Before v2.1.214 the exit wait was capped at about two seconds, which could cut off the end of a large response. The following example uses [jq](<https://jqlang.org/>) to filter for text deltas and display only the streaming text. The `-r` flag outputs raw strings (no quotes) and `-j` joins without newlines so tokens stream continuously: +The last line of the stream is a `result` message with the final response text, cost, and session metadata. If your consumer reads the stream slowly, Claude Code waits for the queued output to drain before exiting, scaling the wait with how much is still queued, capped at 30 seconds. The following example uses [jq](<https://jqlang.org/>) to filter for text deltas and display only the streaming text. The `-r` flag outputs raw strings (no quotes) and `-j` joins without newlines so tokens stream continuously: claude -p "Write a poem" --output-format stream-json --verbose --include-partial-messages | \ jq -rj 'select(.type == "stream_event" and .event.delta.type? == "text_delta") | .event.delta.text' @@ -201,7 +201,6 @@ For a forked skill started from the prompt, match `parent_tool_use_id` on the `forked-command-` prefix, because the name after it can differ from the one you typed. If some of these messages are missing from your stream, check your Claude Code version against these minimums: - * **`--forward-subagent-text` and `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`**: v2.1.211 or later * **Forwarding at every nesting depth** : v2.1.219 or later * **A forked skill that Claude starts with the Skill tool from the main conversation** : v2.1.86 or later for its `tool_use` and `tool_result` blocks, and v2.1.265 or later for its first `user` message and its text and thinking blocks * **Messages of subagents that a forked skill spawns, and of forked skills started inside a subagent or another forked skill** : v2.1.275 or later @@ -292,10 +291,10 @@ claude -p "Run the test suite and fix any failures" \ --allowedTools "Bash,Read,Edit" -To set a baseline for the whole session instead of listing individual tools, pass a [permission mode](</docs/en/permission-modes>). A run where nothing sets a permission mode takes the [built-in starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>), which can be `auto`, so pass the one you want: +Calls to tools you didn’t list run if they need no approval. In a [Manual mode](</docs/en/permission-modes#available-modes>) `claude -p` run, a call that needs approval is denied unless something approves it, such as a [`PermissionRequest` hook](</docs/en/hooks#permissionrequest>) or a [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>). With Claude Code v2.1.302 or later, `claude -p` runs start in Manual mode when [nothing sets a permission mode](</docs/en/permission-modes#which-mode-a-non-interactive-run-starts-in>). To set a baseline for the whole session instead of listing individual tools, pass a [permission mode](</docs/en/permission-modes>) with `--permission-mode`, such as `auto`, `dontAsk`, or `acceptEdits`: * **`auto`** : pass `--permission-mode auto` to have a classifier review most actions instead of you - * **`dontAsk`** : Claude Code denies every call that would otherwise prompt, which is useful for locked-down CI runs. Actions that need no approval in Manual mode still run, such as file reads in your working directories and the [read-only command set](</docs/en/permissions#read-only-commands>), and so do actions your `--allowedTools` entries or `permissions.allow` rules cover. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and [reads from network paths](</docs/en/permissions#network-paths>) are denied even when an allow rule matches + * **`dontAsk`** : Claude Code denies every call that would otherwise prompt, which is useful for locked-down CI runs, 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>). Actions that need no approval in Manual mode still run, such as file reads in your working directories and the [read-only command set](</docs/en/permissions#read-only-commands>). Actions covered by your `--allowedTools` entries or `permissions.allow` rules also run. `AskUserQuestion`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), and [reads from network paths](</docs/en/permissions#network-paths>) are denied even when an allow rule matches * **`acceptEdits`** : Claude writes files without prompting, and Claude Code auto-approves common filesystem commands such as `mkdir`, `touch`, `mv`, and `cp`. The [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) still apply. Apart from the read-only command set, other shell commands and network requests still need an `--allowedTools` entry or a `permissions.allow` rule. See [what `acceptEdits` auto-approves](</docs/en/permission-modes#auto-approve-file-edits-with-acceptedits-mode>) for the full list This example applies lint fixes with `acceptEdits` as the baseline:
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -427,7 +427,7 @@ How hooks work -Claude Code fires hook events at specific points in its lifecycle. When an event fires, Claude Code runs all matching hooks in parallel; see [Hook handler fields](</docs/en/hooks#hook-handler-fields>) for how duplicate handlers are treated. The table below shows each event and when it triggers: +Claude Code fires hook events at specific points in its lifecycle. When an event fires, Claude Code runs the matching hooks in parallel; see [Hook handler fields](</docs/en/hooks#hook-handler-fields>) for how duplicate handlers are treated. The table below shows each event and when it triggers: Event| When it fires ---|--- @@ -555,15 +555,13 @@ exit 0 # exit 0 = no decision; the normal permission flow applies -The exit code determines what happens next: - - * **Exit 0** : your hook reports no objection through its exit code. - * For a `PreToolUse` hook this doesn’t approve the tool call: the normal [permission flow](</docs/en/permissions>) still applies. - * For `UserPromptSubmit`, `UserPromptExpansion`, `SessionStart`, and `PostModelSwitch` hooks, Claude Code adds stdout it [treats as plain text](</docs/en/hooks#exit-code-0>) to Claude’s context. - * **Exit 2** : Claude Code blocks the action. Write a reason to stderr. Where it lands depends on the event: some events feed it to Claude as feedback so it can adjust, others show it to the user, and a few, such as `ConfigChange` and `Elicitation`, surface no message. Some events can’t be blocked: for `SessionStart` and others, exit 2 shows stderr to the user and execution continues. See [exit code 2 behavior per event](</docs/en/hooks#exit-code-2-behavior-per-event>) for the full list. - * **Any other exit code** : for most events, the action proceeds as a [non-blocking error](</docs/en/hooks#exit-code-output>), unless the hook is one [whose failure blocks the action](</docs/en/hooks#block-the-action-when-a-hook-fails>) or its JSON output passes validation: - * A parsed object that passes schema validation: Claude Code ignores the exit code, the JSON alone decides the outcome, and the hook isn’t reported as an error. The per-event exceptions, like `WorktreeCreate` failing on any nonzero exit, are listed in the reference’s [Exit code output](</docs/en/hooks#exit-code-output>) section. - * A parsed object that fails schema validation, or stdout that Claude Code [tries to parse as JSON](</docs/en/hooks#exit-code-0>) but that isn’t valid JSON: a non-blocking error; the notice carries the validation or parse message. +With an exit code besides 0 and 2 and no valid JSON output, the action proceeds on most events, unless the hook is one [whose failure blocks the action](</docs/en/hooks#block-the-action-when-a-hook-fails>). A hook with `onFailure` set to `"block"` is one example. Exit 0 to report no objection, or exit 2 to block the action: + + * **Exit 0** : if you exit 0 from a `PreToolUse` hook, the tool call still goes through the normal [permission flow](</docs/en/permissions>), because exit 0 doesn’t approve it. For `UserPromptSubmit`, `UserPromptExpansion`, `SessionStart`, and `PostModelSwitch` hooks, Claude Code adds stdout it [treats as plain text](</docs/en/hooks#exit-code-0>) to Claude’s context. + * **Exit 2** : write a reason to stderr. Depending on the event, Claude receives it as feedback so it can adjust, the user sees it, or no message appears, as with `ConfigChange` and `Elicitation`. Some events can’t be blocked: for `SessionStart` and others, exit 2 shows stderr to the user and execution continues. See [exit code 2 behavior per event](</docs/en/hooks#exit-code-2-behavior-per-event>) for the full list. + * **Any other exit code** : for the per-event exceptions, such as `WorktreeCreate` failing on any nonzero exit, see [Exit code output](</docs/en/hooks#exit-code-output>). On other events, unless the hook is one whose failure blocks the action, find your case by what your hook printed to stdout: + * A parsed object that passes schema validation: Claude Code ignores the exit code, the JSON alone decides the outcome, and the hook isn’t reported as an error. + * A parsed object that fails schema validation, or stdout that Claude Code [tries to parse as JSON](</docs/en/hooks#exit-code-0>) but that isn’t valid JSON: the action proceeds as a non-blocking error. Check the `<hook name> hook error` notice for the validation or parse message. * Stdout that Claude Code [treats as plain text](</docs/en/hooks#exit-code-0>), or empty stdout: the action proceeds as a non-blocking error. The transcript shows a `<hook name> hook error` notice, then the first line of stderr prefixed with `Failed with non-blocking status code:`. To capture the full stderr, enable [debug logging](</docs/en/hooks#debug-hooks>) with `claude --debug` or by running `/debug` mid-session. #### @@ -586,17 +584,13 @@ } } -With `"deny"`, Claude Code cancels the tool call and feeds `permissionDecisionReason` back to Claude. On `PreToolUse`, Claude Code handles each `permissionDecision` value as follows: - - * `"allow"`: skip the interactive permission prompt. Deny and ask rules, including enterprise managed deny lists, still apply, as do prompts for: - * Reads from [network paths](</docs/en/permissions#network-paths>) - * MCP tools marked [`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>) in sessions where that setting reaches Claude Code -For what `"allow"` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). - * `"deny"`: cancel the tool call and send the reason to Claude - * `"ask"`: show the permission prompt to the user as normal - -A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. A `PreModelSwitch` hook returns the same `permissionDecision` field: `"allow"` lets a model switch proceed, and `"deny"` cancels it. `"ask"` has you confirm the switch when you run `/model` in an interactive session; everywhere else, Claude Code treats `"ask"` as a refusal. See [PreModelSwitch decision control](</docs/en/hooks#premodelswitch-decision-control>). Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: +With `"deny"`, Claude Code cancels the tool call and feeds `permissionDecisionReason` back to Claude. On `PreToolUse`, you can also return `"ask"` to show the user the normal permission prompt, or `"allow"` to skip the interactive permission prompt. With `"allow"`, deny and ask rules, including enterprise managed deny lists, still apply, as do prompts for: + + * Reads from [network paths](</docs/en/permissions#network-paths>) + * MCP tools marked [`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>) in sessions where that setting reaches Claude Code + +For what `"allow"` does in plan mode, see [Hook approvals in plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>). A fourth value, `"defer"`, is available in [non-interactive mode](</docs/en/headless>) with the `-p` flag. It exits the process with the tool call preserved so an Agent SDK wrapper can collect input and resume. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) in the reference. A `PreModelSwitch` hook returns the same `permissionDecision` field: `"allow"` lets a model switch proceed, and `"deny"` cancels it. `"ask"` has you confirm the switch when you run `/model` in an interactive session; everywhere else, Claude Code treats `"ask"` as a refusal. See [PreModelSwitch decision control](</docs/en/hooks#premodelswitch-decision-control>). Other events use different decision patterns. For example, `PostToolUse` and `Stop` hooks use a top-level `decision: "block"` field, while `PermissionRequest` uses `hookSpecificOutput.decision.behavior`. See the [summary table](</docs/en/hooks#decision-control>) in the reference for a full breakdown by event. For `UserPromptSubmit` hooks, use `hookSpecificOutput.additionalContext` instead to inject text into Claude’s context. Nest `additionalContext` inside `hookSpecificOutput`; if you place it at the top level of the JSON, Claude Code silently ignores it. For example, this output adds the current branch state to every prompt: { "hookSpecificOutput": { @@ -785,7 +779,7 @@ * `"ok": true`: the action proceeds * `"ok": false`: what happens depends on the event: * `Stop` and `SubagentStop`: the `reason` is fed back to Claude so it keeps working, unless the response also sets `"impossible": true` to mark the condition as one that can never be satisfied, in which case Claude Code allows the stop and the turn ends - * `PreToolUse`: the tool call is denied; by default the turn ends and the deny `reason` appears in the chat as a warning line. Set `continueOnBlock: true` on the hook to instead return the `reason` to Claude as the tool error, so it can adjust and continue. Before v2.1.210, the deny `reason` was returned to Claude as the tool error and the turn continued + * `PreToolUse`: the tool call is denied; by default the turn ends and the deny `reason` appears in the chat as a warning line. Set `continueOnBlock: true` on the hook to instead return the `reason` to Claude as the tool error, so it can adjust and continue * `PostToolUse`: by default the turn ends and the `reason` appears in the chat as a warning line. Set `continueOnBlock: true` to feed the `reason` back to Claude and continue the turn instead * `PostToolBatch`, `UserPromptSubmit`, and `UserPromptExpansion`: the turn ends and the `reason` appears in the chat as a warning line @@ -901,13 +895,16 @@ Hooks and permission modes -`PreToolUse` hooks fire before any permission-mode check, in every [permission mode](</docs/en/permission-modes>), including `dontAsk`. A hook that returns `permissionDecision: "deny"` blocks the tool even in `bypassPermissions` mode or with `--dangerously-skip-permissions`. This lets you enforce policy that users can’t bypass by changing their permission mode. The reverse is not true: hooks in settings files and in a plugin’s `hooks/hooks.json` can tighten restrictions but not loosen them past what permission rules allow. A hook returning `"allow"` doesn’t bypass deny rules from settings, and it can’t suppress the prompt for: - - * Reads from [network paths](</docs/en/permissions#network-paths>) - * MCP tools marked [`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>) in sessions where that setting reaches Claude Code - -In [plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>), if your `PreToolUse` hook returns `"allow"` for a file edit, you get the same prompt, block, or approval the edit would get with no hook. To lift this limit on hook approvals, [approve the plan](</docs/en/permission-modes#review-and-approve-a-plan>) or switch to another permission mode. A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can approve a call that your `PreToolUse` hook blocked, unless the hook is in managed settings. In plan mode, the mod can approve such a call when it’s read-only, but not a file edit or another call that isn’t read-only. [Extend permissions with hooks](</docs/en/permissions#extend-permissions-with-hooks>) lists which rules hold over a mod. +With a hook in a settings file or a plugin’s `hooks/hooks.json` you can’t loosen restrictions past what permission rules allow, and a hook’s `"deny"` holds in every permission mode: + + * **What still holds over`"allow"`**: a hook returning `"allow"` doesn’t bypass deny rules from settings, and it can’t suppress the prompt for: + * Reads from [network paths](</docs/en/permissions#network-paths>) + * MCP tools marked [`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>) in sessions where that setting reaches Claude Code +In [plan mode](</docs/en/permissions#hook-approvals-in-plan-mode>), if your `PreToolUse` hook returns `"allow"` for a file edit, you get the same prompt, block, or approval the edit would get with no hook. To lift this limit on hook approvals, [approve the plan](</docs/en/permission-modes#review-and-approve-a-plan>) or switch to another permission mode. + * **`"deny"` in every permission mode**: a hook that returns `permissionDecision: "deny"` blocks the tool even in `bypassPermissions` mode or with `--dangerously-skip-permissions`. `PreToolUse` hooks fire before any permission-mode check, in every [permission mode](</docs/en/permission-modes>), including `dontAsk`. This lets you enforce policy that users can’t bypass by changing their permission mode. + +If your machine has no [managed settings](</docs/en/settings#check-what-your-organization-enforces>) and your session doesn’t use [`/login` credentials](</docs/en/authentication#authentication-precedence>) for a Team or Enterprise plan, a [mod](</docs/en/plugins/mods/overview>) can approve a call your `PreToolUse` hook blocked. A session that runs on an API key or a long-lived [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/authentication#generate-a-long-lived-token>) instead isn’t using that login, even when that login is stored.In plan mode, a mod can approve such a blocked call only when it’s read-only, so not a file edit. For the cases where a mod’s approval doesn’t get past your rules and hooks, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>). ###
modified Install and manage plugins View current →
--- a/install.md +++ b/install.md @@ -89,7 +89,7 @@ Open the plugin browser -Click the **+** button next to the prompt box and select **Plugins** , then **Add plugin**. The plugin browser opens with the plugins from your marketplaces. +Click the **+** button next to the prompt box and select **Add plugins**. If the **+** menu shows **Plugins** instead of **Add plugins** , select **Plugins** , then **Browse plugins**. The plugin browser opens with the plugins from your marketplaces. 2 @@ -103,7 +103,7 @@ Choose a scope: your user account, this project, or local-only. -To enable, disable, or uninstall later, use **+ > Plugins > Manage plugins**. The plugin browser isn’t available in the desktop app’s cloud sessions. See [Install plugins in the desktop app](</docs/en/desktop#install-plugins>). +To enable, disable, or uninstall a plugin later, see [Install plugins in the desktop app](</docs/en/desktop#install-plugins>). In the Claude Code panel in VS Code:
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -183,7 +183,7 @@ Remap INSERT-mode key sequences -The [`vimInsertModeRemaps`](</docs/en/settings-reference#viminsertmoderemaps>) setting maps a two-key INSERT-mode sequence to Escape, so a mapping like `jj` returns you to NORMAL mode. Requires Claude Code v2.1.208 or later. The following `~/.claude/settings.json` example turns on vim mode and maps `jj` to Escape: +The [`vimInsertModeRemaps`](</docs/en/settings-reference#viminsertmoderemaps>) setting maps a two-key INSERT-mode sequence to Escape, so a mapping like `jj` returns you to NORMAL mode. The following `~/.claude/settings.json` example turns on vim mode and maps `jj` to Escape: { "editorMode": "vim", @@ -242,8 +242,8 @@ `cc`| Change line `C`| Change to end of line `cw`/`ce`/`cb`| Change word/to end/back -`s`| Substitute character: delete the character under the cursor and enter INSERT mode. Requires Claude Code v2.1.211 or later -`S`| Substitute line: clear the line and enter INSERT mode. Requires Claude Code v2.1.211 or later +`s`| Substitute character: delete the character under the cursor and enter INSERT mode +`S`| Substitute line: clear the line and enter INSERT mode `yy`/`Y`| Yank (copy) line `yw`/`ye`/`yb`| Yank word/to end/back `p`| Paste after cursor @@ -459,7 +459,7 @@ * After the first turn of a conversation, in some sessions * The previous response ended in an error * While you’re in plan mode - * Your account is close to or at its usage limit. To keep suggestions on until you reach the limit, set [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) to `true`. Before v2.1.238, Claude Code skipped them near the limit even with the variable set to `true` + * Your account is close to or at its usage limit. To keep this skip from applying until you reach the limit, set [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) to `true`. Before v2.1.238, Claude Code skipped suggestions near the limit even with the variable set to `true` * In an [agent team](</docs/en/agent-teams>), in teammates’ sessions by default. The lead’s session shows suggestions The notice `Showing fewer prompt suggestions · use one to bring them back` means Claude Code is showing suggestions less often because you left many in a row unused. To return to the usual frequency, use a suggestion or set [`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`](</docs/en/env-vars>) to `true`. In print mode, Claude Code doesn’t generate suggestions by default. Pass [`--prompt-suggestions`](</docs/en/cli-reference#cli-flags>) with `-p "<prompt>" --output-format stream-json --verbose` to have Claude Code emit a `prompt_suggestion` message after each turn that generates one. The generator skips very short conversations and cold prompt caches here too, so a single short `-p` query can emit none. @@ -724,7 +724,7 @@ * **Single response** : there are no follow-up turns in the overlay. To continue the thread, ask another `/btw` question. To continue with full tool access in a local session, press `f` to fork this question and answer into a [background subagent](</docs/en/sub-agents#fork-the-current-conversation>). * **Low cost** : while the conversation’s [prompt cache](</docs/en/prompt-caching>) is warm, a side question costs little beyond the answer itself. -Your five newest earlier side questions appear as a dimmed list above the current answer, with a count of any older ones. They stay out of the conversation history. To return to the overlay after dismissing it, run `/btw` with no question. The overlay reopens on your most recent exchange. Before v2.1.212, `/btw` without a question printed a usage message instead. Once the answer appears, the overlay accepts these keys. +Your five newest earlier side questions appear as a dimmed list above the current answer, with a count of any older ones. They stay out of the conversation history. To return to the overlay after dismissing it, run `/btw` with no question. The overlay reopens on your most recent exchange. Once the answer appears, the overlay accepts these keys. Key| Action ---|--- @@ -757,7 +757,7 @@ Session recap -When you return to the terminal after stepping away, Claude Code shows a one-line recap of what happened in the session so far. The recap generates in the background once at least three minutes have passed since the last completed turn and the terminal is unfocused, so it’s ready when you switch back. Recaps only appear once the session has at least three turns, and never twice in a row. Run `/recap` to generate a summary on demand. It runs only when you ask for it yourself. When it arrives in a message relayed from a Slack, Teams, or project thread, or in a prompt a routine sent, you get a [notice](</docs/en/errors#recap-only-runs-when-you-ask-for-it-yourself>) instead of a recap. Session recap is on by default for every plan and provider. To turn automatic recaps off, open `/config` and turn off **Session recap**. The automatic recap never appears in non-interactive mode. Claude Code caps both automatic recaps and `/recap` output at 400 characters. +When you return to the terminal after stepping away, Claude Code shows a one-line recap of what happened in the session so far. The recap generates in the background once at least three minutes have passed since the last completed turn and the terminal is unfocused, so it’s ready when you switch back. Recaps only appear once the session has at least three turns, and never twice in a row. Run `/recap` to generate a summary on demand. It runs only when you ask for it yourself. When it arrives in a message relayed from a Slack, Teams, or project thread, you get a [notice](</docs/en/errors#recap-only-runs-when-you-ask-for-it-yourself>) instead of a recap. You also get the notice when `/recap` arrives in a prompt a cloud scheduled task sent. Session recap is on by default for every plan and provider. To turn automatic recaps off, open `/config` and turn off **Session recap**. The automatic recap never appears in non-interactive mode. Claude Code caps both automatic recaps and `/recap` output at 400 characters. ##
modified Draw in the interface with a mod View current →
--- a/interface.md +++ b/interface.md @@ -304,7 +304,7 @@ Draw in the VS Code extension -In the VS Code extension, what a mod draws appears in the chat panel with extension version 2.1.299 or later, in a session that [fetches feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>). In a `ui.render` hook for the panel, `e.surface` is `vscode`. To check which sites and elements the panel draws, and which props it ignores, see the [render sites](</docs/en/plugins/mods/reference#render-sites>) and [elements](</docs/en/plugins/mods/reference#elements>) tables. To make a mod work in the panel as well as the terminal, account for these differences: +In the VS Code extension, what a mod draws appears in the chat panel with extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as one on Amazon Bedrock, needs 2.1.304 or later. In a `ui.render` hook for the panel, `e.surface` is `vscode`. To check which sites and elements the panel draws, and which props it ignores, see the [render sites](</docs/en/plugins/mods/reference#render-sites>) and [elements](</docs/en/plugins/mods/reference#elements>) tables. To make a mod work in the panel as well as the terminal, account for these differences: * **Panes** : in a panel 800 pixels or wider, panes dock beside the conversation, `e.props.placement` is `'dock'`, and `e.viewport.isFullscreen` is `true`. In a narrower panel, panes draw above the prompt box, `placement` is `'inline'`, and a pane shows 12 rows before it scrolls. * **Toasts and status lines** : these sit in one stack directly above the prompt box, together with the panes when the panel is narrow, with one status line per mod. The stack is hidden while a permission request or a dialog shows.
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -470,12 +470,7 @@ `abovePrompt:highlightNext`| Down| Highlight the next option in a focused select `abovePrompt:highlightPrevious`| Up| Highlight the previous option in a focused select -Two contexts bind more keys to these actions by default: - - * **`AbovePrompt`** : Right and Left also run `abovePrompt:next` and `abovePrompt:previous`, and Space also runs `abovePrompt:press` - * **`AbovePromptInput`** : Down and Up also run `abovePrompt:next` and `abovePrompt:previous` - -The `AbovePrompt` context also binds Up, Down, PageUp, PageDown, Home, and End to the pane scroll actions `pane:scrollUp` through `pane:bottom`, so to change one of those keys for the band, bind the scroll action in an `AbovePrompt` block. +In the `AbovePrompt` context, Right and Left also run `abovePrompt:next` and `abovePrompt:previous` by default, and Space also runs `abovePrompt:press`. The `AbovePrompt` context also binds Up, Down, PageUp, PageDown, Home, and End to the pane scroll actions `pane:scrollUp` through `pane:bottom`, so to change one of those keys for the band, bind the scroll action in an `AbovePrompt` block. ### @@ -787,6 +782,8 @@ * In vim NORMAL mode, `?` shows the help menu (vim behavior) * In vim NORMAL mode, `/` opens history search, the same as Ctrl+R in standard mode +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. + ## ​
modified Connect Claude Code to an LLM gateway View current →
--- a/llm-gateway-connect.md +++ b/llm-gateway-connect.md @@ -204,7 +204,7 @@ * **Distributed by an administrator** : if your organization has [deployed the configuration](</docs/en/llm-gateway-rollout#distribute-through-managed-settings>), the desktop app routes through the gateway with no setup on your part * **Configured locally** : for devices without an administrator-distributed configuration, open Help → Troubleshooting → Enable Developer Mode, which restarts the app with a Developer menu. Then open Developer → Configure Third-Party Inference and enter your gateway base URL. An administrator-distributed configuration takes precedence and makes this form read-only -With the gateway configuration active, the environment picker doesn’t offer Anthropic-hosted cloud environments, and [Remote Control](</docs/en/remote-control>) is unavailable. SSH sessions are in beta with a gateway configuration and require Claude Desktop v1.40609.0 or later. Before you connect, check the allowlist and the gateway’s address: +With the gateway configuration active, the environment selector doesn’t offer Anthropic-hosted cloud environments, and [Remote Control](</docs/en/remote-control>) is unavailable. SSH sessions are in beta with a gateway configuration and require Claude Desktop v1.40609.0 or later. Before you connect, check the allowlist and the gateway’s address: * **Allowed hosts** : SSH sessions are off by default. To turn them on, you or your administrator lists the allowed hosts in the [`sshHostAllowlist`](<https://claude.com/docs/third-party/claude-desktop/configuration#sshhostallowlist>) key of the third-party inference configuration * **Gateway address** : the remote machine connects to the gateway itself, so a gateway at `localhost` on your computer doesn’t work for SSH sessions
modified How Claude remembers your project View current →
--- a/memory.md +++ b/memory.md @@ -473,7 +473,7 @@ * Copilot rules in `.github/copilot-instructions.md` * With `CLAUDE_CODE_NEW_INIT=1` set: `AGENTS.md`, `.devin/rules/`, `.windsurf/rules/` or `.windsurfrules`, and `.clinerules` -You can also run [`/import`](</docs/en/commands>) to bring a supported coding agent’s configuration into Claude Code, which appends a one-time copy of instruction files such as `AGENTS.md` to the matching `CLAUDE.md` and carries over MCP servers, commands, subagents, and skills. Requires Claude Code v2.1.213 or later. +You can also run [`/import`](</docs/en/commands>) to bring a supported coding agent’s configuration into Claude Code, which appends a one-time copy of instruction files such as `AGENTS.md` to the matching `CLAUDE.md` and carries over MCP servers, commands, subagents, and skills. ## @@ -537,7 +537,7 @@ How it works -The first 200 lines of `MEMORY.md`, or the first 25KB, whichever comes first, are loaded at the start of every conversation. Content beyond that threshold is not loaded at session start. Claude keeps `MEMORY.md` concise by moving detailed notes into separate topic files. After Claude writes to `MEMORY.md`, Claude Code measures the file against the 200-line and 25KB read limits. If the file is near a limit, Claude Code reminds Claude to shorten it: keep one line per entry, move detail into topic files, and merge or drop stale entries. If the file is over a limit, the write still succeeds, but Claude Code returns an [error telling Claude to rewrite the index](</docs/en/errors#memory-index-is-over-its-read-limit>), because everything past the limit is dropped on the next load. This limit applies only to `MEMORY.md`. Claude Code loads a CLAUDE.md file of up to 4 MiB in full and skips a larger file. Shorter files produce better adherence. Claude Code doesn’t load topic files such as `user_role.md` or `feedback_testing.md` at startup. Claude reads them on demand using its standard file tools when it needs the information. The main conversation’s auto memory isn’t loaded into [subagents](</docs/en/sub-agents#what-loads-at-startup>); the exception is a [fork](</docs/en/sub-agents#fork-the-current-conversation>), which inherits the parent conversation and system prompt. A subagent’s own auto memory, enabled with the subagent `memory` field, is a separate directory. Claude reads and writes memory files during your session. When you see messages like “Saved 2 memories” or “Recalled 2 memories” in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`. When Claude writes a memory file that begins with YAML frontmatter, Claude Code records the write time in a `modified` frontmatter field as an ISO 8601 timestamp. The timestamp shows how current the fact is, both to you and to Claude when it reads the memory back. Any file that has frontmatter gets the field the next time Claude writes it, including files created on earlier versions; Claude Code never adds frontmatter to a file that has none. The `modified` field requires Claude Code v2.1.214 or later. +The first 200 lines of `MEMORY.md`, or the first 25KB, whichever comes first, are loaded at the start of every conversation. Content beyond that threshold is not loaded at session start. Claude keeps `MEMORY.md` concise by moving detailed notes into separate topic files. After Claude writes to `MEMORY.md`, Claude Code measures the file against the 200-line and 25KB read limits. If the file is near a limit, Claude Code reminds Claude to shorten it: keep one line per entry, move detail into topic files, and merge or drop stale entries. If the file is over a limit, the write still succeeds, but Claude Code returns an [error telling Claude to rewrite the index](</docs/en/errors#memory-index-is-over-its-read-limit>), because everything past the limit is dropped on the next load. This limit applies only to `MEMORY.md`. Claude Code loads a CLAUDE.md file of up to 4 MiB in full and skips a larger file. Shorter files produce better adherence. Claude Code doesn’t load topic files such as `user_role.md` or `feedback_testing.md` at startup. Claude reads them on demand using its standard file tools when it needs the information. The main conversation’s auto memory isn’t loaded into [subagents](</docs/en/sub-agents#what-loads-at-startup>); the exception is a [fork](</docs/en/sub-agents#fork-the-current-conversation>), which inherits the parent conversation and system prompt. A subagent’s own auto memory, enabled with the subagent `memory` field, is a separate directory. Claude reads and writes memory files during your session. When you see messages like “Saved 2 memories” or “Recalled 2 memories” in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`. When Claude writes a memory file that begins with YAML frontmatter, Claude Code records the write time in a `modified` frontmatter field as an ISO 8601 timestamp. The timestamp shows how current the fact is, both to you and to Claude when it reads the memory back. ###
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -198,6 +198,7 @@ * **Skill or command override** : Claude Code ignores the override, including a blocked family alias, and the skill or command runs on the session model. A skill or command that [runs in a subagent](</docs/en/skills#run-skills-in-a-subagent>) follows the subagent behavior above instead * **`advisorModel` setting**: the advisor is disabled for the session * **`--advisor` flag**: Claude Code exits with an error at launch. In a [background session](</docs/en/agent-view>), it starts the session without the advisor instead of exiting + * **`CLAUDE_CODE_AUTO_MODE_MODEL`** : Claude Code ignores the variable and picks the model for its [auto mode classifier requests](</docs/en/permission-modes#default-classifier-model>) as if you hadn’t set it Claude Code hides excluded models from the `/model` picker. Whether a model ID you list also gets a row of its own differs by provider: @@ -209,7 +210,7 @@ * **Fallback model chains** : entries outside the allowlist are dropped * **Plan-mode upgrades** : on the Anthropic API and Claude Platform on AWS, an upgrade such as `opusplan` to an excluded model uses the newest permitted version of the upgrade family. On providers with provider-specific model IDs, and when no version is permitted, the upgrade is skipped and planning continues on the session’s model * **Automatic model fallback** : a fallback whose target is excluded does not run, so the flagged request ends with a refusal instead - * **[Auto mode classifier](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)** : the classifier’s Claude Sonnet 5 default applies only when the allowlist permits Sonnet 5. When it’s excluded, the classifier runs on the session’s model, which the allowlist already governs, or on an Opus model when the session runs on a Fable model. On providers other than the Anthropic API, that Opus fallback runs on the model you set in `ANTHROPIC_DEFAULT_OPUS_MODEL` or otherwise on Opus 5, without consulting the allowlist. Requires Claude Code v2.1.210 or later + * **[Auto mode classifier](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>)** : when the allowlist excludes the [default classifier model](</docs/en/permission-modes#default-classifier-model>), classifier requests that would use that model run on the session model, or an Opus model in Fable sessions. On providers other than the Anthropic API, that Opus fallback runs on the model you set in `ANTHROPIC_DEFAULT_OPUS_MODEL` or otherwise on Opus 5, without consulting the allowlist. Requires Claude Code v2.1.210 or later * **[Fast mode](</docs/en/fast-mode>)** : enabling fast mode is refused when the model the session would run on afterward is outside the allowlist * **Availability fallback on Amazon Bedrock and Google Cloud’s Agent Platform** : when your account loses access to a model mid-session, the switch to another model skips excluded models. The startup model checks on [Amazon Bedrock](</docs/en/amazon-bedrock#when-your-organization-enforces-a-model-allowlist>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-your-organization-enforces-a-model-allowlist>) skip excluded models only when managed settings also set `enforceAvailableModels` @@ -691,12 +692,14 @@ Set the auto-compact window +If Claude Code warned about the value of `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, see the variable’s values and warnings. + You can set the auto-compact window in these places: * **For the current model, in this session and later ones** : run `/autocompact` with a value, like `/autocompact 500k`. Claude Code saves it to your user settings under the current model in [`modelSettings`](</docs/en/settings-reference#modelsettings>) and applies it to the current session. If a higher-priority [settings scope](</docs/en/settings#settings-precedence>) such as managed settings sets its own window for that model or for every model, the command saves your value but the session keeps that scope’s window, and the command says so. Run `/autocompact auto` to return to the window tuned for your model. Before v2.1.288, the command saved one window for every model, as the top-level `autoCompactWindow`. * **For every model** : set [`autoCompactWindow`](</docs/en/settings-reference#autocompactwindow>) in a settings file, such as `"autoCompactWindow": 200000` in `~/.claude/settings.json`. A window you saved for a model with `/autocompact` takes precedence over this key in the same file for that model. * **For one launch** : pass [`--autocompact`](</docs/en/cli-reference#cli-flags>) when starting Claude Code. The flag overrides your saved setting for that launch without changing it, and `claude --autocompact auto` runs the session at the tuned window even if your saved setting has a value. Unlike `/autocompact`, the flag isn’t preempted by a higher-priority settings scope such as managed settings. - * **In scripts and cloud environments** : set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>). While it’s set, it takes precedence over the command, the flag, and the setting, and `/autocompact` reports the override instead of changing the window. + * **In scripts and cloud environments** : set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>) to a token count such as `200000`. Unless Claude Code ignores the value, the variable takes precedence over the command, the flag, and the `autoCompactWindow` setting. `/autocompact` then reports the override without saving. The status line’s `used_percentage` measures against the model’s full context window, so while the variable is set, that percentage doesn’t indicate when compaction will run. * **For one subagent** : see [Set the auto-compact window for one subagent](</docs/en/sub-agents#subagent-auto-compact-window>). The command and the flag accept a window size from 100K to 1M tokens, in any of these forms: @@ -705,7 +708,23 @@ * A `k` or `M` suffix, such as `500k` or `1M` * A bare number from 100 to 1000, meaning thousands, so `200` sets 200,000 -The environment variable accepts only the plain token count. Claude Code caps the window at the model’s context window. +Whichever way you set the window, Claude Code caps it at the model’s context window. + +#### + +​ + +Values and warnings for `CLAUDE_CODE_AUTO_COMPACT_WINDOW` + +A warning that quotes your `CLAUDE_CODE_AUTO_COMPACT_WINDOW` value means the value falls outside 100,000 to 1,000,000 or isn’t a token count. To stop the warning, set a number in that range, such as `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000`. On Claude Code v2.1.304 or later, you can also write the number with `k` for thousands or `M` for millions, as in `200k` or `1M`. Find your warning’s wording in the first column, then read across for the window your session uses and what to change: + +Your warning contains| Window the session uses| What to change +---|---|--- +`reads as <N> tokens, so Claude Code treats it as the 100k minimum`| The smaller of 100,000 tokens and your model’s context window| Set at least `100000`, such as `200000`, or `200k` if you meant `200` as thousands +`is too large, so Claude Code treats it as the 1M maximum`| The smaller of 1,000,000 tokens and your model’s context window| You already have the largest window. To stop the warning, set `1M` or `1000000` +`isn't a usable size, so Claude Code ignores it`| The window from `--autocompact`, `/autocompact`, or `autoCompactWindow`, or the default when none is set| Set a number such as `200000`, or unset the variable + +A number with no suffix is read as that many tokens, so `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200` means 200 tokens even though `/autocompact 200` means 200,000. ###
modified Monitoring View current →
Show diff (223 lines)
--- a/monitoring-usage.md +++ b/monitoring-usage.md @@ -111,11 +111,11 @@ `OTEL_LOG_TOOL_CONTENT`| Enable logging of tool content in the `tool.output` span event (default: disabled). Span attributes carry tool content under their own gates. Requires tracing. Content is truncated at the content limit (60 KB by default)| `1` to enable `OTEL_LOG_MANAGED_SETTINGS`| Add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to managed settings resolved events (default: disabled). A value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later| `1` to enable `OTEL_LOG_RAW_API_BODIES`| Emit the full Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events (default: disabled). Bodies include the entire conversation history. Enabling this implies consent to everything `OTEL_LOG_USER_PROMPTS`, `OTEL_LOG_TOOL_DETAILS`, and `OTEL_LOG_TOOL_CONTENT` would reveal| `1` for inline bodies truncated at the content limit (60 KB by default), or `file:<dir>` for untruncated bodies on disk with a `body_ref` pointer in the event -`CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Content limit: the maximum length of content-bearing attributes such as model responses, tool content, system prompts, and raw API bodies, truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). The default is sized for backends that cap attribute values at 64 KB; raise it only if your backend accepts larger values, or lower it to cut telemetry volume. When an OpenTelemetry SDK attribute limit, `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` or one of its logrecord and span variants, is set lower, Claude Code truncates at that smaller value so the `[TRUNCATED ...]` marker stays within the SDK limit. Requires Claude Code v2.1.214 or later| `262144` +`CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Content limit: the maximum length of content-bearing attributes such as model responses, tool content, system prompts, and raw API bodies, truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). The default is sized for backends that cap attribute values at 64 KB; raise it only if your backend accepts larger values, or lower it to cut telemetry volume. When an OpenTelemetry SDK attribute limit, `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` or one of its logrecord and span variants, is set lower, Claude Code truncates at that smaller value so the `[TRUNCATED ...]` marker stays within the SDK limit| `262144` `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`| Metrics temporality preference (default: `delta`). Set to `cumulative` if your backend expects cumulative temporality| `delta`, `cumulative` `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic headers (default: 1740000ms / 29 minutes)| `900000` -For the `http/protobuf` and `http/json` protocols, Claude Code sends each export request with a `Content-Length` header. Before v2.1.212, Claude Code versions from v2.1.191 onward sent these requests with chunked transfer encoding; Azure Monitor and other endpoints that require a declared length rejected them with `411 Length Required` or `400` errors. +For the `http/protobuf` and `http/json` protocols, Claude Code sends each export request with a `Content-Length` header. ### @@ -168,7 +168,7 @@ `OTEL_EXPORTER_OTLP_TRACES_HEADERS`| Authentication headers for traces, merged with `OTEL_EXPORTER_OTLP_HEADERS`| `Authorization=Bearer token` `OTEL_TRACES_EXPORT_INTERVAL`| Span batch export interval in milliseconds (default: 5000)| `1000`, `10000` -Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. When tracing is active and Claude Code is connected directly to the Anthropic API, each model request carries a W3C `traceparent` header set to the `claude_code.llm_request` span’s context, and the API’s `traceresponse` header is recorded as a span link. Together these connect Claude Code’s client-side spans to the server-side trace through any compliant intermediary. Outbound HTTP MCP requests carry `traceparent` the same way. The header is not sent to third-party providers. By default, the `traceparent` header on model and HTTP MCP requests is sent only when `ANTHROPIC_BASE_URL` is unset or points at the Anthropic API, since some proxies reject unrecognized headers. The subprocess `TRACEPARENT` variable is controlled by the same switch for consistency. If you run Claude Code through a custom `ANTHROPIC_BASE_URL` proxy and want trace context propagated, set `CLAUDE_CODE_PROPAGATE_TRACEPARENT=1`. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. The inbound trace context also applies to events. In Agent SDK and `-p` sessions with `TRACEPARENT` set, each OTLP event log record carries `trace_id` and `span_id` values that join it to your application’s trace, even when the traces exporter isn’t configured, so your logging backend can correlate events with the rest of the trace. A record emitted while an interaction is active carries the interaction span’s IDs, even when Claude Code emits it outside the span’s async context, such as in a permission prompt callback or for a record buffered during startup and exported later. A record emitted with no active interaction span carries the inbound `TRACEPARENT` IDs directly. Before v2.1.214, records emitted outside the span’s async context carried the inbound `TRACEPARENT` IDs instead of the span’s IDs. Before v2.1.212, event records emitted outside an active span didn’t carry `trace_id` or `span_id`. +Spans redact user prompt text, tool input details, and tool content by default. Set `OTEL_LOG_USER_PROMPTS=1`, `OTEL_LOG_TOOL_DETAILS=1`, and `OTEL_LOG_TOOL_CONTENT=1` to include them. When tracing is active, Bash and PowerShell subprocesses automatically inherit a `TRACEPARENT` environment variable containing the W3C trace context of the active tool execution span. This lets any subprocess that reads `TRACEPARENT` parent its own spans under the same trace, enabling end-to-end distributed tracing through scripts and commands that Claude runs. When tracing is active and Claude Code is connected directly to the Anthropic API, each model request carries a W3C `traceparent` header set to the `claude_code.llm_request` span’s context, and the API’s `traceresponse` header is recorded as a span link. Together these connect Claude Code’s client-side spans to the server-side trace through any compliant intermediary. Outbound HTTP MCP requests carry `traceparent` the same way. The header is not sent to third-party providers. By default, the `traceparent` header on model and HTTP MCP requests is sent only when `ANTHROPIC_BASE_URL` is unset or points at the Anthropic API, since some proxies reject unrecognized headers. The subprocess `TRACEPARENT` variable is controlled by the same switch for consistency. If you run Claude Code through a custom `ANTHROPIC_BASE_URL` proxy and want trace context propagated, set `CLAUDE_CODE_PROPAGATE_TRACEPARENT=1`. In Agent SDK and non-interactive sessions started with `-p`, Claude Code also reads `TRACEPARENT` and `TRACESTATE` from its own environment when starting each interaction span. This lets an embedding process pass its active W3C trace context into the subprocess so Claude Code’s spans appear as children of the caller’s distributed trace. Interactive sessions ignore inbound `TRACEPARENT` to avoid accidentally inheriting ambient values from CI or container environments. The inbound trace context also applies to events. In Agent SDK and `-p` sessions with `TRACEPARENT` set, each OTLP event log record carries `trace_id` and `span_id` values that join it to your application’s trace, even when the traces exporter isn’t configured, so your logging backend can correlate events with the rest of the trace. A record emitted while an interaction is active carries the interaction span’s IDs, even when Claude Code emits it outside the span’s async context, such as in a permission prompt callback or for a record buffered during startup and exported later. A record emitted with no active interaction span carries the inbound `TRACEPARENT` IDs directly. #### @@ -282,10 +282,10 @@ Attribute| Description| Gated by ---|---|--- `duration_ms`| Time spent waiting for the permission decision| -`decision`| `accept` or `reject`| -`source`| Decision source, matching the Tool decision event| - -**`claude_code.tool.execution`** +`decision`| `accept`, `reject`, or `cancelled`, where `cancelled` means Claude Code stopped waiting for a permission decision on the tool call and didn’t run it| +`source`| For an `accept` or `reject`, where the decision came from, such as `config`, `hook`, or `user_temporary`, with the meanings given under the Tool decision event. For a `cancelled`, what ended the wait before any decision was made, such as `user_abort`| + +A `cancelled` decision with `source` `user_abort` means a message needing immediate delivery interrupted the turn while the permission prompt or [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) check was pending. For example, during an auto mode check, the user had a message queued and [sent it immediately](</docs/en/interactive-mode#when-claude-code-sends-what-you-queued>). **`claude_code.tool.execution`** Attribute| Description| Gated by ---|---|--- @@ -736,9 +736,9 @@ ---|--- `prompt.id`| UUID v4 identifier linking all events produced while processing a single user prompt `event.sequence`| 0-based counter for ordering events, counted per Claude Code process rather than per session -`message.uuid`| UUID of the message as persisted in the session transcript, the `~/.claude/projects/*/*.jsonl` files. Present on `assistant_response`, on `api_response_body`, and on `user_prompt` except for command dispatches, which can produce zero or many messages. On `assistant_response` and `api_response_body`, this is the response’s final transcript entry, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.214 or later, or v2.1.274 or later on `api_response_body` +`message.uuid`| UUID of the message as persisted in the session transcript, the `~/.claude/projects/*/*.jsonl` files. Present on `assistant_response`, on `api_response_body`, and on `user_prompt` except for command dispatches, which can produce zero or many messages. On `assistant_response` and `api_response_body`, this is the response’s final transcript entry, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.274 or later on `api_response_body` `request_id`| Server-assigned ID of the API request, read from the `request-id` response header, such as `req_011...`. On a response with no `request-id` header, as on [Amazon Bedrock](</docs/en/amazon-bedrock>), the value comes from the `x-amzn-requestid` header instead. Present on `api_request`, `api_error`, `api_refusal`, `assistant_response`, and `api_response_body` when the response carries either header. Matches the same attribute on the `llm_request` trace span. The `x-amzn-requestid` source requires Claude Code v2.1.282 or later -`client_request_id`| Client-generated UUID sent as the `x-client-request-id` request header. Present on `api_request` and `api_error` on first-party API connections; absent on third-party provider backends and when the request was retried through the non-streaming fallback. Pairs a request with its response and remains available for failures such as timeouts that never produced a server `request_id`. Matches the same attribute on the `llm_request` trace span. Requires Claude Code v2.1.214 or later +`client_request_id`| Client-generated UUID sent as the `x-client-request-id` request header. Present on `api_request` and `api_error` on first-party API connections; absent on third-party provider backends and when the request was retried through the non-streaming fallback. Pairs a request with its response and remains available for failures such as timeouts that never produced a server `request_id`. Matches the same attribute on the `llm_request` trace span To trace all activity triggered by a single prompt, filter your events by a specific `prompt.id` value. This returns the user_prompt event, any api_request events, and any tool_result events that occurred while processing that prompt. `event.sequence` starts at 0 each time a Claude Code process starts and counts up for the life of that process. It keeps counting across `/clear`, which assigns a new `session.id`. If you [resume a session without forking](</docs/en/how-claude-code-works#resume-or-fork-sessions>), the session keeps its `session.id` but takes its `event.sequence` values from the process that resumed it, so within one session a later event can carry a lower value than an earlier one, or repeat one. To order a session’s events, sort by `event.timestamp` and use `event.sequence` to order events that share a timestamp. For message-level reconstruction, each event class carries a key that matches a field in the session transcript. The transcript entry format is [internal to Claude Code](</docs/en/sessions#where-transcripts-are-stored>) and changes between versions, so a pipeline that joins on these fields can break on any release; treat the joins as version-specific rather than a stable contract: @@ -761,7 +761,7 @@ * `prompt_length`: Length of the prompt * `prompt`: Prompt content. Redacted by default. Set `OTEL_LOG_USER_PROMPTS=1` to include it * `prompt_text`: Same value as `prompt`, redacted under the same gate. A backend that stores dotted attribute names as nested objects reads `prompt.id` as `id` inside an object named `prompt` and can lose the prompt string. Read `prompt_text` there instead. Requires Claude Code v2.1.287 or later - * `message.uuid`: UUID of the resulting user message, matching the persisted transcript entry. Absent on command dispatches, which can produce zero or many messages. Requires Claude Code v2.1.214 or later + * `message.uuid`: UUID of the resulting user message, matching the persisted transcript entry. Absent on command dispatches, which can produce zero or many messages. * `command_name`: Command name when the prompt invokes one. Built-in and bundled command names such as `compact` or `debug` are emitted as-is; aliases such as `reset` emit as typed rather than the canonical name. Custom, plugin, and MCP command names collapse to `custom` or `mcp` unless `OTEL_LOG_TOOL_DETAILS=1` is set * `command_source`: Origin of the command when present: `builtin`, `custom`, or `mcp`. Plugin-provided commands report as `custom` @@ -781,7 +781,7 @@ * `response`: Response text, truncated at the content limit (60 KB by default). Redacted to `<REDACTED>` by default. Set `OTEL_LOG_ASSISTANT_RESPONSES=1` to include it. When `OTEL_LOG_ASSISTANT_RESPONSES` is unset, `OTEL_LOG_USER_PROMPTS` controls it instead, so set `OTEL_LOG_ASSISTANT_RESPONSES=0` to keep responses redacted while prompt logging is on * `model`: Model identifier (for example, “claude-sonnet-5”) * `request_id`: API request ID, described under Event correlation attributes - * `message.uuid`: UUID of the response’s final transcript entry. An API response is persisted as one transcript entry per content block; this is the last one, which the next turn’s `parentUuid` chains from. Requires Claude Code v2.1.214 or later + * `message.uuid`: UUID of the response’s final transcript entry. An API response is persisted as one transcript entry per content block; this is the last one, which the next turn’s `parentUuid` chains from. * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name #### @@ -808,7 +808,7 @@ * `tool_result_size_bytes`: Size of the tool result in bytes * `mcp_server_scope`: MCP server scope identifier (for MCP tools) * `vcs.ref.head.revision`, `vcs.ref.head.name`, `vcs.ref.head.type` (when `OTEL_LOG_TOOL_DETAILS=1`): the commit identity of a successful `git commit` run by the Bash or PowerShell tool. `vcs.ref.head.revision` is the commit SHA, `vcs.ref.head.name` is the branch it was committed on, and `vcs.ref.head.type` is `branch`. The name and type are omitted when the commit was made on a detached HEAD. Requires Claude Code v2.1.269 or later - * `tool_parameters` (when `OTEL_LOG_TOOL_DETAILS=1`): JSON string containing tool-specific parameters. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, the `mcp_server_name`/`mcp_tool_name` pair is included even with the flag off, the same host-authored exception as the Tool decision event, requiring Claude Code v2.1.214 or later. The parameters vary by tool: + * `tool_parameters` (when `OTEL_LOG_TOOL_DETAILS=1`): JSON string containing tool-specific parameters. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, the `mcp_server_name`/`mcp_tool_name` pair is included even with the flag off, the same host-authored exception as the Tool decision event. The parameters vary by tool: * For Bash tool: includes `bash_command`, `full_command`, `timeout`, `description`, and `dangerouslyDisableSandbox`, plus `git_commit_id` and `git_branch` when a `git commit` command succeeds. `git_commit_id` is the full commit SHA when the commit is the HEAD of the session’s working directory, and git’s abbreviated SHA otherwise. `git_branch` is the branch it was committed on, omitted on a detached HEAD * For the desktop app’s workspace Bash tool, which also reports `tool_name` as `Bash`: includes only `bash_command`, `full_command`, and `timeout` * For MCP tools: includes `mcp_server_name`, `mcp_tool_name` @@ -837,7 +837,7 @@ * `cache_read_tokens`: Number of tokens read from cache * `cache_creation_tokens`: Number of tokens used for cache creation * `request_id`: API request ID, such as `"req_011..."`, described under Event correlation attributes. - * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header; see the event correlation attributes table for when it’s present. Requires Claude Code v2.1.214 or later + * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header; see the event correlation attributes table for when it’s present * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request: `"low"`, `"medium"`, `"high"`, `"xhigh"`, or `"max"`. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. @@ -861,7 +861,7 @@ * `duration_ms`: Request duration in milliseconds * `attempt`: Number of attempts made, including the initial request. Detect retry exhaustion says when the count starts again * `request_id`: API request ID, such as `"req_011..."`, described under Event correlation attributes. - * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header. Available even when a failure such as a timeout or connection error never produced a server `request_id`; see the event correlation attributes table for when it’s present. Requires Claude Code v2.1.214 or later + * `client_request_id`: Client-generated UUID sent as the `x-client-request-id` request header. Available even when a failure such as a timeout or connection error never produced a server `request_id`; see the event correlation attributes table for when it’s present. * `speed`: `"fast"` or `"normal"`, indicating whether fast mode was active * `query_source`: Subsystem that issued the request, such as `"repl_main_thread"`, `"compact"`, or a subagent name * `effort`: [Effort level](</docs/en/model-config#adjust-effort-level>) applied to the request. Absent when Claude Code sends no effort level, for example on a model that doesn’t support effort. @@ -949,19 +949,43 @@ * `tool_name`: Name of the tool (for example, “Read”, “Edit”, “Write”, “NotebookEdit”) * `tool_use_id`: Unique identifier for this tool invocation. Matches the `tool_use_id` passed to hooks, allowing correlation between OTel events and hook-captured data. * `decision`: Either `"accept"` or `"reject"` - * `tool_source`: Always present. The tool’s provenance, as a closed set of CLI-authored values. Requires Claude Code v2.1.214 or later + * `tool_source`: Always present. The tool’s provenance, as a closed set of CLI-authored values: * `"builtin"`: the CLI’s own tools * `"mcp"`: MCP servers generally * `"sdk_host_builtin_mcp"`: an in-process server built into Claude Desktop itself, in a session Claude Desktop owns. Claude Desktop owns a session it started from one of its own entrypoints, `claude-desktop`, `claude-desktop-3p`, or `local-agent`, when that session isn’t a nested child; nested sessions, including sessions Claude Code itself spawns, report these servers as `"mcp"` * `source`: Where the decision came from: - * `"config"`: Decided automatically without prompting, based on project settings, allow or deny rules in the user’s personal settings, enterprise managed policy, `--allowedTools` or `--disallowedTools` flags, the active permission mode, a session-scoped grant from an earlier prompt in the same interactive CLI session, or because the tool is inherently safe. The event doesn’t indicate which of these sources matched. Claude Code also reports `"config"` when the permission prompt request itself fails, for example when the Agent SDK’s [`canUseTool`](</docs/en/agent-sdk/typescript#canusetool>) callback or the [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) tool returns an invalid result, or when the input stream closes while the request is pending. Before v2.1.216, Claude Code reported these failures as `"user_reject"`. + * `"config"`: Decided automatically without prompting, by one of these sources: + * Project settings + * Allow or deny rules in the user’s personal settings + * Enterprise managed policy + * `--allowedTools` or `--disallowedTools` flags + * The active permission mode + * The auto mode classifier, whose verdict the same event records in `classifier_verdict` + * A grant for the rest of the session, given at an earlier permission prompt in the same interactive CLI session + * The tool being inherently safe +The `source` value doesn’t indicate which of these sources matched. Claude Code also reports `"config"` when the permission prompt request itself fails. For example, that request fails when the Agent SDK’s [`canUseTool`](</docs/en/agent-sdk/typescript#canusetool>) callback or the [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) tool returns an invalid result, or when the input stream closes while the request is pending. Before v2.1.216, Claude Code reported these failures as `"user_reject"`. * `"hook"`: A `PreToolUse` or `PermissionRequest` hook returned the decision. * `"user_permanent"`: Emitted when the user chose “Yes, and don’t ask again for …” at a permission prompt, which saves an allow rule to their personal settings. In the interactive CLI this is emitted only for that choice itself; later calls that match the saved rule emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, both the initial choice and later rule matches emit `"user_permanent"`. Treated as an accept. * `"user_temporary"`: Emitted when the user chose “Yes” at a permission prompt for a one-time approval, or chose an option that grants access for the rest of the session on a file edit or read prompt. In the interactive CLI this is emitted only for the choice itself; later calls allowed by that session-scoped grant emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, both the choice and later matches emit `"user_temporary"`. Treated as an accept. * `"user_abort"`: Emitted when the user dismissed the permission prompt without answering. In Agent SDK and non-interactive `-p` sessions, this includes interrupting the turn while a `canUseTool` or `--permission-prompt-tool` permission request is pending; before v2.1.216, Claude Code reported that interrupt as `"user_reject"`. Treated as a reject. * `"user_reject"`: Emitted when the user chose “No” when prompted. In the interactive CLI this is emitted only for that choice itself; calls that match a deny rule in the user’s personal settings emit `"config"` instead. In Agent SDK or non-interactive `-p` sessions, calls that match a deny rule in personal settings emit `"user_reject"`. Treated as a reject. + * `classifier_verdict`: The auto mode [classifier](</docs/en/permission-modes#how-the-classifier-evaluates-actions>) verdict for the call, or why Claude Code denied the call when none came. Requires Claude Code v2.1.301 or later + * `"allow"`: the classifier approved the call + * `"block"`: the classifier blocked the call. A classifier check that fails partway through can also end as `"block"`, so a partial classifier outage can appear as more blocks rather than as `"unavailable"` + * `"no_verdict"`: the check ran but gave [no usable verdict](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>), so Claude Code denied the call. The denial doesn’t mean the classifier found the call unsafe + * `"unavailable"`: the request to the classifier failed, for example on a rate limit, timeout, or connection error, so Claude Code denied the call. With [server-side classifier review](</docs/en/permission-modes#server-side-classifier-review>), it also marks a call denied because [the server returned no safety verdict](</docs/en/errors#the-server-returned-no-safety-verdict>) +The attribute also appears on plan mode calls when [the classifier reviews commands in plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>). The attribute is absent in these cases: + * An allow or deny [permission rule](</docs/en/permissions#manage-permissions>) decided the call + * Claude Code approved the call in auto mode without asking the classifier + * The user answered the prompt Claude Code showed after [repeated blocks](</docs/en/permission-modes#repeated-block-thresholds>) + * In a `-p` run without `--permission-prompt-tool`, Claude Code denied the call after repeated blocks because there was nobody to answer a prompt. That event reports `decision` as `"reject"` and `source` as `"config"` + * `classifier_category` (when `OTEL_LOG_TOOL_DETAILS=1`): The name of the [built-in rule](</docs/en/auto-mode-config#inspect-the-defaults-and-your-effective-config>) the classifier named when it blocked the call, in lowercase with underscores, such as `"data_exfiltration"` for the Data Exfiltration rule. Requires Claude Code v2.1.301 or later. The attribute is present when all of these hold: + * `classifier_verdict` is `"block"` + * Claude Code sent the classifier request itself, rather than using [server-side classifier review](</docs/en/permission-modes#server-side-classifier-review>) + * The classifier named exactly one rule, and that rule is a built-in one rather than one you wrote + * `permission_mode`: [Permission mode](</docs/en/permission-modes>) active when this call’s permission check began: `"default"`, `"plan"`, `"acceptEdits"`, `"bypassPermissions"`, `"dontAsk"`, or `"auto"`. Manual mode appears as `"default"`. A [subagent](</docs/en/sub-agents#permission-modes>) call reports the subagent’s permission mode rather than the session’s. Requires Claude Code v2.1.301 or later * `tool_parameters` (when `OTEL_LOG_TOOL_DETAILS=1`): JSON string containing tool-specific parameters. Same shape as the Tool result event, minus post-execution fields such as `git_commit_id`. Values may differ from `tool_result` for an accepted call if the permission decision rewrites the tool input via `updatedInput`. Use this attribute to see which command was rejected when `decision` is `"reject"`. - * For `"sdk_host_builtin_mcp"` tools: `mcp_server_name` and `mcp_tool_name` are included even when `OTEL_LOG_TOOL_DETAILS` is off, because the host application defines these names; without them, a rejected call to one of these built-in servers would be unattributable on the default stream. For user-configured MCP servers, the event’s `tool_name` is always the literal `"mcp_tool"`, and the server and tool names appear only in `tool_parameters` with the flag on; argument content requires the flag everywhere. Requires Claude Code v2.1.214 or later + * For `"sdk_host_builtin_mcp"` tools: `mcp_server_name` and `mcp_tool_name` are included even when `OTEL_LOG_TOOL_DETAILS` is off, because the host application defines these names; without them, a rejected call to one of these built-in servers would be unattributable on the default stream. For user-configured MCP servers, the event’s `tool_name` is always the literal `"mcp_tool"`, and the server and tool names appear only in `tool_parameters` with the flag on; argument content requires the flag everywhere. * For Bash tool: includes `bash_command`, `full_command`, `timeout`, `description`, `dangerouslyDisableSandbox`. The desktop app’s workspace bash tool also reports `tool_name` as `Bash`, but includes only `bash_command`, `full_command`, and `timeout` * For MCP tools: includes `mcp_server_name`, `mcp_tool_name` * For Skill tool: includes `skill_name` @@ -973,7 +997,7 @@ Permission mode changed event -Logged when the permission mode changes, for example from `Shift+Tab` cycling, exiting plan mode, or an auto mode gate check. **Event Name** : `claude_code.permission_mode_changed` **Attributes** : +Logged when the permission mode changes, for example from `Shift+Tab` cycling, exiting plan mode, or an auto mode gate check. To group tool calls by the permission mode each was checked in, use `permission_mode` on the Tool decision event. **Event Name** : `claude_code.permission_mode_changed` **Attributes** : * All standard attributes * `event.name`: `"permission_mode_changed"` @@ -981,7 +1005,7 @@ * `event.sequence`: per-process counter for ordering events, described under Event correlation attributes * `from_mode`: The previous permission mode, for example `"default"`, `"plan"`, `"acceptEdits"`, `"auto"`, or `"bypassPermissions"` * `to_mode`: The new permission mode - * `trigger`: What caused the change. One of `"shift_tab"`, `"exit_plan_mode"`, `"auto_gate_denied"`, or `"auto_opt_in"`. Absent for some changes, such as when the SDK sets the permission mode through [`setPermissionMode()`](</docs/en/agent-sdk/typescript#query-object>) + * `trigger`: What caused the change, for example `"shift_tab"`, `"exit_plan_mode"`, or `"auto_gate_denied"`. Absent for some changes, such as when the SDK sets the permission mode through [`setPermissionMode()`](</docs/en/agent-sdk/typescript#query-object>) #### @@ -1262,8 +1286,8 @@ * `total_tool_uses`: Number of tool calls the subagent made across the whole run * `duration_ms`: Run time in milliseconds * `model`: The model the subagent was resolved to run - * `final_model`: The model that produced the subagent’s final response, which differs from `model` after a mid-run switch such as a fallback. Requires Claude Code v2.1.212 or later - * `model_swapped`: Whether more than one model served the subagent’s requests. Requires Claude Code v2.1.212 or later + * `final_model`: The model that produced the subagent’s final response, which differs from `model` after a mid-run switch such as a fallback + * `model_swapped`: Whether more than one model served the subagent’s requests * `plugin_id_hash`, `plugin.name`: Present for plugin-provided agents. Official-marketplace plugin names appear verbatim; other plugin names are replaced with `"third-party"` unless `OTEL_LOG_TOOL_DETAILS=1` is set #### @@ -1394,7 +1418,7 @@ Cost metrics are approximations. For official billing data, refer to your API provider (Claude Console, Amazon Bedrock, or Google Cloud’s Agent Platform). -Claude Code counts each streaming response toward the cost and token metrics exactly once, including when a gateway or proxy behind `ANTHROPIC_BASE_URL` streams usage progressively across multiple frames. Before v2.1.214, streams that carried usage in more than one frame inflated `claude_code.cost.usage` and `claude_code.token.usage` by roughly one extra full request per extra frame. +Claude Code counts each streaming response toward the cost and token metrics exactly once, including when a gateway or proxy behind `ANTHROPIC_BASE_URL` streams usage progressively across multiple frames. ### @@ -1416,7 +1440,7 @@ Detect retry exhaustion -Claude Code retries failed API requests internally and emits a single `claude_code.api_error` event only after it gives up, so the event itself is the terminal signal for that request. Intermediate retry attempts are not logged as separate events. The `attempt` attribute on the event records the number of attempts. `CLAUDE_CODE_MAX_RETRIES` defaults to 10 and is capped at 15. On v2.1.199 or later, you can set `CLAUDE_CODE_RETRY_WATCHDOG` to raise the default and remove the cap. When the request exhausts all retries on a transient error, `attempt` is at most one more than that effective limit: 11 by default. A lower value can still mean the retries ran out: `attempt` starts again from `1` each time Claude Code re-issues the request after a streaming failure. To distinguish a session that recovered from one that stalled, group events by `session.id` and check whether a later `api_request` event exists after the error. +Claude Code retries failed API requests internally and emits a single `claude_code.api_error` event only after it gives up, so the event itself is the terminal signal for that request. Intermediate retry attempts are not logged as separate events. The `attempt` attribute on the event records the number of attempts. `CLAUDE_CODE_MAX_RETRIES` defaults to 10 and is capped at 15; with [`CLAUDE_CODE_RETRY_WATCHDOG`](</docs/en/env-vars>) set, the default is higher and there is no cap. When the request exhausts all retries on a transient error, `attempt` is at most one more than that effective limit: 11 by default. A lower value can still mean the retries ran out: `attempt` starts again from `1` each time Claude Code re-issues the request after a streaming failure. To distinguish a session that recovered from one that stalled, group events by `session.id` and check whether a later `api_request` event exists after the error. ### @@ -1488,8 +1512,8 @@ Without `OTEL_LOG_TOOL_DETAILS`, these events drop the identifying detail: - * `tool_result`: keeps `mcp_server_scope` and a `tool_name` redacted to the literal `"mcp_tool"` for user-configured servers, omits argument content. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, it also keeps the `mcp_server_name`/`mcp_tool_name` pair inside `tool_parameters`, the same host-authored exception as `tool_decision`, requiring Claude Code v2.1.214 or later - * `tool_decision`: keeps `tool_source` and a `tool_name` redacted to the literal `"mcp_tool"` for user-configured servers, omits argument content. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, it also keeps the `mcp_server_name`/`mcp_tool_name` pair inside `tool_parameters`; `tool_source` and the name pair both require Claude Code v2.1.214 or later + * `tool_result`: keeps `mcp_server_scope` and a `tool_name` redacted to the literal `"mcp_tool"` for user-configured servers, omits argument content. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, it also keeps the `mcp_server_name`/`mcp_tool_name` pair inside `tool_parameters`, the same host-authored exception as `tool_decision` + * `tool_decision`: keeps `tool_source` and a `tool_name` redacted to the literal `"mcp_tool"` for user-configured servers, omits argument content. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, it also keeps the `mcp_server_name`/`mcp_tool_name` pair inside `tool_parameters` * `mcp_server_connection`: omits `server_name` and the error message, but keeps `is_plugin`, `plugin_id_hash`, and `plugin.name`, with non-Anthropic plugin names redacted to the literal `"third-party"`, so plugin-provided servers remain distinguishable without detailed logging ### @@ -1502,8 +1526,10 @@ Signal| Event| Key attributes ---|---|--- -Tool call allowed or denied, and by what| `tool_decision`| `decision`, `source`, `tool_name`, `tool_parameters` +Tool call allowed or denied, and where the decision came from, such as a rule, a hook, or the user| `tool_decision`| `decision`, `source`, `classifier_verdict`, `permission_mode`, `tool_name`; `tool_parameters` when you set `OTEL_LOG_TOOL_DETAILS=1` +Auto mode classifier allowed or blocked a tool call, or Claude Code denied the call without a classifier verdict| `tool_decision` where `classifier_verdict` is present. For a denial without a verdict, `classifier_verdict` is `"no_verdict"` or `"unavailable"`| `classifier_verdict`, `permission_mode`, `tool_name`; `classifier_category` when you set `OTEL_LOG_TOOL_DETAILS=1` Permission mode escalation| `permission_mode_changed`| `from_mode`, `to_mode`, `trigger` +Which permission mode each tool call was checked in, including calls subagents make| `tool_decision`| `permission_mode`, `session.id` Policy hook blocked an action| `hook_execution_complete`| `hook_event`, `num_blocking` Login, logout, and authentication failure| `auth`| `action`, `success`, `error_category` MCP server connect or failure| `mcp_server_connection`| `status`, `server_name`, `is_plugin`, `error_code` @@ -1675,7 +1701,7 @@ * With tracing on, the `claude_code.interaction` span carries the prompt text in its `user_prompt` attribute * Under detailed beta tracing, spans also carry the new user messages, tool results, and system reminders sent with each request, system prompt text, and model output. Content attributes under detailed beta tracing lists each attribute. The `claude_code.system_prompt` event carries the complete system prompt * Assistant response text is not collected by default. Only response length is recorded. To include response text, set `OTEL_LOG_ASSISTANT_RESPONSES=1`. Like all OpenTelemetry data from Claude Code, the response text is sent only to the OTel endpoint you configure, never to Anthropic. When this variable is unset, `OTEL_LOG_USER_PROMPTS` is used as a fallback, so set `OTEL_LOG_ASSISTANT_RESPONSES=0` if you want prompt content without response content in events. Under detailed beta tracing, the `claude_code.llm_request` span still carries model output in `response.model_output`, which follows `OTEL_LOG_USER_PROMPTS` rather than this variable - * Tool input arguments and parameters are not logged by default. To include them, set `OTEL_LOG_TOOL_DETAILS=1`. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, `tool_decision` and `tool_result` carry the `mcp_server_name`/`mcp_tool_name` pair, host-authored names rather than argument content, even with the flag off. The exception requires Claude Code v2.1.214 or later. This data is sent only to the OTEL endpoint you configure, never to Anthropic. Arguments may still contain sensitive values, so configure your telemetry backend to filter or redact these attributes as needed. When enabled: + * Tool input arguments and parameters are not logged by default. To include them, set `OTEL_LOG_TOOL_DETAILS=1`. For Claude Desktop’s built-in servers, in sessions Claude Desktop owns, `tool_decision` and `tool_result` carry the `mcp_server_name`/`mcp_tool_name` pair, host-authored names rather than argument content, even with the flag off. This data is sent only to the OTEL endpoint you configure, never to Anthropic. Arguments may still contain sensitive values, so configure your telemetry backend to filter or redact these attributes as needed. When enabled: * `tool_result` and `tool_decision` events include a `tool_parameters` attribute with Bash commands, MCP server and tool names, and skill names. Fields such as `full_command` are emitted untruncated * `tool_result` events additionally include a `tool_input` attribute with file paths, URLs, search patterns, and other arguments. Individual values over 512 characters are truncated and the total is bounded to ~4 K characters * `user_prompt` events include the verbatim `command_name` for custom, plugin, and MCP commands
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -181,7 +181,7 @@ * `CLAUDE_STREAM_IDLE_TIMEOUT_MS` sets both watchdogs’ timeout. Claude Code raises values below 5 minutes to 5 minutes, and caps the value at 30 minutes for the byte-level watchdog. * `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` sets the byte-level watchdog’s timeout without changing the event-level watchdog’s, clamped to between 10 seconds and 30 minutes, and takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog. * `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` sets the first-byte deadline directly. Leave it unset and Claude Code uses the byte-level watchdog’s timeout, so `CLAUDE_STREAM_IDLE_TIMEOUT_MS` and `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` change the deadline too. For the clamps, the upload allowance, the `API_TIMEOUT_MS` cap, and how long the retry waits after a no-response abort, see [No response from API](</docs/en/errors#no-response-from-api>). - * `API_TIMEOUT_MS` limits the wait for response headers. Where the first-byte deadline doesn’t run, such as a Claude apps gateway session, set it below `300000`, which is 5 minutes, to retry an unanswered request sooner. Keep it above the longest wait for headers, and the longest [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>), that you expect: a request that needs longer times out again on each retry. + * `API_TIMEOUT_MS` limits the wait for response headers, not how long a response streams after them. Where the first-byte deadline doesn’t run, such as a Claude apps gateway session, set it below `300000`, which is 5 minutes, to retry an unanswered request sooner. Keep it above the longest wait for headers, and the longest [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>), that you expect: a request that needs longer times out again on each retry. * `API_FORCE_IDLE_TIMEOUT` set to `0` turns the body idle timeout off, and set to `1` turns it on for every provider. The watchdogs run independently of it, so to let a stream pause longer than their thresholds, also raise or disable them. When a watchdog aborts a stalled stream, Claude Code treats the abort as a mid-stream failure, and what you see depends on how far the response had got. Claude Code retries the request or ends the turn with an error, keeps the completed output and shows an [incomplete-response notice](</docs/en/errors#the-response-above-may-be-incomplete>), or ends the turn normally. [Automatic retries](</docs/en/errors#automatic-retries>) says where each outcome applies. In a [non-interactive session](</docs/en/headless>), and for a subagent’s response in any session, Claude Code may first prompt Claude to continue the cut-off response; [that notice’s entry](</docs/en/errors#the-response-above-may-be-incomplete>) says when it does and when you still see the notice. When the first-byte deadline fires, no response has started, so there is no partial output to keep. For how Claude Code re-sends the request and when the turn ends instead, see [No response from API](</docs/en/errors#no-response-from-api>).
modified Choose a permission mode View current →
Show diff (269 lines)
--- a/permission-modes.md +++ b/permission-modes.md @@ -14,7 +14,7 @@ `acceptEdits`| Reads, file edits, and common filesystem commands (`mkdir`, `touch`, `mv`, `cp`, etc.)| Iterating on code you’re reviewing `plan`| Reads, plus classifier-approved commands when auto mode is available| Exploring a codebase before changing it `auto`| Everything, with background safety checks| Long tasks, reducing prompt fatigue -`dontAsk`| File reads inside your working directories and pre-approved tools; anything that would prompt is denied| Locked-down CI and scripts +`dontAsk`| File reads inside your working directories and pre-approved tools; anything that would prompt is denied, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve some of those calls| Locked-down CI and scripts `bypassPermissions`| Everything| Isolated containers and VMs only The mode that reviews every action is named **Manual** in the CLI, in `claude --help`, in the VS Code and JetBrains extensions, and in the desktop app. Its config value is `default`, which is what hooks and SDK integrations use. The CLI accepts `manual` as an alias wherever you type the value, for example `claude --permission-mode manual` or `"defaultMode": "manual"`. Writes to protected paths are never auto-approved except in `bypassPermissions` mode and in plan-mode sessions where bypass permissions are available, meaning interactive terminal sessions started in a way that puts `bypassPermissions` in the mode cycle. Modes set the baseline. Layer [permission rules](</docs/en/permissions#manage-permissions>) on top to pre-approve or block specific tools. Deny rules block in every mode, including `bypassPermissions`. Deny and ask rules don’t apply to [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) as long as Claude still has at least one other tool it can call. Allow rules have no effect in `bypassPermissions`. @@ -70,16 +70,47 @@ How you run Claude Code| Built-in starting permission mode ---|--- Any settings file sets `disableAutoMode` to `"disable"`| `default` -`claude -p` or the [Agent SDK](</docs/en/agent-sdk/permissions#permission-modes>)| `default` in sessions that [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>). In sessions that don’t, such as on a third-party provider or with telemetry off, `auto` with Claude Code v2.1.285 or later and `default` on earlier versions. A session in an organization whose policy withholds the `auto` default starts in `default` instead +`claude -p` or the [Agent SDK](</docs/en/agent-sdk/permissions#permission-modes>)| `default` Your organization has the HIPAA configuration applied and the session is [eligible for it](</docs/en/hipaa-setup#check-how-developers-sign-in-and-connect>)| `default` with Claude Code v2.1.285 or later; auto mode stays available to switch to In a terminal or through the [VS Code extension](</docs/en/vs-code>)| `auto` with Claude Code v2.1.283 or later; on earlier versions, `auto` on Pro, Max, or Team plans in sessions that [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), and `default` otherwise -In your [first session after an install or upgrade](</docs/en/env-vars#first-session-after-an-install-or-upgrade>), Claude Code can choose the starting permission mode before its feature flags arrive. That session can start in a different permission mode than the table gives. When the flag, a settings file, or the built-in default selects `auto` but auto mode isn’t available to the session, Claude Code starts the session in Manual instead. Auto mode is unavailable when the session doesn’t meet the availability requirements, such as a settings file turning it off or a model that doesn’t support it, or when Anthropic has temporarily turned it off server-side. The first time the built-in default starts one of your sessions in auto mode, Claude Code shows a notice that links to this page: +When the flag, a settings file, or the built-in default selects `auto` but auto mode isn’t available to the session, Claude Code starts the session in Manual instead. Auto mode is unavailable when the session doesn’t meet the availability requirements, such as a settings file turning it off or a model that doesn’t support it, or when Anthropic has temporarily turned it off server-side. The first time the built-in default starts one of your sessions in auto mode, Claude Code shows a notice that links to this page: * In a terminal, once, at the top of the session * In the VS Code extension, as a card on the new-conversation screen that stays until you dismiss it If your `~/.claude/settings.json` sets a `defaultMode` other than `auto` and no other settings file sets one, your sessions keep starting in that mode. On Pro, Max, and Team plans, and in sessions that [don’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), Claude Code asks once, in the terminal or in the VS Code extension, whether to change the setting to auto mode. If you decline, your setting stays as it is. + +### + +​ + +Tool calls denied in `claude -p` and Agent SDK runs + +In Claude Code v2.1.302 or later, `claude -p` and [Agent SDK](</docs/en/agent-sdk/permissions#permission-modes>) runs with no permission mode set start in Manual mode. This mode appears as `default` in SDK options and settings. Calls needing approval are denied unless you approve them with an allow rule, hook, `canUseTool` callback, or `--permission-prompt-tool`. To get these calls approved, add allow rules or start in auto mode: + + * **[Add allow rules](</docs/en/permissions#manage-permissions>)** : Claude runs the calls you list. Pass [`--allowedTools "Bash(npm test)"`](</docs/en/headless#auto-approve-tools>) to `claude -p`, or set your SDK’s [allowed-tools option](</docs/en/agent-sdk/permissions#allow-and-deny-rules>). + * **Start inauto mode**: a classifier model reviews calls, so you list nothing beforehand. Pass `--permission-mode auto` to `claude -p`, or set your SDK’s [permission mode option](</docs/en/agent-sdk/permissions#set-permission-mode>). + +These examples show the auto mode form for the CLI and each SDK: + + * CLI + + * TypeScript + + * Python + + claude -p "Run the test suite and fix any failures" --permission-mode auto + + const options = { + permissionMode: "auto" + }; + + from claude_agent_sdk import ClaudeAgentOptions + + options = ClaudeAgentOptions(permission_mode="auto") + +Before v2.1.302, these runs could start in auto mode if they didn’t [fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), for example on a [third-party provider](</docs/en/third-party-integrations>) or with `DISABLE_TELEMETRY`. ### @@ -174,7 +205,7 @@ The JetBrains plugin runs Claude Code in the IDE terminal, so switching permission modes works the same as in the CLI: press `Shift+Tab` to cycle, or pass `--permission-mode` when launching. -**During a session** : in the Code tab, use the mode selector next to the send button. Not every mode appears in the selector: +**During a session** : in the Code tab, use the mode selector in the row under the prompt box. Not every mode appears in the selector: * **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 @@ -267,7 +298,12 @@ Auto mode on Bedrock, Agent Platform, or Foundry -On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode is available by default. When nothing else sets a permission mode, it’s also the built-in starting permission mode, on the versions that section’s table lists. To choose the starting permission mode yourself, set `permissions.defaultMode` as Start in a different permission mode describes, or pick a permission mode from the VS Code extension’s mode indicator. Only Claude Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and the Fable models are supported on these providers. On any other model, the session starts in Manual instead. Auto mode with Haiku 5.5 on these providers requires Claude Code v2.1.293 or later. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/managed-settings>). This removes `auto` from the `Shift+Tab` cycle, and a session started with `--permission-mode auto` starts in Manual instead. A session already running in auto mode leaves it when the setting reaches that session from an [admin-deployed source](</docs/en/managed-settings#which-managed-source-claude-code-uses>), and shows `auto mode disabled by settings`. Before v2.1.251, a running session kept auto mode until it ended. +On [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, auto mode is available by default. If you don’t set a permission mode there, interactive sessions start in auto mode, and `claude -p` or Agent SDK runs start in Manual mode, whose config value is `default`: + + * **Interactive terminal and VS Code sessions** : to start them in a permission mode other than auto, set `permissions.defaultMode` as Start in a different permission mode describes, or pick one from the VS Code extension’s mode indicator. Which mode a session starts in lists the Claude Code versions that start them in auto mode. + * **`claude -p` and Agent SDK runs**: to start one in auto mode, pass `--permission-mode auto` to `claude -p`, or pass `permissionMode: "auto"` in TypeScript or `permission_mode="auto"` in Python. If you pass no permission mode, see Tool calls denied in `claude -p` and Agent SDK runs, which also covers earlier Claude Code versions. + +Only Claude Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, and the Fable models are supported on these providers. On any other model, the session starts in Manual instead. Auto mode with Haiku 5.5 on these providers requires Claude Code v2.1.293 or later. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/managed-settings>). This removes `auto` from the `Shift+Tab` cycle, and a session started with `--permission-mode auto` starts in Manual instead. A session already running in auto mode leaves it when the setting reaches that session from an [admin-deployed source](</docs/en/managed-settings#which-managed-source-claude-code-uses>), and shows `auto mode disabled by settings`. Before v2.1.251, a running session kept auto mode until it ended. ### @@ -287,6 +323,69 @@ * **The server gives no verdict for an action** : Claude Code denies the action rather than run it unreviewed. On any connection, this happens when the response ends before the review results arrive or the results arrive in a form Claude Code can’t read. An LLM gateway or proxy that cuts responses short or rewrites the results can cause either. On a direct connection to the Anthropic API, it also happens when the server’s check fails for the action, for example by timing out. [The server returned no safety verdict](</docs/en/errors#the-server-returned-no-safety-verdict>) covers the denial message, what happens when denials repeat, and what to do. To skip asking the server and always use Claude Code’s own classifier requests, set [`CLAUDE_CODE_AUTO_MODE_SERVER=0`](</docs/en/env-vars>). On a direct connection to the Anthropic API, the variable requires Claude Code v2.1.281 or later. Setting it to `1` there turns server review on in a session that doesn’t have it yet, unless you’ve also set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`. If you set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` and leave `CLAUDE_CODE_AUTO_MODE_SERVER` unset, Claude Code also stops asking the server, except as [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) describes. + +### + +​ + +Default classifier model + +By default, classifier requests go to Claude Sonnet 5. If `/status` shows `Auto mode server` as `Enabled`, they’re sent only for calls outside the server’s review. Find the first row in this table that matches your session. You get that row’s model in place of Sonnet 5. + +Your session| Classifier model +---|--- +Has an Anthropic-configured classifier model| The configured model. Check the debug log to see which +Runs on Claude Sonnet 4.6| Sonnet 4.6 +Has [`ANTHROPIC_DEFAULT_SONNET_MODEL`](</docs/en/model-config#environment-variables>) set| Its value, or Sonnet 5 if its value is Claude Sonnet 5.5 or Claude Opus 5.5 + +If Sonnet 5 or the model in `ANTHROPIC_DEFAULT_SONNET_MODEL` is unavailable from your provider or excluded by your organization’s [model policy](</docs/en/model-config#restrict-model-selection>), Claude Code uses a fallback model. That’s your session’s model, or an Opus model in a [Fable session](</docs/en/model-config#work-with-fable>). + +### + +​ + +Choose the classifier model + +With Claude Code v2.1.302 or later, set [`CLAUDE_CODE_AUTO_MODE_MODEL`](</docs/en/env-vars>) to a full model ID to run the classifier on a model other than the default. Your cloud provider’s own full model IDs work too. This `~/.claude/settings.json` example sets Claude Sonnet 4.6: + + { + "env": { + "CLAUDE_CODE_AUTO_MODE_MODEL": "claude-sonnet-4-6" + } + } + +#### + +​ + +When your model doesn’t review + +Situation| What happens| What to do +---|---|--- +The debug log reports an Anthropic-configured classifier model| That model reviews| None needed +You set Claude Opus 5, Sonnet 5.5, Opus 5.5 or one your organization’s [model policy](</docs/en/model-config#restrict-model-selection>) excludes| The default classifier model reviews| Set another model +Your provider can’t serve the model| Classifier checks fail, so Claude Code [denies each action it checks](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>)| Set a model it serves, or remove the variable +In a session, `/status` shows `Auto mode server` as `Enabled`| The server reviews without your model| None needed + +If several situations apply, go by the first listed. + +#### + +​ + +Check which model the classifier used + +From your shell, start an auto mode session with [`--debug-file`](</docs/en/cli-reference#cli-flags>): + + claude --permission-mode auto --debug-file classifier-debug.log + +Have Claude run a shell command that isn’t read-only, then search the log for `classifier_request_started`: + + * **Your model after`model=`**: the variable took effect + * **A different model after`model=`**: search the log for `ignoring CLAUDE_CODE_AUTO_MODE_MODEL`, which gives the reason and any step to take + * **No such line** : read `Auto mode server` in `/status` at the Claude Code prompt: + * **`Enabled`** : the server is set to review this session’s calls. + * **`Disabled`** : make sure the permission mode is auto, then have Claude run another command that isn’t read-only. ### @@ -304,7 +403,7 @@ * Modifying shared infrastructure * Irreversibly destroying files that existed before the session * Force push - * Committing or pushing a change that would send secrets or sensitive data outside the repository when it runs, or widen what a deploy exposes. This covers a CI workflow or deploy configuration that passes a secret to a destination that doesn’t already receive it, a script or setup step that reads a secret store and sends the data out, and a config change that widens what a deploy publishes, such as a registry, visibility, artifact, or sourcemap setting. The check applies on any branch, applies even when the repository is public, and fires when the change is committed or pushed, whether or not that commit or push triggers the pipeline; clearing it requires naming the execution effect, not only the commit or push. Before v2.1.211, this check was scoped to the default branch instead: a push there was blocked when it carried sensitive content, changes concealed or misdescribed relative to what you asked for, content ported in from outside the repository, or routed around a review you asked for + * Committing or pushing a change that would send secrets or sensitive data outside the repository when it runs, or widen what a deploy exposes. This covers a CI workflow or deploy configuration that passes a secret to a destination that doesn’t already receive it, a script or setup step that reads a secret store and sends the data out, and a config change that widens what a deploy publishes, such as a registry, visibility, artifact, or sourcemap setting. The check applies on any branch, applies even when the repository is public, and fires when the change is committed or pushed, whether or not that commit or push triggers the pipeline; clearing it requires naming the execution effect, not only the commit or push * `git reset --hard`, `git checkout -- .`, `git restore .`, `git clean -fd`, `git stash drop`, or `git stash clear`, which the classifier presumes would discard uncommitted changes * `git commit --amend` when the commit at HEAD was not created in this session * From v2.1.198, `git commit --amend` when the commit at HEAD has already been pushed. A message-only reword is not blocked: `--amend -m` with nothing newly staged, on a commit that Claude created during this session @@ -354,7 +453,7 @@ * Installing dependencies declared in your lock files or manifests * Reading `.env` and sending credentials to their matching API * Read-only HTTP requests - * Pushing to any branch of the repository you’re working in, including the default branch. A non-default branch whose name marks it as a deploy or publication target, such as `production` or `gh-pages`, isn’t covered: the classifier judges a push there on its own terms. The push’s content is still checked against the other rules, [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) can still block push commands [as written](</docs/en/permissions#bash-rule-limits>) in every mode, and the remote’s own branch protection still applies. Before v2.1.211, only pushes to the branch you started on, branches Claude created, and routine pushes to the default branch were allowed by default + * Pushing to any branch of the repository you’re working in, including the default branch. A non-default branch whose name marks it as a deploy or publication target, such as `production` or `gh-pages`, isn’t covered: the classifier judges a push there on its own terms. A push’s content is still checked against the classifier’s other rules, and [`permissions.deny` rules](</docs/en/permissions#manage-permissions>) can still block push commands [as written](</docs/en/permissions#bash-rule-limits>) in every mode. The remote’s own branch protection still applies. From v2.1.203 until v2.1.211, only routine default-branch pushes and pushes to the branch you started on or to branches Claude created were allowed by default. * Deleting the exact jobs Claude created earlier in the same session * Reading, reviewing, or writing security-related code, configs, and threat models as part of your task * Messages between agents working together in the same multi-agent session @@ -446,7 +545,7 @@ 3. Everything else goes to the classifier, apart from critical-path removals under their default handling. The connector tools and `requiresUserInteraction` MCP tools that prompt you directly in step 1 never reach the classifier either, so neither an org-required approval nor a consent step is auto-approved 4. If the classifier blocks, Claude receives the reason. In most sessions the reason names the rule the classifier matched, such as `[Data Exfiltration]`, rather than giving a written explanation; see [Review denials](</docs/en/auto-mode-config#review-denials>) -A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can approve an action before step 3, and the classifier doesn’t check an action the mod approves. See [Extend permissions with hooks](</docs/en/permissions#extend-permissions-with-hooks>).In the VS Code extension, how [Claude in Chrome](</docs/en/chrome>) browser actions get approved depends on how the session connected to the browser: see [Permission prompts in VS Code sessions](</docs/en/chrome#permission-prompts-in-vs-code-sessions>).On entering auto mode, broad allow rules that grant arbitrary code execution are dropped: +A [mod](</docs/en/plugins/mods/overview>) you install that handles `tool.check` can also approve an action. For the cases where its approval doesn’t get past your rules and hooks, see [Extend permissions with hooks](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).In the VS Code extension, how [Claude in Chrome](</docs/en/chrome>) browser actions get approved depends on how the session connected to the browser: see [Permission prompts in VS Code sessions](</docs/en/chrome#permission-prompts-in-vs-code-sessions>).On entering auto mode, broad allow rules that grant arbitrary code execution are dropped: * Blanket `Bash(*)` or `PowerShell(*)` * Wildcarded interpreters like `Bash(python*)` @@ -466,7 +565,7 @@ Cost and latency -The classifier runs on Claude Sonnet 5 by default rather than on your `/model` selection. A classifier model that Anthropic configures server-side takes precedence over that default. When your session’s model is Claude Sonnet 4.6, or when [`availableModels`](</docs/en/model-config#restrict-model-selection>) excludes Sonnet 5, the classifier runs on the session’s model instead, or on an Opus model when the session runs on a [Fable model](</docs/en/model-config#work-with-fable>). On providers other than the Anthropic API, that Opus fallback is the model you set in [`ANTHROPIC_DEFAULT_OPUS_MODEL`](</docs/en/model-config#environment-variables>), or Opus 5 if you haven’t set one.The session’s first auto-mode request validates the Sonnet 5 default: if the request succeeds, Sonnet 5 stays the session’s classifier model, and if it fails because the model isn’t available, the session uses the fallback instead.On Enterprise plans and on accounts that use the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, classifier calls count toward your token usage. Each check sends a portion of the transcript plus the pending action, adding a round-trip before execution. Reads and working-directory edits outside protected paths skip the classifier, so the overhead comes mainly from shell commands and network operations. Where the server reviews the actions as part of the session’s model requests, there are no separate classifier calls to count; see Server-side classifier review.Sandboxed network access adds no per-connection classifier requests. The classifier judges [the hosts a command names](</docs/en/sandboxing#per-command-allowed-domains-in-auto-mode>) together with the command in one review, and Claude Code checks each connection against the approved list without calling the classifier again. +Claude Code’s classifier requests can run on a model other than your `/model` selection. See which model they run on.On Enterprise plans and on accounts that use the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, classifier calls count toward your token usage. Each check sends a portion of the transcript plus the pending action, adding a round-trip before execution. Reads and working-directory edits outside protected paths skip the classifier, so the overhead comes mainly from shell commands and network operations. Where the server reviews the actions as part of the session’s model requests, there are no separate classifier calls to count; see Server-side classifier review.Sandboxed network access adds no per-connection classifier requests. The classifier judges [the hosts a command names](</docs/en/sandboxing#per-command-allowed-domains-in-auto-mode>) together with the command in one review, and Claude Code checks each connection against the approved list without calling the classifier again. ## @@ -474,7 +573,7 @@ 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. 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>), plus actions matching your `permissions.allow` rules and calls approved by a [PreToolUse hook](</docs/en/permissions#extend-permissions-with-hooks>). 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` while this mode is active. 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. `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: claude --permission-mode dontAsk @@ -594,7 +693,7 @@ * Your working directory and its parents * Your additional working directories and their parents, but only when the removal is a glob under one of them, such as `rm -rf <dir>/*`. `rm -rf <dir>` on the directory itself doesn’t trigger this check -The checks on the home directory’s 8.3 short name and on the `\\?\C:\` and `\\localhost\C$` spellings require Claude Code v2.1.292 or later. +For mounted drive paths such as `/mnt/c` or `/Volumes/USB`, see The mounted drive prompt. The checks on the home directory’s 8.3 short name and on the `\\?\C:\` and `\\localhost\C$` spellings require Claude Code v2.1.292 or later. ### @@ -652,6 +751,60 @@ ​ +The mounted drive prompt + +The mounted drive prompt appears on macOS, Linux, and WSL when a recursive `rm` targets a listed mounted drive path, such as `/mnt/c` or `/Volumes/USB/build`. Its reason reads `Dangerous rm operation on mounted drive path: <path>`. A `/*` target gets the prompt without the recursive flag, since Claude Code reads `rm /Volumes/USB/build/*` as a removal of `/Volumes/USB/build`. Even with an allow rule for `rm`, Claude Code handles the command as a critical-path removal: a prompt or a denial depending on your permission mode. Approve the prompt to let the `rm` run, or turn the prompt off. + +#### + +​ + +Paths that get the mounted drive prompt + +Match the target of your recursive `rm` or `/*` removal against these path shapes, where each placeholder such as `<drive>` or `<name>` stands for exactly one path segment: + +Under| Path shapes that get the prompt| Examples +---|---|--- +`/Volumes`| `/Volumes/<drive>`, `/Volumes/<drive>/<name>`| `/Volumes/USB`, `/Volumes/USB/build` +`/System/Volumes`| `/System/Volumes`, `/System/Volumes/<volume>`, `/System/Volumes/<volume>/<name>`| `/System/Volumes/Data` +`/media`| `/media/<user>`, `/media/<user>/<drive>`, `/media/<user>/<drive>/<name>`| `/media/alex` +`/run/media`| `/run/media`, `/run/media/<user>`, `/run/media/<user>/<drive>`, `/run/media/<user>/<drive>/<name>`| `/run/media/alex/USB/build` +`/mnt`| `/mnt/<name>`, and `/mnt/<letter>/<name>` under a one-letter mount such as WSL’s `/mnt/c`| `/mnt/data`, `/mnt/c/Users` + +For a recursive or non-recursive `rm` on `/Volumes`, `/media`, or `/mnt` itself, you see the critical path reason `Dangerous rm operation on critical path: <path>` instead. A relative target counts from your working directory, so `rm -rf build` while you work in `/Volumes/USB` targets `/Volumes/USB/build` and gets the prompt. + +#### + +​ + +Turn off the mounted drive prompt + +To stop getting the mounted drive prompt while prompts from other causes stay, start Claude Code with [`CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT=1`](</docs/en/env-vars#variables>) in its environment. For example, set the variable in [your shell](</docs/en/env-vars#set-variables-in-your-shell>) and start `claude` from it: + + export CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT=1 + claude + +In a session started that way, the mounted drive prompt stops for a whole drive such as `/Volumes/USB` and for the other listed paths. If you allow `Bash(rm *)`, use Manual mode, and work in `/Volumes/USB`, then `rm -rf build` runs with no prompt. A prompt that still shows `Dangerous rm operation on mounted drive path` means the variable isn’t reaching the session: + + * **Variable in a settings file** : Claude Code [ignores the variable in a settings file’s `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), whichever kind of settings file, so set the variable where you start `claude` instead + * **Session started without the variable** : start `claude` again from an environment where the variable is set, since a running session doesn’t pick it up + +#### + +​ + +Removals that still prompt with the mounted drive prompt off + +In Manual mode with an allow rule for `rm`, an `rm` on a mounted drive path can still prompt, without the `Dangerous rm operation on mounted drive path` reason: + + * **Target outside your working directories** : `rm -rf /Volumes/USB/other` while you work in `/Volumes/USB/project` gets a prompt. To stop that prompt, [add a directory that contains the target](</docs/en/permissions#working-directories>) to the session + * **Target with a`*`**: `rm -rf build/*` gets a prompt. Approve that prompt to run the command, or ask Claude to name each target without a `*` + * **Target that is a critical path** : `/mnt` itself and your working directory itself stay critical paths, so `rm -rf` on either gets a prompt. Approve that prompt to let the `rm` run + +### + +​ + Critical-path removals in each permission mode What Claude Code does with a critical-path removal depends on your permission mode:
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -47,7 +47,7 @@ canUseTool callback -If not resolved by any of the above, call your [`canUseTool` callback](</docs/en/agent-sdk/user-input>) for a decision. In `dontAsk` mode, this step is skipped and the tool is denied.In the TypeScript SDK, if you set [`permissionPrompts: 'none'`](</docs/en/agent-sdk/typescript#options>), your callback isn’t called at this step. A [`PermissionRequest` hook](</docs/en/hooks#permissionrequest>) still gets a chance to decide, and if it doesn’t, Claude Code denies the call. The option requires Claude Code v2.1.259 or later. +If not resolved by any of the above, call your [`canUseTool` callback](</docs/en/agent-sdk/user-input>) for a decision. In `dontAsk` mode, this step is skipped and the tool is denied, though a [mod](</docs/en/plugins/mods/overview>) you installed can still approve [some such calls](</docs/en/permissions#precedence-among-rules-hooks-and-mods>).In the TypeScript SDK, if you set [`permissionPrompts: 'none'`](</docs/en/agent-sdk/typescript#options>), your callback isn’t called at this step. A [`PermissionRequest` hook](</docs/en/hooks#permissionrequest>) still gets a chance to decide, and if it doesn’t, Claude Code denies the call. The option requires Claude Code v2.1.259 or later. If you pass a `canUseTool` callback in a configuration where the TypeScript SDK expects the evaluation order to auto-approve calls before the callback is consulted, the SDK emits a Node.js process warning once when the query is constructed. The warning’s code is `CLAUDE_SDK_CAN_USE_TOOL_SHADOWED`. Two configurations trigger it: @@ -85,7 +85,7 @@ permissionMode: "dontAsk" }; -Listed tools are approved, apart from the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) and [reads from network paths](</docs/en/permissions#network-paths>), and every other call that would prompt is denied instead. Calls that need no approval in `default` mode run whether or not you list them, such as [read-only Bash commands](</docs/en/permissions#read-only-commands>), tools like `Agent` that don’t ask before running, and file reads inside your working directories. To remove a tool from the request entirely, add its bare name to `disallowedTools`. +Listed tools are approved, apart from the [actions no mode auto-approves](</docs/en/permission-modes#actions-no-mode-auto-approves>) and [reads from network paths](</docs/en/permissions#network-paths>). Every other call that would prompt is denied instead, 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 that need no approval in `default` mode run whether or not you list them. They include [read-only Bash commands](</docs/en/permissions#read-only-commands>), tools like `Agent` that don’t ask before running, and file reads inside your working directories. To remove a tool from the request entirely, add its bare name to `disallowedTools`. **`allowed_tools` does not constrain `bypassPermissions`.** `allowed_tools` pre-approves the tools you list. Other unlisted tools are not matched by any allow rule and fall through to the permission mode, where `bypassPermissions` approves them. Setting `allowed_tools=["Read"]` alongside `permission_mode="bypassPermissions"` still approves every tool, including `Bash`, `Write`, and `Edit`. If you need `bypassPermissions` but want specific tools blocked, use `disallowed_tools`. @@ -97,12 +97,7 @@ Permission modes -Permission modes provide global control over how Claude uses tools. You can set the permission mode when calling `query()` or change it dynamically during streaming sessions. If you don’t set one, Claude Code picks the starting permission mode by the rules in [Which mode a session starts in](</docs/en/permission-modes#which-mode-a-session-starts-in>): - - * A `permissions.defaultMode` from the session’s [settings files](</docs/en/settings#where-settings-live>) when one applies - * Otherwise the built-in default, which can be [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) - -A session that starts in auto mode drops broad allow rules such as a bare `Bash` entry, as [How auto mode evaluates actions](</docs/en/permission-modes#how-auto-mode-evaluates-actions>) describes. If your application relies on the `default` mode or on such a rule, pass `default` explicitly. Before TypeScript Agent SDK v0.3.286, omitting `permissionMode` was the same as passing `default`. +Permission modes provide global control over how Claude uses tools. You can set the permission mode when calling `query()` or change it dynamically during streaming sessions. With Claude Code v2.1.302 or later, your app starts in `default` mode unless you set a permission mode or it gets one from [`permissions.defaultMode`](</docs/en/settings-reference#permissions-defaultmode>) in its settings files. In `default` mode, Claude Code denies any tool call needing approval unless you approve it through an allow rule, hook, `canUseTool` callback, or permission prompt tool. If tool calls are denied, see [Tool calls denied in `claude -p` and Agent SDK runs](</docs/en/permission-modes#which-mode-a-non-interactive-run-starts-in>). ### @@ -115,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. 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, as are [reads from network paths](</docs/en/permissions#network-paths>) and `rm` and `rmdir` removals targeting a [critical path](</docs/en/permission-modes#critical-paths>). `canUseTool` is never called +`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 `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 @@ -254,7 +249,7 @@ Don’t ask mode (`dontAsk`) -Converts any permission prompt into a denial, without calling `canUseTool`. Tools pre-approved by `allowed_tools`, `settings.json` allow rules, or a hook run as normal, and so do calls that need no approval in `default` mode, 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 `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. ####
modified Platforms and integrations View current →
--- a/platforms.md +++ b/platforms.md @@ -100,4 +100,4 @@ * [Dispatch](</docs/en/desktop#sessions-from-dispatch>): message a task from your phone and it can spawn a Desktop session * [Remote Control](</docs/en/remote-control>): drive a running session from your phone or browser * [Channels](</docs/en/channels>): push events from chat apps or your own servers into a session - * [Scheduled tasks](</docs/en/scheduled-tasks>): run prompts on a recurring schedule + * [Scheduling options](</docs/en/scheduled-tasks#compare-scheduling-options>): run prompts on a recurring schedule
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -1027,7 +1027,7 @@ }, ) - * `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents. + * [`API_TIMEOUT_MS`](</docs/en/env-vars>): how long each request attempt can wait for response headers, in milliseconds. It doesn’t limit how long a streaming response runs after the headers arrive. Default `600000`. Applies to the main loop and all subagents. * `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window. For unattended runs that need to wait through longer outages, set [`CLAUDE_CODE_RETRY_WATCHDOG=1`](</docs/en/errors#tune-retry-behavior>): it retries transient capacity errors indefinitely and, on Claude Code v2.1.199 or later, raises the default for other transient errors to `300` and removes the cap on this variable. * `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents. While the stream watchdog is on, the default is `CLAUDE_STREAM_IDLE_TIMEOUT_MS` plus 5 minutes, which comes to `600000` unless you raise that variable. With the stream watchdog off, the default is `600000`. Before v2.1.257, the default was always `600000`. The timer resets on each stream event. On a stall, Claude Code aborts the subagent and reports the stall to the parent. For a background subagent, it also marks the task failed and attaches any partial result. * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: stream watchdog that aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, [Automatic retries](</docs/en/errors#automatic-retries>) covers what Claude Code does, based on how far the response had progressed. While the watchdog waits out a response that a gateway behind `ANTHROPIC_BASE_URL` holds open with keep-alive pings, a host that sets `include_partial_messages` keeps receiving `ping` `StreamEvent` messages. Read those frames as liveness rather than timing the session out on silence. Before v2.1.257, the frames stopped 5 minutes after the last real stream event.
modified Mods reference View current →
--- a/reference.md +++ b/reference.md @@ -277,7 +277,7 @@ Render sites -A render site is an extension point in Claude Code’s interface. Each row is a value of `e.component` in a `ui.render` hook, with the fields of `e.props` and the apps that render it. `e.surface` names the app that’s drawing, such as `terminal`, `desktop`, or `vscode`. [Change what Claude Code already draws](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>) shows what a hook can do at a site, with an example of each choice. Rendering in the VS Code extension requires extension version 2.1.299 or later and a session that [fetches feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>). [Draw in the VS Code extension](</docs/en/plugins/mods/interface#draw-in-the-vs-code-extension>) lists what the extension draws differently. +A render site is an extension point in Claude Code’s interface. Each row is a value of `e.component` in a `ui.render` hook, with the fields of `e.props` and the apps that render it. `e.surface` names the app that’s drawing, such as `terminal`, `desktop`, or `vscode`. [Change what Claude Code already draws](</docs/en/plugins/mods/interface#change-what-claude-code-already-draws>) shows what a hook can do at a site, with an example of each choice. Rendering in the VS Code extension requires extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>) needs 2.1.304 or later. [Draw in the VS Code extension](</docs/en/plugins/mods/interface#draw-in-the-vs-code-extension>) lists what the extension draws differently. Site| `e.props`| `e.requestId`| Rendered on ---|---|---|--- @@ -445,7 +445,7 @@ ---|---|--- `CLAUDE_CODE_PLUGIN_DIRS`| Environment, or `env` in `~/.claude/settings.json`| Plugin directories to load as `--plugin-dir` does, for apps you can’t pass a flag to. Absolute paths separated by `:`, or `;` on Windows. `CLAUDE_CODE_PLUGIN_DIR_WATCH`| Environment| `1` makes a long-running non-interactive session reload `--plugin-dir` mods on save -`prependPlugins`, `appendPlugins`| Managed settings. User settings only on a machine with no managed settings, for a user who isn’t signed in with a Team or Enterprise plan.| Lists of plugin ids, such as `acme-guard@acme-tools`. Mods in `prependPlugins` run before every mod a user installs, and mods in `appendPlugins` run after, in the listed order. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>). +`prependPlugins`, `appendPlugins`| Managed settings. User settings only on a machine with no managed settings, in a session whose credential isn’t a Team or Enterprise `/login`.| Lists of plugin ids, such as `acme-guard@acme-tools`. Mods in `prependPlugins` run before every mod a user installs, and mods in `appendPlugins` run after, in the listed order. See [The order mods run in](</docs/en/plugins/mods/events#the-order-mods-run-in>). `allowManagedModsOnly`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Only mods that [count as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>), and mods built into Claude Code, run their hooks. Users’ settings hooks keep running. `allowModsToOverrideDenyRules`| Managed settings, as an [option on the built-in guard](</docs/en/plugins/mods/admin#set-options-on-the-built-in-guard>)| Lets a mod a user installed approve a tool call that a `deny` rule refuses `allowManagedHooksOnly`| Managed settings| Blocks hooks and installed mods that aren’t your organization’s. See [what keeps running](</docs/en/settings-reference#what-runs-under-allowmanagedhooksonly>). @@ -453,7 +453,7 @@ `disableSideloadFlags`| Managed settings| Rejects `--plugin-dir` and `--plugin-url` at startup `pluginConfigs`| User or managed settings| Holds `userConfig` values for a mod, keyed by the plugin’s id, such as `acme-guard@acme-tools`, or its name and `@inline`, such as `first-mod@inline`, for one loaded with `--plugin-dir` -`sec-default@builtin` is a guard built into Claude Code, listed as `cc-plugin-sec-default` in `/plugin` and the debug log. It loads ahead of every mod a person installs on a machine with managed settings, or for a user signed in with a Team or Enterprise plan. If managed `prependPlugins` is set, the guard loads only when that list names it, at the position listed. Its source is in the [`mods/sec-default` directory of the Claude Code repository](<https://github.com/anthropics/claude-code/tree/main/mods/sec-default>). +`sec-default@builtin` is a guard built into Claude Code, listed as `cc-plugin-sec-default` in `/plugin` and the debug log. It loads ahead of every mod a person installs on a machine with managed settings, or in a session whose credential is a Team or Enterprise [`/login`](</docs/en/authentication#authentication-precedence>). If managed `prependPlugins` is set, the guard loads only when that list names it, at the position listed. Its source is in the [`mods/sec-default` directory of the Claude Code repository](<https://github.com/anthropics/claude-code/tree/main/mods/sec-default>). ##
modified Automate work with scheduled tasks View current →
Show diff (571 lines)
--- a/routines.md +++ b/routines.md @@ -1,12 +1,21 @@ -Routines are in research preview. Behavior, limits, and the API surface may change. - -A routine is a saved Claude Code configuration: a prompt, one or more repositories, and a set of [connectors](</docs/en/mcp>), packaged once and run automatically. Routines execute on Anthropic-managed cloud infrastructure, or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there, so they keep working when your laptop is closed. Each routine can have one or more triggers attached to it: - - * **Scheduled** : run on a recurring cadence like hourly, nightly, or weekly, or once at a specific future time - * **API** : trigger on demand by sending an HTTP POST to a per-routine endpoint with a bearer token +Scheduled tasks are in research preview. Behavior, limits, and the API surface may change. + +A cloud scheduled task, formerly a routine, is a saved Claude Code configuration: a prompt, one or more repositories, and a set of [connectors](</docs/en/mcp>), packaged once and run automatically. Scheduled tasks execute on Anthropic-managed cloud infrastructure, or on your organization’s [self-hosted environment](</docs/en/self-hosted-environments>) when routed there, so they keep working when your laptop is closed. Each scheduled task can have one or more triggers attached to it: + + * **Schedule** : run on a recurring cadence like hourly, nightly, or weekly, or once at a specific future time + * **API** : trigger on demand by sending an HTTP POST to the task’s own endpoint with a bearer token * **GitHub** : run automatically in response to repository events such as pull requests or releases -A single routine can combine triggers. For example, a PR review routine can run nightly, trigger from a deploy script, and also react to every new PR. Routines are available on Pro, Max, Team, and Enterprise plans. Create and manage them at [claude.ai/code/routines](<https://claude.ai/code/routines>), or from the CLI with `/schedule`. Team and Enterprise Owners can disable routines for all members with the Routines toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). When disabled, existing routines stop running and members cannot create new ones. This page covers creating a routine, configuring each trigger type, managing runs, and how usage limits apply. +A single scheduled task can combine triggers. For example, a PR review task can run nightly, trigger from a deploy script, and also react to every new PR. A scheduled task doesn’t need a schedule: + + * A task with only an API trigger runs when you call its endpoint. + * A task with only a GitHub trigger runs when a matching repository event occurs. + +Scheduled tasks are available on Pro, Max, Team, and Enterprise plans. Create and manage them at [claude.ai/code/routines](<https://claude.ai/code/routines>), or from the CLI with `/schedule`. The earlier name, routines, still appears in the web address, the CLI, and the API. + +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. ## @@ -14,15 +23,28 @@ Example use cases -Each example pairs a trigger type with the kind of work routines are suited to: unattended, repeatable, and tied to a clear outcome. **Backlog maintenance.** A schedule trigger runs every weeknight against your issue tracker via a connector. The routine reads issues opened since the last run, applies labels, assigns owners based on the area of code referenced, and posts a summary to Slack so the team starts the day with a groomed queue. **Alert triage.** Your monitoring tool calls the routine’s API endpoint when an error threshold is crossed, passing the alert body as `text`. The routine’s prompt tells Claude to investigate the alert in the fire payload, so it pulls the stack trace, correlates it with recent commits in the repository, and opens a draft pull request with a proposed fix and a link back to the alert. On-call reviews the PR instead of starting from a blank terminal. **Bespoke code review.** A GitHub trigger runs on `pull_request.opened`. The routine applies your team’s own review checklist, leaves inline comments for security, performance, and style issues, and adds a summary comment so human reviewers can focus on design instead of mechanical checks. **Deploy verification.** Your CD pipeline calls the routine’s API endpoint after each production deploy. The routine runs smoke checks against the new build, scans error logs for regressions, and posts a go or no-go to the release channel before the deploy window closes. **Docs drift.** A schedule trigger runs weekly. The routine scans merged PRs since the last run, flags documentation that references changed APIs, and opens update PRs against the docs repository for an editor to review. **Library port.** A GitHub trigger runs on `pull_request.closed` filtered to merged PRs in one SDK repository. The routine ports the change to a parallel SDK in another language and opens a matching PR, keeping the two libraries in step without a human re-implementing each change. - -## - -​ - -Create a routine - -Create a routine from the web at [claude.ai/code/routines](<https://claude.ai/code/routines>), from the Desktop app, or from the CLI. All three surfaces write to the same cloud account, so a routine you create in one shows up in the others immediately. In the Desktop app’s **Code** tab, click **Routines** in the sidebar or in the sidebar’s **More** menu, then **New routine** , and choose **Cloud** ; choosing **Local** instead creates a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), which runs on your machine rather than in the cloud. The creation form sets up the routine’s prompt, repositories, environment, connectors, and triggers. Routines run autonomously as full Claude Code cloud sessions: there is no permission-mode picker, and the session runs shell commands, uses [skills](</docs/en/skills>) committed to the cloned repository, and calls any connectors you include, all without stopping for approval apart from some artifact actions. What a routine can reach is determined by the repositories you select, the [environment’s](</docs/en/cloud-environments>) network access and variables, and the connectors you include. Scope each of those to what the routine actually needs. Routines belong to your individual claude.ai account. They are not shared with teammates, and their runs count against your account’s usage and limits. Anything a routine does through your connected GitHub identity or connectors appears as you: commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services. +Each example pairs a trigger type with the kind of work scheduled tasks are suited to: unattended, repeatable, and tied to a clear outcome. + + * **Backlog maintenance** : a schedule trigger runs every weeknight in your repository, with your issue tracker added as a connector. The scheduled task reads issues opened since the last run, applies labels, and assigns owners based on the area of code referenced. It then posts a summary to Slack so the team starts the day with a groomed queue. + * **Alert triage** : your monitoring tool calls the scheduled task’s API endpoint when an error threshold is crossed, passing the alert body as `text`. The task’s prompt tells Claude to investigate the alert in the fire payload, so it pulls the stack trace and correlates it with recent commits in the repository. It then opens a draft pull request with a proposed fix and a link back to the alert. On-call reviews the PR instead of starting from a blank terminal. + * **Bespoke code review** : a GitHub trigger runs on `pull_request.opened`. The scheduled task applies your team’s own review checklist and leaves inline comments for security, performance, and style issues. It also adds a summary comment so human reviewers can focus on design instead of mechanical checks. + * **Deploy verification** : your CD pipeline calls the scheduled task’s API endpoint after each production deploy. The task runs smoke checks against the new build, scans error logs for regressions, and posts a go or no-go to the release channel before the deploy window closes. + * **Docs drift** : a schedule trigger runs weekly. The scheduled task scans merged PRs since the last run, flags documentation that references changed APIs, and opens update PRs against the docs repository for an editor to review. + * **Library port** : a GitHub trigger runs on `pull_request.closed` filtered to merged PRs in one SDK repository. The scheduled task ports the change to a parallel SDK in another language and opens a matching PR, keeping the two libraries in step without a human re-implementing each change. + +## + +​ + +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>) committed to the cloned repository, and calls any connectors you include, all without stopping for approval apart from some artifact actions. What a scheduled task can reach is determined by: + + * The repositories you select + * The [environment’s](</docs/en/cloud-environments>) network access and variables + * The connectors you include + +Scope each of those to what the task needs. Scheduled tasks belong to your individual claude.ai account. They are not shared with teammates, and their runs count against your account’s usage and limits. Anything a scheduled task does through your connected GitHub identity or connectors appears as you. Commits and pull requests carry your GitHub user, and Slack messages, Linear tickets, or other connector actions use your linked accounts for those services. ### @@ -32,63 +54,71 @@ 1 -Open the creation form - -Visit [claude.ai/code/routines](<https://claude.ai/code/routines>) and click **New routine**. +Open the creation dialog + +Go to [claude.ai/code/routines](<https://claude.ai/code/routines>) and click **New task**. If a menu opens first, select **Set up manually**. The **New scheduled task** dialog opens. The menu’s other option, **Create with Claude** , lets you describe the task in a chat and have Claude create it instead.If **Repositories** and **Environment** are already showing when the dialog opens, see how that dialog differs. Otherwise, this dialog also creates scheduled tasks for claude.ai chat. To make yours what the dialog calls a Claude Code task, select a repository or add a GitHub event or API trigger in the steps that follow. That kind of task runs Claude Code in a cloud session. 2 -Name the routine and write the prompt - -Give the routine a descriptive name and write the prompt Claude runs each time. The prompt is the most important part: the routine runs autonomously, so the prompt must be self-contained and explicit about what to do and what success looks like.When a trigger fires, the session receives the routine’s saved prompt as its assigned task and carries it out, rather than treating it as untrusted content that arrived mid-conversation. The trigger attests only that the prompt was stored ahead of time by an authorized session on your account, so the fired prompt is not live user input and can’t act as approval or consent for actions during the run. Content the session fetches during the run keeps its normal handling. Before v2.1.213, the session received the same prompt framed as an untrusted background notification and could refuse to act on it.The prompt input includes a model selector. Claude uses the selected model on every run. +Name the task and write the prompt + +Give the scheduled task a descriptive name and write the prompt Claude runs each time. The prompt is the most important part: the task runs autonomously, so the prompt must be self-contained and explicit about what to do and what success looks like. Select a model in the prompt input’s model selector. Claude uses it on every run.When a trigger fires, the session receives the saved prompt as its assignment and carries it out, rather than treating it as untrusted content that arrived mid-conversation. The trigger attests only that the prompt was stored ahead of time by an authorized session on your account. The fired prompt is therefore not live user input and can’t act as approval or consent for actions during the run. Content the session fetches during the run keeps its normal handling. 3 +Select a trigger + +In the **Trigger** row, choose how the task starts. To combine several triggers, click **+** at the end of the row. + + * Schedule + + * GitHub event + + * API + +Pick a preset frequency for a recurring run. See Add a schedule trigger for timezone handling, late starts, custom cron intervals, and one-off runs. + +Select the repository, the event to react to, and optional filters. See Add a GitHub trigger for the full list of supported events and filter fields. + +Select **API** here. When you click **Create** , the **API token** dialog shows the token once, so copy it before you close the dialog. See Add an API trigger to copy the URL or generate a new token. + +4 + Select repositories -Add one or more GitHub repositories for Claude to work in. Each repository is cloned at the start of a run. Claude creates `claude/`-prefixed branches for its changes. - -4 +Expand **Advanced settings**. Under **Repository** on the **General** tab, select one or more GitHub repositories for Claude to work in.Each repository is cloned at the start of a run. Claude creates `claude/`-prefixed branches for its changes. + +5 Select an environment -Pick a [cloud environment](</docs/en/cloud-environments>) for the routine. Environments control what the cloud session has access to: +After you select a repository, **Cloud environment** appears below it. Pick a [cloud environment](</docs/en/cloud-environments>) for the task. Environments control what the cloud session has access to: * **Network access** : set the level of internet access available during each run * **Environment variables** : provide values Claude can use during each run. They’re [visible to anyone who uses the environment](</docs/en/cloud-environments#what-carries-over-from-your-setup>), so in an Anthropic-hosted environment, store keys for the APIs Claude calls during a run as [network secrets](</docs/en/cloud-environments#add-network-secrets>) instead. That section also lists the requests that never get a secret - * **Setup script** : install dependencies and tools the routine needs. The result is [cached](</docs/en/cloud-environments#environment-caching>), so the script doesn’t re-run on every session - -A **Default** environment is provided with **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains through the session’s network. Connectors you add to the routine reach their services through Anthropic’s servers, so they don’t need allowlist changes. If your routine needs to reach your own services directly, or a domain outside that list, edit the environment’s [network access](</docs/en/cloud-environments#network-access>) before running. To use a separate environment, [create one](</docs/en/cloud-environments#configure-your-environment>) first. - -5 - -Select a trigger - -Under **Select a trigger** , choose how the routine starts. You can pick one trigger type or combine several. - - * Schedule - - * GitHub event - - * API - -Pick a preset frequency for a recurring run, or schedule a single one-off run at a specific timestamp. See Add a schedule trigger for timezone handling, late starts, custom cron intervals, and one-off runs. - -Select the repository, the event to react to, and optional filters. See Add a GitHub trigger for the full list of supported events and filter fields. - -Select **API** here, then save the routine. The URL and token are generated after the routine is saved, since they depend on the routine ID. See Add an API trigger to copy the URL and generate a token. + * **Setup script** : install dependencies and tools the task needs. The result is [cached](</docs/en/cloud-environments#environment-caching>), so the script doesn’t re-run on every session + +A **Default** environment is provided with **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) of package registries, cloud provider APIs, container registries, and common development domains through the session’s network. Connectors you add to the task reach their services through Anthropic’s servers, so they don’t need allowlist changes.If your task needs to reach your own services directly, or a domain outside that list, edit the environment’s [network access](</docs/en/cloud-environments#network-access>) before running. To use a separate environment, [create one](</docs/en/cloud-environments#configure-your-environment>) first. 6 Review connectors -Under **Connectors** at the bottom of the form, all of your connected [MCP connectors](</docs/en/mcp>) are included by default. Remove any the routine doesn’t need: Claude can use every tool from an included connector, including writes, without asking for permission during a run. +Switch to the **Connectors** tab of **Advanced settings**. All of your connected [MCP connectors](</docs/en/mcp>) are included by default. Remove any the task doesn’t need: Claude can use every tool from an included connector, including writes, without asking for permission during a run. 7 -Create the routine - -Click **Create**. The routine appears in the list and runs the next time one of its triggers matches. To start a run immediately, click **Run now** on the routine’s 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. +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. + +#### + +​ + +Dialog with Repositories and Environment in the main view + +Follow the steps to create from the web, and fill in each field in the dialog’s main view rather than under **Advanced settings**. This dialog creates only Claude Code tasks. Select the repository before you add a GitHub event trigger, because that trigger is unavailable until a repository is selected. ### @@ -96,7 +126,12 @@ Create from the CLI -Run `/schedule` in any session to create a scheduled routine conversationally. You can also pass a description directly, for a recurring routine like `/schedule daily PR review at 9am` or a one-off like `/schedule clean up feature flag in one week`. Claude walks through the same information the web form collects, then saves the routine to your account. The command is also available under the alias `/routines`. A successful start looks like a conversation: Claude asks follow-up questions about the schedule, repositories, and prompt before saving. If Claude instead replies that you need to authenticate or that it can’t connect to your remote claude.ai account, no routine was created; see Troubleshooting. `/schedule` in the CLI creates scheduled routines. To add an API trigger, edit the routine on the web at [claude.ai/code/routines](<https://claude.ai/code/routines>). You can add a GitHub trigger from the web or from the CLI. The CLI path requires Claude Code v2.1.225 or later. A routine with no schedule trigger, such as one started only by API calls or GitHub events, has no next run time, and the CLI shows none when Claude saves or updates it. Before v2.1.211, the CLI reported a next run time in the year 1 for these routines. +Run `/schedule` in any session to create a scheduled task conversationally. You can also pass a description directly, for a recurring task like `/schedule daily PR review at 9am` or a one-off like `/schedule clean up feature flag in one week`. Claude walks through the same information the web dialog collects, then saves the task to your account. The command is also available under the alias `/routines`. A successful start looks like a conversation: Claude asks follow-up questions about the schedule, repositories, and prompt before saving. If Claude instead replies that you need to authenticate or that it can’t connect to your remote claude.ai account, no scheduled task was created; see Troubleshooting. A task you create with `/schedule` has a schedule trigger. You can also add the other trigger types: + + * **API trigger** : edit the task on the web at [claude.ai/code/routines](<https://claude.ai/code/routines>) + * **GitHub trigger** : edit the task on the web, or ask Claude in the CLI. Adding one from the CLI requires Claude Code v2.1.225 or later + +A scheduled task with no schedule trigger, such as one started only by API calls or GitHub events, has no next run time. The CLI shows none when Claude saves or updates it. Before v2.1.211, the CLI reported a next run time in the year 1 for these tasks. ## @@ -104,7 +139,7 @@ Configure triggers -A routine starts when one of its triggers matches. You can attach any combination of schedule, API, and GitHub triggers to the same routine, and add or remove them at any time from the **Select a trigger** section of the routine’s edit form. +A scheduled task starts when one of its triggers matches. Add or remove a task’s triggers at any time in the **Trigger** row of the task’s edit dialog. When a task has two or more triggers, each one has a trash icon in that dialog. To remove a schedule or GitHub event trigger, click its trash icon, then **Save changes**. To remove an API trigger, delete its token instead. ### @@ -112,7 +147,11 @@ Add a schedule trigger -A schedule trigger runs the routine on a recurring cadence, or once at a specific future time. Pick a preset frequency in the **Select a trigger** section: hourly, daily, weekdays, or weekly. Times are entered in your local zone and converted automatically, so the routine runs at that wall-clock time regardless of where the cloud infrastructure is located. 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. For a custom interval such as every two hours or the first of each month, pick the closest preset in the form, 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. +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. #### @@ -120,7 +159,13 @@ Schedule a one-off run -A one-off schedule fires the routine a single time at a specific timestamp. Use it to remind yourself later in the week, to open a cleanup PR after a rollout finishes, or to start a follow-up task after an upstream change ships. After the routine fires, it auto-disables and the web UI marks it as **Ran**. To run it again, edit the routine and set a new one-off 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. +A one-off schedule runs the task a single time at a specific timestamp. For example, use it to: + + * Remind yourself later in the week + * 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. /schedule tomorrow at 9am, summarize yesterday's merged PRs @@ -134,44 +179,44 @@ Add an API trigger -An API trigger gives a routine a dedicated HTTP endpoint. POSTing to the endpoint with the routine’s bearer token starts a new session and returns a session URL. Use this to wire Claude Code into alerting systems, deploy pipelines, internal tools, or anywhere you can make an authenticated HTTP request. API triggers are added to an existing routine from the web. The CLI can’t currently create, regenerate, or delete tokens. +An API trigger gives a scheduled task a dedicated HTTP endpoint. POSTing to the endpoint with the task’s bearer token starts a new session and returns a session URL. Use this to wire Claude Code into alerting systems, deploy pipelines, internal tools, or anywhere you can make an authenticated HTTP request. Add an API trigger on the web, either while you create the task or later with the steps below. You can’t add an API trigger or manage its token from the CLI. 1 -Open the routine for editing - -Go to [claude.ai/code/routines](<https://claude.ai/code/routines>), click the routine you want to trigger via API, then open the menu next to the routine’s name and select **Edit**. +Open the task for editing + +Go to [claude.ai/code/routines](<https://claude.ai/code/routines>), click the scheduled task you want to trigger via API, then open the menu next to its name and select **Edit**. The **Edit scheduled task** dialog opens. 2 Add an API trigger -Scroll to the **Select a trigger** section below the **Instructions** box, click **Add another trigger** , and choose **API**. +In the **Trigger** row, click **+** and select **API** from the menu that opens. A panel with the **Fire URL** and **Token** for this task appears. 3 Copy the URL and generate a token -The modal shows the URL for this routine along with a sample curl command. Copy the URL, then click **Generate token** and copy the token immediately. The token is shown once and cannot be retrieved later, so store it somewhere secure such as your alerting tool’s secret store. +Copy the **Fire URL**. Click **Generate token** , then copy the token from the **Token generated** dialog immediately. The token is shown once and can’t be retrieved later, so store it somewhere secure such as your alerting tool’s secret store.The API trigger takes effect as soon as you generate the token. You don’t need to click **Save changes** , so close the dialog when you’re done. 4 Call the endpoint -Send the token in the `Authorization: Bearer` header when you POST to the URL. The Trigger a routine section below shows a complete example. - -Each routine has its own token, scoped to triggering that routine only. To turn off API access or rotate the token, return to the same modal: - - * **Turn off API access** : click **Delete token** , the trash icon next to **Regenerate** - * **Rotate the token** : click **Regenerate** +Send the token in the `Authorization: Bearer` header when you POST to the URL. Trigger a scheduled task shows a complete example. + +Each scheduled task has its own token, scoped to triggering that task only. To turn off API access or rotate the token, open the task’s **Edit scheduled task** dialog again. Both controls are next to the token in the API trigger’s panel and take effect immediately: + + * **Turn off API access** : click **Delete token** , the trash icon next to **Regenerate**. This removes the API trigger + * **Rotate the token** : click **Regenerate**. The previous token stops working, and the **Token generated** dialog shows the new one once #### ​ -Trigger a routine - -Send a POST request to the `/fire` endpoint with the bearer token in the `Authorization` header. The request body accepts an optional `text` field for run-specific context such as an alert body or a failing log, passed to the routine alongside its saved prompt. The value is freeform text and is not parsed: if you send JSON or another structured payload, the routine receives it as a literal string. The `text` value doesn’t reach the routine as a bare message. It arrives wrapped in a `<routine-fire-payload>` block that labels it as untrusted data and tells Claude not to follow instructions inside it unless the routine’s own prompt says to. The same wrapping applies to text supplied with **Run now** in the web UI. This means a routine’s saved prompt must opt in to acting on fire text: write the prompt to reference the payload explicitly, for example “Investigate the alert described in the routine-fire-payload block”, or the routine treats the text as inert context. Anyone holding the bearer token can send `text`, so the wrapper makes fire text from a leaked token arrive labeled as untrusted data rather than as direct instructions to your routine. The example below triggers a routine from a shell. The routine ID and token shown are placeholders: replace them with the URL and token you copied when adding the API trigger, or the request fails with a `401` authentication error: +Trigger a scheduled task + +Send a POST request to the `/fire` endpoint with the bearer token in the `Authorization` header. The request body accepts an optional `text` field for run-specific context such as an alert body or a failing log, passed to the task alongside its saved prompt. The value is freeform text and is not parsed: if you send JSON or another structured payload, the task receives it as a literal string. The `text` value doesn’t reach the routine as a bare message. It arrives wrapped in a `<routine-fire-payload>` block that labels it as untrusted data and tells Claude not to follow instructions inside it unless the routine’s own prompt says to. The same wrapping applies to text supplied with **Run now** in the web UI. This means a routine’s saved prompt must opt in to acting on fire text: write the prompt to reference the payload explicitly, for example “Investigate the alert described in the routine-fire-payload block”, or the routine treats the text as inert context. Anyone holding the bearer token can send `text`, so the wrapper makes fire text from a leaked token arrive labeled as untrusted data rather than as direct instructions to your routine. The example below triggers a scheduled task from a shell. The task ID and token shown are placeholders: replace them with the URL and token you copied when adding the API trigger, or the request fails with a `401` authentication error: curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABCDEFGHJKLMNOPQRSTUVW/fire \ -H "Authorization: Bearer sk-ant-oat01-xxxxx" \ @@ -198,7 +243,7 @@ API reference -For the full API reference, including all error responses, validation rules, and field limits, see [Trigger a routine via API](<https://platform.claude.com/docs/en/api/claude-code/routines-fire>) in the Claude Platform documentation. The `/fire` endpoint is available to claude.ai users only and is not part of the Claude Platform API surface. +For the full API reference, including all error responses, validation rules, and field limits, see [Trigger a routine through the API](<https://platform.claude.com/docs/en/api/claude-code/routines-fire>) in the Claude Platform documentation. The `/fire` endpoint is available to claude.ai users only and is not part of the Claude Platform API surface. ### @@ -208,24 +253,24 @@ A GitHub trigger starts a new session automatically when a matching event occurs on a connected repository. Claude Code doesn’t reuse sessions across events, so two PR updates produce two independent sessions. -GitHub webhook events are subject to per-routine and per-account hourly caps. Events beyond the limit are dropped until the window resets. +GitHub webhook events are subject to per-task and per-account hourly caps. Events beyond the limit are dropped until the window resets. The Claude GitHub App must be installed on the repository you want to subscribe to, whichever surface you configure the trigger from. * Configure GitHub triggers from the web UI, which prompts you to install the app when it’s missing. Follow the steps below to configure one on the web. - * From the CLI, install the app from the [GitHub App page](<https://github.com/apps/claude>) first, then ask Claude to attach a GitHub trigger to an existing routine, for example `/schedule add a GitHub trigger to my nightly review for pull requests opened in acme/webapp`. The CLI path requires Claude Code v2.1.225 or later. When Claude adds the trigger, it replies with a link to the routine the trigger fires. + * From the CLI, install the app from the [GitHub App page](<https://github.com/apps/claude>) first, then ask Claude to attach a GitHub trigger to an existing scheduled task, for example `/schedule add a GitHub trigger to my nightly review for pull requests opened in acme/webapp`. The CLI path requires Claude Code v2.1.225 or later. When Claude adds the trigger, it replies with a link to the task the trigger fires. 1 -Open the routine for editing - -Go to [claude.ai/code/routines](<https://claude.ai/code/routines>), click the routine, then open the menu next to the routine’s name and select **Edit**. +Open the task for editing + +Go to [claude.ai/code/routines](<https://claude.ai/code/routines>), click the scheduled task, then open the menu next to its name and select **Edit**. The **Edit scheduled task** dialog opens. 2 Add a GitHub event trigger -Scroll to the **Select a trigger** section, click **Add another trigger** , and choose **GitHub event**. +In the **Trigger** row, click **+** and select **GitHub event** from the menu that opens. Running `/web-setup` in the CLI grants repository access for cloning, but it does not install the Claude GitHub App and does not enable webhook delivery. @@ -233,7 +278,7 @@ Configure the trigger -Select the repository, choose an event from the supported events list, and optionally add filters. Save the trigger. +Change the repository if needed, choose an event from the supported events list, and optionally add filters. Then click **Save changes** at the bottom of the dialog to apply the trigger. #### @@ -254,7 +299,7 @@ Filter pull requests -Use filters to narrow which pull requests start a new session. All filter conditions must match for the routine to trigger. The available filter fields are: +Use filters to narrow which pull requests start a new session. All filter conditions must match for the scheduled task to trigger. The available filter fields are: Filter| Matches ---|--- @@ -270,16 +315,16 @@ Each filter pairs a field with an operator: equals, contains, starts with, is one of, is not one of, or matches regex. The `matches regex` operator tests the entire field value, not a substring within it. To match any title containing `hotfix`, write `.*hotfix.*`. Without the surrounding `.*`, the filter matches only a title that is exactly `hotfix` with nothing before or after. For literal substring matching without regex syntax, use the `contains` operator instead. A few example filter combinations: * **Auth module review** : base branch `main`, head branch contains `auth-provider`. Sends any PR that touches authentication to a focused reviewer. - * **Ready-for-review only** : is draft is `false`. Skips drafts so the routine only runs when the PR is ready for review. - * **Label-gated backport** : labels include `needs-backport`. Triggers a port-to-another-branch routine only when a maintainer tags the PR. - -## - -​ - -Manage routines - -Click a routine in the list to open its detail page. The detail page shows the routine’s repositories, connectors, prompt, schedule, API tokens, GitHub triggers, and a list of past runs. + * **Ready-for-review only** : is draft is `false`. Skips drafts so the task only runs when the PR is ready for review. + * **Label-gated backport** : labels include `needs-backport`. Triggers a port-to-another-branch task only when a maintainer tags the PR. + +## + +​ + +Manage scheduled tasks + +Click a scheduled task in the list to open its detail page. The detail page shows the task’s repositories, connectors, prompt, schedule, API tokens, GitHub triggers, and a list of past runs. ### @@ -289,28 +334,28 @@ Click any run to open it as a full session. From there you can see what Claude did, review changes, create a pull request, or continue the conversation. Each run session works like any other session: use the dropdown menu next to the session title to rename, archive, or delete it. -A green status in the run list means the session started and exited without an infrastructure error. It does not mean the task in your prompt succeeded. Open the run to read the transcript and confirm what Claude actually did. Blocked network requests, missing connector tools, and task-level failures all surface there rather than in the status indicator. - -### - -​ - -Edit and control routines - -From the routine detail page you can: - - * Click **Run now** to start a run immediately without waiting for the next scheduled time. You can optionally supply run-specific text, which reaches the routine the same way as the API trigger’s `text` field. - * Use the on/off switch at the top of the page to pause or resume the schedule. Paused routines keep their configuration but don’t run until you re-enable them. - * Open the menu next to the routine’s name and select **Edit** to change the name, prompt, repositories, environment, connectors, or any of the routine’s triggers. The **Select a trigger** section is where you add or remove schedules, API tokens, and GitHub event triggers. - * Open the same menu and select **Delete** to delete the routine. - -### - -​ - -Manage routines from the CLI - -The CLI supports managing existing routines. Run `/schedule list` to see all routines, `/schedule update` to change one, or `/schedule run` to trigger it immediately. You can also ask about a routine’s run history, for example `/schedule why did my nightly review do nothing this morning?`. Claude lists the routine’s recent runs with their status and a link to open each run on the web, and reads a run’s log to explain what happened, including tool errors, permission denials, and the final result. Requires Claude Code v2.1.227 or later. +A green status in the run list means the session started and exited without an infrastructure error. It does not mean the work your prompt describes succeeded. Open the run to read the transcript and confirm what Claude actually did. Blocked network requests, missing connector tools, and failures in the work itself all surface there rather than in the status indicator. + +### + +​ + +Edit and control scheduled tasks + +From the detail page you can: + + * Click **Run now** to start a run immediately without waiting for the next scheduled time. + * Use the on/off switch at the top of the page to pause or resume the schedule. Paused tasks keep their configuration but don’t run until you turn them back on. + * Open the menu next to the task’s name and select **Edit** to change the name, prompt, repositories, environment, connectors, or any of the task’s triggers. The **Edit scheduled task** dialog opens with the same layout as the creation dialog. To add a trigger, click **+** in the **Trigger** row. Click **Save changes** to apply your edits. API token actions take effect immediately, without **Save changes**. + * Open the same menu and select **Delete** to delete the task. + +### + +​ + +Manage scheduled tasks from the CLI + +Run `/schedule list` to see your scheduled tasks, `/schedule update` to change one, or `/schedule run` to start one immediately. You can also ask about a scheduled task’s run history, for example `/schedule why did my nightly review do nothing this morning?`. Claude lists the task’s recent runs with their status and a link to open each run on the web. It also reads a run’s log to explain what happened, including tool errors, permission denials, and the final result. Requires Claude Code v2.1.227 or later. ### @@ -318,7 +363,11 @@ Repositories and branch permissions -Routines need GitHub access to clone repositories. When you create a routine from the CLI with `/schedule`, Claude checks whether your account has GitHub access for the repository you ran it from and, if it doesn’t, adds a setup note naming how to grant it. See [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>) for the two ways to grant access. On Team and Enterprise plans, an [Owner](</docs/en/server-managed-settings#access-control>) of your Claude organization has to turn on each method before you can use it; see [Connect GitHub](</docs/en/web-quickstart#connect-github>). If your GitHub connection is missing or expired when a run is due, the routine skips runs until you reconnect, for up to 72 hours. Reconnect GitHub within that window and the routine resumes on its own. After 72 hours without a connection, the routine turns off, and you turn it back on after reconnecting GitHub. Each repository you add is cloned on every run. Claude starts from the repository’s default branch unless your prompt specifies otherwise. If a GitHub pull request event triggers the run and the pull request’s repository is the first repository in the routine, that repository starts from the pull request’s head commit instead. Claude pushes its work to a branch prefixed with `claude/` unless your prompt directs it to push to another branch. To control which branches a run can push to, use branch protection rules or rulesets on GitHub. For runs on Anthropic-managed infrastructure, and for self-hosted runs that push through [Anthropic’s git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), GitHub applies them to the GitHub access you connected, so a rule that access can bypass doesn’t block a run’s push. A self-hosted run that pushes with the git credentials your deployment provides is checked against those instead. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>). +Scheduled tasks need GitHub access to clone repositories. When you create a scheduled task from the CLI with `/schedule`, Claude checks whether your account has GitHub access for the repository you ran it from. If it doesn’t, Claude adds a setup note naming how to grant it. + +See [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>) for the two ways to grant access. On Team and Enterprise plans, an [Owner](</docs/en/server-managed-settings#access-control>) of your Claude organization has to turn on each method before you can use it; see [Connect GitHub](</docs/en/web-quickstart#connect-github>). + +If your GitHub connection is missing or expired when a run is due, the scheduled task skips runs until you reconnect, for up to 72 hours. Reconnect GitHub within that window and the task resumes on its own. After 72 hours without a connection, the task turns off, and you turn it back on after reconnecting GitHub. Each repository you add is cloned on every run. Claude starts from the repository’s default branch unless your prompt specifies otherwise. If a GitHub pull request event triggers the run and the pull request’s repository is the task’s first repository, that repository starts from the pull request’s head commit instead. Claude pushes its work to a branch prefixed with `claude/` unless your prompt directs it to push to another branch. To control which branches a run can push to, use branch protection rules or rulesets on GitHub. For runs on Anthropic-managed infrastructure, and for self-hosted runs that push through [Anthropic’s git proxy](</docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy>), GitHub applies them to the GitHub access you connected, so a rule that access can bypass doesn’t block a run’s push. A self-hosted run that pushes with the git credentials your deployment provides is checked against those instead. See [Configure git](</docs/en/self-hosted-environments-deploy#configure-git>). ### @@ -326,7 +375,12 @@ Connectors -Routines can use your connected MCP connectors to read from and write to external services during each run. For example, a routine 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 routine, add it as a connector at [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>). For a routine with one repository, you can instead declare it in a committed [`.mcp.json`](</docs/en/mcp#project-scope>) so it is part of the cloned repository. When you create a routine, 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 routine form. To manage or add connectors outside of the routine form, visit [claude.ai/customize/connectors](<https://claude.ai/customize/connectors>) or use `/schedule update` in the CLI. +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, you can instead declare the server in a committed [`.mcp.json`](</docs/en/mcp#project-scope>) so it is part of the cloned repository + +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. ### @@ -334,7 +388,7 @@ When a run publishes an artifact without asking -When a routine’s schedule or **Run now** starts a run, Claude can publish a new [artifact](</docs/en/artifacts>) without asking. The new artifact is visible only to you until you [share it](</docs/en/artifacts#share-an-artifact>). If the publish declares runtime capabilities for the page, such as [connector calls](</docs/en/artifacts#pull-live-data-with-mcp-connectors>) or [file downloads](</docs/en/artifacts#offer-a-file-download>), Claude asks first. In those runs, Claude republishes an existing artifact without asking only when all of these hold: +When a scheduled task’s schedule or **Run now** starts a run, Claude can publish a new [artifact](</docs/en/artifacts>) without asking. The new artifact is visible only to you until you [share it](</docs/en/artifacts#share-an-artifact>). If the publish declares runtime capabilities for the page, such as [connector calls](</docs/en/artifacts#pull-live-data-with-mcp-connectors>) or [file downloads](</docs/en/artifacts#offer-a-file-download>), Claude asks first. In those runs, Claude republishes an existing artifact without asking only when all of these hold: * You can edit the artifact and it belongs to your own organization * If the publish carries more than the page, such as supporting files, you own the artifact @@ -344,7 +398,7 @@ * The publish doesn’t declare runtime capabilities for the page * The existing page holds no grant that reaches beyond the page, such as [connector calls](</docs/en/artifacts#pull-live-data-with-mcp-connectors>) -In every other case, including a run that an API or GitHub trigger starts, Claude asks first. When a routine’s job is to keep a page current, give it an artifact you already published. +In every other case, including a run that an API or GitHub trigger starts, Claude asks first. When a scheduled task’s job is to keep a page current, give it an artifact you already published. ### @@ -352,19 +406,19 @@ Environments and network access -Each routine uses a [cloud environment](</docs/en/cloud-environments>) that controls network access, environment variables, and setup scripts. The routine inherits the environment’s network policy on every run. The **Default** environment uses **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) through the session’s network. Requests on that path to hosts outside the allowlist fail with `403` and `x-deny-reason: host_not_allowed`. MCP connector traffic is routed through Anthropic’s servers rather than that path, so the connectors you add to the routine work without adding their hosts to **Allowed domains**. Remove any connectors you don’t need under Connectors. To allow additional domains on one of your own environments, follow these steps. An [organization-shared environment](</docs/en/cloud-environments#organization-shared-environments>) opens read-only here, so an Owner changes its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead. +Each scheduled task uses a [cloud environment](</docs/en/cloud-environments>) that controls network access, environment variables, and setup scripts. The task inherits the environment’s network policy on every run. The **Default** environment uses **Trusted** network access, which allows only the [default allowlist](</docs/en/cloud-environments#default-allowed-domains>) through the session’s network. Requests on that path to hosts outside the allowlist fail with `403` and `x-deny-reason: host_not_allowed`. MCP connector traffic is routed through Anthropic’s servers rather than that path, so the connectors you add to the task work without adding their hosts to **Allowed domains**. Remove any connectors you don’t need under Connectors. To allow additional domains on one of your own environments, follow these steps. An [organization-shared environment](</docs/en/cloud-environments#organization-shared-environments>) opens read-only here, so an Owner changes its network access from the **Cloud environments** page in [admin settings](<https://claude.ai/admin-settings>) instead. 1 -Open the routine for editing - -On the routine’s detail page, open the menu next to the routine’s name and select **Edit**. +Open the task for editing + +Go to [claude.ai/code/routines](<https://claude.ai/code/routines>), click the scheduled task, then open the menu next to its name and select **Edit**. The **Edit scheduled task** dialog opens. 2 Open the environment selector -Below the **Instructions** box, select the cloud icon showing your environment’s name, such as **Default**. +Go to **Advanced settings > General > Cloud environment**, expanding **Advanced settings** first if it’s collapsed. Click the cloud icon showing your environment’s name, such as **Default**. 3 @@ -382,7 +436,7 @@ Save -Click **Save changes**. The new policy applies from the next run. +Click **Save changes** in the **Edit cloud environment** dialog, then close the **Edit scheduled task** dialog behind it. The new policy applies from the next run. See [Network access](</docs/en/cloud-environments#network-access>) for details on access levels and the default allowlist. @@ -392,17 +446,30 @@ Usage and limits -Routines draw down subscription usage the same way interactive sessions do. See your current consumption at [claude.ai/settings/usage](<https://claude.ai/settings/usage>). Separately from subscription usage, each way of starting a run has an hourly limit: +Scheduled tasks draw down subscription usage the same way interactive sessions do. See your current consumption at [claude.ai/settings/usage](<https://claude.ai/settings/usage>). Separately from subscription usage, each way of starting a run has an hourly limit: Action| Limit| Counted for| Over the limit ---|---|---|--- Scheduled runs, including one-off runs| 100 per hour| Your account| The run waits until the limit resets -**Run now** , API fires, and setting a one-off routine to run again| 30 per hour| Each routine, one count shared by all three| The action fails until the limit resets -**Run now** and setting a one-off routine to run again| 100 per hour| Your account| Same +**Run now** , API fires, and setting a one-off task to run again| 30 per hour| Each scheduled task, one count shared by all three| The action fails until the limit resets +**Run now** and setting a one-off task to run again| 100 per hour| Your account| Same API fires| 100 per hour| Your account, counted separately from **Run now**| Same GitHub events| See Add a GitHub trigger| | -None of these hourly limits has overage. When a routine hits your subscription usage limit, organizations with usage credits turned on can keep running routines on metered overage. Without usage credits, additional runs are rejected until your usage window resets. Turn on usage credits at [claude.ai/settings/usage](<https://claude.ai/settings/usage>). On Team and Enterprise plans, an admin turns them on for the organization at [claude.ai/admin-settings/usage](<https://claude.ai/admin-settings/usage>). While your subscription is paused, your routines are put on hold and don’t run. Once your subscription is active again, turn them back on. +None of these hourly limits has overage. When a scheduled task hits your subscription usage limit, organizations with usage credits turned on can keep running scheduled tasks on metered overage. Without usage credits, additional runs are rejected until your usage window resets. Turn on usage credits at [claude.ai/settings/usage](<https://claude.ai/settings/usage>). On Team and Enterprise plans, an admin turns them on for the organization at [claude.ai/admin-settings/usage](<https://claude.ai/admin-settings/usage>). While your subscription is paused, your scheduled tasks are put on hold and don’t run. Once your subscription is active again, turn them back on. + +## + +​ + +Where the name routines still appears + +Scheduled tasks were previously called routines, and these places keep the earlier name. Each one refers to the same feature: + + * **Web address** : `claude.ai/code/routines` + * **CLI** : the `/routines` alias for `/schedule`, the command’s description, and Claude’s replies while it sets up a task + * **API** : the `/fire` endpoint path, its beta header, its response `type`, the `<routine-fire-payload>` tag, and the [Trigger a routine through the API](<https://platform.claude.com/docs/en/api/claude-code/routines-fire>) reference page + * **Organization settings** : the **Scheduled tasks (Was Routines)** toggle ## @@ -420,11 +487,11 @@ * You are authenticated with a Console API key, an [Anthropic profile or federation credential](</docs/en/authentication#anthropic-profiles-and-federation-credentials>), or a cloud provider such as Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. `/schedule` requires a claude.ai subscription login. With a Console API key or a profile, and feature-flag fetching enabled, submitting `/schedule` instead shows `/schedule is available with Claude for Enterprise — ask your admin about migrating from API-key access`. With a cloud-provider login, you still see `Unknown command: /schedule`. If `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` is set in your shell, or `apiKeyHelper` is set in `settings.json`, remove it first, since these take precedence over a claude.ai login. A profile or federation credential takes precedence too, so switch that off as well * You are fully signed out, with no API key or other credential. With feature-flag fetching enabled, submitting `/schedule` shows `/schedule requires a claude.ai subscription. Run /login to sign in with your claude.ai account.` Before v2.1.268, a signed-out session showed the same Claude for Enterprise message as a Console API key - * You are inside a cloud session, where submitting `/schedule` answers that the command isn’t available in that environment. Manage routines 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 routines 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 routines for your Team or Enterprise organization. Before v2.1.227, the command still appeared in this case, and claude.ai rejected the routine when Claude tried to create or run it - -Unless your organization’s policy disables routines or cloud sessions, you can create and manage routines at [claude.ai/code/routines](<https://claude.ai/code/routines>) regardless of how the CLI is configured. + * 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. ### @@ -432,7 +499,7 @@ “Routines are disabled by your organization’s policy” -An Owner in your Team or Enterprise organization has likely turned off the **Routines** toggle at [claude.ai/admin-settings/claude-code](<https://claude.ai/admin-settings/claude-code>). On Claude Code v2.1.227 or later, the same toggle also hides `/schedule` in the CLI. This is a server-side organization setting, so it cannot be overridden from your local configuration. Ask an Owner to enable routines for your organization. +An Owner in your Team or Enterprise organization has likely turned off the **Scheduled tasks (Was Routines)** toggle at [**Organization settings > Capabilities > Remote sessions**](<https://claude.ai/admin-settings/capabilities>). On Claude Code v2.1.227 or later, the same toggle also hides `/schedule` in the CLI. This is a server-side organization setting, so it cannot be overridden from your local configuration. Ask an Owner to turn scheduled tasks back on for your organization. ## @@ -443,6 +510,6 @@ * [`/loop` and in-session scheduling](</docs/en/scheduled-tasks>): schedule local tasks within an open CLI session * [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>): local scheduled tasks that run on your machine with access to local files * [Cloud environments](</docs/en/cloud-environments>): configure network access, environment variables, and setup scripts for cloud sessions - * [Projects](</docs/en/claude-projects>): ongoing work Claude coordinates across parallel cloud sessions; routines created from a project appear on its **Routines** tab + * [Projects](</docs/en/claude-projects>): ongoing work Claude coordinates across parallel cloud sessions; scheduled tasks created from a project appear on its **Scheduled tasks** tab * [MCP connectors](</docs/en/mcp>): connect external services like Slack, Linear, and Google Drive * [GitHub Actions](</docs/en/github-actions>): run Claude in your CI pipeline on repository events
modified Choose a sandbox environment View current →
--- a/sandbox-environments.md +++ b/sandbox-environments.md @@ -96,11 +96,15 @@ mkdir -p ~/.claude && { [ -f ~/.claude.json ] || echo '{}' > ~/.claude.json; } -Once the settings file is in place, launch Claude Code with `npx` and pass `claude` as the command to wrap: +Install the runtime globally, under a prefix outside every path you allow writes to: - npx @anthropic-ai/sandbox-runtime claude + npm install -g @anthropic-ai/sandbox-runtime -Claude Code starts inside the sandbox with the filesystem and network boundaries you configured. The same command works for sandboxing standalone MCP servers or other helper processes. +Once the settings file is in place, launch Claude Code through the runtime from your project directory: + + srt claude + +Claude Code starts inside the sandbox with the filesystem and network boundaries you configured. The same `srt` command works for sandboxing standalone MCP servers or other helper processes. ###
modified Run prompts on a schedule View current →
--- a/scheduled-tasks.md +++ b/scheduled-tasks.md @@ -1,4 +1,11 @@ -Scheduled tasks let Claude re-run a prompt automatically on an interval. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session. To react to events as they happen instead of polling, see [Channels](</docs/en/channels>): your CI can push the failure into the session directly. To keep the session working turn after turn toward a condition rather than on an interval, see [`/goal`](</docs/en/goal>). Tasks are session-scoped. When you resume with `--resume` or `--continue`, Claude Code restores tasks that haven’t expired, except those listed under Limitations. For scheduling that survives independently of any session, use [Routines](</docs/en/routines>) to create a routine on the cloud, set up a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), or use [GitHub Actions](</docs/en/github-actions>). +Session-scoped scheduled tasks let Claude re-run a prompt automatically on an interval within a Claude Code session. Use them to poll a deployment, babysit a PR, check back on a long-running build, or remind yourself to do something later in the session. + +These cases are covered on other pages: + + * **Reacting to events as they happen instead of polling** : see [Channels](</docs/en/channels>). Your CI can push the failure into the session directly. + * **Keeping the session working turn after turn toward a condition rather than on an interval** : see [`/goal`](</docs/en/goal>). + +Tasks are session-scoped. When you resume with `--resume` or `--continue`, Claude Code restores tasks that haven’t expired, except those listed under Limitations. For scheduling that survives independently of any session, create a [cloud scheduled task](</docs/en/routines>), set up a [Desktop scheduled task](</docs/en/desktop-scheduled-tasks>), or use [GitHub Actions](</docs/en/github-actions>). ## @@ -137,7 +144,7 @@ ​ -Manage scheduled tasks +Manage session-scoped scheduled tasks Ask Claude in natural language to list or cancel tasks, or reference the underlying tools directly. @@ -159,7 +166,7 @@ ​ -How scheduled tasks run +How session-scoped scheduled tasks run The scheduler checks every second for due tasks and enqueues them at low priority. A scheduled prompt fires between your turns, not while Claude is mid-response. If Claude is busy when a task comes due, the prompt waits until the current turn ends. All times are interpreted in your local timezone. A cron expression like `0 9 * * *` means 9am wherever you’re running Claude Code, not UTC. @@ -208,7 +215,7 @@ Seven-day expiry -Recurring tasks automatically expire 7 days after creation. The task fires one final time, then deletes itself. This bounds how long a forgotten loop can run. If you need a recurring task to last longer, cancel and recreate it before it expires, or use [Routines](</docs/en/routines>) or [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) for durable scheduling. +Recurring tasks automatically expire 7 days after creation. The task fires one final time, then deletes itself. This bounds how long a forgotten loop can run. If you need a recurring task to last longer, cancel and recreate it before it expires, or use [cloud scheduled tasks](</docs/en/routines>) or [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) for durable scheduling. ## @@ -233,7 +240,7 @@ ​ -Disable scheduled tasks +Disable session-scoped scheduled tasks Set `CLAUDE_CODE_DISABLE_CRON=1` in your environment to disable the scheduler entirely. The cron tools and `/loop` become unavailable, and any already-scheduled tasks stop firing. See [Environment variables](</docs/en/env-vars>) for the full list of disable flags. @@ -252,6 +259,6 @@ For cron-driven automation that needs to run unattended: - * [Routines](</docs/en/routines>): run in the cloud on a schedule, via API call, or on GitHub events + * [Cloud scheduled tasks](</docs/en/routines>): run in the cloud on a schedule, via API call, or on GitHub events * [GitHub Actions](</docs/en/github-actions>): use a `schedule` trigger in CI * [Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>): run locally on your machine
modified Catch security issues as Claude writes code View current →
--- a/security-guidance.md +++ b/security-guidance.md @@ -23,7 +23,7 @@ `/plugin` opens an interactive panel in the terminal CLI. If Claude replies that `/plugin` isn’t available in this environment, install another way: - * **Claude desktop app, local or SSH session** : open the [plugin browser](</docs/en/desktop#install-plugins>) by clicking the **+** button next to the prompt, then **Plugins** , then **Add plugin** + * **Claude desktop app, local or SSH session** : use the **Desktop app** tab under [Install a plugin](</docs/en/plugins/install#install-a-plugin>) * **VS Code extension** : install from the [**Manage plugins** dialog](</docs/en/vs-code#manage-plugins>) * **Cloud sessions** : a cloud session doesn’t load plugins from your user settings or from the repository’s `.claude/settings.json`, as [What carries over from your setup](</docs/en/cloud-environments#what-carries-over-from-your-setup>) explains. For plugins your organization distributes through managed settings, see [Manage plugins for your organization](</docs/en/plugins/org>)
modified Self-hosted environments View current →
--- a/self-hosted-environments.md +++ b/self-hosted-environments.md @@ -1,6 +1,6 @@ Self-hosted environments are in public beta on Team and Enterprise plans and are off by default. See Availability and limitations for the enablement path and what’s excluded. -A self-hosted environment executes Claude Code cloud sessions on infrastructure your organization operates. A [cloud session](</docs/en/claude-code-on-the-web>) is any session that runs somewhere other than the developer’s machine: developers start them from claude.ai, the mobile and desktop apps, the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>), and [scheduled routines](</docs/en/routines>), and by default they execute on Anthropic’s infrastructure. In a self-hosted environment, those same sessions execute inside your network, and the developer experience is otherwise the same apart from the differences in Availability and limitations and the deploy page’s [known issues](</docs/en/self-hosted-environments-deploy#known-issues-and-limitations>). If your team doesn’t use cloud sessions, there’s nothing here to configure: sessions in a terminal or IDE always run on the developer’s own machine. If you want to run Claude Code on your own always-on machine and drive it from other devices, use [Remote Control](</docs/en/remote-control>), which is also available on Pro and Max plans. When you’re ready to set up, go straight to the [quickstart](</docs/en/self-hosted-environments-quickstart>); to review the security posture first, start with [Deploy to production](</docs/en/self-hosted-environments-deploy>). The rest of this page explains how self-hosting works and when to choose it. +A self-hosted environment executes Claude Code cloud sessions on infrastructure your organization operates. A [cloud session](</docs/en/claude-code-on-the-web>) is any session that runs somewhere other than the developer’s machine. Developers start them from claude.ai, the mobile and desktop apps, the terminal with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>), and [cloud scheduled tasks](</docs/en/routines>). By default, cloud sessions execute on Anthropic’s infrastructure. In a self-hosted environment, those same sessions execute inside your network. The developer experience is otherwise the same apart from the differences in Availability and limitations and the deploy page’s [known issues](</docs/en/self-hosted-environments-deploy#known-issues-and-limitations>). If your team doesn’t use cloud sessions, there’s nothing here to configure: sessions in a terminal or IDE always run on the developer’s own machine. If you want to run Claude Code on your own always-on machine and drive it from other devices, use [Remote Control](</docs/en/remote-control>), which is also available on Pro and Max plans. When you’re ready to set up, go straight to the [quickstart](</docs/en/self-hosted-environments-quickstart>); to review the security posture first, start with [Deploy to production](</docs/en/self-hosted-environments-deploy>). The rest of this page explains how self-hosting works and when to choose it. ## @@ -29,7 +29,7 @@ * **Plans** : public beta for Team and Enterprise organizations. Self-hosted environments are off by default; an [Owner](</docs/en/cloud-environments#organization-shared-environments>) turns on **Allow self-hosted environments** on the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>), which requires [cloud sessions](</docs/en/claude-code-on-the-web>) to be enabled for the organization. * **Zero Data Retention and HIPAA** : unavailable for organizations with [Zero Data Retention](</docs/en/zero-data-retention>) enabled or with the [HIPAA configuration](</docs/en/hipaa-setup>) applied. * **Model inference** : sessions use the Anthropic API unless you configure a runner to [send model requests to Amazon Bedrock or Google Cloud’s Agent Platform](</docs/en/self-hosted-environments-configuration#send-model-requests-to-bedrock-or-agent-platform>). Session content goes to Anthropic in both cases. On a runner configured this way, [server-managed settings](</docs/en/server-managed-settings>) and organization policies from claude.ai don’t reach sessions. - * **Surfaces** : sessions started from [claude.ai/code](<https://claude.ai/code>), the mobile and desktop apps, [scheduled routines](</docs/en/routines>), and the terminal, with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>) or an [`--environment` dispatch](</docs/en/self-hosted-environments-testing#run-the-test-loop>), can run in self-hosted environments. [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions can run in them too, but Claude can’t use [Access bundles](<https://claude.com/docs/claude-tag/concepts/glossary#access-bundle>) in those sessions yet. [Claude Security](</docs/en/claude-security>) and [Code Review](</docs/en/code-review>) sessions don’t route to them yet. Support for those two surfaces follows separately. + * **Surfaces** : sessions started from [claude.ai/code](<https://claude.ai/code>), the mobile and desktop apps, [cloud scheduled tasks](</docs/en/routines>), and the terminal, with [`claude --cloud`](</docs/en/claude-code-on-the-web#from-terminal-to-cloud>) or an [`--environment` dispatch](</docs/en/self-hosted-environments-testing#run-the-test-loop>), can run in self-hosted environments. [Claude Tag](<https://claude.com/docs/claude-tag/overview>) sessions can run in them too, but Claude can’t use [Access bundles](<https://claude.com/docs/claude-tag/concepts/glossary#access-bundle>) in those sessions yet. [Claude Security](</docs/en/claude-security>) and [Code Review](</docs/en/code-review>) sessions don’t route to them yet. Support for those two surfaces follows separately. * **Repositories** : sessions check out repositories from GitHub; see [GitHub authentication options](</docs/en/claude-code-on-the-web#github-authentication-options>). For a GitHub Enterprise Server host, see its [network requirements](</docs/en/github-enterprise-server#network-requirements>). * **Billing** : sessions in a self-hosted environment consume your organization’s Claude Code usage the same way sessions in Anthropic-hosted environments do. @@ -66,7 +66,7 @@ Environment| A named group of your runners, created in claude.ai settings. Sessions are routed to an environment, not to an individual runner. Environment secret| The single shared credential runners use to authenticate and register with the environment. Shown once at environment creation, labeled **environment key** in the admin UI. Runner| The long-lived process you deploy. A runner registers with the environment, receives a runner token, and polls for sessions. -Session| One Claude Code task, started from claude.ai, the mobile app, or another Anthropic surface such as a scheduled routine or an agent. Each session runs as a child Claude Code process the runner spawns. +Session| One Claude Code task, started from claude.ai, the mobile app, or another Anthropic surface such as a scheduled task or an agent. Each session runs as a child Claude Code process the runner spawns. In API fields, token claims, and metric names, the environment appears as `pool`, and the environment ID is the `pool_id`. The [reference](</docs/en/self-hosted-environments-reference>) maps the two spellings, including the deprecated `pool` flag names. A runner serves one owner at a time. The first session a runner picks up locks the runner to that session’s owner, and the runner then runs sessions only for that owner, up to a configured capacity. Who the owner is depends on how the session started:
modified Customize sessions in self-hosted environments View current →
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -486,7 +486,7 @@ Turn off built-in session tools -Anthropic’s control plane attaches its own MCP server, named Claude Code Remote, to cloud sessions. Claude uses the server’s tools to schedule [routines](</docs/en/routines>), start and steer other cloud sessions, attach more repositories, and follow pull request activity. To turn off the whole server, add a [server-level deny rule](</docs/en/permissions#mcp>) to your settings. The control plane registers the server under one of three names, depending on how the session was created. Claude Code matches the name in a rule exactly, including case, so write the rule once per name as shown: +Anthropic’s control plane attaches its own MCP server, named Claude Code Remote, to cloud sessions. Claude uses the server’s tools to create [cloud scheduled tasks](</docs/en/routines>), start and steer other cloud sessions, attach more repositories, and follow pull request activity. To turn off the whole server, add a [server-level deny rule](</docs/en/permissions#mcp>) to your settings. The control plane registers the server under one of three names, depending on how the session was created. Claude Code matches the name in a rule exactly, including case, so write the rule once per name as shown: { "permissions": { @@ -637,7 +637,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 [routine](</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, commit it to the repository’s `.claude/skills/` or add it to your runner image. 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 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, commit it to the repository’s `.claude/skills/` or add it to your runner image. 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 @@ -512,6 +512,14 @@ ​ +Post a status message before a restart + +Before a restart that will interrupt sessions, have an [Owner](</docs/en/cloud-environments#organization-shared-environments>) post a status message on the environment from the [**Cloud environments** admin page](<https://claude.ai/admin-settings/cloud-environments>). At [claude.ai/code](<https://claude.ai/code>), members see the message in their sessions in that environment. Have the Owner set an expiry with the post, or remove the message once the runners are back. + +### + +​ + Defer the drain past the first signal Set [`--defer-shutdown-max-min <n>`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) if you want a runner you’re restarting to go on serving the sessions it holds for up to `n` minutes, instead of draining them on the first signal. On the first `SIGTERM` or `SIGINT`, the runner stops taking new work and goes on serving the sessions it holds. It keeps polling so that the control plane doesn’t requeue those sessions. Requires Claude Code v2.1.238 or later. @@ -592,12 +600,13 @@ Pin the version -Each session’s child Claude Code process runs the runner’s own binary, and the runner turns off auto-update inside the sessions it spawns, so every session runs the version you installed on the host or built into the image. A host-level update takes effect the next time the runner starts. Choose which version your sessions run and when it changes: +Each session’s child process runs the runner’s own binary by default, and the runner turns off auto-update inside the sessions it spawns. With that default, every session runs the version you installed on the host or built into the image. A host-level update takes effect the next time the runner starts. Choose which version your sessions run and when it changes: * **Before you pin a version** : check [the Claude Code versions that models require](</docs/en/model-config#available-models>) for every model your sessions use. If a model requires a newer version than the one your sessions run, the server rejects requests for that model with [Claude Code does not support this model](</docs/en/errors#claude-code-does-not-support-this-model>). * **To hold a fleet on one version** : build the image with a pinned version, or on a bare host install a specific version and [disable auto-updates](</docs/en/setup#disable-auto-updates>) * **To upgrade a fixed fleet** : read the [changelog](</docs/en/changelog>) entries between your version and the one you’re installing, then install the newer version or rebuild the image and restart the runners * **To upgrade on-demand runners** : read the [changelog](</docs/en/changelog>) entries between your version and the one you’re installing, then change the image your [`spawn-runner` hook](</docs/en/self-hosted-environments-configuration#the-spawn-runner-hook>) starts. Each new runner gets the new version. A runner that’s already up, including a standby runner that [`--min-idle`](</docs/en/self-hosted-environments-reference#orchestrator-cli-flags>) started, keeps its version until it exits. Don’t restart it, because its work order is single-use. + * **If sessions start a different binary** : if you use [`--exec-path`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) or a [`command` hook](</docs/en/self-hosted-environments-configuration#command>) to start a Claude Code binary other than the runner’s own, sessions run that binary’s version. Update that binary when you update the runner. * **Plugins** : plugin marketplaces don’t auto-update either; set `FORCE_AUTOUPDATE_PLUGINS=1` in the runner’s environment to let plugins auto-update while the binary stays pinned ## @@ -659,6 +668,7 @@ * **Before enabling the flag** : restrict who can push to `claude/*` refs on the source remote. On resume, the runner fetches the previously pushed branch without verifying who pushed it. * **A repository added mid-session can fail to clone** : Claude clones it with `git clone` over HTTPS. On a runner without `--use-anthropic-git-proxy`, the clone fails with a git authentication error if nothing on the host can read the repository. Where you can, select every repository the session needs when you create it. * **Some connectors don’t appear in self-hosted sessions** : a connector you haven’t yet connected in claude.ai Settings isn’t listed in a self-hosted session, and the session won’t prompt you to connect it. Connect it in Settings first, then start a fresh session. Adding a connector to an already-running session also doesn’t make its tools available to Claude; start a fresh session to pick up a newly added connector. + * **When someone archives or deletes a session, or releases its runner from the session’s menu** : don’t count on the [`--push-outcome-on-release`](</docs/en/self-hosted-environments-reference#runner-cli-flags>) push. To save commits in those cases, push `HEAD` to a rescue branch from a [`post-session` hook](</docs/en/self-hosted-environments-configuration#post-session>). If you start from the example there, make it push even when nothing is uncommitted, because it pushes only after a snapshot commit. ### @@ -693,6 +703,7 @@ * **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. * **Sessions take minutes to start** : the initial clone usually dominates. Watch the `claude_code_self_hosted_runner_session_init_duration_seconds` [metric](</docs/en/self-hosted-environments-reference#prometheus-metrics>) to confirm, and cut the clone with a pre-warmed checkout or a smaller `CLAUDE_RUNNER_FETCH_DEPTH`. * **Turns fail with a 401** : when a turn ends with a 401 or 403 from the Anthropic API, the runner fetches a fresh [`CLAUDE_CODE_OAUTH_TOKEN`](</docs/en/self-hosted-environments-configuration#wrapper-scripts>) from Anthropic and passes it to the session. The failed turn isn’t retried. This token is short-lived, and the runner rotates it over the session’s stdin. When a fetch fails, the runner logs an `inference_token refresh failed` line that says when it will retry, and it keeps retrying for as long as the session runs. If every call starts failing about 30 minutes into a session, a wrapper script has likely severed the session’s stdin, so token rotations can’t reach it; see [Keep stdin and file descriptor 3 attached](</docs/en/self-hosted-environments-configuration#keep-stdin-and-file-descriptor-3-attached>). Before v2.1.274, the runner stopped retrying a failed fetch after a few attempts and waited for the next scheduled one. A failed turn didn’t trigger a fetch, so every turn failed with a 401 until the next scheduled fetch. + * **A turn fails in claude.ai/code with`This model needs a newer version of Claude Code`**: the Claude Code version that your runners start sessions with is older than the session’s model requires, so the API [rejects the request](</docs/en/errors#claude-code-does-not-support-this-model>). Upgrade the runners to the version the message asks for, or a later one, as described in Pin the version. Until then, people can pick a different model in the session. * **Pod is killed mid-drain** : raise `terminationGracePeriodSeconds` to at least the value the runner logs at startup. See Shutdown timing. Once logging is initialized, the runner writes its lifecycle log, including `[runner:fatal]` lines, to stdout, and debug output to stderr, all as plain-text lines rather than JSON. The base directory failures described in the troubleshooting entries above print to stderr before that point. Capture both streams with `--log-file`, which also lets `self-hosted-runner doctor` tail them, or with your platform’s log collection. Each session’s child process writes a separate debug log. On failure the runner surfaces the log’s tail alongside the session in claude.ai/code. Unless you started the runner with [`--remove-session-state`](</docs/en/self-hosted-environments-reference#runner-cli-flags>), it also keeps a failed session’s log on disk and prints its path in the runner log.
modified Configure server-managed settings View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -181,7 +181,7 @@ * Cached settings persist through network failures. If the startup fetch fails, Claude Code warns in interactive sessions that the cached policy is in effect * Until a fetch succeeds, the values withheld at startup stay withheld -Claude Code withholds several categories of variables in the cached `env` block until the server confirms the payload for the session. This keeps a cached proxy, certificate authority, endpoint, or credential value from redirecting, intercepting, or re-authenticating the settings fetch that confirms the payload. The hardening applies only to the server-fetched settings cache: [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) deployed through MDM or `managed-settings.json` are unaffected. The withholding requires Claude Code v2.1.198 or later; before v2.1.198, the whole cached `env` block applies at startup. The withheld categories include: +Claude Code withholds several categories of variables in the cached `env` block until the server confirms the payload for the session. This keeps a cached proxy, certificate authority, endpoint, or credential value from redirecting, intercepting, or re-authenticating the settings fetch that confirms the payload. The hardening applies only to the server-fetched settings cache: [endpoint-managed settings](</docs/en/managed-settings#delivery-mechanisms>) deployed through MDM or `managed-settings.json` are unaffected. The withheld categories include: * Proxy and TLS configuration, such as `HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`, and the mTLS client certificate variables `CLAUDE_CODE_CLIENT_CERT` and `CLAUDE_CODE_CLIENT_KEY` * API routing and provider selection, including `ANTHROPIC_BASE_URL`, the provider selection variables such as `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_VERTEX`, and the provider endpoint URLs such as `ANTHROPIC_BEDROCK_BASE_URL` @@ -266,7 +266,7 @@ Claude Code can’t always show the dialog. Each case below says which settings apply when it can’t and when you next see the dialog: - * **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. Requires Claude Code v2.1.211 or later. + * **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. * **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.
modified All settings View current →
--- a/settings-reference.md +++ b/settings-reference.md @@ -214,7 +214,7 @@ `spinnerTipsEnabled`| Hide tips in the spinner while Claude works| Interface and terminal| Any file `spinnerTipsOverride`| Add your own tips to the spinner rotation, or replace the built-in tips| Interface and terminal| Any file `spinnerVerbs`| Add or replace the verbs shown while a turn runs| Interface and terminal| Any file -`sshConfigs`| Add [SSH connections](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) to the Desktop environment dropdown| Remote, desktop, and notifications| User or managed +`sshConfigs`| Add [SSH connections](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) to the Desktop environment selector| Remote, desktop, and notifications| User or managed `sshHostAllowlist`| Limit which hosts [Desktop SSH sessions](</docs/en/desktop#restrict-which-ssh-hosts-users-can-connect-to>) can reach| Remote, desktop, and notifications| Managed `statusLine`| Run your own command to render a [status line](</docs/en/statusline>) below the prompt| Interface and terminal| Any file `strictKnownMarketplaces`| Allowlist the [marketplace](</docs/en/plugins/overview>) sources users can add and install from| Plugins and skills| Managed @@ -1190,7 +1190,7 @@ * `"acceptEdits"`: Claude Code also runs file edits and common filesystem commands such as `mkdir` and `mv` without asking * `"plan"`: Claude Code reads and plans but blocks edits until you approve a plan * `"auto"`: Claude Code runs without routine prompts; before actions such as shell commands and network requests run, a background classifier checks that they align with your request - * `"dontAsk"`: Claude Code auto-denies every call that would otherwise prompt; file reads inside your working directories, other actions that need no approval, and pre-approved tools still run, apart from reads from [network paths](</docs/en/permissions#network-paths>) + * `"dontAsk"`: Claude Code auto-denies every call that would otherwise prompt, 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>). File reads inside your working directories, other actions that need no approval, and pre-approved tools still run, apart from reads from [network paths](</docs/en/permissions#network-paths>) * `"bypassPermissions"`: Claude Code runs everything without asking * `"manual"`: an alias for `"default"` * **Default** : unset @@ -2435,7 +2435,7 @@ * **Scope** : `Any file` * **Type** : number of tokens, from `100000` to `1000000`. Claude Code caps the value at your model’s context window; the [models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>) lists each model’s window * **Default** : unset, so Claude Code picks a window tuned for your model - * **Per-session overrides** : [`--autocompact`](</docs/en/cli-reference#cli-flags>) takes precedence over this key for one session, and [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>) takes precedence over both + * **Per-session overrides** : [`--autocompact`](</docs/en/cli-reference#cli-flags>) takes precedence over this key for one session, and [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars>) takes precedence over both unless Claude Code [ignores the variable’s value](</docs/en/model-config#claude_code_auto_compact_window-values>) settings.json @@ -2621,7 +2621,7 @@ * [`CLAUDE_CODE_PROJECT_DIR_NAME`](</docs/en/sessions#name-the-project-directory-yourself>), which Claude Code reads from the launch environment only, is ignored from every file; requires v2.1.234 or later. * [`CLAUDE_CODE_RESTRICTED`](</docs/en/env-vars#variables>), which Claude Code reads from the launch environment only, is ignored from every file. * [`CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`](</docs/en/env-vars#variables>), which Claude Code reads from the launch environment only, is ignored from every file. The variable requires Claude Code v2.1.283 or later. - * [`CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`, `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`, and `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`](</docs/en/env-vars#variables>), which Claude Code reads from the launch environment only, are ignored from every file. + * [`CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`, `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`, `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`, and `CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`](</docs/en/env-vars#variables>), which Claude Code reads from the launch environment only, are ignored from every file. ### @@ -3629,7 +3629,7 @@ `vimInsertModeRemaps` -Map two-key INSERT-mode sequences to Escape in [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>). Each key is exactly two printable characters typed in sequence, and `"<Esc>"` is the only supported target; Claude Code ignores other entries. Requires Claude Code v2.1.208 or later. +Map two-key INSERT-mode sequences to Escape in [vim editor mode](</docs/en/interactive-mode#vim-editor-mode>). Each key is exactly two printable characters typed in sequence, and `"<Esc>"` is the only supported target; Claude Code ignores other entries. * **Scope** : `User or managed`. A repository can’t remap your keystrokes. * **Type** : object mapping a two-character sequence to `"<Esc>"` @@ -3643,7 +3643,7 @@ } } -Has no effect unless `editorMode` is `"vim"`. See [Remap INSERT-mode key sequences](</docs/en/interactive-mode#remap-insert-mode-key-sequences>). Requires Claude Code v2.1.208 or later. +Has no effect unless `editorMode` is `"vim"`. See [Remap INSERT-mode key sequences](</docs/en/interactive-mode#remap-insert-mode-key-sequences>). ### @@ -4814,7 +4814,7 @@ List the managed plugins whose [mods](</docs/en/plugins/mods/overview>) run before every mod a user installs, in the listed order. When you set this key in managed settings, name `sec-default@builtin` in the list to keep the built-in guard. In managed settings, Claude Code skips an id whose plugin doesn’t count as your organization’s. See [Install your organization’s mods and set the order](</docs/en/plugins/mods/admin#install-your-organizations-mods>) for those conditions and for how the two ordering keys work together. - * **Scope** : `User or managed`. Claude Code reads the key from managed settings. It reads the key from user settings only on a machine with no managed settings, for a user who isn’t signed in with a Team or Enterprise plan. It ignores the key in project and local settings and in a `--settings` file. + * **Scope** : `User or managed`. Claude Code reads the key from managed settings. It reads the key from user settings only on a machine with no managed settings, in a session whose credential isn’t a Team or Enterprise `/login`. It ignores the key in project and local settings and in a `--settings` file. * **Type** : array of `plugin-name@marketplace-name` strings * **Default** : unset @@ -4838,7 +4838,7 @@ List the managed plugins whose [mods](</docs/en/plugins/mods/overview>) run after every mod a user installs, in the listed order. An id listed in both `prependPlugins` and `appendPlugins` is prepended. In managed settings, Claude Code skips an id whose plugin doesn’t [count as your organization’s](</docs/en/plugins/mods/admin#install-your-organizations-mods>). - * **Scope** : `User or managed`. Claude Code reads the key from managed settings. It reads the key from user settings only on a machine with no managed settings, for a user who isn’t signed in with a Team or Enterprise plan. It ignores the key in project and local settings and in a `--settings` file. + * **Scope** : `User or managed`. Claude Code reads the key from managed settings. It reads the key from user settings only on a machine with no managed settings, in a session whose credential isn’t a Team or Enterprise `/login`. It ignores the key in project and local settings and in a `--settings` file. * **Type** : array of `plugin-name@marketplace-name` strings * **Default** : unset @@ -5477,7 +5477,14 @@ `disableDesktopLocalSessions` -Turn off Code sessions that run on the device in the [desktop app](</docs/en/desktop#local-sessions-on-managed-devices>), for deployments where developers should work on remote machines over SSH. In the Code tab, the **Local** environment stays in the environment dropdown but is grayed out and can’t be selected, with a tooltip saying your organization turned it off; on Windows the WSL entry is grayed out the same way, though whether WSL sessions run on a managed device at all is [governed separately](</docs/en/admin-setup#wsl-sessions-in-claude-code-desktop>). New sessions default to the first [SSH connection](</docs/en/desktop#ssh-sessions>) if one is configured, and the app refuses to start or resume a session on the device, including an SSH connection back to the same machine. SSH sessions to other hosts and cloud sessions are unaffected. The desktop app reads this key; the terminal CLI ignores it. Requires Claude Desktop v1.37937.0 or later. +Turn off Code sessions that run on the device in the [desktop app](</docs/en/desktop#local-sessions-on-managed-devices>), for deployments where developers should work on remote machines over SSH. With the key set to `true`, users see this in the Code tab: + + * **Environment selector** : the entry for the user’s computer is grayed out and unselectable, with the tooltip **Disabled by your organization**. On Windows the WSL entry is grayed out the same way, though whether WSL sessions run on a managed device at all is [governed separately](</docs/en/admin-setup#wsl-sessions-in-claude-code-desktop>). + * **New sessions** : default to the first [SSH connection](</docs/en/desktop#ssh-sessions>) if one is configured + * **Sessions on the device** : the app refuses to start or resume a session on the device, including an SSH connection back to the same machine + * **SSH sessions to other hosts and cloud sessions** : unaffected + +The desktop app reads this key; the terminal CLI ignores it. Requires Claude Desktop v1.37937.0 or later. * **Scope** : `Managed`. By default, the desktop app reads the key from [one managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). * **Type** : Boolean; only the JSON Boolean `true` takes effect @@ -5636,7 +5643,7 @@ `sshConfigs` -Add SSH connections to the [Desktop](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) environment dropdown. Administrators use it to distribute shared connections to a team. Connections you define in managed settings show as managed. Users can select them and [set their own **Worktree folder**](</docs/en/desktop#choose-where-ssh-session-worktrees-go>) for them, but can’t edit anything else or delete them in the app. +Add SSH connections to the [Desktop](</docs/en/desktop#pre-configure-ssh-connections-for-your-team>) environment selector. Administrators use `sshConfigs` to distribute shared connections to a team. Users can select a managed connection and [set their own **Worktree folder**](</docs/en/desktop#set-the-worktree-folder-on-an-existing-connection>) for it. They can’t edit its other fields or delete it in the app. * **Scope** : `User or managed`. The desktop app reads this key. By default, it reads managed connections from [one managed source](</docs/en/managed-settings#how-claude-code-combines-managed-sources>). * **Type** : array of objects, each with required `id`, `name`, and `sshHost` and optional `sshPort` and `sshIdentityFile`
modified Customize your status line View current →
--- a/statusline.md +++ b/statusline.md @@ -183,7 +183,7 @@ `workspace.added_dirs`| Additional directories added via `/add-dir` or `--add-dir`. Empty array if none have been added `workspace.git_worktree`| Git worktree name when the current directory is inside a linked worktree created with `git worktree add`. Absent in the main working tree. Populated for any git worktree, unlike `worktree.*`, which is present only while the session is in a [worktree session](</docs/en/worktrees>) `workspace.repo.host`, `workspace.repo.owner`, `workspace.repo.name`| Repository identity parsed from the `origin` remote, for example, `"github.com"`, `"anthropics"`, `"claude-code"`. Absent outside a git repository or when no `origin` remote is configured. For a gitlab.com project nested in subgroups, `owner` is the full namespace path with slashes, such as `"group/subgroup"`. Before v2.1.260, `workspace.repo` was absent for these projects -`cost.total_cost_usd`| Estimated session cost in USD, computed client-side at list price unless a [`modelPricing`](</docs/en/settings-reference#modelpricing>) table is in effect. May differ from your actual bill. Resets to $0 when `/clear` starts a new session. Before v2.1.211, the total carried over after `/clear` +`cost.total_cost_usd`| Estimated session cost in USD, computed client-side at list price unless a [`modelPricing`](</docs/en/settings-reference#modelpricing>) table is in effect. May differ from your actual bill. Resets to $0 when `/clear` starts a new session `cost.total_duration_ms`| Total wall-clock time the session has been running, in milliseconds. Accumulates across resumes and doesn’t include time while the session isn’t running `cost.total_api_duration_ms`| Total time spent waiting for API responses in milliseconds `cost.total_lines_added`, `cost.total_lines_removed`| Lines of code changed @@ -1143,7 +1143,7 @@ `label`| string| Short progress summary of the task when Claude Code has one, otherwise the same text as `description` `startTime`| number| When the task started, in milliseconds since the Unix epoch `model`| string, optional| ID of the resolved model the task runs on. Omitted until the model is resolved -`effort`| string or number, optional| Reasoning effort set for the subagent in its [definition frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>) or on the individual invocation: `low`, `medium`, `high`, `xhigh`, `max`, or a numeric token budget. This is the configured value, and the effort Claude Code applies can differ when the model doesn’t support that level. Omitted when no effort is set. Requires Claude Code v2.1.213 or later +`effort`| string or number, optional| Reasoning effort set for the subagent in its [definition frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>) or on the individual invocation: `low`, `medium`, `high`, `xhigh`, `max`, or a numeric token budget. This is the configured value, and the effort Claude Code applies can differ when the model doesn’t support that level. Omitted when no effort is set `contextWindowSize`| number, optional| Context window of `model` in tokens, computed the same way as the main status line’s `context_window.context_window_size`, so you can render a per-row percentage from `tokenCount`. Omitted when `model` is `tokenCount`| number| Running token count of the subagent, the figure the default row shows `tokenSamples`| array of numbers| Up to the last 16 `tokenCount` readings, one per refresh tick, oldest first and ending with the current one
modified Create custom subagents View current →
Show diff (191 lines)
--- a/sub-agents.md +++ b/sub-agents.md @@ -220,7 +220,7 @@ You are a code reviewer. When invoked, analyze the code and provide specific, actionable feedback on quality, security, and best practices. -The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), pass [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) to append your text to the end of every subagent’s system prompt, nested subagents included, apart from a forked subagent, which reuses the conversation’s own prompt. Requires Claude Code v2.1.205 or later. If your text is too long to pass on the command line, save it to a file and pass the path with `--append-subagent-system-prompt-file` instead. The file flag requires Claude Code v2.1.261 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. This working-directory check covers the whole repository containing the directory you launched Claude Code from. When your session runs in a linked [worktree](</docs/en/worktrees>) of its own, the check also covers the main checkout that worktree is linked from. Before v2.1.210, the check covered only the launch directory itself. A command whose working directory resolved elsewhere in the same repository, such as the repository root when you launched Claude Code from a monorepo subdirectory, ran there instead of failing. For Bash commands, Claude Code also checks the command itself in two ways: +The frontmatter defines the subagent’s metadata and configuration. The body becomes the system prompt that guides the subagent’s behavior. Subagents receive only this system prompt plus basic environment details like the working directory, not the Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), pass [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) to append your text to the end of every subagent’s system prompt, nested subagents included, apart from a forked subagent, which reuses the conversation’s own prompt. Requires Claude Code v2.1.205 or later. If your text is too long to pass on the command line, save it to a file and pass the path with `--append-subagent-system-prompt-file` instead. The file flag requires Claude Code v2.1.261 or later. A subagent starts in the main conversation’s current working directory. Within a subagent, `cd` commands don’t persist between Bash or PowerShell tool calls and don’t affect the main conversation’s working directory. To give the subagent an isolated copy of the repository instead, set `isolation: worktree`. A subagent with `isolation: worktree` runs its Bash and PowerShell commands inside its worktree. A command whose working directory resolves to your main checkout instead, for example because the worktree directory was removed while the subagent was running, fails with an error. This working-directory check covers the whole repository containing the directory you launched Claude Code from. When your session runs in a linked [worktree](</docs/en/worktrees>) of its own, the check also covers the main checkout that worktree is linked from. For Bash commands, Claude Code also checks the command itself in two ways: * It blocks a command that redirects git into the main checkout. * It refuses a command when it can’t verify from the command text that any git the command runs stays inside the worktree, for example when the command name is computed at runtime. @@ -252,7 +252,7 @@ `mcpServers`| No| [MCP servers](</docs/en/mcp>) available to this subagent. Each entry is either a server name referencing an already-configured server (e.g., `"slack"`) or an inline definition with the server name as key and a full [MCP server config](</docs/en/mcp#installing-mcp-servers>) as value. Ignored for plugin subagents `hooks`| No| Lifecycle hooks scoped to this subagent. Ignored for plugin subagents `memory`| No| Persistent memory scope: `user`, `project`, or `local`. Enables cross-session learning -`background`| No| Set to `true` to keep this subagent in the background even when Claude asks to run it in the foreground. Where fork mode is on, Claude Code already runs the subagents Claude spawns in the background +`background`| No| Set to `true` to keep this subagent in the background even when Claude asks to wait for it. By default, subagents Claude spawns from the main conversation already start in the background `omitClaudeMd`| No| Set to `true` to start this subagent without the user, project, and local CLAUDE.md files in its initial context; [managed policy files](</docs/en/memory#how-claude-md-files-load>) still load, except for managed subagents. Use it for subagents that take everything they need from the delegation prompt. Ignored when the agent runs as the main session agent via `--agent` or the `agent` setting. Requires Claude Code v2.1.271 or later `effort`| No| Effort level when this subagent is active. Overrides the session effort level, but not the [`CLAUDE_CODE_EFFORT_LEVEL`](</docs/en/env-vars#variables>) environment variable. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model. See Choose an effort level `isolation`| No| Set to `worktree` to run the subagent in a temporary [git worktree](</docs/en/worktrees>), giving it an isolated copy of the repository branched by default from your [default branch](</docs/en/worktrees#choose-the-base-branch>) rather than the parent session’s `HEAD`. The worktree is automatically cleaned up if the subagent makes no changes @@ -318,7 +318,7 @@ * When the blocked value is a family alias such as `opus`, Claude Code runs the subagent on the newest version of that family the allowlist permits, following the same [substitution rules and provider scope](</docs/en/model-config#restrict-model-selection>) as `/model`. Before v2.1.222, Claude Code ran the subagent on the inherited model for a blocked family alias as well. * For any other blocked value, on providers where that substitution doesn’t operate, or when the allowlist permits no version of the family, Claude Code runs the subagent on the inherited model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules. -In interactive sessions, Claude Code shows a warning naming the requested model and the model the subagent runs on, for either substitution. To check which model a subagent is running on, run [`/tasks`](</docs/en/commands>). Claude Code names the model on the subagent’s row, and adds the [effort level](</docs/en/model-config#adjust-effort-level>) set for that subagent, if any. Requires Claude Code v2.1.242 or later. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. Before v2.1.211, resuming dropped the per-invocation value and the subagent reverted to its definition’s `model` field or, without one, the main conversation’s model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting. +In interactive sessions, Claude Code shows a warning naming the requested model and the model the subagent runs on, for either substitution. To check which model a subagent is running on, run [`/tasks`](</docs/en/commands>). Claude Code names the model on the subagent’s row, and adds the [effort level](</docs/en/model-config#adjust-effort-level>) set for that subagent, if any. Requires Claude Code v2.1.242 or later. A per-invocation `model` parameter also applies when the subagent is resumed or sent a follow-up message, so the subagent stays on that model. As of v2.1.198, subagents also inherit the main conversation’s [extended thinking](</docs/en/model-config#extended-thinking>) configuration: if thinking is on in your session, it’s on for the subagent, and if it’s off, it stays off. There is no per-subagent thinking setting. Before v2.1.198, subagents ran with extended thinking disabled regardless of the main conversation’s setting. #### @@ -402,7 +402,7 @@ disallowedTools: Write, Edit --- -When nothing in the `tools` list resolves to a tool, for example because every entry is misspelled or names a tool that isn’t available to subagents, Claude Code usually refuses to launch the subagent and the Agent tool returns an error naming the unresolved entries; see [Agent would be spawned with zero tools](</docs/en/errors#agent-would-be-spawned-with-zero-tools>) for the message and how to fix each entry. Before v2.1.208, that subagent launched with no tools and could return an empty or confusing result. The `tools` and `disallowedTools` fields also take entries for a whole MCP server: +When nothing in the `tools` list resolves to a tool, for example because every entry is misspelled or names a tool that isn’t available to subagents, Claude Code usually refuses to launch the subagent and the Agent tool returns an error naming the unresolved entries; see [Agent would be spawned with zero tools](</docs/en/errors#agent-would-be-spawned-with-zero-tools>) for the message and how to fix each entry. The `tools` and `disallowedTools` fields also take entries for a whole MCP server: Goal| Field| Example entry ---|---|--- @@ -519,7 +519,7 @@ `default`| Manual mode: prompts for permission `acceptEdits`| Auto-accept file edits and common filesystem commands for paths in the working directory or `additionalDirectories` `auto`| [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>): a background classifier reviews commands and protected-directory writes -`dontAsk`| Auto-deny permission prompts. Explicitly allowed tools still work; `AskUserQuestion`, MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), [reads from network paths](</docs/en/permissions#network-paths>), and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code are denied even if you’ve allowed them +`dontAsk`| Auto-denies calls that would prompt, 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>). Explicitly allowed tools still work. `AskUserQuestion`, MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>), [reads from network paths](</docs/en/permissions#network-paths>), and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) in sessions where that setting reaches Claude Code are denied even if you’ve allowed them `bypassPermissions`| [Skip permission prompts](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>). A subagent runs in this mode only when the main conversation does `plan`| Plan mode (read-only exploration) @@ -804,17 +804,51 @@ * **Foreground subagents** block the main conversation until complete. Permission prompts are passed through to you as they come up. * **Background subagents** run concurrently while you continue working. When a background subagent reaches a tool call that needs permission, Claude Code surfaces the prompt in your main session and names the subagent that is asking. Approve to let the subagent continue, or press Esc to deny that one tool call without stopping the subagent. -For each subagent Claude spawns with the Agent tool, Claude Code picks foreground or background from the first of these cases that applies: - - * If an in-process [agent team](</docs/en/agent-teams#limitations>) teammate spawned the subagent, Claude Code runs it in the foreground. Claude Code refuses with an error to spawn a teammate’s subagent whose definition sets `background: true`. Where fork mode is off and you haven’t [turned background tasks off](</docs/en/env-vars>), Claude Code also refuses with an error when a teammate sets `run_in_background: true`. - * If you set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, Claude Code runs the subagent in the foreground, in every kind of session and whether or not fork mode is on. - * Where fork mode is on, as it is by default in an interactive session, Claude Code runs the subagent in the background, forks and non-fork subagents alike, and Claude can’t ask for the foreground. - * Where fork mode is off, Claude runs the subagent in the background by default and in the foreground when it needs the result before continuing. Fork mode is off in [non-interactive mode](</docs/en/headless>) with `-p` and in the Agent SDK unless you turn it on. To keep a particular subagent in the background even when Claude wants the result, set its frontmatter `background` field to `true`. - -For a skill with `context: fork`, Claude Code follows the rules in [Run skills in a subagent](</docs/en/skills#run-skills-in-a-subagent>) instead, whether or not fork mode is on. Background subagents run with a smaller built-in tool set than foreground subagents, except for conversation forks and resumed foreground subagents. Background subagents surface every permission prompt in your main session. When you answer one of those prompts with a choice that lasts beyond that one tool call, such as a grant that lasts for the rest of the session, Claude Code applies your answer to the whole session, including your main conversation. A background subagent can leave a background [Bash or PowerShell command](</docs/en/tools-reference#background-commands>) [running past the end of its turn](</docs/en/interactive-mode#how-backgrounding-works>). When that command ends, Claude Code sends the subagent a notification. A background subagent’s results reach Claude as a completion notification in a later turn. Claude waits for that notification before reporting the subagent’s results, and if you ask about progress first, it reports that the subagent is still running. Before v2.1.211, Claude sometimes reported results for a background subagent that hadn’t finished. You can also steer this yourself: - - * Where fork mode is off, ask Claude to run a task in the background or in the foreground - * Press **Ctrl+B** to background a running task +#### + +​ + +Which subagents run in the background + +With nothing configured, a subagent that Claude spawns from your main conversation starts in the background. + + * **`claude -p` and the Agent SDK**: Claude can wait, on its own judgment or when you ask. + * **Interactive terminal session, VS Code, and desktop app sessions on your machine** : to let Claude wait for a subagent, turn off fork mode, which is on by default. + +For a skill with `context: fork`, Claude Code follows the rules in [Run skills in a subagent](</docs/en/skills#run-skills-in-a-subagent>) instead, whether or not fork mode is on. + +#### + +​ + +Let Claude wait for a subagent + + 1. Turn fork mode off by setting `CLAUDE_CODE_FORK_SUBAGENT` to `0`, for example in [`settings.json`](</docs/en/settings>): + + { + "env": { + "CLAUDE_CODE_FORK_SUBAGENT": "0" + } + } + + 2. Run `claude` again from your shell, or open a new VS Code conversation. + 3. Ask Claude to wait when you need a result first, for example “run the reviewer subagent and wait for its report”. + +To keep working while Claude waits, press **Ctrl+B** in the terminal or click [**Run in background**](</docs/en/vs-code#move-a-running-command-or-subagent-to-the-background>) in VS Code. If you set the [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) environment variable to `1` instead of turning fork mode off, Claude waits for every subagent and background tasks are off, **Ctrl+B** included. + +#### + +​ + +Tools, permissions, and results of background subagents + +Background subagents run with a smaller built-in tool set than foreground subagents, except for conversation forks and resumed foreground subagents. Background subagents surface every permission prompt in your main session. When you answer one of those prompts with a choice that lasts beyond that one tool call, such as a grant that lasts for the rest of the session, Claude Code applies your answer to the whole session, including your main conversation. A background subagent can leave a background [Bash or PowerShell command](</docs/en/tools-reference#background-commands>) [running past the end of its turn](</docs/en/interactive-mode#how-backgrounding-works>). When that command ends, Claude Code sends the subagent a notification. A background subagent’s results reach Claude as a completion notification in a later turn. Claude waits for that notification before reporting the subagent’s results, and if you ask about progress first, it reports that the subagent is still running. + +#### + +​ + +Finished subagents in the panel and task list Claude Code clears a background subagent’s row from the subagent panel below the prompt input in one of two ways, depending on how the subagent ended: @@ -856,8 +890,6 @@ * **Marker line** : the scan prepends a line starting with `[harness: subagent output matched instruction-shaped pattern(s):` when the report imitates a tag like `<system-reminder>` or mentions permission settings such as `bypassPermissions` or `--dangerously-skip-permissions`. Permission-setting mentions get the marker line, but the text itself stays as written. The scan doesn’t judge whether content is malicious, and it doesn’t change what an instruction in a report can do: a tool call the report leads Claude to make still goes through the session’s [permission checks](</docs/en/permissions>) and [sandboxing](</docs/en/sandboxing>). It isn’t a substitute for restricting what a subagent can reach. A report that returns to Claude as the subagent’s result also arrives under a header marking it as subagent output. The header states that instructions or approval claims inside the report are the subagent’s words and carry no authority from you. A background subagent’s report arrives inside a completion notification, which is marked as an automated event rather than a message from you. - -Subagent output scanning requires Claude Code v2.1.210 or later. ### @@ -928,7 +960,12 @@ Let subagents spawn their own subagents -By default, a subagent can spawn subagents of its own, up to three layers below the main conversation. At the depth limit, Claude Code withholds the `Agent` tool from every subagent except a fork, so a subagent at the limit does its delegated work itself and returns one summary. A fork at the limit keeps `Agent` in its inherited tool list, but the tool returns an error instead of spawning. Nested subagents suit a delegated task that itself splits into parallel subtasks, such as a reviewer subagent that dispatches a verifier per finding. In an interactive session, only the top-level subagent’s summary returns to you and the intermediate output stays out of your main conversation: a subagent that launches background subagents waits for their results before it finishes. In [non-interactive mode](</docs/en/headless>) and the Agent SDK, the launching subagent doesn’t wait, so a nested background subagent that finishes after its launcher has ended reports to your main conversation instead. To change the limit, set [`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`](</docs/en/env-vars>) to the number of subagent layers you want below your main conversation. For example, this entry in [`settings.json`](</docs/en/settings>) caps nesting at two layers: +By default, a subagent can spawn subagents of its own, up to three layers below the main conversation. At the depth limit, Claude Code withholds the `Agent` tool from every subagent except a fork, so a subagent at the limit does its delegated work itself and returns one summary. A fork at the limit keeps `Agent` in its inherited tool list, but the tool returns an error instead of spawning. Nested subagents suit a delegated task that itself splits into parallel subtasks, such as a reviewer subagent that dispatches a verifier per finding. By default the spawning subagent waits for each nested subagent’s report: + + * **Interactive terminal session** : only the top-level subagent’s summary returns to you, because a subagent that launches background subagents waits for their results before it finishes. + * **`claude -p` and the Agent SDK**: the spawning subagent waits while fork mode is on. If you turn fork mode off, nested subagents start in the background instead. The spawning subagent doesn’t wait for a background nested subagent, which reports to your main conversation if it outlasts the spawning subagent. + +To change the limit, set [`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`](</docs/en/env-vars>) to the number of subagent layers you want below your main conversation. For example, this entry in [`settings.json`](</docs/en/settings>) caps nesting at two layers: { "env": { @@ -1030,7 +1067,7 @@ ##### Set the auto-compact window for one subagent -To make one subagent compact earlier than it otherwise would, set `autoCompactWindow` in its frontmatter to a token count from `100000` to `1000000`. If you set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars#variables>) to a positive integer, the subagent uses that variable’s window instead and the field has no effect. Requires Claude Code v2.1.296 or later. This frontmatter sets `autoCompactWindow` to 200,000 tokens for a subagent that reads long log files: +To make one subagent compact earlier than it otherwise would, set `autoCompactWindow` in its frontmatter to a token count from `100000` to `1000000`. If you set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](</docs/en/env-vars#variables>), the subagent uses that variable’s window instead and the field has no effect, unless Claude Code [ignores the variable’s value](</docs/en/model-config#claude_code_auto_compact_window-values>). Requires Claude Code v2.1.296 or later. This frontmatter sets `autoCompactWindow` to 200,000 tokens for a subagent that reads long log files: --- name: log-reader @@ -1049,9 +1086,9 @@ Fork the current conversation -Run a forked subagent with `/subtask`, which requires Claude Code v2.1.212 or later. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` starts the forked subagent instead; otherwise `/fork` copies the whole session into a new [background session](</docs/en/agent-view#from-inside-a-session>). - -A fork is a subagent that inherits the entire conversation so far instead of starting fresh. This drops the input isolation that subagents otherwise provide: a fork sees the same system prompt, tools, model, and message history as the main session, so you can hand it a side task without re-explaining the situation. The fork’s own tool calls still stay out of your conversation and only its final result comes back, so your main context window stays clean. Use a fork when any other subagent would need too much background to be useful, or when you want to try several approaches in parallel from the same starting point. Claude starts a fork by requesting the `fork` subagent type through the Agent tool. You control whether it can with fork mode, which is on by default in interactive sessions. You can start a fork yourself with `/subtask` followed by a task, whether or not fork mode is on. On v2.1.161 through v2.1.211 the command is `/fork`. Claude Code names the fork from the first words of the task. The following example forks the conversation to draft test cases while you continue with the implementation in the main session: +When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and `/fork` starts the forked subagent instead; otherwise `/fork` copies the whole session into a new [background session](</docs/en/agent-view#from-inside-a-session>). + +A fork is a subagent that inherits the entire conversation so far instead of starting fresh. This drops the input isolation that subagents otherwise provide: a fork sees the same system prompt, tools, model, and message history as the main session, so you can hand it a side task without re-explaining the situation. The fork’s own tool calls still stay out of your conversation and only its final result comes back, so your main context window stays clean. Use a fork when any other subagent would need too much background to be useful, or when you want to try several approaches in parallel from the same starting point. Claude can start a fork on its own while fork mode is on, as it is by default. To stop forks, see Turn fork mode off. You can start a fork yourself with `/subtask` followed by a task, whether or not fork mode is on. Claude Code names the fork from the first words of the task. The following example forks the conversation to draft test cases while you continue with the implementation in the main session: /subtask draft unit tests for the parser changes so far @@ -1092,7 +1129,6 @@ Context| Full conversation history| Fresh context with the prompt you pass System prompt and tools| Same as main session| From the subagent’s definition file, filtered for background runs Model| Same as main session| From the subagent’s `model` field -Permissions| Prompts surface in your terminal| Prompts surface in your main session when running in the background Prompt cache| Shared with main session| Separate cache Because a fork’s system prompt and tool definitions are identical to the parent, its first request reuses the parent’s [prompt cache](</docs/en/prompt-caching#subagents-and-the-cache>). Because of that reuse, a fork costs less than a fresh subagent for tasks that need the same context. When Claude spawns a fork through the Agent tool, it can pass `isolation: "worktree"` so the fork’s file edits are written to a separate git worktree instead of your checkout. A fork can’t spawn further forks. @@ -1101,19 +1137,14 @@ ​ -Turn fork mode on or off - -Claude Code turns fork mode on by default in interactive sessions and leaves it off by default in [non-interactive mode](</docs/en/headless>) with `-p` and in the Agent SDK. The interactive default requires Claude Code v2.1.232 or later. On earlier versions, set `CLAUDE_CODE_FORK_SUBAGENT` to `1` to turn fork mode on. You can tell fork mode is on from how Claude Code handles the Agent tool: - - * Claude can spawn a fork by requesting the `fork` subagent type. When Claude doesn’t request a type, it gets the general-purpose subagent, if the session still has that type. Subagents spawned from a definition, such as Explore, work as usual. - * Claude Code runs the subagents Claude spawns in the background, forks and non-fork subagents alike, apart from the cases that stay in the foreground. Claude Code also removes the Agent tool’s `run_in_background` parameter, so Claude can’t ask for the foreground. - -Set the [`CLAUDE_CODE_FORK_SUBAGENT`](</docs/en/env-vars>) environment variable to override the defaults: - - * `1` turns fork mode on in non-interactive mode and the Agent SDK as well - * `0` turns fork mode off in every kind of session - -To keep fork mode on but stop Claude from spawning forks, deny the `fork` subagent type with an `Agent(fork)` rule. Claude Code still runs the subagents Claude spawns in the background, apart from the same cases that stay in the foreground. +Turn fork mode off + +Fork mode lets Claude start a fork on its own. To stop Claude from starting forks: + + * **Stop forks only** : add `"Agent(fork)"` to `permissions.deny` in your settings. + * **Turn fork mode off** : set `CLAUDE_CODE_FORK_SUBAGENT` to `0`, following the steps in Let Claude wait for a subagent. + +While fork mode is on, Claude also can’t wait for a subagent in interactive terminal, VS Code, or desktop sessions on your machine. Fork mode is on by default from Claude Code v2.1.302, and in an interactive terminal session from v2.1.232. ##
modified Subagents in the SDK View current →
--- a/subagents.md +++ b/subagents.md @@ -163,7 +163,18 @@ `effort`| `'low' | 'medium' | 'high' | 'xhigh' | 'max' | number`| No| Reasoning effort level for this agent `permissionMode`| `PermissionMode`| No| Permission mode for tool execution within this agent. The [subagent inheritance rules](</docs/en/agent-sdk/permissions#available-modes>) decide when it applies -In the Python SDK, multi-word field names such as `disallowedTools` and `mcpServers` keep their camelCase spelling to match the wire format rather than following Python’s snake_case convention. See the [`AgentDefinition` reference](</docs/en/agent-sdk/python#agentdefinition>) for details. Subagents run in the background by default. An Agent tool call that omits the [`run_in_background`](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) input launches a background subagent, and Claude sets `run_in_background: false` when it needs the result before continuing. Set the `background` field to `true` to force background execution for a specific agent regardless of what Claude requests. Before Claude Code v2.1.198, the background default was rolling out gradually, and an Agent tool call that omitted `run_in_background` could run the subagent synchronously. Subagents can also spawn subagents of their own. To limit how deep that nesting goes, how many subagents run at once, and how much a query spends, see Cap subagent depth, concurrency, and spend. +In the Python SDK, multi-word field names such as `disallowedTools` and `mcpServers` keep their camelCase spelling to match the wire format rather than following Python’s snake_case convention. See the [`AgentDefinition` reference](</docs/en/agent-sdk/python#agentdefinition>) for details. + +#### + +​ + +Choose whether Claude waits for subagents + +By default, a subagent your main agent spawns [runs in the background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). The Agent tool result has `status: "async_launched"`, and the report arrives in a later turn. Claude waits when its next action needs the report: the call blocks and returns `status: "completed"`. To make that choice yourself: + + * **In your prompt** : ask Claude to wait, such as “run the test-runner agent and wait for it” + * **In the definition** : set `background` to `true` to keep that agent in the background ### @@ -224,6 +235,28 @@ "Use the code-reviewer agent to check the authentication module" This bypasses automatic matching and directly invokes the named subagent. + +### + +​ + +Forked subagents + +A [fork](</docs/en/sub-agents#fork-the-current-conversation>) is a subagent that copies the conversation so far instead of starting fresh. From Claude Code v2.1.302, Claude can start forks in your application with nothing configured, by calling the Agent tool with `subagent_type: "fork"`. To stop Claude from starting forks, add an [`Agent(fork)` deny rule](</docs/en/agent-sdk/permissions#allow-and-deny-rules>): + +Python + +TypeScript + + options = ClaudeAgentOptions( + # Deny only the fork subagent type; other subagents still run + disallowed_tools=["Agent(fork)"], + ) + + const options = { + // Deny only the fork subagent type; other subagents still run + disallowedTools: ["Agent(fork)"] + }; ###
modified Configure your terminal for Claude Code View current →
--- a/terminal-config.md +++ b/terminal-config.md @@ -46,7 +46,7 @@ * VS Code -Open Settings → Profiles → Keyboard and check “Use Option as Meta Key”.If you accepted Claude Code’s first-run terminal setup prompt, this is already done. That prompt runs `/terminal-setup` for you, which enables Option as Meta and turns off the audible bell in your Apple Terminal profile.In [screen reader mode](</docs/en/accessibility>), `/terminal-setup` leaves the bell setting unchanged so the terminal bell stays audible. Before v2.1.211, `/terminal-setup` turned the bell off even in screen reader mode. If an earlier run turned the bell off, turn it back on under Settings → Profiles → Advanced → “Audible bell”. +Open Settings → Profiles → Keyboard and check “Use Option as Meta Key”.If you accepted Claude Code’s first-run terminal setup prompt, this is already done. That prompt runs `/terminal-setup` for you, which enables Option as Meta and turns off the audible bell in your Apple Terminal profile.In [screen reader mode](</docs/en/accessibility>), `/terminal-setup` leaves the bell setting unchanged so the terminal bell stays audible. If an earlier run turned the bell off, turn it back on under Settings → Profiles → Advanced → “Audible bell”. Open Settings → Profiles → Keys → General and set Left Option key and Right Option key to “Esc+”.Running `/terminal-setup` in iTerm2 enables “Applications in terminal may access clipboard” under Settings → General → Selection so the `/copy` command can write to your system clipboard. The command detects iTerm2 even when run from inside tmux. Restart iTerm2 for the change to take effect.
modified Tools reference View current →
Show diff (156 lines)
--- a/tools-reference.md +++ b/tools-reference.md @@ -8,11 +8,11 @@ `Artifact`| Publishes an HTML or Markdown file as an [artifact](</docs/en/artifacts>): a private, interactive page on claude.ai. You can share it with a public link, or inside your organization on Team and Enterprise plans, where public sharing requires an Owner to [enable it](</docs/en/artifacts#control-public-sharing>). Requires a Pro, Max, Team, or Enterprise plan and `/login` authentication; see [Availability](</docs/en/artifacts#availability>)| Yes `AskUserQuestion`| Asks multiple-choice questions to gather requirements or clarify ambiguity. Questions stay open until you answer them by default. See AskUserQuestion tool behavior| No `Bash`| Executes shell commands in your environment. See Bash tool behavior| Yes -`CronCreate`| Schedules a recurring or one-shot prompt within the current session. Tasks are session-scoped and restored on `--resume` or `--continue` if unexpired. See [scheduled tasks](</docs/en/scheduled-tasks>)| No -`CronDelete`| Cancels a scheduled task by ID| No -`CronList`| Lists all scheduled tasks in the session| No +`CronCreate`| Schedules a recurring or one-shot prompt within the current session. Tasks are session-scoped and restored on `--resume` or `--continue` if unexpired. See [session-scoped scheduled tasks](</docs/en/scheduled-tasks>)| No +`CronDelete`| Cancels a session-scoped scheduled task by ID| No +`CronList`| Lists all session-scoped scheduled tasks| No `Edit`| Makes targeted edits to specific files. See Edit tool behavior| Yes -`EndConversation`| Ends the session, in rare cases of sustained abusive input or when you ask Claude to demonstrate the tool. Requires Claude Code v2.1.213 or later. See EndConversation tool behavior| No +`EndConversation`| Ends the session, in rare cases of sustained abusive input or when you ask Claude to demonstrate the tool. See EndConversation tool behavior| No `EnterPlanMode`| Switches to plan mode to design an approach before coding| No `EnterWorktree`| Creates an isolated [git worktree](</docs/en/worktrees>) and switches into it. Pass a `path` to switch into an existing worktree instead of creating a new one. On first entry the target may be a worktree of the current repository or, in a multi-repo workspace, of a repository nested inside it. Before v2.1.203, a nested repository’s worktree was rejected. A `path` outside `.claude/worktrees/` prompts for your approval before entering, since it moves the session’s working directory and write access to that location. New-worktree creation and paths under `.claude/worktrees/` don’t prompt. Before v2.1.206, Claude entered paths outside `.claude/worktrees/` without a prompt. From within a worktree session, or from a subagent with a pinned working directory such as [`isolation: worktree`](</docs/en/sub-agents#supported-frontmatter-fields>), only the `path` form is available and the target must be under `.claude/worktrees/` of the session’s repository| Yes `ExitPlanMode`| Presents a plan for approval and exits plan mode| Yes @@ -25,16 +25,16 @@ `Monitor`| Runs a command in the background and feeds each output line back to Claude, so it can react to log entries, file changes, or polled status mid-conversation. Can also open a WebSocket and treat each incoming message as an event. See Monitor tool| Yes `NotebookEdit`| Modifies Jupyter notebook cells. See NotebookEdit tool behavior| Yes `PowerShell`| Executes PowerShell commands natively. See PowerShell tool for availability| Yes -`PushNotification`| Sends a desktop notification, and a phone push when [Remote Control](</docs/en/remote-control>) is connected, so a long-running task or [scheduled task](</docs/en/scheduled-tasks>) can reach you when you step away. Push delivery runs through Anthropic-hosted infrastructure, which is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No +`PushNotification`| Sends a desktop notification, and a phone push when [Remote Control](</docs/en/remote-control>) is connected, so a long-running task or [session-scoped scheduled task](</docs/en/scheduled-tasks>) can reach you when you step away. Push delivery runs through Anthropic-hosted infrastructure, which is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No `Read`| Reads the contents of files. See Read tool behavior| No `ReadMcpResourceTool`| Reads a specific MCP resource by URI| No -`RemoteTrigger`| Creates, updates, runs, and lists [Routines](</docs/en/routines>) on claude.ai. Backs the `/schedule` command. The [`RemoteTrigger` input reference](</docs/en/agent-sdk/typescript#remotetrigger>) documents every action and the organization policies that remove the tool. Routines live on claude.ai and require a Pro, Max, Team, or Enterprise plan, so this tool is not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No +`RemoteTrigger`| Creates, updates, runs, and lists [cloud scheduled tasks](</docs/en/routines>), formerly routines, on claude.ai. Backs the `/schedule` command. The [`RemoteTrigger` input reference](</docs/en/agent-sdk/typescript#remotetrigger>) documents every action and the organization policies that remove the tool. Cloud scheduled tasks live on claude.ai and require a Pro, Max, Team, or Enterprise plan. This tool is therefore not accessible from Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry| No `ReportFindings`| Reports code-review findings as a structured list, with a file, summary, and failure scenario per finding, so Claude Code can render them instead of printing them as text. Claude calls it when active code-review instructions tell it to. A finding can also carry an optional `category` slug, such as `correctness` or `test-coverage`, shown next to the file location in the rendered list| No `ScheduleWakeup`| Reschedules the next iteration of a [self-paced `/loop`](</docs/en/scheduled-tasks#let-claude-choose-the-interval>). Claude calls this at the end of each iteration to pick when the next one runs, between one minute and one hour out; you don’t call it directly. To end the loop instead, Claude calls it with `stop: true`, which cancels the pending wakeup. The pending wakeup appears in `session_crons` in [Stop hook input](</docs/en/hooks#stop-input>)| No `SendFeedback`| Drafts a feedback report about Claude Code, covering a product problem or Claude’s own behavior in the session, and queues it on your machine for you to review. Claude Code sends nothing until you choose to send the draft. See SendFeedback tool behavior. Requires Claude Code v2.1.238 or later| No `SendMessage`| Sends a message to another agent: an [agent team](</docs/en/agent-teams>) teammate, a [subagent it resumes](</docs/en/sub-agents#resume-subagents>) by agent ID or name, or one of your other Claude Code sessions, on this machine or beyond it. Messaging other sessions requires Claude Code v2.1.224 or later. [Cross-session messaging](</docs/en/cross-session-messaging>) covers which sessions Claude can reach, [what a message looks like when it arrives](</docs/en/cross-session-messaging#what-a-message-looks-like>), and [how Claude gets a notice when another session goes idle](</docs/en/cross-session-messaging#get-a-notice-when-another-session-goes-idle>). Claude can include an optional `summary` input, typically 5-10 words, that Claude Code shows as a one-line preview. When Claude omits it on a [plain-text message](</docs/en/cross-session-messaging#limitations>), Claude Code uses the first line of the message as the summary. Claude Code truncates a summary longer than 200 characters with an ellipsis| No `SendUserFile`| Sends files from the session to you with an optional caption, so a generated report, diagram, screenshot, or built artifact reaches your device instead of only being mentioned in the transcript. The optional `display` input controls presentation: `render` opens the file inline in the client, `attach` shows a download card only, and when unset the client decides by file type. Available when a [Remote Control](</docs/en/remote-control>) client is connected or in a [cloud session](</docs/en/claude-code-on-the-web>). Delivery runs through Anthropic-hosted infrastructure, so the tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No -`ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Pro, Max, Team, and Enterprise plans| Yes +`ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Team and Enterprise plans| Yes `Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation| Yes `SubagentHandback`| Delivers a subagent’s final report to whichever conversation receives that subagent’s result. Provided only in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), to subagents that the Agent tool runs locally other than [forks](</docs/en/sub-agents#fork-the-current-conversation>), and available in the terminal CLI, IDE extensions, cloud sessions, and the Agent SDK; the classifier reviews the report before it’s delivered. Requires Claude Code v2.1.271 or later| No `TaskCreate`| Creates a new task in the task list. Provided by default only on the models listed under Task tool availability, and on other models when you opt in| No @@ -78,7 +78,7 @@ `WebFetch(domain:example.com)`| WebFetch| [Domain matching](</docs/en/permissions#webfetch>) `WebSearch`| WebSearch| No specifier; allow or deny the tool as a whole -Tools not listed here, such as `ExitPlanMode` or `ShareOnboardingGuide`, accept only the bare tool name with no specifier. An `Edit(...)` allow rule also grants read access to the same path, so you don’t need a matching `Read(...)` rule. A `Read(...)` deny rule also blocks the Edit and Write tools on the same path, including creating a new file there, because both tools change content Claude has to be able to read back. The `Read` deny check requires Claude Code v2.1.208 or later on edits, and v2.1.228 or later on writes. Hook `matcher` fields use bare tool names, not the parenthesized rule format. See [matcher patterns](</docs/en/hooks#matcher-patterns>) for the matching rules. For the field names each tool passes to `tool_input` in hooks, see the [PreToolUse input reference](</docs/en/hooks#pretooluse-input>). +Tools not listed here, such as `ExitPlanMode` or `ShareOnboardingGuide`, accept only the bare tool name with no specifier. An `Edit(...)` allow rule also grants read access to the same path, so you don’t need a matching `Read(...)` rule. A `Read(...)` deny rule also blocks the Edit and Write tools on the same path, including creating a new file there, because both tools change content Claude has to be able to read back. For the Write tool, the `Read` deny check requires Claude Code v2.1.228 or later. Hook `matcher` fields use bare tool names, not the parenthesized rule format. See [matcher patterns](</docs/en/hooks#matcher-patterns>) for the matching rules. For the field names each tool passes to `tool_input` in hooks, see the [PreToolUse input reference](</docs/en/hooks#pretooluse-input>). ## @@ -86,7 +86,12 @@ Agent tool behavior -The Agent tool spawns a subagent in a separate context window. The subagent works through its task autonomously, then returns its result to the parent conversation. The parent doesn’t see the subagent’s intermediate tool calls or outputs, only that final result. With [agent teams](</docs/en/agent-teams>) enabled, a call that carries a `name` can launch a [teammate](</docs/en/agent-teams#how-claude-starts-agent-teams>) instead, which reports back through team messages rather than by returning a result. To cap how many turns a subagent runs, set `maxTurns` in the [subagent definition](</docs/en/sub-agents#supported-frontmatter-fields>). When the subagent reaches the limit, Claude Code marks the returned result as partial output, and Claude can [resume the subagent](</docs/en/sub-agents#resume-subagents>) to continue. The same Agent tool also launches [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) wherever [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>) is on. A fork inherits the full parent conversation instead of starting fresh, runs in the background apart from the [cases that stay in the foreground](</docs/en/sub-agents#run-subagents-in-foreground-or-background>), and still surfaces permission prompts in your terminal. The rest of this section describes non-fork subagents. Which tools a non-fork subagent can use depends on the `tools` and `disallowedTools` fields in the [subagent definition](</docs/en/sub-agents>): +The Agent tool spawns a subagent in a separate context window. The subagent works through its task autonomously, then returns its result to the parent conversation. The parent doesn’t see the subagent’s intermediate tool calls or outputs, only that final result. The same tool can also launch a teammate or a fork: + + * **Teammate** : with [agent teams](</docs/en/agent-teams>) enabled, a call that carries a `name` can launch a [teammate](</docs/en/agent-teams#how-claude-starts-agent-teams>) instead, which reports back through team messages rather than by returning a result + * **Fork** : wherever [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>) is on, the tool can launch a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>), which inherits the full parent conversation instead of starting fresh + +To cap how many turns a subagent runs, set `maxTurns` in the [subagent definition](</docs/en/sub-agents#supported-frontmatter-fields>). When the subagent reaches the limit, Claude Code marks the returned result as partial output, and Claude can [resume the subagent](</docs/en/sub-agents#resume-subagents>) to continue. Which tools a non-fork subagent can use depends on the `tools` and `disallowedTools` fields in the [subagent definition](</docs/en/sub-agents>): * **Neither field set** : the subagent inherits every [tool available to subagents](</docs/en/sub-agents#available-tools>). * **`tools` only**: the subagent gets only the listed tools. @@ -253,13 +258,13 @@ Edit tool behavior -The Edit tool performs exact string replacement. It takes an `old_string` and a `new_string` and replaces the first with the second. It doesn’t use regex or fuzzy matching. These checks must pass for an edit to apply. Before any of them, a path matched by a [`Read` deny rule](</docs/en/permissions#tool-specific-permission-rules>) is refused, including creating a new file there. The refusal requires Claude Code v2.1.208 or later. +The Edit tool performs exact string replacement. It takes an `old_string` and a `new_string` and replaces the first with the second. It doesn’t use regex or fuzzy matching. These checks must pass for an edit to apply. Before any of them, a path matched by a [`Read` deny rule](</docs/en/permissions#tool-specific-permission-rules>) is refused, including creating a new file there. * **Read-before-edit** : Claude reads the file in the current conversation before editing it, and a read cut short with a `PARTIAL view` notice doesn’t count. Claude Opus 4.6, Claude Haiku 4.5, and older models always require the read. Newer models can edit an unread file when reading it wouldn’t need a permission prompt and the Read tool is available. * **Match** : `old_string` must appear in the file exactly as written. A single character of whitespace or indentation difference is enough to miss. * **Uniqueness** : `old_string` must appear exactly once. When it appears more than once, Claude either supplies a longer string with enough surrounding context to pin down one occurrence, or sets `replace_all: true` to replace them all. -A file that changed on disk after Claude last read it can still be edited when `old_string` matches the current content exactly and unambiguously and Claude Code can read the file without prompting. Matching against the file’s current content keeps this safe, and the result notes that the file carries other changes so Claude re-reads it before edits that depend on surrounding content. In any other case, such as a stale `old_string` or one that matches more than once without `replace_all`, Claude reads the file again before editing. The relaxed handling of unread and changed files requires Claude Code v2.1.208 or later; before that, Claude Code refused any edit to a file it hadn’t read in the conversation or that changed on disk after the read. Claude can also edit a file without a separate Read after it views the file with a Bash command such as `cat` or `grep`. Those commands are `cat`, `nl`, `bat`, `batcat`, `head`, `tail`, `sed -n 'X,Yp'`, `grep`, `egrep`, `fgrep`, and `rg`, each run on one file with no pipes or redirects. A search that prints no matches doesn’t count as a read, nor does any command outside this list. When Claude views a file this way, Claude Code also loads any [subdirectory `CLAUDE.md`](</docs/en/memory#how-claude-md-files-load>) and [path-scoped rules](</docs/en/memory#path-specific-rules>) that apply to that file. See [Read and Edit permission rules](</docs/en/permissions#read-and-edit>) for which Bash commands your `Read` and `Edit` deny rules cover. +A file that changed on disk after Claude last read it can still be edited when `old_string` matches the current content exactly and unambiguously and Claude Code can read the file without prompting. Matching against the file’s current content keeps this safe, and the result notes that the file carries other changes so Claude re-reads it before edits that depend on surrounding content. In any other case, such as a stale `old_string` or one that matches more than once without `replace_all`, Claude reads the file again before editing. Claude can also edit a file without a separate Read after it views the file with a Bash command such as `cat` or `grep`. Those commands are `cat`, `nl`, `bat`, `batcat`, `head`, `tail`, `sed -n 'X,Yp'`, `grep`, `egrep`, `fgrep`, and `rg`, each run on one file with no pipes or redirects. A search that prints no matches doesn’t count as a read, nor does any command outside this list. When Claude views a file this way, Claude Code also loads any [subdirectory `CLAUDE.md`](</docs/en/memory#how-claude-md-files-load>) and [path-scoped rules](</docs/en/memory#path-specific-rules>) that apply to that file. See [Read and Edit permission rules](</docs/en/permissions#read-and-edit>) for which Bash commands your `Read` and `Edit` deny rules cover. ### @@ -282,7 +287,6 @@ General frustration, profanity, or a task going badly don’t qualify, and neither do requests for harmful content, which Claude declines instead of ending the session. Claude Code follows the same approach as claude.ai, which can [end a rare subset of chats](<https://www.anthropic.com/research/end-subset-conversations>). After Claude ends an interactive session, the session locks. New prompts and most commands return `Claude ended this conversation. Start a new session (or /clear) to continue.`, and only `/clear`, `/resume`, `/help`, `/exit`, and `/feedback` still run. Claude Code records the end in the session’s transcript, so resuming an ended session restores the lock; the session’s history isn’t deleted. Resuming an ended session in [non-interactive mode](</docs/en/headless>) with the `-p` flag errors and exits with code 1, so a script doesn’t read the ended run as a success. The tool never prompts for permission, and [PreToolUse hooks](</docs/en/hooks#pretooluse>) don’t run for it. While any other tool remains, you can’t block it either: [deny and ask rules](</docs/en/permissions#tool-specific-permission-rules>) naming `EndConversation` have no effect, and neither `--disallowedTools` nor a `--tools` list can remove it. The exemption is deliberate: the tool does nothing except end the conversation, never reading or modifying files or data, and a safeguard of this kind holds only if the session it applies to can’t turn it off. When your deny rules remove every other tool and also match `EndConversation`, as `"*"` does, Claude Code removes it too rather than leaving it as the only tool, unless an allow rule names `EndConversation` explicitly. A deny list that removes every other tool without matching `EndConversation` leaves it in place. [Subagents](</docs/en/sub-agents>) never get the tool. Background tasks that share the main conversation’s tool list see it, but calling it there ends nothing. The tool appears only when all of the following are true: - * **Version** : Claude Code v2.1.213 or later. * **Model** : the session’s model is Claude Opus 4.8, Claude Sonnet 5, Claude Fable 5, or a later version of one of those families. * **Surface** : an interactive terminal session, including a `claude` session in an IDE’s integrated terminal, which is how the [JetBrains plugin](</docs/en/jetbrains>) runs it. Other surfaces don’t include the tool, such as: * non-interactive `-p` runs @@ -323,7 +327,7 @@ * `files_with_matches`: file paths only, no line content. This is the default. * `content`: matching lines with file and line number. When the tool’s `offset` parameter points past the last match for a pattern that has matches, Grep returns `No entries at this offset`, so Claude widens or resets the offset instead of concluding the pattern doesn’t match. - * `count`: match count per file, followed by a total across all matching files. The total covers every match even when the tool’s `head_limit` or `offset` parameters truncate the listed per-file entries. Before v2.1.208, the total only summed the listed entries. + * `count`: match count per file, followed by a total across all matching files. The total covers every match even when the tool’s `head_limit` or `offset` parameters truncate the listed per-file entries. Claude can scope results by file with the `glob` parameter, such as `**/*.tsx`, or by language with the `type` parameter, such as `py` or `rust`. By default, patterns match within a single line. Claude can set `multiline: true` to match across line boundaries. Grep respects `.gitignore`, so gitignored files are skipped. To search a gitignored file, Claude passes its path directly. Claude Code decides permission for a Grep call before it checks whether the search `path` exists. It still runs the read-permission check for a missing `path` outside the [working directories](</docs/en/permissions#working-directories>), so a permission prompt for a path doesn’t mean the path exists. @@ -460,16 +464,12 @@ Windows encoding and exit codes -On Windows, the following PowerShell encoding and exit-code behaviors require Claude Code v2.1.214 or later: - * Redirection with `>` and `>>` writes UTF-8 files on PowerShell 5.1 * 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 -Before v2.1.214, `>` on PowerShell 5.1 wrote UTF-16LE files, non-ASCII piped input arrived as `?`, and Python scripts could crash with a `UnicodeEncodeError` when printing non-ASCII characters. - ### ​ @@ -487,13 +487,13 @@ Read tool behavior -The Read tool takes a file path and returns the contents with line numbers. Claude is instructed to always pass absolute paths. Reading an empty file returns a notice that the file exists but its contents are empty, and an `offset` past the last line returns a notice giving the file’s line count. Before v2.1.208, reading an empty file returned the past-the-end notice instead. Read handles several file types beyond plain text: - - * **Images** : PNG, JPG, and other image formats are returned as visual content that Claude can see, not as raw bytes. Claude Code resizes and recompresses large images to fit the model’s image size limits before sending them, so Claude may see a downscaled version of a large screenshot. An image that is still larger than 500KB after that resize is re-encoded as a JPEG at reduced quality with its pixel dimensions unchanged. If Claude misses fine pixel-level detail in a large image, ask it to crop the region of interest first, for example with ImageMagick via Bash. +The Read tool takes a file path and returns the contents with line numbers. Claude is instructed to always pass absolute paths. Reading an empty file returns a notice that the file exists but its contents are empty, and an `offset` past the last line returns a notice giving the file’s line count. Read handles several file types beyond plain text: + + * **Images** : PNG, JPEG, GIF, and WebP files are returned as visual content that Claude can see, not as raw bytes. Claude Code resizes and recompresses large images to fit the model’s image size limits before sending them, so Claude may see a downscaled version of a large screenshot. If Claude misses fine pixel-level detail in a large image, ask it to crop the region you care about, such as with ImageMagick via Bash, and then read the crop. * **PDFs** : Claude reads short `.pdf` files whole. For PDFs longer than 10 pages, it reads in ranges with a `pages` parameter, such as `"1-5"`, up to 20 pages at a time. Page-range reads render pages with `pdftoppm` from poppler-utils, so install it with `brew install poppler` on macOS or `apt-get install poppler-utils` on Debian and Ubuntu. On Windows and other platforms, install a poppler build that puts `pdftoppm` on your `PATH`. Without it, a page-range read fails with `pdftoppm is not installed`. * **Jupyter notebooks** : `.ipynb` files return all cells with their outputs, including code, markdown, and visualizations. A notebook whose cells come to more than 256 KB, or more than the token limit, returns an error instead. Claude Code refuses to read a notebook file over 100 MB; the error tells Claude how to read a portion of the notebook instead, such as a slice of cells, with a shell command. -Read only reads files, not directories. Claude lists directory contents with a shell command such as `ls`. +Read only reads files, not directories. Claude lists directory contents with a shell command such as `ls`. Read refuses a file whose extension it treats as binary, such as `.xlsx`, `.parquet`, `.heic`, or `.zip`. Claude keeps working after a refusal: the error suggests a skill for that file type if one is available, or else a shell command or script that reads the format. If you [`@`-mention](</docs/en/common-workflows#reference-files-and-directories>) a file that Read refuses, Claude receives the file’s path but not its contents. ### @@ -615,7 +615,7 @@ * WebFetch caches each response for 15 minutes by default, so repeated fetches of the same URL return quickly. On Claude Code v2.1.233 or later, set [`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`](</docs/en/env-vars#variables>) to change how long WebFetch keeps each response. * A page that hasn’t finished downloading within five minutes, including any redirects WebFetch follows, fails with a deadline error. On Claude Code v2.1.268 or later, set [`CLAUDE_CODE_WEBFETCH_DEADLINE_MS`](</docs/en/env-vars#variables>) to change the limit, or to `0` to remove it. * When a URL redirects to a different host, WebFetch returns a text result that names the original URL and the redirect target instead of following it. Claude then fetches the new URL with a second WebFetch call. - * When the extraction step hits an overloaded API, Claude Code retries it with backoff; a fetch that still fails returns an error result. Before v2.1.212, the API error text could reach Claude as if it were the extracted page content. + * When the extraction step hits an overloaded API, Claude Code retries it with backoff; a fetch that still fails returns an error result. In Manual and `acceptEdits` [permission modes](</docs/en/permission-modes>), WebFetch prompts before fetching, except for domains your [permission rules](</docs/en/permissions#manage-permissions>) already allow or deny and a built-in set of preapproved documentation domains that fetch without a prompt. Whatever your rules allow, a fetch also passes the [WebFetch domain safety check](</docs/en/data-usage#webfetch-domain-safety-check>) first; that section covers what the check sends and the setting that skips it. The prompt offers three options: @@ -639,7 +639,7 @@ WebSearch tool behavior -WebSearch runs a query against Anthropic’s [web search](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool>) backend and returns result titles and URLs. It doesn’t fetch the result pages. To read a page Claude finds in search results, it follows up with WebFetch. The tool may issue up to eight backend searches per call, refining the search internally before returning results. Claude can scope results with `allowed_domains` to include only certain hosts, or `blocked_domains` to exclude them. The two lists can’t be combined in a single call. When the search request hits an overloaded API, Claude Code retries it with backoff; a call that still fails returns an error result. Before v2.1.212, the API error text could reach Claude as if it were search results. WebSearch permission rules take no specifier. A bare `WebSearch` entry in `allow` or `deny` is the only form. The search backend is not configurable. To search with a different provider, add an [MCP server](</docs/en/mcp>) that exposes a search tool. +WebSearch runs a query against Anthropic’s [web search](<https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool>) backend and returns result titles and URLs. It doesn’t fetch the result pages. To read a page Claude finds in search results, it follows up with WebFetch. The tool may issue up to eight backend searches per call, refining the search internally before returning results. Claude can scope results with `allowed_domains` to include only certain hosts, or `blocked_domains` to exclude them. The two lists can’t be combined in a single call. When the search request hits an overloaded API, Claude Code retries it with backoff; a call that still fails returns an error result. WebSearch permission rules take no specifier. A bare `WebSearch` entry in `allow` or `deny` is the only form. The search backend is not configurable. To search with a different provider, add an [MCP server](</docs/en/mcp>) that exposes a search tool. WebSearch is available on the Claude API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Microsoft Foundry. On Google Cloud’s Agent Platform it works with Opus 4, Sonnet 4, Haiku 4.5, and later models. Amazon Bedrock doesn’t expose the server-side web search tool. @@ -649,7 +649,7 @@ Session search limit -An interactive terminal session has a limit of 200 WebSearch calls. Searches from the main conversation and from [subagents](</docs/en/sub-agents>), such as a parallel research fan-out, count against the same limit. The limit requires Claude Code v2.1.212 or later. While a session is at the limit, searches appear in the conversation as calls that did nothing. Claude gets a notice telling it to continue with the information it already gathered and, if it needs more searches, to ask you to raise the limit. To get more searches, raise the cap, wait for the limit to refill, or start a new conversation: +An interactive terminal session has a limit of 200 WebSearch calls. Searches from the main conversation and from [subagents](</docs/en/sub-agents>), such as a parallel research fan-out, count against the same limit. While a session is at the limit, searches appear in the conversation as calls that did nothing. Claude gets a notice telling it to continue with the information already gathered, say so in its answer, and, if it needs more searches, ask you to raise the limit. To get more searches, raise the cap, wait for the limit to refill, or start a new conversation: * **Raise the cap** : set the [`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`](</docs/en/env-vars#variables>) environment variable to a positive whole number, such as `500`. The cap can be raised but not turned off. * **Wait for the refill** : on Claude Code v2.1.290 or later, an interactive terminal session’s limit refills at about 100 calls per hour. To change the rate, set [`CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`](</docs/en/env-vars#variables>) to a number of calls per hour, such as `50`.
modified Troubleshoot a mod View current →
--- a/troubleshoot.md +++ b/troubleshoot.md @@ -84,7 +84,7 @@ Messages from the built-in guard -On a machine with managed settings, or for a user signed in with a Team or Enterprise plan, the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) can refuse a mod or one of its answers. Each message names the option your organization’s administrator sets to change the rule. +On a machine with managed settings, or in a session whose credential is a Team or Enterprise `/login`, the [built-in guard](</docs/en/plugins/mods/admin#know-what-happens-by-default>) can refuse a mod or one of its answers. Each message names the option your organization’s administrator sets to change the rule. Message contains| What it means| Where it appears ---|---|--- @@ -237,6 +237,20 @@ ​ +A toast appears after a turn is stopped + +### + +​ + +`Stopped: type a message to continue; a mod cannot resume work after Stop` + +This toast means that after you stopped the turn, for example with Esc, a mod tried to start work on its own and Claude Code didn’t let it. Nothing needs fixing. After your next message, mods can start work again and [some of that work comes back](</docs/en/plugins/mods/api#work-your-mod-started-before-the-interruption>) on its own. If what you expected from the mod doesn’t come back, ask for it again or run the mod’s command again. If you wrote the mod, see [Calls and background work after the user interrupts a turn](</docs/en/plugins/mods/api#calls-and-background-work-after-the-user-interrupts-a-turn>). + +## + +​ + A drawing doesn’t appear or respond The mod loaded, and its pane, band, toast, or controls don’t behave as you expect. @@ -323,7 +337,7 @@ * **The site or element isn’t drawn in that app** : look up your site in the [render sites](</docs/en/plugins/mods/reference#render-sites>) table and your elements in the [elements](</docs/en/plugins/mods/reference#elements>) table. For an element the app lacks, check `e.surface` in the hook and return a tree the app can draw. * **The VS Code extension is older than 2.1.299** : the chat panel draws for mods from [extension version](</docs/en/vs-code#install-the-extension>) 2.1.299. Check the version in VS Code’s Extensions view and update the extension there. - * **The VS Code session doesn’t fetch feature flags** : drawing in the chat panel requires it. Sessions on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, or through a [Claude apps gateway](</docs/en/claude-apps-gateway>), skip it, among others that [Features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) lists. To see the drawing in such a session, run `claude` in a terminal instead, such as VS Code’s integrated terminal. + * **The extension is older than 2.1.304 and the session doesn’t fetch feature flags** : update the extension, or run `claude` in VS Code’s integrated terminal instead. Sessions on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry skip the fetch. For the others that skip it, such as a [Claude apps gateway](</docs/en/claude-apps-gateway>) session, see [Features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>). ##
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -622,7 +622,7 @@ `outputFormat`| `{ type: 'json_schema', schema: JSONSchema }`| `undefined`| Define output format for agent results. See [Structured outputs](</docs/en/agent-sdk/structured-outputs>) for details `outputStyle`| `string`| `undefined`| Not an `Options` field. Set `outputStyle` in the inline [`settings`](</docs/en/settings>) object or a settings file instead. See [Activate an output style](</docs/en/agent-sdk/modifying-system-prompts#activate-an-output-style>) `pathToClaudeCodeExecutable`| `string`| Auto-resolved from bundled native binary| Path to Claude Code executable. Only needed if optional dependencies were skipped during install or your platform isn’t in the supported set -`permissionMode`| `PermissionMode`| `undefined`| Permission mode for the session. If you omit it, the session can start in auto mode. See [Permission modes](</docs/en/agent-sdk/permissions#permission-modes>) for how Claude Code picks the starting permission mode +`permissionMode`| `PermissionMode`| `undefined`| Permission mode for the session. If you omit it and nothing else sets a permission mode, such as a [`permissions.defaultMode`](</docs/en/settings-reference#permissions-defaultmode>) setting, the session starts in `default`. See [Permission modes](</docs/en/agent-sdk/permissions#permission-modes>) `permissionPromptToolName`| `string`| `undefined`| MCP tool name for permission prompts `permissionPrompts`| `'host' | 'none'`| `'host'`| Who answers permission prompts: `'host'` routes them to your `canUseTool` callback or the `permissionPromptToolName` tool, and `'none'` [denies the calls that would have prompted](</docs/en/agent-sdk/permissions#how-permissions-are-evaluated>). Requires Claude Code v2.1.259 or later `persistSession`| `boolean`| `true`| When `false`, disables session persistence to disk. Sessions cannot be resumed later @@ -674,7 +674,7 @@ }, }); - * `API_TIMEOUT_MS`: per-request timeout on the Anthropic client, in milliseconds. Default `600000`. Applies to the main loop and all subagents. + * [`API_TIMEOUT_MS`](</docs/en/env-vars>): how long each request attempt can wait for response headers, in milliseconds. It doesn’t limit how long a streaming response runs after the headers arrive. Default `600000`. Applies to the main loop and all subagents. * `CLAUDE_CODE_MAX_RETRIES`: maximum API retries. Default `10`, capped at `15`. Each retry gets its own `API_TIMEOUT_MS` window. For unattended runs that need to wait through longer outages, set [`CLAUDE_CODE_RETRY_WATCHDOG=1`](</docs/en/errors#tune-retry-behavior>): it retries transient capacity errors indefinitely and, on Claude Code v2.1.199 or later, raises the default for other transient errors to `300` and removes the cap on this variable. * `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`: stall watchdog for subagents. While the stream watchdog is on, the default is `CLAUDE_STREAM_IDLE_TIMEOUT_MS` plus 5 minutes, which comes to `600000` unless you raise that variable. With the stream watchdog off, the default is `600000`. Before v2.1.257, the default was always `600000`. The timer resets on each stream event. On a stall, Claude Code aborts the subagent and reports the stall to the parent. For a background subagent, it also marks the task failed and attaches any partial result. * `CLAUDE_ENABLE_STREAM_WATCHDOG` with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`: stream watchdog that aborts the request when headers have arrived but the response body stops streaming. The watchdog is on by default for all providers; set `CLAUDE_ENABLE_STREAM_WATCHDOG=0` to disable it. `CLAUDE_STREAM_IDLE_TIMEOUT_MS` defaults to `300000` and is clamped to that minimum. After the abort, [Automatic retries](</docs/en/errors#automatic-retries>) covers what Claude Code does, based on how far the response had progressed. While the watchdog waits out a response that a gateway behind `ANTHROPIC_BASE_URL` holds open with keep-alive pings, a host that sets `includePartialMessages` keeps receiving `ping` stream events, so read those frames as liveness rather than timing the session out on silence. Before v2.1.257, the frames stopped 5 minutes after the last real stream event. @@ -941,7 +941,7 @@ * Only messages that were enqueued with a UUID appear. An empty array doesn’t mean nothing else will run. * Only main-thread messages are listed. Messages addressed to a subagent are out of scope. - * The list can include UUIDs your client never sent, such as [scheduled task](</docs/en/scheduled-tasks>) triggers. Ignore UUIDs you don’t recognize instead of treating them as an error. + * The list can include UUIDs your client never sent, such as [session-scoped scheduled task](</docs/en/scheduled-tasks>) triggers. Ignore UUIDs you don’t recognize instead of treating them as an error. A client that drives the CLI’s control protocol directly, rather than through `interrupt()`, can set `cancel_queued: true` on the `interrupt` control request. Claude Code v2.1.219 and later advertises support with the `interrupt_cancel_queued_v1` capability in `SDKSystemMessage.capabilities`; older CLIs ignore the field and leave queued messages to run as usual. Such an interrupt also cancels every message that would otherwise be listed under `still_queued`: the receipt lists them under `cancelled` instead, `still_queued` is empty, and none of them run. The `cancelled` list carries the same caveats as `still_queued`. The `interrupt()` method never sends `cancel_queued`, so receipts it resolves with don’t carry `cancelled`. The receipt is a snapshot taken at the moment the interrupt is processed, and on a clean interrupt it arrives before the interrupted turn’s `SDKResultMessage`. Read the receipt rather than inspecting the queue after that result: the loop starts the next queued turn immediately, so the queue you inspect after the result has already changed. @@ -1798,7 +1798,12 @@ `sdk_opt_in_required`| The session hasn’t opted in to fast mode: pass `fastMode: true` in the `settings` option or through `applyFlagSettings()` `pending`| The availability check hasn’t completed yet -The same pair of fields appears on `SDKSystemMessage` and on the `SDKControlInitializeResponse`, so you can read the fast mode state before the first turn. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. When the SDK injects a synthetic follow-up turn, such as for a finished background task, the resulting `SDKResultMessage` carries `origin: { kind: "task-notification" }`. Routines whose trigger fired and server-verified messages from your other sessions arrive with this kind too, each with the `subkind` described in Task-notification subkinds. Check `kind` to distinguish results that answer your prompt from injected follow-ups before routing or suppressing them. If your application declares scheduled runs, their results carry `kind: "task-notification"` too, so don’t suppress on `kind` alone. When several background-task completions are queued together, Claude Code can answer them in one turn rather than one turn each. Each completion still produces its own result with this origin. All but the last of the completions Claude Code answers together produce empty results with `num_turns: 0`, in order, and the last one’s result carries the turn that answers them all. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip. +The same pair of fields appears on `SDKSystemMessage` and on the `SDKControlInitializeResponse`, so you can read the fast mode state before the first turn. The `origin` field forwards the `SDKMessageOrigin` of the user message that triggered this result. Results that carry `origin: { kind: "task-notification" }` include: + + * **Synthetic follow-up turns** : when the SDK injects a synthetic follow-up turn, such as for a finished background task, the resulting `SDKResultMessage` carries this kind + * **Fired scheduled tasks and messages from other sessions** : cloud scheduled tasks whose trigger fired and server-verified messages from your other sessions arrive with this kind too, each with the `subkind` described in Task-notification subkinds + +Check `kind` to distinguish results that answer your prompt from injected follow-ups before routing or suppressing them. If your application declares scheduled runs, their results carry `kind: "task-notification"` too, so don’t suppress on `kind` alone. When several background-task completions are queued together, Claude Code can answer them in one turn rather than one turn each. Each completion still produces its own result with this origin. All but the last of the completions Claude Code answers together produce empty results with `num_turns: 0`, in order, and the last one’s result carries the turn that answers them all. The field is absent for results emitted before any user turn, such as startup errors. When a `PreToolUse` hook returns `permissionDecision: "defer"`, the result has `stop_reason: "tool_deferred"` and `deferred_tool_use` carries the pending tool’s `id`, `name`, and `input`. Read this field to surface the request in your own UI, then resume with the same `session_id` to continue. See [Defer a tool call for later](</docs/en/hooks#defer-a-tool-call-for-later>) for the full round trip. #### @@ -2335,10 +2340,10 @@ When Claude Code delivers a task notification into a session, it sets `subkind` on the notification’s `origin` if Anthropic servers verified where that notification came from. It also sets `subkind` when your application declares the message as a scheduled run itself, which requires TypeScript Agent SDK v0.3.280 or later. `subkind` requires Claude Code v2.1.213 or later, and it takes one of two values: - * `scheduled-trigger`: the notification is a [routine](</docs/en/routines>)’s stored prompt, delivered because one of the routine’s triggers fired: its schedule, its [API trigger](</docs/en/routines#add-an-api-trigger>), its [GitHub trigger](</docs/en/routines#add-a-github-trigger>), or **Run now**. A prompt your application declares as a scheduled run carries this value too. Claude Code frames these to the model as the session’s assigned task, with a different notice from the notice that other task notifications carry. + * `scheduled-trigger`: the notification is a [cloud scheduled task](</docs/en/routines>)’s stored prompt, delivered because one of the task’s triggers fired: its schedule, its [API trigger](</docs/en/routines#add-an-api-trigger>), its [GitHub trigger](</docs/en/routines#add-a-github-trigger>), or **Run now**. A prompt your application declares as a scheduled run carries this value too. Claude Code frames these to the model as the session’s assigned task, with a different notice from the notice that other task notifications carry. * `peer-send-message`: the notification is a message that another of your sessions sent with the server-side `send_message` tool that [cloud sessions](</docs/en/claude-code-on-the-web>) use to message each other, not the [cross-session `SendMessage` tool](</docs/en/cross-session-messaging>), and Anthropic servers verified that both sessions belong to the same private group of sessions. Requires Claude Code v2.1.224 or later. A `send_message` delivery the servers didn’t verify that way gets no subkind. -Every other task notification has no `subkind`. That includes [PR activity](</docs/en/claude-code-on-the-web#how-claude-responds-to-pr-activity>) delivered into a session and background events such as a finished task. Messages from the [cross-session `SendMessage` tool](</docs/en/cross-session-messaging>) aren’t task notifications at all: whether they come from a session on the same machine or through Anthropic servers from another machine, Claude Code gives them `kind: "peer"` and the peer origin fields. `fireReason` says why a `scheduled-trigger` notification fired, as a short lowercase token such as `scheduled`, `manual`, `retry`, `catch_up`, or `api`. Anthropic servers set it on a [routine](</docs/en/routines>)’s deliveries, and your application sets it when it declares a scheduled run. It’s absent when neither sent one. Requires TypeScript Agent SDK v0.3.280 or later. A background task can run more than once under the same `task_id`, such as when Claude [resumes a subagent](</docs/en/agent-sdk/subagents#resume-subagents>). Each run has its own `run_id`. When a run’s notification reaches your session as a user message, `runId` on that message’s `task-notification` origin holds the same value. A notification can arrive after the task’s next run has started, and it still carries the earlier run’s ID. To tell which run a turn belongs to, compare `runId`, not `task_id`. Requires TypeScript Agent SDK v0.3.292 or later. +Every other task notification has no `subkind`. That includes [PR activity](</docs/en/claude-code-on-the-web#how-claude-responds-to-pr-activity>) delivered into a session and background events such as a finished task. Messages from the [cross-session `SendMessage` tool](</docs/en/cross-session-messaging>) aren’t task notifications at all: whether they come from a session on the same machine or through Anthropic servers from another machine, Claude Code gives them `kind: "peer"` and the peer origin fields. `fireReason` says why a `scheduled-trigger` notification fired, as a short lowercase token such as `scheduled`, `manual`, `retry`, `catch_up`, or `api`. Anthropic servers set it on a [cloud scheduled task](</docs/en/routines>)’s deliveries, and your application sets it when it declares a scheduled run. It’s absent when neither sent one. Requires TypeScript Agent SDK v0.3.280 or later. A background task can run more than once under the same `task_id`, such as when Claude [resumes a subagent](</docs/en/agent-sdk/subagents#resume-subagents>). Each run has its own `run_id`. When a run’s notification reaches your session as a user message, `runId` on that message’s `task-notification` origin holds the same value. A notification can arrive after the task’s next run has started, and it still carries the earlier run’s ID. To tell which run a turn belongs to, compare `runId`, not `task_id`. Requires TypeScript Agent SDK v0.3.292 or later. #### @@ -3730,7 +3735,7 @@ durable?: boolean; }; -Schedules a prompt to run on a 5-field cron schedule in local time. Set `recurring` to `false` to fire once at the next match. Jobs are session-scoped by default, and resuming with `--resume` or `--continue` restores jobs that haven’t expired. See [Scheduled tasks](</docs/en/scheduled-tasks>). Setting `durable` to `true` requests persistence to `.claude/scheduled_tasks.json` so the job survives restarts. Durable scheduling isn’t available in every session: when it isn’t, Claude Code accepts `durable: true` but creates the job session-only. Read the output’s `durable` field to see whether the job persisted. +Schedules a prompt to run on a 5-field cron schedule in local time. Set `recurring` to `false` to fire once at the next match. Jobs are session-scoped by default, and resuming with `--resume` or `--continue` restores jobs that haven’t expired. See [Session-scoped scheduled tasks](</docs/en/scheduled-tasks>). Setting `durable` to `true` requests persistence to `.claude/scheduled_tasks.json` so the job survives restarts. Durable scheduling isn’t available in every session: when it isn’t, Claude Code accepts `durable: true` but creates the job session-only. Read the output’s `durable` field to see whether the job persisted. ### @@ -3802,7 +3807,12 @@ }; }; -Manages [Routines](</docs/en/routines>), the scheduled and triggered Claude Code runs hosted in the cloud. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, `run`, and `list_runs` actions. `body` is required for `create`, `update`, and `create_webhook_trigger`, and optional for `run`. `create_webhook_trigger` attaches an event source to an existing routine, such as a [GitHub event](</docs/en/routines#add-a-github-trigger>) that fires it. The `body` names the source, the events, and the routine to fire. Requires Claude Code v2.1.225 or later. `list_runs` lists a routine’s recent runs, and `get_run_log` reads one run’s log. `session_id` names the run to read, from a `list_runs` result, and `cursor` pages through either action’s results. Both actions require Claude Code v2.1.227 or later. This tool is available only when the session is authenticated with a claude.ai account on a plan with Routines enabled, and is absent when your organization’s policy disables [cloud sessions](</docs/en/claude-code-on-the-web>). On Claude Code v2.1.227 or later, the tool is also absent when an Owner has [turned off routines for the organization](</docs/en/routines#routines-are-disabled-by-your-organizations-policy>). Before v2.1.227, a session with only the routines toggle turned off still showed the tool, and the server denied its calls. +Manages [cloud scheduled tasks](</docs/en/routines>), formerly routines: the scheduled and triggered Claude Code runs hosted in the cloud. This tool backs the `/schedule` command. `trigger_id` is required for the `get`, `update`, `run`, and `list_runs` actions. `body` is required for `create`, `update`, and `create_webhook_trigger`, and optional for `run`. `create_webhook_trigger`, `list_runs`, and `get_run_log` each require a minimum Claude Code version: + + * **`create_webhook_trigger`** : attaches an event source to an existing scheduled task, such as a [GitHub event](</docs/en/routines#add-a-github-trigger>) that fires it. The `body` names the source, the events, and the task to fire. Requires Claude Code v2.1.225 or later. + * **`list_runs` and `get_run_log`**: `list_runs` lists a scheduled task’s recent runs, and `get_run_log` reads one run’s log. `session_id` names the run to read, from a `list_runs` result, and `cursor` pages through either action’s results. Both actions require Claude Code v2.1.227 or later. + +This tool is available only when the session is authenticated with a claude.ai account on a plan with cloud scheduled tasks enabled. It is absent when your organization’s policy disables [cloud sessions](</docs/en/claude-code-on-the-web>). On Claude Code v2.1.227 or later, the tool is also absent when an Owner has [turned off scheduled tasks for the organization](</docs/en/routines#routines-are-disabled-by-your-organizations-policy>). ###
modified Use Claude Code in VS Code View current →
--- a/vs-code.md +++ b/vs-code.md @@ -194,7 +194,7 @@ Resume past conversations -Click the **Session history** button at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time. Click any conversation to resume it with the full message history. If the conversation is already open in another tab of the current window, clicking it switches to that tab. If the messages stay blank at first, see why they’re blank and when they appear. For more on resuming sessions, see [Manage sessions](</docs/en/sessions>). +Click the **Session history** button at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time. Click any conversation to resume it. If the conversation is already open in another tab of the current window, clicking it switches to that tab. If the conversation opens with no messages showing, see why a resumed conversation is blank at first. For more on resuming sessions, see [Manage sessions](</docs/en/sessions>). * **Session titles** : new sessions receive AI-generated titles based on your first message. * **Rename and archive** : hover over a session to reveal these actions. Rename to give it a descriptive title, or archive to move it to the **Archived sessions** group at the bottom of the list. @@ -336,7 +336,8 @@ An open doesn’t finish when the panel crashes or stops responding while loading the conversation, or when you reload or close the window within about three seconds of it opening. The conversation is unchanged and stays in Session history. - * **To open it anyway** : click **Open it anyway** or pick the conversation from Session history. If it opens and the panel keeps working, it comes back after later reloads as usual. If the panel stops responding again, reload the window to return to a new chat with the notice. + * **To open it anyway** : click **Open it anyway** or pick the conversation from Session history. Once the conversation finishes opening, it comes back after later reloads as usual. + * **If the panel stops responding while the conversation loads** : reload the window. A new chat opens. * **To leave it closed** : keep working in the new chat. The notice disappears once you send a prompt. ### @@ -480,7 +481,7 @@ Plugins that draw in the panel -A plugin that contains a [mod](</docs/en/plugins/mods/overview>) can draw in the chat panel. Drawing requires extension version 2.1.299 or later and a session that [fetches feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>). From such a plugin you can see: +A plugin that contains a [mod](</docs/en/plugins/mods/overview>) can draw in the chat panel. Drawing requires extension version 2.1.299 or later. A session that [doesn’t fetch feature flags](</docs/en/env-vars#features-that-need-feature-flag-fetching>), such as one on Amazon Bedrock, needs 2.1.304 or later. From such a plugin you can see: * A pane beside the conversation or above the prompt box * A toast or a status line above the prompt box @@ -548,10 +549,21 @@ When a command or a [subagent](</docs/en/sub-agents>) keeps Claude waiting longer than you want, click **Run in background** below its tool call in the conversation. Requires Claude Code v2.1.287 or later. - * **Timing** : the action appears once a command has been running for about two seconds, or as soon as a subagent starts. + * **Timing** : the action appears once a command has run for about two seconds, or as soon as Claude starts waiting for a [subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) it spawned from the main conversation. * **After you click** : Claude stops waiting and continues the turn. The command or subagent keeps running as a [background task](</docs/en/tools-reference#background-commands>) that notifies Claude when done. To check on the task or stop it in the meantime, type `/tasks` in the prompt box to open the agent map. A subagent keeps its place in the tree of agents there, and a command is listed below the agents with its latest output on its card. + +#### + +​ + +The Run in background action is missing under a subagent + +By default in VS Code, subagents don’t show this action. To see why for one subagent, open its card in the agent map and read the `Spawned by` line: + + * **`Spawned by the main agent`** : the subagent started in the background, so Claude isn’t waiting for it and you don’t need to do anything. To have Claude wait for subagents instead, see [Let Claude wait for a subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>). + * **`Spawned by` names another subagent**: the action appears only for subagents the main agent spawned, not a [nested subagent](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) another subagent waits for. To end the nested subagent early, click **Stop agent** on its card. The waiting subagent then carries on without that result. ### @@ -930,11 +942,17 @@ If none of the math in Claude’s responses is typeset, check the extension’s version in the Extensions view, because math rendering requires version 2.1.301 or later. If you use terminal mode, which doesn’t typeset math whatever the version, uncheck the [Use Terminal setting](<vscode://settings/claudeCode.useTerminal>) so that Claude Code opens in the chat panel instead. If one formula shows as written while others near it are typeset, check it for these causes: - * **It reads as something other than math** : `$…$` text that reads as a word stays as written, such as `$O(n log n)$`. `$…$` text that starts with a digit, such as `$30$` or `$1/N$`, also stays as written unless a character such as `=`, `+`, or `^` marks it as math. Ask Claude for a `$$` block on its own lines instead, which the panel typesets without this check. - * **It’s padded, long, or split across lines** : `$ x^2 $` with spaces inside the dollars, `$…$` content over 60 characters, and `$…$` or `\(…\)` split across two lines aren’t typeset. Ask Claude for a `$$` block on its own lines instead, which has none of these limits. - * **The TeX can’t be typeset** : a formula with a syntax error, a macro definition such as `\newcommand` or `\def`, or an unescaped `%` shows as written. Ask Claude to rewrite it with the error corrected, without the macro, or with `\%` for a percent sign. - * **It’s too large** : a formula longer than 8,192 characters, or one that would draw far larger than its source, shows as written. Ask Claude to split it into smaller formulas or to write it more compactly. - * **It follows a large amount of math** : within one block of text in a response, the panel typesets formulas in order up to a limit. A later formula that would go past the limit shows as written. Ask Claude to send the formula you need again by itself. + * **The formula is inline and the panel doesn’t treat it as math** : ask Claude to send it again as a `$$` block on its own lines. The panel leaves an inline formula as written when the text between its `$…$` delimiters: + * Is more than simple arithmetic yet has no character such as `=`, `+`, or `^` to mark it as math, as in `$O(n log n)$` + * Starts with a digit and has no such character, as in `$30$` and `$1/N$` + * Has spaces inside the dollar signs, as in `$ x^2 $` + * Is longer than 60 characters + * Is split across two lines. A `\(…\)` formula split across two lines isn’t typeset either. + * **The formula has a TeX syntax error** : ask Claude to rewrite it with the error corrected. + * **The formula defines a macro** : a formula with a macro definition such as `\newcommand` or `\def` shows as written. Ask Claude to rewrite it without the macro. + * **The formula contains an unescaped`%`**: ask Claude to rewrite it with `\%` for a percent sign. + * **The formula is too large** : a formula longer than 8,192 characters, or one whose typeset output would be far larger than its TeX source, shows as written. Ask Claude to split it into smaller formulas or to write it more compactly. + * **The formula follows a large amount of math** : within one block of text in a response, the panel typesets formulas in order up to a limit. A later formula that would go past the limit shows as written. Ask Claude to send the formula you need again by itself. ###
modified Get started with Claude Code in the cloud View current →
--- a/web-quickstart.md +++ b/web-quickstart.md @@ -318,6 +318,6 @@ * [Use Claude Code in the cloud](</docs/en/claude-code-on-the-web>): the full reference, including teleporting sessions to your terminal, session sharing, and auto-fixing pull requests * [Configure cloud environments](</docs/en/cloud-environments>): network access levels, environment variables, and setup scripts for cloud sessions - * [Routines](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events + * [Cloud scheduled tasks](</docs/en/routines>): automate work on a schedule, via API call, or in response to GitHub events * [CLAUDE.md](</docs/en/memory>): give Claude persistent instructions and context that load at the start of every session * Install the Claude mobile app for [iOS](<https://apps.apple.com/us/app/claude-by-anthropic/id6473753684>) or [Android](<https://play.google.com/store/apps/details?id=com.anthropic.claude>) to monitor sessions from your phone. From the Claude Code CLI, `/mobile` shows a QR code for [claude.ai/mobile](<https://claude.ai/mobile>) that opens the right app store for your phone.
modified Orchestrate subagents at scale with dynamic workflows View current →
--- a/workflows.md +++ b/workflows.md @@ -143,8 +143,6 @@ * a scheduled task prompt * a webhook payload or pull request comment relayed into the conversation -Before v2.1.210, the keyword started a workflow from any of these routes too, including a webhook payload or pull request comment relayed into the conversation. - ### ​
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -1,6 +1,9 @@ A [git worktree](<https://git-scm.com/docs/git-worktree>) is a separate working directory with its own files and branch, sharing the same repository history and remote as your main checkout. Running each Claude Code session in its own worktree gives it a separate copy of the files to edit, so one session can build a feature while a second fixes a bug. -Worktrees require a git repository; for other version control systems, configure hooks to replace the git logic. In the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>), select the **worktree** option when you start a session to give it its own worktree. +If you use another version control system or the desktop app, follow the instructions for your setup: + + * **Other version control systems** : worktrees require a git repository; configure hooks to replace the git logic + * **Desktop app** : see [Run a session in its own worktree](</docs/en/desktop#run-a-session-in-its-own-worktree>) Worktrees are one of several ways to run Claude in parallel. They isolate file edits. [Subagents](</docs/en/sub-agents>) split work up inside one session, and [cross-session messaging](</docs/en/cross-session-messaging>) lets Claude pass findings between the sessions in your worktrees. See [Run agents in parallel](</docs/en/agents>) to compare the approaches, or skip ahead to Isolate subagents with worktrees to use worktrees and subagents together. Most sessions need only the first two sections: start Claude in a worktree, then clean up when you exit. Return to the rest of the page when you need to resume a session, change how worktrees are created, or debug a failure. @@ -222,7 +225,7 @@ * **Permission approvals** : choosing “Yes, and don’t ask again” for a Bash command in a worktree session saves the rule to the main checkout’s `.claude/settings.local.json`, so it applies in the main checkout and in every other worktree of the repository, and it survives the worktree’s removal. On Windows and in the other cases where Claude Code [doesn’t use the repository root](</docs/en/settings#where-claude-code-looks-for-each-file>), the rule stays with that worktree. Before v2.1.211, an approval granted in a worktree was saved inside that worktree, didn’t apply elsewhere, and was lost when the worktree was removed. See [where approvals are saved](</docs/en/permissions#permission-system>). * **Untracked skills, agents, and commands** : when the worktree checkout has no `.claude/skills` directory at its root, for example because your `.claude/skills` is gitignored, Claude Code loads the main checkout’s [project skills](</docs/en/skills#where-skills-live>) in the worktree session. In a worktree with its own `.claude/skills` directory, only that copy loads. The same read-through covers `.claude/agents` and `.claude/commands`. For skills, the read-through requires Claude Code v2.1.277 or later. -All of these apply whether you create the worktree with `--worktree` or with `git worktree add`. In a worktree session that you start from the [desktop app](</docs/en/desktop#work-in-parallel-with-sessions>), Claude Code reads project configuration such as settings, hooks, skills, agents, commands, and [`.mcp.json`](</docs/en/mcp#project-scope>) servers from the main checkout’s root rather than from the worktree. Hook commands run in that root, and `${CLAUDE_PROJECT_DIR}` points at it. To reach the files Claude is working on, read the worktree’s path from the hook’s [`cwd` input field](</docs/en/hooks#common-input-fields>). `CLAUDE.md` files and `.claude/rules/` still load from the worktree. +All of these apply whether you create the worktree with `--worktree` or with `git worktree add`. In a worktree session you start from the [desktop app](</docs/en/desktop#run-a-session-in-its-own-worktree>), Claude Code reads project configuration such as settings, hooks, skills, agents, commands, and [`.mcp.json`](</docs/en/mcp#project-scope>) servers from the main checkout’s root. Hook commands run in that root, and `${CLAUDE_PROJECT_DIR}` points at it. To reach the files Claude is working on, read the worktree’s path from the hook’s [`cwd` input field](</docs/en/hooks#common-input-fields>). `CLAUDE.md` files and `.claude/rules/` still load from the worktree. ## @@ -366,4 +369,4 @@ * [Cross-session messaging](</docs/en/cross-session-messaging>): let the sessions in your worktrees pass findings to each other * [Agent teams](</docs/en/agent-teams>): coordinate multiple Claude sessions automatically * [Manage sessions](</docs/en/sessions>): name, resume, and switch between conversations - * [Desktop parallel sessions](</docs/en/desktop#work-in-parallel-with-sessions>): worktree-backed sessions in the desktop app + * [Run a Desktop session in its own worktree](</docs/en/desktop#run-a-session-in-its-own-worktree>): worktree-backed sessions in the desktop app