modified How the agent loop works View current →
--- a/agent-loop.md +++ b/agent-loop.md @@ -143,7 +143,7 @@ **Discovery**| `ToolSearch`| Dynamically find and load tools on-demand instead of preloading all of them **Orchestration**| `Agent`, `Skill`, `AskUserQuestion`, `TaskCreate`, `TaskUpdate`| Spawn subagents, invoke skills, ask the user, track tasks -Beyond built-in tools, you can: +On the [models that don’t get the task-tracking tools](</docs/en/agent-sdk/todo-tracking#model-availability>), Claude Code provides `TaskCreate` and `TaskUpdate` only when you opt in. Beyond built-in tools, you can: * **Connect external services** with [MCP servers](</docs/en/agent-sdk/mcp>) (databases, browsers, APIs) * **Define custom tools** with [custom tool handlers](</docs/en/agent-sdk/custom-tools>)
modified Orchestrate teams of Claude Code sessions View current →
--- a/agent-teams.md +++ b/agent-teams.md @@ -33,7 +33,7 @@ ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent **Communication**| Report results back to the main agent only| Teammates message each other directly -**Coordination**| Main agent manages all work| Shared task list with self-coordination +**Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -55,6 +55,8 @@ } } +Enabling agent teams also changes ordinary delegation. Claude may [name a subagent](</docs/en/sub-agents#subagent-names>) on its own, and while agent teams are enabled, a subagent that Claude names launches as a teammate, so teams can form even when you didn’t ask for one. For more, see How Claude starts agent teams; to turn the behavior off, see Claude spawns teammates instead of subagents. Spawning teammates also requires an interactive session. In [non-interactive mode](</docs/en/headless>) with the `-p` flag, including Agent SDK sessions, Claude doesn’t spawn teammates, and a subagent that Claude names runs as an ordinary [subagent](</docs/en/sub-agents>) even with agent teams enabled. + ## ​ @@ -161,7 +163,7 @@ Assign and claim tasks -The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. The lead can assign tasks explicitly, or teammates can self-claim: +The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. Agents [without the Task tools](</docs/en/tools-reference#task-tool-availability>) coordinate through messages instead of the shared task list. The lead can assign tasks explicitly, or teammates can self-claim: * **Lead assigns** : tell the lead which task to give to which teammate * **Self-claim** : after finishing a task, a teammate picks up the next unassigned, unblocked task on its own @@ -206,12 +208,7 @@ How Claude starts agent teams -An agent team forms when the first teammate is spawned, with the main session acting as the lead. There are two ways teammates get spawned: - - * **You request teammates** : give Claude a task that benefits from parallel work and explicitly ask for teammates. Claude spawns them based on your instructions. - * **Claude proposes teammates** : if Claude determines your task would benefit from parallel work, it may suggest spawning teammates. You confirm before it proceeds. - -In both cases, you stay in control. Claude won’t spawn teammates without your approval. +To start a team, ask Claude for teammates. Claude launches a teammate when it calls the [Agent tool](</docs/en/tools-reference>) with a [`name`](</docs/en/sub-agents#subagent-names>) while agent teams are enabled, and Claude Code doesn’t ask you to confirm. Claude also names ordinary subagents on its own so it can message them later, and while agent teams are enabled, a named subagent launches as a teammate, so teams can form even when you didn’t ask for one. If you want subagents instead, turn agent teams off. ### @@ -245,7 +242,7 @@ Spawn a teammate using the security-reviewer agent type to audit the auth module. -The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. Team coordination tools such as `SendMessage` and the task management tools are always available to a teammate even when `tools` restricts other tools. +The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. For an in-process teammate, Claude Code adds `SendMessage` to that allowlist. In a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>), Claude Code adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` to it too. The `skills` and `mcpServers` frontmatter fields in a subagent definition are not applied when that definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, the same as a regular session. @@ -277,7 +274,7 @@ Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. - * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. + * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. The notification doesn’t carry the teammate’s output; a teammate shares results by messaging the lead or updating the shared task list. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. * **Shared task list** : all agents can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. @@ -431,6 +428,34 @@ which tmux * For iTerm2, verify the `it2` CLI is installed and the Python API is enabled in iTerm2 preferences. + +### + +​ + +Claude spawns teammates instead of subagents + +While agent teams are enabled, a subagent that Claude names in the lead’s session launches as a teammate. Claude can name subagents on its own, so this can happen during delegation you never framed as team work. Subagents and teammates report back differently: + + * **Subagents** : Claude receives the subagent’s result when it completes. + * **Teammates** : the idle notification reports that the teammate stopped, without its output. + +An orchestration flow that waits on subagent results can stall. To make named subagents launch as subagents again, turn agent teams off by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to `0`: + +settings.json + + { + "env": { + "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "0" + } + } + +You don’t need to start a new session: Claude Code reapplies settings-file `env` values to the running session when you save, and rereads the variable each time Claude spawns a subagent, so the next subagent Claude names launches as a subagent. Setting the variable to `0` in your user `settings.json` overrides a shell export. Other settings sources can still enable agent teams: + + * **Higher-precedence settings files** : project settings, local settings, and a `--settings` payload apply after user settings, so an `env` entry that sets the variable to `1` in any of them wins. See [Settings precedence](</docs/en/settings#settings-precedence>). + * **Managed settings** : [managed settings](</docs/en/server-managed-settings>) apply after every other source. If your organization enables agent teams there, ask your administrator to change the managed value. + +After the change, Claude may still name subagents, and the name keeps working as a [`SendMessage` address](</docs/en/sub-agents#resume-subagents>). Claude receives each subagent’s result when it completes. ###
modified Manage multiple agents with agent view View current →
--- a/agent-view.md +++ b/agent-view.md @@ -101,7 +101,7 @@ `∙`| The process has exited. You can still peek, reply, or attach, and Claude restarts from where it left off `✢`| A [`/loop`](</docs/en/scheduled-tasks>) session sleeping between iterations. The row shows its run count and a countdown -The `#N` label that can appear at the right edge of a row is a pull request the session is linked to, not part of the state icon. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. While agent view is open, Claude Code also sends a notification through your configured [terminal notification channel](</docs/en/terminal-config#get-a-terminal-bell-or-notification>) when a local background session starts needing your input, finishes, or fails. Sessions that run on a schedule, such as [`/loop`](</docs/en/scheduled-tasks>) sessions, notify only when they need your input. Notifications use the same [`preferredNotifChannel` setting](</docs/en/settings#available-settings>) as the rest of Claude Code and fire the [`Notification` hook](</docs/en/hooks#notification>) with the `agent_needs_input` or `agent_completed` type. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. A session that was mid-response when the machine slept can come back unresponsive. When you open a session that has stopped responding, the supervisor restarts its process and the session continues the interrupted response from where it left off. +The `#N` or `!N` label that can appear at the right edge of a row is a link to the session’s pull request or merge request, not part of the state icon. The terminal tab title shows the awaiting-input count while agent view is open: `2 awaiting input · claude agents` when sessions need input, or `claude agents` when none do. While agent view is open, Claude Code also sends a notification through your configured [terminal notification channel](</docs/en/terminal-config#get-a-terminal-bell-or-notification>) when a local background session starts needing your input, finishes, or fails. Sessions that run on a schedule, such as [`/loop`](</docs/en/scheduled-tasks>) sessions, notify only when they need your input. Notifications use the same [`preferredNotifChannel` setting](</docs/en/settings#available-settings>) as the rest of Claude Code and fire the [`Notification` hook](</docs/en/hooks#notification>) with the `agent_needs_input` or `agent_completed` type. Background sessions don’t need any terminal open to keep working. A separate supervisor process runs them, so you can close agent view, close your shell, or start a new interactive session and your dispatched work keeps going. Session state persists on disk through auto-updates and supervisor restarts. Sessions are also preserved when your machine sleeps. Their processes resume on wake and the supervisor reconnects to them instead of treating the time gap as idle. Shutting down still stops running sessions; see Sessions show as failed after shutdown for how to recover them. A session that was mid-response when the machine slept can come back unresponsive. When you open a session that has stopped responding, the supervisor restarts its process and the session continues the interrupted response from where it left off. ### @@ -117,7 +117,13 @@ Pull request status -When a session opens a pull request, a `#1234` label appears at the right edge of the row, linked to the pull request. Claude Code emits the link even when it can’t detect hyperlink support, for example over SSH or tmux; set [`FORCE_HYPERLINK=0`](</docs/en/env-vars>) to render the label as plain text. The label persists when you send a follow-up to the session, so the pull request remains visible while the row reverts to live progress. Claude opens these pull requests from the session itself when the task calls for one; How file edits are isolated covers what Claude commits and pushes without asking and when it asks first. A session that works on an existing pull request is linked to it the same way. Claude Code finds the pull request differently depending on the command Claude runs: +When a session opens a pull request, Claude Code adds a label at the right edge of the row, linked to the pull request: + + * Claude Code writes the label as `#1234` for a pull request and as `!1234` for a GitLab merge request. + * Claude Code emits the link even when it can’t detect hyperlink support, for example over SSH or tmux. Set [`FORCE_HYPERLINK=0`](</docs/en/env-vars>) to render the label as plain text. + * After you send a follow-up to the session, Claude Code keeps the label while the row returns to live progress. + +A session that works on an existing pull request is linked to it the same way. Claude Code finds the pull request differently depending on the command Claude runs: * When Claude edits, comments on, closes, or marks a pull request ready with `gh`, Claude Code links the pull request that the command’s own output names. A `gh` command whose captured output names no pull request doesn’t create a link; `gh pr merge` is the common case, because it prints its result only to an interactive terminal. * When Claude checks a pull request out with `gh pr checkout` or pushes to a branch, Claude Code looks the branch up with `gh pr view` and links its open pull request. @@ -204,7 +210,7 @@ ---|--- `a:<name>`| Sessions running the named agent `s:<state>`| Sessions in the given state, such as `s:working`. Also accepts `s:blocked` for everything waiting on you -`#<number>` or a PR URL| The session working on that pull request +`#<number>` or a pull or merge request URL| The session working on that pull request or merge request Any other URL| The session whose first prompt contained that URL ### @@ -258,7 +264,7 @@ `@<repo>`| Mention a repository to run the session there. See Dispatch to a specific directory for which repositories are listed `/<command>`| Suggest [skills](</docs/en/skills>) and [commands](</docs/en/commands>) to dispatch as the prompt `! <command>`| Run a shell command as a background job instead of starting a Claude session. The job appears as a row you can attach to, watch, and detach from -`#<number>` or a pull request URL| If a session is already working on that PR, select it instead of dispatching +`#<number>` or a pull or merge request URL| If a session is already working on that pull request or merge request, Claude Code selects its row instead of dispatching a new session `Shift+Enter`| Dispatch and immediately attach to the new session A small set of commands run in agent view itself instead of dispatching: @@ -734,6 +740,7 @@ Version| Change ---|--- +v2.1.233| For a session linked to a GitLab merge request, Claude Code writes the row’s label in GitLab’s `!1234` reference syntax. You can also paste the merge request’s URL into the dispatch input to select that session. Before this release, the label rendered as `#1234`, and a pasted merge request URL matched a session only when its first prompt contained the URL. v2.1.227| Deleting a session keeps the session and its worktree while another live Claude Code session is running inside that worktree directory. Agent view shows `not deleted` on the row and the reason in the footer, and `claude rm` prints `kept <id>` with the reason, which names the other session’s process ID. Before this release, deleting the session removed the worktree while the other session was still working in it. v2.1.225| `claude agents` in a directory you haven’t trusted shows the same [workspace trust dialog](</docs/en/permissions#project-allow-rules-and-workspace-trust>) that `claude` shows on startup, before agent view opens. Accepting saves trust for that workspace; declining exits without opening agent view. Before this release, `claude agents` opened without asking, so sessions you dispatched from it ran in a directory you’d never been asked to trust.
modified Share session output as artifacts View current →
--- a/artifacts.md +++ b/artifacts.md @@ -184,7 +184,7 @@ - Typography: Inter for body, JetBrains Mono for code - Spacing: 8px scale, 6px border radius -Claude treats your design system as higher precedence than its own choices, and your prompt as higher precedence than both. The heading and format above are an example; any clear list of colors, fonts, and spacing works. +Claude treats your design system as higher precedence than its own choices, and your prompt as higher precedence than both. The heading and format above are an example; any clear list of colors, fonts, and spacing works. For typography, Claude can load a typeface from Google Fonts, the one external font source an artifact page can load from. Claude inlines any other typeface as a `@font-face` data URI and gives every typeface a fallback stack, so the page still renders if a font doesn’t load. To use a specific typeface, name it in your prompt or your design system. ## @@ -196,7 +196,7 @@ Constraint| Effect ---|--- -No external requests| The CSP blocks scripts, stylesheets, fonts, and images loaded from any other host, along with `fetch`, XHR, and WebSocket calls. Claude inlines CSS and JavaScript and embeds images as data URIs so the page renders without any external request. Connector calls are the exception: the page hands them to claude.ai, which makes the network call itself. +External requests| Apart from Google Fonts and connector data, nothing reaches the page from outside. The CSP blocks scripts, stylesheets, fonts, and images from other hosts, along with `fetch`, XHR, and WebSocket calls, so Claude inlines CSS and JavaScript and embeds images as data URIs. Google Fonts stylesheets load through a `<link>` tag or a CSS `@import` from `fonts.googleapis.com`, along with the font files they reference from `fonts.gstatic.com`. Connector calls go through claude.ai, which makes the network call itself. No backend| An artifact is a static page. It can’t store data submitted through a form or authenticate viewers itself. Its only way to fetch data when someone views it is calling MCP connectors, not an API of its own. Single page| Relative links do not resolve, because nothing is deployed alongside the page. For multi-section content, Claude uses in-page anchors rather than separate files. Source file types| The published file must be `.html`, `.htm`, or `.md`. Markdown files render as styled HTML. @@ -292,7 +292,7 @@ Allowlist the viewer domain -The viewer on claude.ai loads each artifact from a sandboxed `*.claudeusercontent.com` origin. If your organization restricts outbound network access, add that domain to your allowlist alongside `claude.ai`. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the full list. +The viewer on claude.ai loads each artifact from a sandboxed `*.claudeusercontent.com` origin. If your organization restricts outbound network access, add that domain to your allowlist alongside `claude.ai`. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the full list. An artifact that loads a typeface from Google Fonts also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. ###
modified Configure auto mode View current →
--- a/auto-mode-config.md +++ b/auto-mode-config.md @@ -1,8 +1,8 @@ [Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) lets Claude Code run without routine permission prompts by routing tool calls through a classifier that blocks anything irreversible, destructive, or aimed outside your environment. Deny and explicit ask rules are evaluated before the classifier and still block or prompt. Use the `autoMode` settings block to tell that classifier which repos, buckets, and domains your organization trusts, so it stops blocking routine internal operations. -Starting August 14, 2026, auto mode becomes the default permission mode for new sessions on Pro, Max, and Team plans. You can switch modes at any time. A default you set yourself stays in place unless you accept the one-time switch prompt, and a default your organization manages is unchanged. For details, see [the announcement](<https://claude.com/blog/auto-mode-default-in-claude-code>) on the blog.Auto mode is available to all users on every provider, including the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. If Claude Code reports auto mode as unavailable for your account, check the [full requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), which also cover the supported models and the organization-level control on Team and Enterprise plans. In v2.1.158 through v2.1.206, auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude apps gateway sessions required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement. - -By default, the classifier trusts only the working directory and the current repo’s configured remotes. Actions like pushing to your company’s source-control org or writing to a team cloud bucket are blocked until you add them to `autoMode.environment`. For how to enable auto mode and what it blocks by default, see [Permission modes](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). This page is the configuration reference. This page covers how to: +Auto mode is available to all users on every provider, including the Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. If Claude Code reports auto mode as unavailable for your account, check the [full requirements](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), which also cover the supported models and the organization-level control on Team and Enterprise plans. In v2.1.158 through v2.1.206, auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude apps gateway sessions required setting `CLAUDE_CODE_ENABLE_AUTO_MODE=1`; v2.1.207 removed the requirement. + +By default, the classifier trusts only the working directory and the current repo’s configured remotes. Actions like pushing to your company’s source-control org or writing to a team cloud bucket are blocked until you add them to `autoMode.environment`. For how sessions end up in auto mode and what the classifier blocks by default, see [auto mode on the Permission modes page](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). This page is the configuration reference. This page covers how to: * Add a human checkpoint for pushes and pull requests with `permissions.ask` * Choose where to set rules across CLAUDE.md, user settings, and managed settings @@ -287,7 +287,7 @@ See also - * [Permission modes](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>): what auto mode is, what it blocks by default, and how to enable it + * [Permission modes](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>): what auto mode is, what it blocks by default, and which sessions start in it * [Managed settings](</docs/en/server-managed-settings>): deploy `autoMode` configuration across your organization * [Permissions](</docs/en/permissions>): allow, ask, and deny rules that apply before the classifier runs * [Settings](</docs/en/settings>): the full settings reference, including the `autoMode` key
modified Best practices for Claude Code View current →
--- a/best-practices.md +++ b/best-practices.md @@ -25,7 +25,7 @@ Once the check exists, decide how hard it gates the stop: * **In one prompt** : ask Claude to run the check and iterate in the same message, as in the table above. - * **Across a session** : set the check as a [`/goal` condition](</docs/en/goal>). A separate evaluator re-checks it after every turn and Claude keeps working until it holds. + * **Across a session** : set the check as a [`/goal` condition](</docs/en/goal>). A separate evaluator re-checks it after every turn and Claude keeps working until the goal resolves. If Claude stalls, Claude Code eventually stops the run with the goal still set — see [how /goal evaluation works](</docs/en/goal#how-evaluation-works>). * **As a deterministic gate** : a [Stop hook](</docs/en/hooks#stop>) runs your check as a script and blocks the turn from ending until it passes. Claude Code overrides the hook and ends the turn after 8 consecutive blocks. * **By a second opinion** : a [verification subagent](</docs/en/sub-agents>) or a [dynamic workflow](</docs/en/workflows>) that checks its own findings has a fresh model try to refute the result, so the agent doing the work isn’t the one grading it. @@ -145,7 +145,7 @@ Run `/init` to generate a starter CLAUDE.md file based on your current project structure, then refine over time. -CLAUDE.md is a special file that Claude reads at the start of every conversation. Include Bash commands, code style, and workflow rules. This gives Claude persistent context it can’t infer from code alone. The `/init` command analyzes your codebase to detect build systems, test frameworks, and code patterns, giving you a solid foundation to refine. There’s no required format for CLAUDE.md files, but keep it short and human-readable. For example: +CLAUDE.md is a special file that Claude reads at the start of every conversation. Include Bash commands, code style, and workflow rules. This gives Claude persistent context it can’t infer from code alone. There’s no required format for CLAUDE.md files, but keep it short and human-readable. For example: CLAUDE.md @@ -169,23 +169,7 @@ Developer environment quirks (required env vars)| File-by-file descriptions of the codebase Common gotchas or non-obvious behaviors| Self-evident practices like “write clean code” -If Claude keeps doing something you don’t want despite having a rule against it, the file is probably too long and the rule is getting lost. If Claude asks you questions that are answered in CLAUDE.md, the phrasing might be ambiguous. Treat CLAUDE.md like code: review it when things go wrong, prune it regularly, and test changes by observing whether Claude’s behavior actually shifts. You can tune instructions by adding emphasis (e.g., “IMPORTANT” or “YOU MUST”) to improve adherence. Check CLAUDE.md into git so your team can contribute. The file compounds in value over time. CLAUDE.md files can import additional files using `@path/to/import` syntax: - -CLAUDE.md - - See @README.md for project overview and @package.json for available npm commands. - - # Additional Instructions - - Git workflow: @docs/git-instructions.md - - Personal overrides: @~/.claude/my-project-instructions.md - -You can place CLAUDE.md files in several locations: - - * **Home folder (`~/.claude/CLAUDE.md`)**: applies to all Claude sessions - * **Project root (`./CLAUDE.md`)**: check into git to share with your team - * **Project root (`./CLAUDE.local.md`)**: personal project-specific notes; add this file to your `.gitignore` so it isn’t shared with your team - * **Parent directories** : useful for monorepos where both `root/CLAUDE.md` and `root/foo/CLAUDE.md` are pulled in automatically - * **Child directories** : Claude pulls in child CLAUDE.md files on demand when it reads a file in those directories +If Claude keeps doing something you don’t want despite having a rule against it, the file is probably too long and the rule is getting lost. If Claude asks you questions that are answered in CLAUDE.md, the phrasing might be ambiguous. Treat CLAUDE.md like code: review it when things go wrong, prune it regularly, and test changes by observing whether Claude’s behavior actually shifts. You can tune instructions by adding emphasis (e.g., “IMPORTANT” or “YOU MUST”) to improve adherence. Check CLAUDE.md into git so your team can contribute. The file compounds in value over time. CLAUDE.md files can import additional files using `@path/to/import` syntax. For import rules and where CLAUDE.md files can live, see [CLAUDE.md files](</docs/en/memory#claude-md-files>). ### @@ -323,7 +307,7 @@ Communicate effectively -The way you communicate with Claude Code significantly impacts the quality of results. +Ask Claude the questions you’d ask another engineer, and for larger features have Claude interview you and write a spec before you start implementing. ### @@ -418,9 +402,7 @@ Use subagents to investigate how our authentication system handles token refresh, and whether we have any existing OAuth utilities I should reuse. -The subagent explores the codebase, reads relevant files, and reports back with findings, all without cluttering your main conversation. You can also use subagents for verification after Claude implements something: - - use a subagent to review this code for edge cases +You can also use subagents for verification after Claude implements something. See Add an adversarial review step. ### @@ -452,7 +434,7 @@ Automate and scale -Once you’re effective with one Claude, multiply your output with parallel sessions, non-interactive mode, and fan-out patterns. Everything so far assumes one human, one Claude, and one conversation. But Claude Code scales horizontally. The techniques in this section show how you can get more done. +Once you’re effective with one Claude, multiply your output with parallel sessions, non-interactive mode, and fan-out patterns. ###
modified Claude Code changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,31 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version. + +​ + +2.1.233 + +August 14, 2026 + + * Added GitLab merge request URL support to the `--worktree` flag and the `claude agents` view (where MRs display as `!N`) + * Added an opt-in `forward_user_identity` apps gateway setting on Anthropic upstreams that sends the signed-in user’s identity as headers, so a proxy behind the gateway can attribute spend per user + * Added opt-in memory cgroup support for Bash tool commands on Linux (`CLAUDE_CODE_TOOL_MEMORY_LIMIT`) so a runaway build can’t stall the session + * Added `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS` environment variable to configure the WebFetch session URL cache TTL (default unchanged: 15 minutes) + * Fixed cloud sessions occasionally being marked as lost when the environment shut down while Claude was waiting on a permission prompt + * Fixed MCP v2 connections endlessly reopening the subscriptions/listen stream against servers that terminate long-held streams on a fixed timeout (e.g. serverless hosts) + * Fixed Notification hooks not firing for permission prompts when running under Claude Desktop or VS Code + * Fixed idle sessions on Linux sometimes keeping one CPU core at 100% when sandboxing is enabled + * Fixed bundled skill aliases like `/checkup` and `/review` reporting “Unknown command” in `-p` mode or with plugins/MCP loaded when a user or project skill shadows the bundled skill + * Fixed skill/command argument substitution to prevent argument values from being re-expanded as template markers + * Fixed Windows paths spelled with the NT `\??\` device prefix bypassing UNC path validation, closing an NTLM credential-leak vector + * Improved `claude self-hosted-runner` session start time: the session branch is now created without rewriting the working tree, and two server round trips no longer block the agent’s launch + * Improved apps gateway error forwarding: 400/413 errors from Vertex, Foundry, and Claude Platform on AWS upstreams now carry the upstream’s own message; fixes a bug with auto-compact on apps gateway + * Improved `claude plugin validate` to check a bare `.claude/skills` directory, reporting SKILL.md files whose frontmatter fails to parse + * Improved screen reader mode: the `/effort` selector renders as a numbered list with a typed-number prompt, and hint and dialog text is no longer clipped + * Improved print mode diagnostics: a `[claude-code:unrecognized_model]` line is written to stderr when a request goes out for a model ID Claude Code doesn’t recognize; map it with `modelOverrides` to silence + * Changed the GitHub app setup tip to no longer appear in repositories whose origin remote is on gitlab.com or bitbucket.org; the enterprise marketplace tip now covers non-GitHub internal git hosts + * Todo/task-tracking tools (TaskCreate/Get/Update/List, TodoWrite) are no longer available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, and newer models; set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` to bring them back + * Windows: fixed auto mode repeatedly stopping for manual approval on ordinary `cd <dir> && <command> > file` Bash commands (a 2.1.232 regression) + * Reverted the 2.1.232 Bash permission changes for Cygwin-style symlinks on Windows and for input redirections (`< file`); a narrower version will return in a later release ​
modified Push events into a running session with channels View current →
--- a/channels.md +++ b/channels.md @@ -247,7 +247,7 @@ what's in my working directory? -The message arrives in your Claude Code session. The terminal shows it as an inbound channel line like `← fakechat · web: what's in my working directory?`, while the model receives it as a `<channel source="plugin:fakechat:fakechat">` event, using the plugin’s scoped server name. Claude reads it, does the work, and calls fakechat’s `reply` tool. The first reply triggers a permission prompt in your terminal; approve it, and the answer shows up in the chat UI. +The message arrives in your Claude Code session. The terminal shows it as an inbound channel line like `← fakechat · web: what's in my working directory?`, while the model receives it as a `<channel source="plugin:fakechat:fakechat">` event, using the plugin’s scoped server name. Claude reads it, does the work, and calls fakechat’s `reply` tool. If Claude Code asks for permission for the first reply, approve it. The answer shows up in the chat UI. If Claude hits a permission prompt while you’re away from the terminal, the session pauses until you respond. Channel servers that declare the [permission relay capability](</docs/en/channels-reference#relay-permission-prompts>) can forward these prompts to you so you can approve or deny remotely. For unattended use, [`--dangerously-skip-permissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) bypasses most prompts, but only use it in environments you trust. Even then, these checks still prompt:
modified Channels reference View current →
--- a/channels-reference.md +++ b/channels-reference.md @@ -704,7 +704,7 @@ claude --dangerously-load-development-channels server:webhook -In the second, stream the outbound side so you can see Claude’s replies and any permission prompts as they fire: +This walkthrough tests the permission dialog itself, so once the session is open, press `Shift+Tab` until the status bar shows `⏸ manual mode on`. In auto mode the classifier would decide the `reply` call instead of you, and no dialog would open for the remote side to answer. In the second, stream the outbound side so you can see Claude’s replies and any permission prompts as they fire: curl -N localhost:8788/events
modified Use Claude Code with Chrome View current →
--- a/chrome.md +++ b/chrome.md @@ -61,7 +61,7 @@ Go to code.claude.com/docs, click on the search box, type "hooks", and tell me what results appear -Before Claude’s first browser action, Claude Code asks for permission to use the `claude-in-chrome` skill. Approve it and Claude opens a new tab and starts the task. +If Claude Code asks for permission before a browser action, approve it. The dialog starts with `Claude in Chrome wants to` and offers an option to allow all actions on that site for the session. Claude opens a new tab and starts the task. Run `/chrome` at any time to check the connection status, manage permissions, reconnect the extension, or choose which connected browser to use. The integration is working when the status panel shows “Status: Enabled” and “Extension: Installed”. If more than one browser is connected, you choose which one Claude uses. When a browser action starts before you’ve chosen, Claude prompts you to pick one. To switch browsers later, run `/chrome` and select **Select browser…**. Claude keeps using your choice even when another browser connects. Browser selection requires Claude Code v2.1.154 or later. For VS Code, see [browser automation in VS Code](</docs/en/vs-code#automate-browser-tasks-with-chrome>).
modified Claude apps gateway configuration View current →
--- a/claude-apps-gateway-config.md +++ b/claude-apps-gateway-config.md @@ -568,11 +568,11 @@ The gateway derives much of the response from the matched policy’s `cli` block and from top-level gateway config: * The model list, from `availableModels` - * Disabled tools, from bare tool-name `permissions.deny` entries - * The egress allowlist, from `sandbox.network.allowedDomains` + * 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 * An OTLP endpoint that points at the gateway itself, which fans out to your destinations, included when `telemetry` forwarding is configured -The gateway omits keys with no Claude Desktop equivalent, such as `hooks` and scoped permission rules like `Bash(npm *)`, from the bootstrap response. The optional `desktop` block alongside `cli` holds the Claude Desktop feature gates that have no CLI equivalent: +To set `disabledBuiltinTools` or `coworkEgressAllowedHosts` in a policy’s `desktop` block, you need Claude Code v2.1.232 or later on the gateway server. The gateway omits keys with no Claude Desktop equivalent, such as `hooks` and scoped permission rules like `Bash(npm *)`, from the bootstrap response. Add the optional `desktop` block alongside `cli` to set Claude Desktop settings directly. Write settings from Claude Desktop’s [managed configuration reference](<https://claude.com/docs/third-party/claude-desktop/configuration>) as flat key names. Leave out keys Claude Desktop reads only from MDM or local files, such as `bootstrapUrl`; the gateway rejects them at boot. Before v2.1.232, the gateway accepted a fixed list of 11 feature-gate keys, such as `chatTabEnabled` and `disableAutoUpdates`, and rejected every other key at boot. Before v2.1.227, the gateway also rejected `chatTabEnabled` and `chatAdvancedFileAnalysisEnabled` at boot. managed: policies: @@ -584,18 +584,19 @@ disableAutoUpdates: true banner: { text: "Contractor build: internal use only" } -Key| Effect ----|--- -`modelDiscoveryEnabled`| Whether Claude Desktop fetches `/v1/models` for its picker. Set `false` to rely solely on the policy’s model list. -`coworkTabEnabled`, `isClaudeCodeForDesktopEnabled`| Show or hide the Cowork and Code tabs. Both show unless set `false` -`chatTabEnabled`| Show or hide the Chat tab. Hidden unless set `true` -`chatAdvancedFileAnalysisEnabled`| Let Claude run code in a local sandbox from the Chat tab to analyze attached files it can’t read natively, such as spreadsheets and presentations. Off unless set `true`. Has no effect when the policy’s `permissions.deny` disables `Bash` -`isDesktopExtensionEnabled`, `isDesktopExtensionSignatureRequired`| Desktop extension loading and signature checks -`isLocalDevMcpEnabled`| Allow locally defined MCP servers -`disableAutoUpdates`, `autoUpdaterEnforcementHours`| Auto-update policy -`banner`| Persistent banner at the top of the app: `enabled`, `text`, `backgroundColor`, `textColor`, `linkUrl` - -`chatTabEnabled` and `chatAdvancedFileAnalysisEnabled` require Claude Code v2.1.227 or later on the gateway server. Earlier releases reject them at boot. Every key is optional; Claude Desktop applies its own default for any key you omit. The gateway rejects unknown keys at boot. If you don’t deploy Claude Desktop, leave `desktop` out of your policies entirely; `/user/bootstrap` then returns 404 for every user. +Every key is optional; Claude Desktop applies its own default for any key you omit. The gateway validates each `desktop` block at boot against the configuration schema Claude Desktop itself uses, so a mistake surfaces at gateway start as an error naming the key rather than reaching every connected desktop. The gateway fails at boot when a block contains: + + * An unknown key + * A recognized key whose value Claude Desktop would reject or silently drop, such as an empty value or a misspelled sub-key inside a nested entry + * A key the gateway computes itself: the inference connection, the model list, and the OTLP relay. Configure those through `upstreams`, `models`, and the `telemetry` section’s `forward_to`. + * A legacy alias of a current key. In the boot error, the gateway names the canonical key to write. + +As with the `cli` block, the gateway validates against the schema bundled with its installed version. To deliver a setting introduced by a newer Claude Desktop release, upgrade the gateway first. The gateway fills in keys a policy’s `desktop` block doesn’t set from the `match: {}` catch-all’s `desktop` block, the same way it fills in a policy’s `cli` block from the base. If you set `disabledBuiltinTools` or `builtinToolPolicy` in both the base and a role policy, the gateway keeps the base’s restriction: + + * `disabledBuiltinTools`: the gateway uses the union of the base’s list and the policy’s list + * `builtinToolPolicy`: if you set a tool to a value other than `allow` in the base, the gateway keeps that value even if you set `allow` for the same tool in a role policy + +For every other key, if you set it in the role policy, the gateway uses the role policy’s value. The gateway replaces an array or a nested object such as `banner` whole, so if you set `banner.text` in a role policy, the gateway drops the base’s `banner.backgroundColor`. If you don’t deploy Claude Desktop, leave `desktop` out of your policies entirely; the gateway then returns 404 from `/user/bootstrap` for every user. #### @@ -632,7 +633,7 @@ Every other key, including `disableBypassPermissionsMode`, comes from the highest-priority source only. One [parent-settings](</docs/en/claude-apps-gateway#restrict-parent-settings>) check reads every admin source: when any admin source sets `allowManagedPermissionRulesOnly`, Claude Code drops parent-supplied permission allow rules and `additionalDirectories`. The key’s effect on the developer’s own rules still follows the highest-priority source. A `forceLoginOrgUUID` or `allowedMcpServers` value in the highest-priority admin source blocks a parent-supplied one and is the value Claude Code enforces. A value in a non-winning admin source neither applies nor blocks the parent’s. Before v2.1.223, a value in any admin source blocked the parent’s. See [Settings precedence](</docs/en/settings#settings-precedence>) for the same rules on the settings page. Gateway policies apply to every Claude Code invocation on the machine, including non-interactive `claude -p` runs and sessions spawned by the Agent SDK. If the gateway is unreachable at startup, signed-in sessions exit with an error rather than running without their policy. -`mcpServers` inside a policy’s `cli` block is rejected at gateway boot. Per-group MCP distribution is not available; deploy MCP servers via the file-based `managed-mcp.json` on each device or let developers add them locally. +At boot, the gateway rejects `mcpServers` inside a policy’s `cli` block. You can’t distribute MCP servers per group to Claude Code clients; deploy MCP servers via the file-based `managed-mcp.json` on each device or let developers add them locally. You can deliver Claude Desktop’s `managedMcpServers` setting to Claude Desktop clients through a policy’s `desktop` block. To set it, you need Claude Code v2.1.232 or later on the gateway server. ###
modified Scan your codebase for vulnerabilities View current →
--- a/claude-security.md +++ b/claude-security.md @@ -86,7 +86,7 @@ Apply each patch from your shell with `git apply`, in its own pull request. Patches are never applied automatically. -You don’t have to start from the menu: ask for a job directly, as arguments to the command, such as `/claude-security scan my branch`, or in plain language, such as “scan commit abc1234”. The plugin works best in [auto mode](</docs/en/permission-modes>), which lets the scan’s agents proceed without a permission prompt at each step; the plugin reminds you how to enable it when a job starts. +You don’t have to start from the menu: ask for a job directly, as arguments to the command, such as `/claude-security scan my branch`, or in plain language, such as “scan commit abc1234”. The plugin works best in [auto mode](</docs/en/permission-modes>), which lets the scan’s agents proceed without a permission prompt at each step. ###
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -58,10 +58,10 @@ `--add-dir`| Add additional working directories for Claude to read and edit files. Grants file access; most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from these directories. Validates each path exists as a directory. To persist these directories across sessions, set [`permissions.additionalDirectories`](</docs/en/settings#permission-settings>) in settings| `claude --add-dir ../apps ../lib` `--advisor <model>`| Enable the server-side [advisor tool](</docs/en/advisor>) for this session with a model alias, `fable`, `opus`, or `sonnet`, or a full model ID. Takes precedence over the `advisorModel` setting for the session. `fable` requires [Fable 5 access](</docs/en/advisor#choose-an-advisor-model>)| `claude --advisor opus` `--agent`| Specify an agent for the current session (overrides the `agent` setting)| `claude --agent my-custom-agent` -`--agents`| Define custom subagents dynamically via JSON. Uses the same field names as subagent [frontmatter](</docs/en/sub-agents#supported-frontmatter-fields>), plus a `prompt` field for the agent’s instructions| `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'` +`--agents`| Define custom subagents dynamically via JSON. Accepts the [fields listed for CLI-defined subagents](</docs/en/sub-agents#choose-the-subagent-scope>)| `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'` `--allow-dangerously-skip-permissions`| Add `bypassPermissions` to the `Shift+Tab` mode cycle without starting in it. Lets you begin in a different mode like `plan` and switch to `bypassPermissions` later. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>)| `claude --permission-mode plan --allow-dangerously-skip-permissions` `--allowedTools`, `--allowed-tools`| Tools that execute without prompting for permission. See [permission rule syntax](</docs/en/settings#permission-rule-syntax>) for pattern matching. To restrict which tools are available, use `--tools` instead| `"Bash(git log *)" "Bash(git diff *)" "Read"` -`--append-subagent-system-prompt`| Append custom text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt, including nested subagents. Only applies in non-interactive mode with `-p`. Requires Claude Code v2.1.205 or later| `claude -p --append-subagent-system-prompt "Cite file paths in every answer" "query"` +`--append-subagent-system-prompt`| Append custom text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt, nested subagents included, apart from a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>), which reuses the conversation’s own prompt. Only applies in non-interactive mode with `-p`. Requires Claude Code v2.1.205 or later| `claude -p --append-subagent-system-prompt "Cite file paths in every answer" "query"` `--append-system-prompt`| Append custom text to the end of the default system prompt| `claude --append-system-prompt "Always use TypeScript"` `--append-system-prompt-file`| Load additional system prompt text from a file and append to the default prompt| `claude --append-system-prompt-file ./extra-rules.txt` `--autocompact <auto|tokens>`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) for this session without changing your saved settings. Accepts the same values as `/autocompact`; that section covers the value forms and what overrides the flag. Requires Claude Code v2.1.221 or later| `claude --autocompact 500k` @@ -133,7 +133,7 @@ `--tools`| Restrict which built-in tools Claude can use. Use `""` to disable all, `"default"` for all, or tool names like `"Bash,Edit,Read"`. The flag doesn’t affect MCP tools; to deny those too, use `--disallowedTools "mcp__*"`. A list that omits [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) doesn’t remove it; `""` removes it only when no MCP tools remain| `claude --tools "Bash,Edit,Read"` `--verbose`| Enable verbose logging, shows full turn-by-turn output. Overrides the [`viewMode`](</docs/en/settings#available-settings>) setting for this session| `claude --verbose` `--version`, `-v`| Output the version number| `claude -v` -`--worktree`, `-w`| Start Claude in an isolated [git worktree](</docs/en/worktrees>) at `<repo>/.claude/worktrees/<name>`. If no name is given, one is auto-generated. Pass `#<number>` or a GitHub pull request URL to fetch that PR from `origin` and branch the worktree from it| `claude -w feature-auth` +`--worktree`, `-w`| Start Claude in an isolated [git worktree](</docs/en/worktrees>) at `<repo>/.claude/worktrees/<name>`. If you don’t give a name, Claude Code generates one. Pass `#<number>`, a GitHub pull request URL, or a GitLab merge request URL to [fetch that PR or MR from `origin` and branch the worktree from it](</docs/en/worktrees#branch-from-a-pull-request>). Branching from a GitLab merge request requires Claude Code v2.1.233 or later| `claude -w feature-auth` ###
modified Commands View current →
--- a/commands.md +++ b/commands.md @@ -64,7 +64,7 @@ `/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#available-settings>) in settings to override it. Only available in [fullscreen rendering](</docs/en/fullscreen>). 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 -`/goal [condition|clear]`| Set a [goal](</docs/en/goal>): Claude keeps working across turns until the condition is met. With no argument, shows the current or most recently achieved goal. `clear`, `stop`, `off`, `reset`, `none`, or `cancel` removes an active goal early +`/goal [condition|clear]`| Set a [goal](</docs/en/goal>): Claude keeps working across turns until the condition is met or judged impossible. 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. Doesn’t appear in 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>) configurations for tool events
modified Common workflows View current →
--- a/common-workflows.md +++ b/common-workflows.md @@ -476,7 +476,7 @@ claude --permission-mode plan -You can also press `Shift+Tab` mid-session to cycle to plan mode. The cycle runs `default` → `acceptEdits` → `plan`. See [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for the approval flow and editing the plan in your text editor. +You can also press `Shift+Tab` mid-session until the status bar shows `⏸ plan mode on`. See [Plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for the approval flow and editing the plan in your text editor. ##
modified Desktop application View current →
--- a/desktop.md +++ b/desktop.md @@ -74,11 +74,11 @@ 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 modes at any time using the mode selector next to the send button. Start with Manual to see exactly what Claude does, then move to Accept edits or Plan as you get comfortable. To set a default mode for new local sessions, add `permissions.defaultMode` to your [settings file](</docs/en/settings#settings-files>). 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 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#settings-files>). 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 ---|---|--- -**Manual**| `default`| Claude asks before editing files or running commands. You see a diff and can accept or reject each change. Recommended for new users. +**Manual**| `default`| Claude asks before editing files or running commands. You see a diff and can accept or reject each change. **Accept edits**| `acceptEdits`| Claude auto-accepts file edits and common filesystem commands like `mkdir`, `touch`, and `mv`, but still asks before running other terminal commands. Use this when you trust file changes and want faster iteration. **Plan**| `plan`| Claude reads files and runs commands to explore, then proposes a plan without editing your source code. Good for complex tasks where you want to review the approach first. **Auto**| `auto`| Claude executes all actions with background safety checks that verify alignment with your request. Reduces permission prompts while maintaining oversight. Appears when your account meets the availability requirements below; there is no separate Settings toggle for it. @@ -754,14 +754,14 @@ Key| Description ---|--- `permissions.disableBypassPermissionsMode`| set to `"disable"` to prevent users from enabling Bypass permissions mode. -`disableAutoMode`| set to `"disable"` to prevent users from enabling [Auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) mode. Removes Auto from the mode selector. Also accepted under `permissions`. +`disableAutoMode`| set to `"disable"` to remove [Auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) mode from the mode selector. Also accepted under `permissions`. `autoMode`| customize what the auto mode classifier trusts and blocks across your organization. See [Configure auto mode](</docs/en/auto-mode-config>). `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. `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 cannot edit or delete managed connections. `sshHostAllowlist`| restrict SSH sessions to hosts whose resolved hostname matches one of these patterns. An empty array disables SSH sessions. Read from managed settings only. -`managedMcpServers`| push MCP server configurations to all users in a third-party deployment. Each entry specifies a transport of `"http"`, `"sse"`, or `"stdio"`, connection details, and optionally a `toolPolicy` map that restricts which tools in that server users can invoke. Available in third-party (3P) Desktop deployments only. Deliver this key through the managed settings file or MDM, since third-party deployments do not receive admin-console settings. +`managedMcpServers`| push MCP server configurations to all users. Available in third-party (3P) Desktop deployments only. In each entry, set a transport of `"http"`, `"sse"`, or `"stdio"`, connection details, and optionally a `toolPolicy` map to restrict which of that server’s tools users can invoke. Deliver it through the managed settings file, MDM, or a Claude apps gateway policy’s [`desktop` block](</docs/en/claude-apps-gateway-config#claude-desktop-overlay>), since 3P deployments don’t receive admin-console settings. To deliver it through the gateway, you need Claude Code v2.1.232 or later on the gateway server. Which managed settings reach a Desktop session depends on where that session runs. Model restrictions such as [`availableModels`](</docs/en/model-config#restrict-model-selection>) are enforced in Desktop’s Claude Code sessions the same way as in the terminal CLI; see [surface coverage](</docs/en/model-config#surface-coverage>). @@ -821,6 +821,8 @@ *.claudeusercontent.com *.claudemcpcontent.com +An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. + ### ​
modified Get started with the desktop app View current →
--- a/desktop-quickstart.md +++ b/desktop-quickstart.md @@ -20,7 +20,7 @@ * **Chat** : General conversation with no file access, similar to claude.ai. * **Cowork** : An autonomous background agent that works on tasks in a sandboxed virtual machine with its own environment, running independently while you do other work. On-device Cowork sessions run the VM on your computer; remote Cowork sessions run on an Anthropic-managed VM instead. - * **Code** : An interactive coding assistant with direct access to your local files. You review and approve each change in real time. + * **Code** : An interactive coding assistant with direct access to your local files. Depending on the permission mode, you approve each change as Claude proposes it or review the changes after Claude makes them. Chat and Cowork are covered in the [Claude Help Center](<https://support.claude.com/>); installing and deploying the desktop app is covered in the [Claude Desktop support articles](<https://support.claude.com/en/collections/16163169-claude-desktop>). This page focuses on the **Code** tab. @@ -88,13 +88,16 @@ Review and accept changes -By default, the Code tab starts in [Manual mode](</docs/en/desktop#choose-a-permission-mode>), where Claude proposes changes and waits for your approval before applying them. You’ll see: +What happens next depends on the [permission mode](</docs/en/desktop#choose-a-permission-mode>) shown in the selector next to the send button: + + * **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 + +In Manual mode, you’ll see: 1. A [diff view](</docs/en/desktop#review-changes-with-diff-view>) showing exactly what will change in each file 2. Accept/Reject buttons to approve or decline each change 3. Real-time updates as Claude works through your request - -If you reject a change, Claude will ask how you’d like to proceed differently. Your files aren’t modified until you accept. ## @@ -104,7 +107,8 @@ 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. Click **Review code** to have Claude evaluate the diffs itself and leave inline suggestions. **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: - * **Manual** : the default. Claude asks before editing files or running commands. + * **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.
modified Environment variables View current →
--- a/env-vars.md +++ b/env-vars.md @@ -222,6 +222,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later +`CLAUDE_CODE_DISABLE_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 `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later @@ -233,7 +234,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt. The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later +`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn @@ -242,8 +243,9 @@ `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) -`CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) +`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_EXIT_AFTER_STOP_DELAY`| Time in milliseconds to wait after the query loop becomes idle before automatically exiting. Useful for automated workflows and scripts using SDK mode `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited @@ -333,7 +335,7 @@ `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting -`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings @@ -396,7 +398,7 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish; before v2.1.142, the blocking wait was the default. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt `MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) @@ -445,17 +447,19 @@ Features that need feature-flag fetching -Claude Code turns some features on through feature flags it fetches from Anthropic. `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` all turn flag fetching off when set to a value that disables them, and each variable’s row says which values do that. A session running with fetching off can’t use: - - * [Remote Control](</docs/en/remote-control#requirements>) - * [Cross-session messaging](</docs/en/cross-session-messaging#availability>) - * [`claude import` and the `/import` command](</docs/en/cli-reference#cli-commands>) - * [The `/schedule` command](</docs/en/routines#troubleshooting>) for creating routines from the CLI - * [The advisor tool](</docs/en/advisor#requirements>) - * [`/loop` self-pacing](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), so a `/loop` prompt with no interval runs on the fixed 10-minute schedule instead - * [The built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), so `/loop` with no prompt shows the usage message instead - -In such a session you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. +Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. With fetching off, you can’t: + + * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead + * Have the VS Code extension [read settings files for the starting mode](</docs/en/permission-modes#switch-permission-modes>) + * Use [Remote Control](</docs/en/remote-control#requirements>) + * Send or receive [cross-session messages](</docs/en/cross-session-messaging#availability>) + * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) + * Create routines from the CLI with [`/schedule`](</docs/en/routines#troubleshooting>) + * Use [the advisor tool](</docs/en/advisor#requirements>) + * Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead + * Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt + +With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. ### @@ -463,7 +467,7 @@ First session after an install or upgrade -A feature in this list can be missing from your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features work differently in that first session: +You can also miss a feature in this list in your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features behave differently in that first session: * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again.
modified Error reference View current →
--- a/errors.md +++ b/errors.md @@ -938,14 +938,7 @@ Socket is closed -`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Depending on how far the response had progressed, Claude Code retries the request, keeps what Claude produced, or ends the turn: - - * If Claude hasn’t completed any part of the response yet, including its thinking, Claude Code treats the failure as a dropped connection and retries the request automatically, so the turn continues, even if some text had started streaming. - * If Claude has finished thinking but hasn’t started any text or tool call, Claude Code re-issues the request up to two times in quick succession, then ends the turn with `Connection lost before a response was produced` if the connection keeps dropping at that point. Before v2.1.227, that message read `Connection closed while thinking, before producing a response`. - * If Claude has completed a block of text or a tool call, or has started one after finishing its thinking, but hasn’t finished the response, Claude Code keeps what Claude completed and shows an incomplete-response notice. It still runs any tool calls Claude completed and continues the turn from their results. - * If the socket closes after Claude has finished the response, Claude Code ends the turn normally with the complete response. - -Before v2.1.214, Claude Code didn’t retry this failure, and the turn stopped with an error containing `Socket is closed`. **What to do:** +`Socket is closed` means the connection carrying a streaming response was closed while the response was still arriving. The most common cause is a corporate proxy on Windows dropping an established tunnel mid-response. Depending on how far the response had progressed, Claude Code retries the request, keeps what Claude produced, or ends the turn. See Automatic retries. Before v2.1.214, Claude Code didn’t retry this failure, and the turn stopped with an error containing `Socket is closed`. **What to do:** * If you see this error, update to v2.1.214 or later with `claude update`, then send your message again * If turns keep failing behind the same proxy after updating, work through Unable to connect to API and check the proxy setup in [Network configuration](</docs/en/network-config>) @@ -1019,7 +1012,7 @@ * Start a new session with `claude --remote-control` to create a new Remote Control session * For other Remote Control startup messages, see [Troubleshoot Remote Control](</docs/en/remote-control#troubleshooting>) -When the server reports instead that the previous session no longer exists, Claude Code shows [`Remote Control could not resume the previous session under the current login`](</docs/en/remote-control#remote-control-could-not-resume-the-previous-session-under-the-current-login>) rather than this message and doesn’t create a replacement session. Earlier versions created a new Remote Control session instead of showing a message: before v2.1.200 on any reconnection failure, and through v2.1.226 when the server reported the session gone. +If the server reports instead that the previous session is gone, you don’t see this message. Claude Code starts a new session in its place or shows [`Previous session is unavailable — run /remote-control to start a new one`](</docs/en/remote-control#previous-session-is-unavailable>), depending on [the conversation’s reconnection record](</docs/en/remote-control#resume-outcomes>). From v2.1.227 through v2.1.231, Claude Code showed a message that starts with `Remote Control could not resume the previous session under the current login` instead, and [earlier versions behaved differently again](</docs/en/remote-control#reconnect-history>). ### @@ -1548,7 +1541,7 @@ The quoted command varies between runs: the review starts several `git` commands against `origin/HEAD` at once and reports whichever fails first, so you may see `git log` or a different `git diff` in its place. Git creates the ref only when the remote’s default branch is both advertised by the remote and covered by your fetch refspec. A full `git clone` of a remote with commits meets both conditions. Single-branch and CI checkouts fetch too narrow a refspec, a server-side HEAD left pointing at a branch nobody pushed advertises no default, and a repository with no `origin` remote, or one you never fetched, provides neither. Claude Code shows the same error for any skill that [injects dynamic context](</docs/en/skills#when-an-injected-command-fails>). A failed injected command aborts that skill’s invocation. Two sibling strings fire before the command runs at all: - * `Shell command permission check failed for pattern "..."`: the command’s permission check returned something other than allow. Injected commands never prompt, so the invocation aborts without asking you. Pre-approve commands that would otherwise hit the default permission prompt with [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>). A matching ask or deny rule still aborts the invocation regardless of `allowed-tools` + * `Shell command permission check failed for pattern "..."`: the command’s permission check returned something other than allow. Injected commands never prompt, so the invocation aborts without asking you. Pre-approve commands that no rule matches with [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>). A matching ask or deny rule still aborts the invocation regardless of `allowed-tools` * `Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found`: the skill’s frontmatter demands bash on a machine without it. Install Git for Windows or change the frontmatter to `shell: powershell`. See [How injected commands run](</docs/en/skills#how-injected-commands-run>) **What to do:**
modified Extend Claude Code View current →
--- a/features-overview.md +++ b/features-overview.md @@ -17,7 +17,7 @@ * **[Code intelligence](</docs/en/tools-reference#lsp-tool-behavior>)** connects Claude to a language server for symbol-level navigation and live type errors * **[MCP](</docs/en/mcp>)** connects Claude to external services and tools * **[Subagents](</docs/en/sub-agents>)** run their own loops in isolated context, returning summaries - * **[Agent teams](</docs/en/agent-teams>)** coordinate multiple independent sessions with shared tasks and peer-to-peer messaging + * **[Agent teams](</docs/en/agent-teams>)** coordinate multiple independent sessions with peer-to-peer messaging, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) * **[Hooks](</docs/en/hooks-guide>)** run your script, HTTP request, prompt, or subagent when Claude Code reaches a lifecycle event * **[Plugins](</docs/en/plugins>)** and **[marketplaces](</docs/en/plugin-marketplaces>)** package and distribute these features @@ -129,7 +129,7 @@ ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent **Communication**| Reports results back to the main agent only| Teammates message each other directly -**Coordination**| Main agent manages all work| Shared task list with self-coordination +**Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -145,7 +145,7 @@ **Provides**| Tools and data access| Knowledge, workflows, reference material **Examples**| Slack integration, database queries, browser control| Code review checklist, deploy workflow, API style guide -These solve different problems and work well together:**MCP** gives Claude purpose-built tools for an external system, with the connection and authentication handled by the server.**Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team’s database schema and query patterns, or a `/post-to-slack` workflow with your team’s message formatting rules.Example: An MCP server connects Claude to your database. A skill teaches Claude your data model, common query patterns, and which tables to use for different tasks. +These solve different problems and work well together:**MCP** gives Claude purpose-built tools for an external system, with the connection and authentication handled by the server.**Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team’s database schema and query patterns, or a `/post-to-slack` workflow with your team’s message formatting rules. Claude Code runs a hook at a lifecycle event; it loads a skill into context for Claude to apply.
modified Glossary View current →
--- a/glossary.md +++ b/glossary.md @@ -12,7 +12,7 @@ Agent teams -Multiple independent Claude Code sessions coordinated by a team lead, with a shared task list and peer-to-peer messaging. Unlike subagents, which run within a single session and report only to the parent, teammates each have their own context window and you can interact with any of them directly. Agent teams are experimental and must be enabled by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. Learn more: [Run agent teams](</docs/en/agent-teams>) +Multiple independent Claude Code sessions coordinated by a team lead, with a shared task list and peer-to-peer messaging. Unlike subagents, which run within a single session and report only to the parent, teammates each have their own context window and you can interact with any of them directly. Agent teams are experimental and disabled by default; see [Enable agent teams](</docs/en/agent-teams#enable-agent-teams>). Learn more: [Run agent teams](</docs/en/agent-teams>) ###
modified Keep Claude working toward a goal View current →
--- a/goal.md +++ b/goal.md @@ -1,4 +1,4 @@ -The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met. Use a goal for substantial work with a verifiable end state: +The `/goal` command sets a completion condition and Claude keeps working toward it without you prompting each step. After each turn, a small fast model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you. The goal clears automatically once the condition is met, or if the model judges the condition impossible to satisfy. Use a goal for substantial work with a verifiable end state: * Migrating a module to a new API until every call site compiles and tests pass * Implementing a design doc until all acceptance criteria hold @@ -15,7 +15,7 @@ Approach| Next turn starts when| Stops when ---|---|--- -`/goal`| The previous turn finishes| A model confirms the condition is met +`/goal`| The previous turn finishes| A model confirms the condition is met or judges it impossible [`/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>)| A time interval elapses| You stop it, or Claude decides the work is done [Stop hook](</docs/en/hooks-guide#prompt-based-hooks>)| The previous turn finishes| Your own script or prompt decides @@ -41,7 +41,7 @@ /goal all tests in test/auth pass and the lint step is clean -Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change permissions. In the default permission mode, Claude still asks before tool calls that your settings don’t already allow, such as the test command above. To let goal turns run unattended, pair `/goal` with [auto mode](</docs/en/auto-mode-config>). After each turn, the evaluator returns a short reason explaining why the condition is or isn’t met. The most recent reason appears in the status view and in the transcript so you can see what Claude is working toward next. +Setting a goal starts a turn immediately, with the condition itself as the directive. You don’t need to send a separate prompt. While the goal is active, a `◎ /goal active` indicator shows how long the goal has been running. A goal doesn’t change your permission mode. To let goal turns run unattended, run `/goal` in [auto mode](</docs/en/auto-mode-config>). In [Manual mode](</docs/en/permission-modes>), Claude still asks before tool calls that your settings don’t already allow, such as the test command above. While the goal is active, the transcript shows each verdict the evaluator returns, and you can press Ctrl+O to see the reason behind it. The status view also shows the most recent reason, so you can see what Claude is working toward next. ### @@ -83,7 +83,7 @@ Clear a goal -Run `/goal clear` to remove an active goal before its condition is met. +Run `/goal clear` to remove an active goal before it resolves. /goal clear @@ -107,7 +107,7 @@ claude -p "/goal CHANGELOG.md has an entry for every PR merged this week" -With the default text output, nothing prints until the condition is met, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before the condition is met. +With the default text output, nothing prints until the run ends, so a goal that runs many turns can look stuck. Add `--output-format stream-json --verbose` to emit each message as the loop runs. Interrupt the process with Ctrl+C to stop a non-interactive goal before it resolves. ## @@ -115,12 +115,13 @@ How evaluation works -`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model answers yes or no and gives a short reason. +`/goal` is a wrapper around a session-scoped [prompt-based Stop hook](</docs/en/hooks#prompt-based-hooks>). Each time Claude finishes a turn, Claude Code sends the condition and the conversation so far to your configured [small fast model](</docs/en/model-config>), which defaults to Haiku on the Claude API; on a third-party provider, check your [provider page](</docs/en/third-party-integrations>) for the platform’s default. The model returns one of three verdicts, each with a short reason: - * **No** : Claude keeps working and takes the reason as guidance for the next turn. - * **Yes** : Claude Code clears the goal and records an achieved entry in the transcript. + * **Not yet met** : Claude keeps working and takes the reason as guidance for the next turn. + * **Met** : Claude Code clears the goal and records an achieved entry in the transcript. + * **Impossible** : the evaluator judged that the condition can never be satisfied. Claude Code clears the goal and records a failed entry in the transcript along with the reason. You don’t need to clear it yourself. -To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>). +If Claude keeps answering the evaluator without making progress (no tool use for several turns in a row), Claude Code stops the loop, prints a warning, and returns control to you with the goal still set. Evaluation resumes after your next prompt. The [hooks guide](</docs/en/hooks-guide#stop-hook-hits-the-block-cap>) explains the underlying mechanism. If a subagent or a background shell command is still running when a turn ends, Claude Code skips the evaluation for that turn and evaluates when the next turn ends. To evaluate on a different model, set [`ANTHROPIC_DEFAULT_HAIKU_MODEL`](</docs/en/model-config#environment-variables>). Claude Code reads `ANTHROPIC_DEFAULT_HAIKU_MODEL` everywhere it uses the small fast model, not only for `/goal` evaluation. When you set it, Claude Code also resolves the [`haiku` alias](</docs/en/model-config#model-aliases>) to that model and runs [background functionality](</docs/en/costs#background-token-usage>), such as conversation summarization, on it. @@ -142,7 +143,7 @@ See also - * [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of until a condition holds + * [Run a prompt repeatedly with `/loop`](</docs/en/scheduled-tasks#run-a-prompt-repeatedly-with-%2Floop>): re-run on a time interval instead of toward a condition * [Prompt-based hooks](</docs/en/hooks-guide#prompt-based-hooks>): write your own Stop hook when you need custom evaluation logic * [Auto mode](</docs/en/auto-mode-config>): approve tool calls automatically so each goal turn runs unattended * [Scheduling comparison](</docs/en/scheduled-tasks#compare-scheduling-options>): run work on a schedule independent of any open session
modified Automate actions with hooks View current →
--- a/hooks-guide.md +++ b/hooks-guide.md @@ -63,7 +63,7 @@ Test the hook -Press `Esc` to return to the CLI. Ask Claude to do something that requires permission, then switch away from the terminal. You should receive a desktop notification. +Press `Esc` to return to the CLI. Press `Shift+Tab` until the status bar shows `⏸ manual mode on`, ask Claude to do something that requires permission, then switch away from the terminal. You should receive a desktop notification. The `/hooks` menu is read-only. To add, modify, or remove hooks, edit your settings JSON directly or ask Claude to make the change. @@ -277,7 +277,7 @@ Re-inject context after compaction -When Claude’s context window fills up, compaction summarizes the conversation to free space. This can lose important details. Use a `SessionStart` hook with a `compact` matcher to re-inject critical context after every compaction. Any text your command writes to stdout is added to Claude’s context. This example reminds Claude of project conventions and recent work. Add this to `.claude/settings.json` in your project root: +When Claude’s context window fills up, compaction summarizes the conversation to free space. This can lose important details. Use a `SessionStart` hook with a `compact` matcher to re-inject critical context after every compaction. Claude Code adds plain text your command writes to stdout to Claude’s context. This example reminds Claude of project conventions and recent work. Add this to `.claude/settings.json` in your project root: { "hooks": { @@ -554,12 +554,12 @@ The exit code determines what happens next: - * **Exit 0** : the 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`, and `SessionStart` hooks, anything you write to stdout is added to Claude’s context. + * **Exit 0** : the 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`, and `SessionStart` 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`, `Setup`, 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 outcome depends on what your hook printed to stdout: - * JSON 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. - * JSON that parses but fails schema validation: a non-blocking error; the notice carries the validation message. - * No JSON on 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. + * 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: a non-blocking error; the notice carries the validation 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. #### @@ -759,7 +759,8 @@ `.claude/settings.local.json`| Single project| No, gitignored when Claude Code saves a setting to it Managed policy settings| Organization-wide| Yes, admin-controlled [Plugin](</docs/en/plugins>) `hooks/hooks.json`| When plugin is enabled| Yes, bundled with the plugin -[Skill](</docs/en/skills>) or [agent](</docs/en/sub-agents>) frontmatter| While the skill or agent is active| Yes, defined in the component file +[Skill](</docs/en/skills>) frontmatter| The rest of the session once the skill is invoked. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>)| Yes, defined in the skill file +[Subagent](</docs/en/sub-agents>) frontmatter| While that subagent is running| Yes, defined in the subagent file Run [`/hooks`](</docs/en/hooks#the-%2Fhooks-menu>) in Claude Code to browse all configured hooks grouped by event. To disable hooks, set `"disableAllHooks": true` in your settings file. Claude Code reads the value left after [settings precedence](</docs/en/hooks#disable-or-remove-hooks>) applies, so a project’s settings file can override yours. Hooks configured in managed settings still run unless `disableAllHooks` is also set there. If you edit settings files directly while Claude Code is running, the file watcher normally picks up hook changes automatically. @@ -769,16 +770,16 @@ Prompt-based hooks -For decisions that require judgment rather than deterministic rules, use `type: "prompt"` hooks. Instead of running a shell command, Claude Code sends your prompt and the hook’s input data to a Claude model, Haiku by default, to make the decision. You can specify a different model with the `model` field if you need more capability. The model’s only job is to return a yes/no decision as JSON: +For decisions that require judgment rather than deterministic rules, use `type: "prompt"` hooks. Instead of running a shell command, Claude Code sends your prompt and the hook’s input data to a Claude model, Haiku by default, to make the decision. You can specify a different model with the `model` field if you need more capability. The model’s only job is to return its decision as JSON: * `"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 + * `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 * `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 -This example uses a `Stop` hook to ask the model whether all requested tasks are complete. If the model returns `"ok": false`, Claude keeps working and uses the `reason` as its next instruction: +This example uses a `Stop` hook to ask the model whether all requested tasks are complete. If the model returns `"ok": false` because the condition isn’t met yet, Claude keeps working and uses the `reason` as its next instruction: { "hooks": { @@ -805,7 +806,7 @@ Agent hooks are experimental. Behavior and configuration may change in future releases. For production workflows, prefer [command hooks](</docs/en/hooks#command-hook-fields>). -When verification requires inspecting files or running commands, use `type: "agent"` hooks. Unlike prompt hooks, which make a single LLM call, agent hooks spawn a subagent that can read files, search code, and use other tools to verify conditions before returning a decision. Agent hooks use the same `"ok"` / `"reason"` response format as prompt hooks, but with a longer default timeout of 60 seconds and up to 50 tool-use turns. The `$ARGUMENTS` placeholder in the prompt is replaced with the hook’s JSON input. See [prompt and agent hook fields](</docs/en/hooks#prompt-and-agent-hook-fields>). This example verifies that tests pass before allowing Claude to stop: +When verification requires inspecting files or running commands, use `type: "agent"` hooks. Unlike prompt hooks, which make a single LLM call, agent hooks spawn a subagent that can read files, search code, and use other tools to verify conditions before returning a decision. Agent hooks use the `"ok"` / `"reason"` response format with a longer default timeout of 60 seconds and up to 50 tool-use turns. They don’t support the prompt-hook `impossible` field. On `ok: false`, Claude Code handles an agent hook the way it handles a prompt hook with `continueOnBlock: true` on the same event, so on `PreToolUse` and `PostToolUse` the turn continues; agent hooks have no `continueOnBlock` field. See [agent hook configuration](</docs/en/hooks#agent-hook-configuration>) for the fields, including the `$ARGUMENTS` placeholder that Claude Code replaces with the hook’s JSON input. This example verifies that tests pass before allowing Claude to stop: { "hooks": {
modified How Claude Code works View current →
--- a/how-claude-code-works.md +++ b/how-claude-code-works.md @@ -49,7 +49,7 @@ What Claude can access -This guide focuses on the terminal. Claude Code also runs in [VS Code](</docs/en/vs-code>), [JetBrains IDEs](</docs/en/jetbrains>), and other environments. When you run `claude` in a directory, Claude Code gains access to: +When you run `claude` in a directory, Claude Code gains access to: * **Your project.** Files in your directory and subdirectories, plus files elsewhere with your permission. * **Your terminal.** Any command you could run: build tools, git, package managers, system utilities, scripts. If you can do it from the command line, Claude can too.
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -30,7 +30,7 @@ `Up/Down arrows` or `Ctrl+P`/`Ctrl+N`| Move cursor or navigate command history| When the input spans more than one visual row, whether wrapped or multiline, first moves the cursor within the prompt. Once the cursor is on the first or last visual row, pressing again navigates command history `Esc`| Interrupt Claude, or close a dialog| Stop the current response or tool call mid-turn so you can redirect. Claude keeps the work done so far. When a dialog such as a permission prompt is open, `Esc` closes the dialog rather than interrupting Claude `Esc` \+ `Esc`| Clear input draft, or rewind| When the prompt input contains text, double `Esc` clears it and saves the draft to history so `Up` recalls it. When the input is empty, double `Esc` opens the [rewind menu](</docs/en/checkpointing>) to restore or summarize code and conversation from a previous point -`Shift+Tab`, or `Alt+M` on Windows when the Node or Bun runtime doesn’t enable VT input mode| Cycle permission modes| Cycle through `default` (labeled Manual in the mode indicator), `acceptEdits`, `plan`, and any modes you have enabled, such as `auto` or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>). +`Shift+Tab`, or `Alt+M` on Windows when the Node or Bun runtime doesn’t enable VT input mode| Cycle permission modes| Cycle through `default` (labeled Manual in the mode indicator), `acceptEdits`, `plan`, and, when available, `bypassPermissions` and then `auto`. From `auto`, the first press switches to `default`. See [permission modes](</docs/en/permission-modes>). `Option+P` (macOS) or `Alt+P` (Windows/Linux)| Switch model| Switch models without clearing your prompt `Option+T` (macOS) or `Alt+T` (Windows/Linux)| Toggle extended thinking| Enable or disable extended thinking mode. Has no effect on Fable 5, which always uses extended thinking. Works on macOS without configuring Option as Meta `Option+O` (macOS) or `Alt+O` (Windows/Linux)| Toggle fast mode| Enable or disable [fast mode](</docs/en/fast-mode>) @@ -460,7 +460,7 @@ Task list -The task list is Claude’s to-do checklist: items Claude created to plan multi-step work, with indicators showing what’s pending, in progress, or complete. It’s separate from the background-task view. To see running shells and subagents, use [`/tasks`](</docs/en/commands>) instead. +The task list is Claude’s to-do checklist: items Claude created to plan multi-step work, with indicators showing what’s pending, in progress, or complete. It’s separate from the background-task view. To see running shells and subagents, use [`/tasks`](</docs/en/commands>) instead. On [Opus 4.8, Sonnet 5, Fable 5, Mythos 5, and later versions of those families](</docs/en/tools-reference#task-tool-availability>), Claude keeps track of multi-step work without a written checklist, and Claude Code doesn’t provide the tools that fill this list, so it stays empty. If you’d like the task list on those models anyway, opt in with `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` or one of the other ways under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). On earlier models such as Opus 4.7, and after you opt in, the task list works as follows: * Press `Ctrl+T` to toggle the task list view. The display shows up to five tasks at a time. When Claude hasn’t created any checklist items yet, the toggle has no visible effect because there’s nothing to display * To see all tasks or clear them, ask Claude directly: “show me all tasks” or “clear all tasks”
modified JetBrains IDEs View current →
--- a/jetbrains.md +++ b/jetbrains.md @@ -49,8 +49,6 @@ If `claude` is installed somewhere your IDE can’t find, set the full path in the plugin’s Claude command setting. Claude Code works with any paid Claude subscription (Pro, Max, Team, or Enterprise) or a Claude Console account, and no API key is required. You’ll be prompted to [log in](</docs/en/authentication#log-in-to-claude-code>) the first time you run `claude`. -After installing the plugin, you may need to restart your IDE completely for it to take effect. - ## ​ @@ -255,7 +253,7 @@ When Claude Code runs in a JetBrains IDE in [`acceptEdits` permission mode](</docs/en/permission-modes#auto-approve-file-edits-with-acceptedits-mode>), it may be able to modify IDE configuration files that can be automatically executed by your IDE. This may increase the risk of running Claude Code in `acceptEdits` mode and allow bypassing Claude Code’s permission prompts for bash execution. When running in JetBrains IDEs, consider: - * Using manual approval mode for edits + * Using Manual mode for edits, because `acceptEdits` and auto mode both approve edits inside your working directory without asking, except in [protected paths](</docs/en/permission-modes#protected-paths>) * Taking extra care to ensure Claude is only used with trusted prompts * Being aware of which files Claude Code has access to modify
modified Set up Claude Code in a monorepo or large codebase View current →
--- a/large-codebases.md +++ b/large-codebases.md @@ -370,7 +370,7 @@ Recommend the right plugin at session start -Once conventions live in plugins, a teammate starting Claude in an unfamiliar part of the tree has no signal about which plugin that area’s owners maintain. A [`SessionStart` hook](</docs/en/hooks#sessionstart>) can close that gap, since anything the hook prints to stdout is added to Claude’s context before the first prompt. For example, you can write a script that reads the launch directory from the [hook input](</docs/en/hooks#common-input-fields>), looks it up in a path-to-plugin map committed to the repository, and prints the recommendation for Claude to relay in its first reply. See [Automate actions with hooks](</docs/en/hooks-guide>) to write and register the hook. +Once conventions live in plugins, a teammate starting Claude in an unfamiliar part of the tree has no signal about which plugin that area’s owners maintain. A [`SessionStart` hook](</docs/en/hooks#sessionstart>) can close that gap, since Claude Code adds plain text the hook prints to stdout to Claude’s context before the first prompt. For example, you can write a script that reads the launch directory from the [hook input](</docs/en/hooks#common-input-fields>), looks it up in a path-to-plugin map committed to the repository, and prints the recommendation for Claude to relay in its first reply. See [Automate actions with hooks](</docs/en/hooks-guide>) to write and register the hook. ##
modified Connect to MCP servers View current →
--- a/mcp-quickstart.md +++ b/mcp-quickstart.md @@ -73,7 +73,7 @@ You don’t normally need to name a server in your prompt, since Claude chooses relevant tools on its own. Naming it here guarantees the demonstration goes through the new server rather than another tool, such as web fetch, that could answer the same question. -The first time Claude calls the server, it asks for permission to use the new tool. Approve it to continue. The tool call in Claude’s output is labeled with the server name, which is how you confirm the answer came from the MCP server rather than Claude’s built-in knowledge. +If Claude Code asks for permission the first time Claude calls the server, approve it. The tool call in Claude’s output is labeled with the server name, which is how you confirm the answer came from the MCP server rather than Claude’s built-in knowledge. 4
modified Model configuration View current →
--- a/model-config.md +++ b/model-config.md @@ -58,7 +58,7 @@ [Claude Fable 5](<https://platform.claude.com/docs/en/about-claude/models/introducing-claude-fable-5-and-claude-mythos-5>) is the most capable model in Claude Code, suited to tasks larger than a single sitting. It sustains long autonomous sessions, investigates before acting, and verifies its work more often than smaller models. Fable 5 is not the default model. Select it with `/model fable`. Requests that its safety classifiers flag, most often in cybersecurity and biology domains, trigger automatic model fallback. To get the most from Fable 5: - * **Describe the outcome, not the steps** : hand it the result you want and let it plan the path. To keep it working until that outcome holds, [set a goal](</docs/en/goal>). + * **Describe the outcome, not the steps** : hand it the result you want and let it plan the path. To keep it working toward that outcome, [set a goal](</docs/en/goal>). * **Hand it ambiguous problems** : root-cause investigations, outage debugging, and architecture decisions are where the extra investigation and verification pay off. * **Skip the verification reminders** : it verifies its own work with less prompting, so reminders to test or check are usually unnecessary. * **Size up larger tasks** : give it work you would normally break into pieces. It holds long sessions without losing the thread.
modified Enterprise network configuration View current →
--- a/network-config.md +++ b/network-config.md @@ -90,12 +90,15 @@ # Optional: Passphrase for encrypted private key export CLAUDE_CODE_CLIENT_KEY_PASSPHRASE="your-passphrase" -Claude Code reads the certificate and key files at startup and re-reads them each time it applies settings. It doesn’t watch those paths during a session, so it keeps presenting the loaded pair until it applies settings again. To rotate the certificate and key: - - * **Running session** : replace the files at the same paths, then restart Claude Code so it picks up the new pair. A mid-session settings application, such as a remote managed-settings sync or running `/login`, also re-reads the files, but no such event is guaranteed to happen before the old pair expires and you see connection errors, so restart to be certain. - * **Future sessions** : replace the files before the current pair expires so Claude Code doesn’t load an already-expired pair on its next start. - -In [cloud sessions](</docs/en/claude-code-on-the-web>), the hosting environment manages the connection to the API, so Claude Code ignores the following variables when they come from a settings file `env` block: +Claude Code reads the certificate and key files at startup and re-reads them each time it applies settings, such as when your organization changes the `env` block in [managed settings](</docs/en/server-managed-settings>) mid-session. To rotate the certificate and key, replace the files at the same paths. Claude Code picks up the replacement in a running session without a restart. When an API request fails with a connection-level error, such as a connection reset or a TLS handshake error, it re-reads both files and retries the request with the new pair. Before v2.1.232, Claude Code didn’t re-read on connection errors, so it kept the pair it had already loaded until it next applied settings or you restarted. Claude Code re-reads the files in response to failed requests, not by watching them for changes: + + * **Timing** : Claude Code does nothing at the moment you replace the files. It presents the new pair on the retry after a qualifying failure, or on the next request after it applies settings, whichever comes first. + * **Gateway rejections** : Claude Code re-reads when your gateway resets the connection or rejects the TLS handshake after it stops accepting the old pair. It doesn’t re-read when the gateway completes the handshake and answers with an HTTP error. In that case, Claude Code loads the new pair when it next applies settings or when you restart it. + * **Half-written rotations** : when Claude Code re-reads while your rotation is mid-write, such as reading a certificate and key that don’t match each other, it keeps the previous pair and re-reads on the next failure. + * **OTLP telemetry exporters** : Claude Code keeps the certificate the [exporters](</docs/en/monitoring-usage#mtls-authentication>) loaded at first use, so restart Claude Code for a rotated certificate to reach your telemetry collector. + * **Turn the reload off** : set [`CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION=1`](</docs/en/env-vars#variables>) to turn off the connection-error re-read. Claude Code then picks up rotated files only when it next applies settings or at the next startup. + +To confirm Claude Code picked up a rotation, start the session with debug logging and look for `Stale connection — reloaded rotated mTLS client material` in the log. Claude Code doesn’t log this line when it picks up the rotation while applying settings instead, so a missing line alone doesn’t mean the rotation failed. Replace the files before the current pair expires so Claude Code doesn’t load an already-expired pair at the next startup. In [cloud sessions](</docs/en/claude-code-on-the-web>), the hosting environment manages the connection to the API, so Claude Code ignores the following variables when they come from a settings file `env` block: * `CLAUDE_CODE_CLIENT_CERT` * `CLAUDE_CODE_CLIENT_KEY` @@ -211,7 +214,7 @@ Desktop and claude.ai -The preceding table covers the standalone CLI. The Claude Desktop app and claude.ai in a browser load their application code and user content from additional Anthropic CDN hosts, including `assets-proxy.anthropic.com` and the `*.claudeusercontent.com` origins that serve [artifacts](</docs/en/artifacts>). Allowing `claude.ai` while blocking those hosts produces a blank page rather than an error. See [network access requirements](</docs/en/desktop#network-access-requirements>) on the Desktop page. +The preceding table covers the standalone CLI. The Claude Desktop app and claude.ai in a browser load their application code and user content from additional Anthropic CDN hosts, including `assets-proxy.anthropic.com` and the `*.claudeusercontent.com` origins that serve [artifacts](</docs/en/artifacts>). Allowing `claude.ai` while blocking those hosts produces a blank page rather than an error. See [network access requirements](</docs/en/desktop#network-access-requirements>) on the Desktop page. An [artifact](</docs/en/artifacts>) that loads a typeface from [Google Fonts](</docs/en/artifacts#improve-the-visual-design>) also requests `fonts.googleapis.com` and `fonts.gstatic.com`. Both hosts are optional. If you block them, artifacts render in fallback typefaces. Block with a fast rejection rather than a silent drop so the font request fails immediately instead of delaying the page’s first render. ##
modified Output styles View current →
--- a/output-styles.md +++ b/output-styles.md @@ -8,7 +8,7 @@ Claude Code’s **Default** output style is the existing system prompt, designed to help you complete software engineering tasks efficiently. There are three additional built-in output styles: - * **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This is stronger autonomous-execution guidance than [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) applies, and it works without changing your permission mode, so you still see permission prompts before tools run. + * **Proactive** : Claude executes immediately, makes reasonable assumptions instead of pausing for routine decisions, and prefers action over planning. This is stronger autonomous-execution guidance than [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) applies, and it works without changing your permission mode, so your permission mode still decides what runs without asking you. * **Explanatory** : Provides educational “Insights” in between helping you complete software engineering tasks. Helps you understand implementation choices and codebase patterns. * **Learning** : Collaborative, learn-by-doing mode where Claude will not only share “Insights” while coding, but also ask you to contribute small, strategic pieces of code yourself. Claude Code will add `TODO(human)` markers in your code for you to implement.
modified Choose a permission mode View current →
Show diff (230 lines)
--- a/permission-modes.md +++ b/permission-modes.md @@ -1,4 +1,4 @@ -When Claude wants to edit a file, run a shell command, or make a network request, it pauses and asks you to approve the action. Permission modes control how often that pause happens. The mode you pick shapes the flow of a session: Manual mode has you review each action as it comes, while looser modes let Claude work in longer uninterrupted stretches and report back when done. Pick more oversight for sensitive work, or fewer interruptions when you trust the direction. +A permission mode sets which actions Claude can take in a session without asking you first. In Manual mode, Claude Code stops and asks you before most actions that edit files, run shell commands, or reach the network. In auto mode, a second model, the classifier, reviews actions instead of you; how the classifier evaluates actions lists which ones it sees. On Pro, Max, and Team plans, the built-in starting mode is auto mode. Which mode a session starts in covers the surfaces and settings that change the starting mode. You can also change a running session’s permission mode at any time. ## @@ -6,11 +6,11 @@ Available modes -Each mode makes a different tradeoff between convenience and oversight. The table below shows what Claude can do without a permission prompt in each mode. +Each mode makes a different tradeoff between convenience and oversight. The table below shows what Claude can do without a permission prompt in each mode. Manual mode appears under its config value, `default`. Mode| What runs without asking| Best for ---|---|--- -`default`| Reads only| Getting started, sensitive work +`default`| Reads only| Reviewing every action yourself, sensitive work `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 @@ -29,41 +29,88 @@ ​ -Switch permission modes - -You can switch modes mid-session, at startup, or as a persistent default. The mode is set through these controls, not by asking Claude in chat. Select your interface below to see how to change it. - - * CLI - - * VS Code - - * JetBrains - - * Desktop - - * Web and mobile - -**During a session** : press `Shift+Tab` to cycle `default` → `acceptEdits` → `plan`. The status bar shows the active mode as `⏸ plan mode on`, `⏵⏵ accept edits on`, `⏵⏵ auto mode on`, `⏵⏵ don't ask on`, or `⏵⏵ bypass permissions on`. Manual mode, `default` in that cycle, shows a gray `⏸ manual mode on` badge.Not every mode is in the default cycle: - - * `auto`: appears when your account meets the auto mode requirements; cycling to it switches modes without a confirmation prompt - * `bypassPermissions`: appears after you start with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, `--allow-dangerously-skip-permissions`, or `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>); the `--allow-` variant adds the mode to the cycle without activating it - * `dontAsk`: never appears in the cycle; set it with `--permission-mode dontAsk` - -Enabled optional modes slot in after `plan`, with `bypassPermissions` first and `auto` last. If you have both enabled, you will cycle through `bypassPermissions` on the way to `auto`.**At startup** : pass the mode as a flag. - - claude --permission-mode plan - -**As a default** : set `defaultMode` in a [settings file](</docs/en/settings#settings-files>) such as `~/.claude/settings.json`: +Which mode a session starts in + +When you start a new session in a terminal, Claude Code takes the permission mode from the first of these that applies: + + 1. The `--permission-mode` flag, or `--dangerously-skip-permissions` + 2. `permissions.defaultMode` in a [settings file](</docs/en/settings#settings-files>). An `"auto"` value in `.claude/settings.json` or `.claude/settings.local.json` doesn’t take effect, and Claude Code then uses the built-in default rather than a `defaultMode` from `~/.claude/settings.json`. The other values apply from any settings file + 3. The built-in default + +Conversations the VS Code extension starts follow the extension’s own list in Switch permission modes. A session you resume keeps the permission mode it was in unless you pass `--permission-mode` or `--dangerously-skip-permissions`; [what a resumed session restores](</docs/en/sessions#what-a-resumed-session-restores>) lists the exceptions. The built-in `auto` default requires Claude Code v2.1.228 or later on macOS, Linux, and WSL, and v2.1.233 or later on native Windows. On earlier versions, the built-in default is Manual. The built-in default depends on how you run Claude Code, on your plan, and on whether Claude Code could fetch its feature flags. The first row that matches your session applies. The table covers sessions you start in a terminal or through the VS Code extension; for the desktop app and claude.ai, see the Desktop and Web tabs in Switch permission modes. + +How you run Claude Code| Built-in starting mode +---|--- +Any settings file sets `disableAutoMode` to `"disable"`| `default` +[Feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) is off, or this is your [first session after you install Claude Code or upgrade to a version that adds this default](</docs/en/env-vars#first-session-after-an-install-or-upgrade>)| `default` +`claude -p` or the [Agent SDK](</docs/en/agent-sdk/permissions>)| `default` +Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), or a signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) session| `default` +A Pro, Max, or Team plan, in a terminal or through the [VS Code extension](</docs/en/vs-code>)| `auto` +An Enterprise plan or a Claude Console API key| `default` + +When feature-flag fetching is off, or in that first session after an install or upgrade, the VS Code extension also reads no settings file for the starting mode. When any of the three steps selects `auto` but auto mode isn’t available to the session, Claude Code starts the session in Manual instead. Auto mode is unavailable when a settings file turns it off or the model doesn’t support it. 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 + +On Pro, Max, and Team plans, if your `~/.claude/settings.json` sets a different `defaultMode` and no other settings file sets one, your terminal sessions keep starting in that mode, and Claude Code asks once, in the terminal or in the extension, whether to change the setting to auto mode. If you decline, your setting stays as it is. + +### + +​ + +Start in a different permission mode + +You can set the starting permission mode for one session, or as a default for every session on a machine, in a project, or in an organization. When more than one settings file sets `permissions.defaultMode`, [settings precedence](</docs/en/settings#settings-precedence>) decides, so a project or managed value outranks `~/.claude/settings.json`. To change the permission mode of a session that’s already running, see Switch permission modes. + +To set the starting permission mode for| Do this +---|--- +One session you’re about to start| Pass the permission mode as a flag, for example `claude --permission-mode default` +Every terminal session you start on this machine| Set `permissions.defaultMode` in `~/.claude/settings.json`. For what the VS Code extension reads, see Switch permission modes +Every terminal session you start in one project| Set `permissions.defaultMode` in the project’s `.claude/settings.json`. Sessions you start in a terminal honor every value except `auto`; sessions the VS Code extension starts don’t read project settings for the starting mode +Every terminal session in your organization| Set `permissions.defaultMode` in [managed settings](</docs/en/permissions#managed-settings>). Terminal sessions start in that mode and people can still switch to auto mode; for what the VS Code extension reads, see Switch permission modes. To remove auto mode so nobody can select it, set `permissions.disableAutoMode` to `"disable"` instead + +This example makes every terminal session on your machine start in Manual mode, whose config value is `default`. Save it in `~/.claude/settings.json`: { "permissions": { - "defaultMode": "acceptEdits" + "defaultMode": "default" } } -The same `--permission-mode` flag works with `-p` for [non-interactive runs](</docs/en/headless>). - -**During a session** : click the mode indicator at the bottom of the prompt box.**As a default** : set `claudeCode.initialPermissionMode` in your VS Code user settings, or use the Claude Code extension settings panel.The mode indicator shows these labels, mapped to the mode each one applies: +The next session you start shows `⏸ manual mode on` in the status bar. + +## + +​ + +Switch permission modes + +Each interface has its own control for switching modes during a session and its own way of choosing the permission mode new sessions start in. Asking Claude in chat to change the permission mode doesn’t work. Select your interface to see its controls. + + * CLI + + * VS Code + + * JetBrains + + * Desktop + + * Web and mobile + +**During a session** : press `Shift+Tab` to cycle modes. From `auto`, the first press switches to `default`, and the cycle then runs `default` → `acceptEdits` → `plan`. The status bar shows the active mode as a gray `⏸ manual mode on` for `default`, or as `⏵⏵ accept edits on`, `⏸ plan mode on`, `⏵⏵ auto mode on`, `⏵⏵ don't ask on`, or `⏵⏵ bypass permissions on`.Not every mode is in the default cycle: + + * `auto`: appears when your account meets the auto mode requirements; cycling to it switches modes without a confirmation prompt + * `bypassPermissions`: appears after you start with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, `--allow-dangerously-skip-permissions`, or `permissions.defaultMode: "bypassPermissions"` in [settings](</docs/en/settings#permission-settings>); the `--allow-` variant adds the permission mode to the cycle without activating it + * `dontAsk`: never appears in the cycle; set it with `--permission-mode dontAsk` + +Enabled optional modes slot in after `plan`, with `bypassPermissions` first and `auto` last. If you have both enabled, you will cycle through `bypassPermissions` on the way to `auto`.**At startup** : pass the permission mode as a flag. + + claude --permission-mode plan + +**As a default** : set `permissions.defaultMode` at the scope you want, as described in Start in a different permission mode.The same `--permission-mode` flag works with `-p` for [non-interactive runs](</docs/en/headless>). + +**During a session** : click the mode indicator at the bottom of the prompt box. It uses these labels for the modes on this page: UI label| Mode ---|--- @@ -73,7 +120,14 @@ Auto| `auto` Bypass permissions| `bypassPermissions` -Auto mode appears in the mode indicator when your account meets every requirement listed in the auto mode section. The `claudeCode.initialPermissionMode` setting does not accept `auto`. To switch a session into auto mode, select **Auto** from the mode indicator.Bypass permissions requires the **Allow dangerously skip permissions** toggle in the extension settings before it appears in the mode indicator.See the [VS Code guide](</docs/en/vs-code>) for extension-specific details. +**As a default** : to pin the permission mode conversations start in, set `claudeCode.initialPermissionMode` in your VS Code user settings to `default`, `manual`, `acceptEdits`, `plan`, or `bypassPermissions`, or, for Auto, leave `claudeCode.initialPermissionMode` unset and pick Auto from the mode indicator once. The extension starts each new conversation in the first of these that applies: + + 1. `claudeCode.initialPermissionMode` + 2. The mode you last picked from the mode indicator, if it was Manual, Edit automatically, or Auto. Picking Plan or Bypass permissions applies to that conversation only + 3. `permissions.defaultMode` from [managed settings](</docs/en/permissions#managed-settings>) or `~/.claude/settings.json`, on Pro, Max, and Team plans with feature-flag fetching available + 4. The built-in default for your plan, provider, and organization settings + +The extension never reads a project’s `.claude/settings.json` or `.claude/settings.local.json` for the starting mode, and in conversations that don’t meet item 3’s conditions it reads no settings file at all. When `claudeCode.claudeProcessWrapper` is set, items 3 and 4 don’t apply either: those conversations start in Manual unless item 1 or item 2 sets a mode.Auto mode appears in the mode indicator when your account meets every requirement listed in the auto mode section. The `claudeCode.initialPermissionMode` setting doesn’t accept `auto`. To start conversations in auto mode where it isn’t the built-in default, leave `claudeCode.initialPermissionMode` unset and select **Auto** from the mode indicator.Bypass permissions requires the **Allow dangerously skip permissions** toggle in the extension settings. Without it, the permission mode doesn’t appear in the indicator, and a `bypassPermissions` value from item 1 or item 3 starts the conversation in Manual instead. Auto from any item likewise starts the conversation in Manual when auto mode isn’t available.See the [VS Code guide](</docs/en/vs-code>) for extension-specific details. The JetBrains plugin runs Claude Code in the IDE terminal, so switching modes works the same as in the CLI: press `Shift+Tab` to cycle, or pass `--permission-mode` when launching. @@ -82,7 +136,7 @@ * **Auto** : appears when your account meets the auto mode requirements * **Bypass permissions** : requires the **Allow bypass permissions mode** toggle in Desktop settings on Pro and Max plans; on Team and Enterprise plans, organization policy controls it instead -The Cowork tab doesn’t use these modes. Cowork has its own permission modes, enabled separately, and the Cowork tab shows no mode selector at all until a mode beyond its default is enabled for your account. See the [Cowork docs](<https://claude.com/docs/cowork/overview>).For desktop-specific details, see [Choose a permission mode](</docs/en/desktop#choose-a-permission-mode>) in the Desktop guide.**As a default** : set `defaultMode` in [settings](</docs/en/settings#settings-files>). The desktop app reads the same settings files as the CLI and applies the mode to new local sessions.A mode you pick in the mode selector is remembered per folder and takes precedence over `defaultMode` for that folder. Plan is the exception: picking it applies to the current session only.This example sets Plan mode as the default for new local sessions: +The Cowork tab doesn’t use these modes. Cowork has its own permission modes, enabled separately, and the Cowork tab shows no mode selector at all until a mode beyond its default is enabled for your account. See the [Cowork docs](<https://claude.com/docs/cowork/overview>).For desktop-specific details, see [Choose a permission mode](</docs/en/desktop#choose-a-permission-mode>) in the Desktop guide.**As a default** : set `defaultMode` in [settings](</docs/en/settings#settings-files>). The desktop app reads the same settings files as the CLI and applies the permission mode to new local sessions.A mode you pick in the mode selector is remembered per folder and takes precedence over `defaultMode` for that folder. Plan is the exception: picking it applies to the current session only.This example sets Plan mode as the default for new local sessions: { "permissions": { @@ -93,7 +147,7 @@ Use the mode dropdown next to the prompt box on [claude.ai/code](<https://claude.ai/code>) or in the mobile app. Permission prompts appear in claude.ai for approval. Which modes appear depends on where the session runs: * **Cloud sessions** on [Claude Code on the web](</docs/en/claude-code-on-the-web>): Accept edits, Plan, and Auto. Accept edits corresponds to `default` mode: cloud sessions pre-approve file edits regardless of mode, so the dropdown shows Accept edits instead of Manual. Cloud sessions still honor `defaultMode: "acceptEdits"` from settings. Auto mode appears only when your organization allows it and the selected model supports it. Bypass permissions isn’t available. - * **[Remote Control](</docs/en/remote-control>) sessions** on your local machine: Manual, Accept edits, and Plan. You can’t select Auto or Bypass permissions from the app. The dropdown shows the mode the local session is in, including a mode set from the terminal, and updates when the mode changes in the app or in the terminal. The one exception is Bypass permissions: the session never reports that mode to claude.ai, so switching into it from the terminal doesn’t change what the dropdown shows. Before v2.1.202, sessions connected with `/remote-control` or `claude --remote-control` didn’t report their mode at all, so claude.ai and the mobile app could show a mode the session wasn’t in. The mismatch affected only the label: Claude Code generated permission prompts from the session’s actual mode, and they still appeared in the app for approval. + * **[Remote Control](</docs/en/remote-control>) sessions** on your local machine: Manual, Accept edits, and Plan. You can’t select Auto or Bypass permissions from the app. The dropdown shows the permission mode the local session is in, including a mode set from the terminal, and updates when the permission mode changes in the app or in the terminal. The one exception is Bypass permissions: the session never reports that mode to claude.ai, so switching into it from the terminal doesn’t change what the dropdown shows. Before v2.1.202, sessions connected with `/remote-control` or `claude --remote-control` didn’t report their mode at all, so claude.ai and the mobile app could show a mode the session wasn’t in. The mismatch affected only the label: Claude Code generated permission prompts from the session’s actual mode, and they still appeared in the app for approval. For Remote Control, the host must be signed in with your claude.ai account; API keys are not supported. You can also set the starting mode when launching the host: @@ -141,7 +195,7 @@ Set plan mode as the default -In a session the [VS Code extension](</docs/en/vs-code>) started, a settings-file `defaultMode` doesn’t set the starting mode. Set `claudeCode.initialPermissionMode` to `plan` in your VS Code user settings instead. Elsewhere, to make plan mode the default for a project, set `defaultMode` in `.claude/settings.json`: +To make plan mode the default for a project’s terminal sessions, set `defaultMode` in `.claude/settings.json`. Conversations the [VS Code extension](</docs/en/vs-code>) starts don’t read project settings for the starting mode. There, set `claudeCode.initialPermissionMode` to `plan` in your VS Code user settings instead. This example sets the project default: { "permissions": { @@ -155,9 +209,7 @@ Eliminate permission prompts with auto mode -Starting August 14, 2026, auto mode becomes the default permission mode for new sessions on Pro, Max, and Team plans. You can switch modes at any time. A default you set yourself stays in place unless you accept the one-time switch prompt, and a default your organization manages is unchanged. For details, see [the announcement](<https://claude.com/blog/auto-mode-default-in-claude-code>) on the blog. - -Auto mode lets Claude execute without routine permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Explicit [ask rules](</docs/en/permissions#manage-permissions>) still force a prompt. The classifier also reviews each message Claude sends to another agent with [`SendMessage`](</docs/en/tools-reference>), plain or structured, before Claude Code delivers it, both in auto mode and in plan mode while the classifier reviews commands; the send review requires Claude Code v2.1.222 or later. The classifier also decides removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, including when the removal sits inside command or process substitution. Before v2.1.218, the plain forms prompted for approval instead, and the substitution forms prompted in v2.1.208 through v2.1.217. Auto mode also nudges Claude to keep working without stopping for clarifying questions, though Claude still asks when your prompt or a skill explicitly relies on it. For stronger autonomous behavior while keeping permission prompts, set the [Proactive output style](</docs/en/output-styles>) instead. +Auto mode lets Claude execute without routine permission prompts. A separate classifier model reviews actions before they run, blocking anything that escalates beyond your request, targets unrecognized infrastructure, or appears driven by hostile content Claude read. Explicit [ask rules](</docs/en/permissions#manage-permissions>) still force a prompt. On Pro, Max, and Team plans, auto mode is the built-in starting mode. The classifier also reviews each message Claude sends to another agent with [`SendMessage`](</docs/en/tools-reference>), plain or structured, before Claude Code delivers it, both in auto mode and in plan mode while the classifier reviews commands; the send review requires Claude Code v2.1.222 or later. The classifier also decides removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, including when the removal sits inside command or process substitution. Before v2.1.218, the plain forms prompted for approval instead, and the substitution forms prompted in v2.1.208 through v2.1.217. Auto mode also nudges Claude to keep working without stopping for clarifying questions, though Claude still asks when your prompt or a skill explicitly relies on it. For stronger autonomous behavior in a mode that still prompts you, set the [Proactive output style](</docs/en/output-styles>) instead. Auto mode reduces permission prompts but does not guarantee safety. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations. @@ -168,7 +220,7 @@ * **Model** : on the Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), Claude Opus 4.6 or later, Sonnet 4.6 or later, or [Fable 5](</docs/en/model-config#work-with-fable-5>). On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, only Claude Sonnet 5, Opus 4.7 or later, and Fable 5. Older models, including Sonnet 4.5, Opus 4.5, Haiku, and claude-3 models, are not supported on any provider. * **Provider** : available by default on the Anthropic API, Claude Platform on AWS, Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in Claude apps gateway sessions. -If Claude Code reports auto mode as unavailable, one of these requirements is unmet; this is not a transient outage. A separate message that names a model and says auto mode “cannot determine the safety” of an action means a classifier request failed; that failure is usually transient, but on Amazon Bedrock it can repeat until your account can invoke the named model. See the [error reference](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) for the causes and what to do. If you set `defaultMode: "auto"` in [settings](</docs/en/settings#available-settings>) and the session starts in `default` mode with no error, the setting is likely in `.claude/settings.json` or `.claude/settings.local.json`. Claude Code v2.1.142 and later ignore `auto` from those files so a repository cannot grant itself auto mode. Move it to `~/.claude/settings.json`. In a session the [VS Code extension](</docs/en/vs-code>) started, a settings-file `defaultMode` doesn’t set the starting mode: select the mode from the extension’s mode indicator instead. +If Claude Code reports auto mode as unavailable, one of these requirements is unmet; this is not a transient outage. A separate message that names a model and says auto mode “cannot determine the safety” of an action means a classifier request failed; that failure is usually transient, but on Amazon Bedrock it can repeat until your account can invoke the named model. See the [error reference](</docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action>) for the causes and what to do. If you set `defaultMode: "auto"` in [settings](</docs/en/settings#available-settings>) and a terminal session starts in Manual mode with no error, the setting is likely in `.claude/settings.json` or `.claude/settings.local.json`. In Claude Code v2.1.142 and later, `auto` doesn’t take effect from those files. Move it to `~/.claude/settings.json`. For a conversation the VS Code extension started, check the extension’s own list in Switch permission modes instead. ### @@ -176,7 +228,7 @@ 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 appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the mode a session starts in. Except in sessions the [VS Code extension](</docs/en/vs-code>) starts, where the extension resolves the starting mode, sessions still start in your [`defaultMode`](</docs/en/settings#available-settings>), which is Manual unless you change it. Only Claude Sonnet 5, Opus 4.7 or later, and Fable 5 are supported on these providers. To make auto mode the default starting mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. In sessions the VS Code extension starts, select **Auto** from the mode indicator instead. The [`/doctor`](</docs/en/commands#all-commands>) checkup proposes this user-settings default on these providers the same way it does on the Anthropic API. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). This removes `auto` from the `Shift+Tab` cycle and rejects `--permission-mode auto` at startup. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward. +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 appears in the `Shift+Tab` cycle by default. Appearing in the cycle doesn’t change the permission mode a session starts in: on these providers, terminal sessions start in your [`defaultMode`](</docs/en/settings#available-settings>), which is Manual unless you change it, and conversations in the [VS Code extension](</docs/en/vs-code>) start in Manual unless `claudeCode.initialPermissionMode` or a mode you picked in the extension sets one. Only Claude Sonnet 5, Opus 4.7 or later, and Fable 5 are supported on these providers. To make auto mode the default starting mode, set `"permissions": {"defaultMode": "auto"}` in user or managed settings. In sessions the VS Code extension starts, select **Auto** from the mode indicator instead. Switch permission modes covers what outranks that pick. The [`/doctor`](</docs/en/commands#all-commands>) checkup proposes this user-settings default on these providers the same way it does on the Anthropic API. To prevent developers from using auto mode, set `disableAutoMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). This removes `auto` from the `Shift+Tab` cycle, and a session started with `--permission-mode auto` starts in Manual instead. In v2.1.158 through v2.1.206, auto mode was off on these providers until you set `CLAUDE_CODE_ENABLE_AUTO_MODE=1`, and Claude Code ignored `defaultMode: "auto"` on these providers unless the variable was also set. The variable is still accepted for compatibility and has no effect from v2.1.207 onward. ### @@ -341,7 +393,7 @@ `bypassPermissions` mode disables permission prompts and safety checks so tool calls execute immediately, including writes to protected paths. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>) still force a prompt in this mode. MCP tools marked with [`_meta["anthropic/requiresUserInteraction"]`](</docs/en/mcp#require-approval-for-a-specific-tool>) also still prompt; this requires Claude Code v2.1.199 or later. Removals targeting the filesystem root or home directory, such as `rm -rf /` and `rm -rf ~`, still prompt as a circuit breaker against model error. The circuit breaker also fires when the command contains command substitution with `$(...)` or backticks, or process substitution with `<(...)`, whether the removal sits inside the substitution, as in `echo "$(rm -rf ~)"`, or elsewhere in the same command. The plain form, typed as its own command, has prompted in this mode since the circuit breaker was introduced; before v2.1.208, commands containing those forms didn’t prompt. Two [cross-session messaging](</docs/en/cross-session-messaging>) safeguards still apply in this mode, and in plan-mode sessions where bypass permissions are available: * The [`isolatePeerMachines`](</docs/en/settings#available-settings>) approval prompt for messages to your sessions beyond this machine still appears. - * When no [`crossSessionInbound`](</docs/en/cross-session-messaging#control-inbound-messages>) value applies, Claude Code holds an inbound message from another of your sessions for your approval, and delivers without asking only when the sending session identifies itself as also bypassing permission prompts. If you leave the mode while messages are held, Claude Code re-applies the inbound rules and delivers any held message they now accept. + * When no [`crossSessionInbound`](</docs/en/cross-session-messaging#control-inbound-messages>) value applies, Claude Code holds an inbound message from another of your sessions for your approval, and delivers without asking only when the sending session identifies itself as also bypassing permission prompts. If you leave the permission mode while messages are held, Claude Code re-applies the inbound rules and delivers any held message they now accept. In sessions with bypass permissions available, Claude Code also doesn’t enforce plan mode’s blocks. Claude is still instructed to plan without editing, but a file edit or shell command it attempts during planning runs without prompting. Explicit [ask rules](</docs/en/permissions#manage-permissions>) and the removal circuit breaker above still prompt. @@ -355,7 +407,7 @@ --dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons -The check is skipped automatically inside a recognized sandbox. To run autonomously in a container, use the [dev container](</docs/en/devcontainer>) configuration, which runs Claude Code as a non-root user. [Claude Code on the web](</docs/en/claude-code-on-the-web>) does not honor `defaultMode: "bypassPermissions"` or `"dontAsk"` from your settings files, so a repository’s checked-in settings cannot start a cloud session in bypass-permissions mode. The setting is ignored silently and the session starts in the mode shown in the mode dropdown instead. See Switch permission modes for which modes cloud sessions offer. +The check is skipped automatically inside a recognized sandbox. To run autonomously in a container, use the [dev container](</docs/en/devcontainer>) configuration, which runs Claude Code as a non-root user. [Claude Code on the web](</docs/en/claude-code-on-the-web>) does not honor `defaultMode: "bypassPermissions"` or `"dontAsk"` from your settings files, so a repository’s checked-in settings cannot start a cloud session in bypass-permissions mode. The setting is ignored silently and the session starts in the permission mode shown in the mode dropdown instead. See Switch permission modes for which modes cloud sessions offer. `bypassPermissions` offers no protection against prompt injection or unintended actions. For background safety checks with far fewer permission prompts, use auto mode instead. Administrators can block this mode by setting `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>).
modified Configure permissions View current →
--- a/permissions.md +++ b/permissions.md @@ -258,7 +258,7 @@ Plan mode (`plan`) -Claude explores the codebase and produces a plan without editing your source files. Read-only tools run as in default mode. File edits are never auto-approved in plan mode, even when an allow rule matches. They prompt through your `canUseTool` callback instead. On Claude Code v2.1.212 or later, shell commands that modify files, such as `touch` and `rm`, reach your `canUseTool` callback the same way. Claude may use `AskUserQuestion` to clarify requirements before finalizing the plan. See [Handle approvals and user input](</docs/en/agent-sdk/user-input#handle-clarifying-questions>) for handling these prompts. **Use when:** 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. +Claude explores the codebase and produces a plan without editing your source files. Read-only tools run as they do in the `default` permission mode. File edits are never auto-approved in plan mode, even when an allow rule matches. They prompt through your `canUseTool` callback instead. On Claude Code v2.1.212 or later, shell commands that modify files, such as `touch` and `rm`, reach your `canUseTool` callback the same way. Claude may use `AskUserQuestion` to clarify requirements before finalizing the plan. See [Handle approvals and user input](</docs/en/agent-sdk/user-input#handle-clarifying-questions>) for handling these prompts. **Use when:** 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. ##
modified Plugins reference View current →
--- a/plugins-reference.md +++ b/plugins-reference.md @@ -591,7 +591,7 @@ * Claude Code takes the skill’s invocation name from the frontmatter `name` field in `SKILL.md`, so the name stays stable whatever the install directory is named * If `name` isn’t set in the frontmatter, Claude Code falls back to the directory basename -A plugin that has a `SKILL.md` at its root, no `skills/` subdirectory, and no `skills` manifest field is automatically loaded as a single-skill plugin in Claude Code v2.1.142 and later. You do not need to set `"skills": ["./"]` in `plugin.json` for this layout. **Path examples** : +A plugin that has a `SKILL.md` at its root, no `skills/` subdirectory, and no `skills` manifest field is automatically loaded as a single-skill plugin. You do not need to set `"skills": ["./"]` in `plugin.json` for this layout. **Path examples** : { "commands": [
modified How Claude Code uses prompt caching View current →
--- a/prompt-caching.md +++ b/prompt-caching.md @@ -173,7 +173,7 @@ Changing permission mode -Switching between [permission modes](</docs/en/permission-modes>), such as from default to accept edits, does not change the system prompt or tool definitions, so mode changes are cache-safe. The exception is plan mode with the [`opusplan`](</docs/en/model-config#opusplan-model-setting>) model setting, which switches the model between Opus and Sonnet as you enter or leave plan mode. That makes the mode toggle a model switch. +Switching between [permission modes](</docs/en/permission-modes>), such as from Manual to accept edits, does not change the system prompt or tool definitions, so mode changes are cache-safe. The exception is plan mode with the [`opusplan`](</docs/en/model-config#opusplan-model-setting>) model setting, which switches the model between Opus and Sonnet as you enter or leave plan mode. That makes the mode toggle a model switch. ###
modified Agent SDK reference - Python View current →
--- a/python.md +++ b/python.md @@ -3020,7 +3020,15 @@ **Tool name:** `TodoWrite` -As of Claude Code v2.1.142, `TodoWrite` is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`. +On Python Agent SDK 0.2.139 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in: + + * `TodoWrite` + * `TaskCreate` + * `TaskGet` + * `TaskUpdate` + * `TaskList` + +On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code. **Input:**
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -95,7 +95,11 @@ Check connection status -In an interactive terminal session, a `/rc active` indicator sits in the footer below the input box while the connection is up, and is hidden if the terminal is too narrow to fit it. The indicator text is a link to the session on claude.ai. Select it with the down arrow key and press Enter, or run `/remote-control` again, to open a status panel with the session URL and a QR code you can use to connect from another device. The status panel also offers a disconnect option. Select it to turn Remote Control off; your local session keeps running in the terminal. If the connection fails, Claude Code shows a notification with the failure reason, and the indicator changes to a failure state that stays in the footer. Select the indicator and press Enter to review the details, or run `/remote-control` to retry. +In an interactive terminal session, a `/rc active` indicator sits in the footer below the input box while the connection is up, and is hidden if the terminal is too narrow to fit it. The indicator text is a link to the session on claude.ai. Select it with the down arrow key and press Enter, or run `/remote-control` again, to open a status panel with the session URL and a QR code you can use to connect from another device. The status panel also offers a disconnect option. Select it to turn Remote Control off; your local session keeps running in the terminal. If the connection fails, Claude Code shows a notification with the failure reason and switches the indicator to a failure state that stays in the footer. To read the reason again, select the indicator with the down arrow key and press Enter. To reconnect, run `/remote-control`, unless the reason says the session was taken over or ended elsewhere, or that the server can’t find it. Read the reason before you reconnect. When the session was taken over or ended from another device, app, or Claude Code session, or the server can’t find it, the reason says which, and Claude Code leaves out its usual advice to run `/remote-control`: + + * **Another device or Claude Code session took the session over** : run `/remote-control` only if you want to take it back from that device. + * **You ended or archived the session from another device or app** : run `/remote-control` only if you want it back; Claude Code reopens an archived session. + * **The server can’t find the session** : it may have been deleted from another device or app. ### @@ -175,7 +179,7 @@ * **`claude remote-control --continue`** : brings back only the session the server started with, and exits when that session ends. If this directory has no record, Claude Code uses the newest one from this repository’s other git worktrees. * **`claude remote-control --session-id<id>`**: brings back only the session whose ID you pass, and exits when that session ends. The ID is the part of the session’s URL at claude.ai/code between `/code/` and any `?`. -These commands work for about four hours after the server stopped. After that, run `claude remote-control` to start a new session. If you archived a session in the meantime, `--continue` and `--session-id` unarchive it on Claude Code v2.1.228 or later. A session you started with `claude --remote-control` or `/remote-control` comes back when you resume the conversation with `claude --continue` or `claude --resume`, as long as Remote Control was still on when the session ended. +These commands work for about four hours after the server stopped. After that, run `claude remote-control` to start a new session. If you archived a session in the meantime, `--continue` and `--session-id` unarchive it on Claude Code v2.1.228 or later. To bring back a session you started with `claude --remote-control` or `/remote-control`, resume the conversation with `claude --continue` or `claude --resume`; whether Claude Code reconnects, and to which session, depends on the conversation’s reconnection record. If you resume the conversation in a second terminal while the first one still has Remote Control on, Claude Code prints a notice in the second terminal and leaves Remote Control off there instead of taking the session away from the first. Run `/remote-control` in the second terminal to move Remote Control to it. When you resume a conversation in Claude Desktop or an IDE extension that had Remote Control on, Claude Code reattaches it to the existing claude.ai session instead of adding a new one to the session list. ## @@ -304,7 +308,10 @@ * **One remote session per interactive process** : outside of server mode, each Claude Code instance supports one remote session at a time. Use server mode to run multiple concurrent sessions from a single process. * **Local process must keep running** : Remote Control runs as a local process. If you close the terminal, quit VS Code, or otherwise stop the `claude` process, the session goes offline until you bring it back. To keep a session running on a remote machine after you disconnect from SSH, start it inside `tmux` or `screen`. - * **Extended network outage** : if your machine is awake but unable to reach the network for more than roughly 10 minutes, the session times out and the process exits. Run `claude remote-control` again to start a new session. + * **Extended network outage** : if your machine is awake but can’t reach the network, what you do next depends on the mode: + * **Server mode** : Claude Code gives up after roughly 10 minutes and the `claude remote-control` process exits. Run `claude remote-control` again to start a new session. + * **Interactive session** : keep working locally. Claude Code retries for as long as the outage lasts and reconnects on its own when the network returns. + * **Presence heartbeats failing** : if an interactive session disconnects with `could not reach the Remote Control server for about 30 minutes`, run `/remote-control` to reconnect. Claude Code shows this message only when the session’s presence heartbeats have been failing while the rest of the connection stayed up; it re-registers the session for about 30 minutes before disconnecting. * **Forwarded dialogs expire** : Claude Code keeps permission prompts and `AskUserQuestion` questions open until you answer them. When Claude Code forwards another kind of dialog to the remote session, such as the model-choice prompt shown after a safety refusal, it waits five minutes by default, then closes the dialog and continues with the dialog’s no-action default. Set [`dialogExpiry`](</docs/en/settings#available-settings>) to adjust or disable the deadline. Requires Claude Code v2.1.224 or later. The approval dialog for a held cross-session message uses the same deadline. [The held-message expiry rules](</docs/en/cross-session-messaging#control-inbound-messages>) cover the cases where Claude Code keeps the dialog open past it. * **Some commands are local-only** : commands that only run in the terminal interface, such as `/plugin` or `/resume`, work only from the local CLI, whether or not you pass an argument. The following work from mobile and web: * Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits` (prints the billing URL instead of opening a browser), `/recap`, `/reload-plugins` @@ -419,20 +426,24 @@ ”Couldn’t reconnect to your Remote Control session” -When you resume a conversation with `claude --resume` or `claude --continue`, Claude Code reconnects to the Remote Control session recorded in that conversation. This message means the reconnection failed for a reason that may be temporary, such as a network interruption or a server error, so Claude Code can’t confirm whether the remote session still exists. Your local session keeps running without Remote Control. Run `/remote-control` to retry the connection, or start a new session with `claude --remote-control` to create a new Remote Control session. Resuming can also end in two other ways: - - * **The server reports that the recorded session no longer exists** : Claude Code shows `Remote Control could not resume the previous session under the current login` instead of this message, doesn’t create a replacement session, and removes the reconnection record from the conversation. - * **Remote Control was turned off before you resumed** : Claude Code keeps the reconnection record only while Remote Control stays on. Turning it off from the CLI’s status panel, the VS Code extension, or a host built on the [Agent SDK](</docs/en/agent-sdk/overview>) removes the record, so resuming doesn’t reconnect Remote Control. - -Earlier versions created a new Remote Control session instead of showing a message: before v2.1.200 on any reconnection failure, and through v2.1.226 when the server reported the session gone. - -### - -​ - -“Remote Control could not resume the previous session under the current login” - -Claude Code tried to reconnect to a previous Remote Control session and stopped: it couldn’t confirm that the session is still available to the account you’re now signed in with, for example because you signed in to a different account or the server reported the session gone. You can see this message after resuming a conversation with `claude --resume` or `claude --continue`, or after Claude Code reconnects on its own following a disconnect. Rather than start a fresh remote session, which by default would upload the local conversation under an account that may not own it, Claude Code leaves the session running locally without Remote Control. Run `/remote-control` to start a fresh Remote Control session under the current login. The related message `Remote Control could not verify the signed-in account — run /remote-control to reconnect` appears when the signed-in account changed or couldn’t be read between Claude Code validating it and reconnecting, and has the same fix. The automatic reconnection is part of disconnect recovery. When a [Remote Control disconnect message](</docs/en/errors#remote-control-couldnt-refresh-your-login>) says to run `/login` to restore Remote Control, Claude Code watches for a new sign-in and reconnects to the previous remote session on its own. Any other disconnect listed in that entry needs a manual `/remote-control`. Both messages were added in v2.1.225. +When you resume a conversation with `claude --resume` or `claude --continue`, Claude Code reconnects to the Remote Control session recorded in that conversation. This message means the reconnection failed for a reason that may be temporary, such as a network interruption or a server error, so Claude Code can’t confirm whether the remote session still exists. Run `/remote-control` to retry the connection, or start a new session with `claude --remote-control` to create a new Remote Control session. Your local session keeps running without Remote Control in the meantime. When you resume, you can also get one of these outcomes instead of this message: + + * **The server reports the recorded session gone, or the reconnection record names a different account** : Claude Code goes by what the conversation’s reconnection record says: + * **The record names your signed-in account** : Claude Code starts a replacement session with an auto-generated name and leaves the conversation’s earlier messages out of it. You get this after you delete the session from claude.ai or the Claude app, for example. + * **The record names a different account** : Claude Code starts a new session without the conversation’s earlier messages and without showing a message, whether or not the recorded session still exists. + * **The record doesn’t say which account owned the session, or Claude Code can’t read your saved sign-in** : Claude Code shows `Previous session is unavailable — run /remote-control to start a new one` instead of this message, starts nothing, and removes the record from the conversation. + * **You turned Remote Control off before resuming** : unless the app hosting Claude Code had told it that the app owns the claude.ai session, Claude Code removed the reconnection record when you turned Remote Control off from the CLI’s status panel, the VS Code extension, or a host built on the [Agent SDK](</docs/en/agent-sdk/overview>), so it doesn’t reconnect. When an owning app turned it off, Claude Code kept the record and reconnects. + * **Another Claude Code on this machine still has the session** : you see a notice that starts with `Remote Control not started here`, and Claude Code leaves Remote Control off in the resumed session. Run `/remote-control` there to move it. + +Before v2.1.232, Claude Code responded differently when the server reported the recorded session gone. From v2.1.227 through v2.1.231, Claude Code refused to start a replacement even when the record matched your account. Through v2.1.226, Claude Code started a replacement whether or not the record matched your account, and in v2.1.224 through v2.1.226 created it under the account signed in on that machine, never another account’s, without uploading the conversation’s earlier messages to it. Before v2.1.200, Claude Code created a new session after any reconnection failure. + +### + +​ + +“Previous session is unavailable — run /remote-control to start a new one” + +Claude Code couldn’t bring back the previous Remote Control session and stopped instead of starting a new one on its own. You can see this message after you resume a conversation with `claude --resume` or `claude --continue`, or after Claude Code [reconnects on its own following a disconnect](</docs/en/errors#remote-control-couldnt-refresh-your-login>). Run `/remote-control` to start a new Remote Control session under the current login; your local session keeps running without Remote Control in the meantime. The related message `Remote Control could not verify the signed-in account — run /remote-control to reconnect` has the same fix; Claude Code shows it when the signed-in account changed or couldn’t be read between validating it and reconnecting. If you run `/remote-control` after `Previous session is unavailable` without restarting Claude Code first, Claude Code leaves the conversation’s earlier messages out of the new session. On resume, Claude Code starts a new session in its place only if the conversation’s reconnection record names the account that owned the session, because the server reports a session you deleted and a session owned by another account the same way. Claude Code before v2.1.227 didn’t record that account, and Claude Code can’t check the record when it can’t read your saved sign-in. Claude Code before v2.1.232 showed `Remote Control could not resume the previous session under the current login — run /remote-control to start fresh` instead, in a different set of cases. ###
modified Configure the sandboxed Bash tool View current →
--- a/sandboxing.md +++ b/sandboxing.md @@ -36,7 +36,7 @@ Run a Bash command -Ask Claude to run a command, such as a build or a test suite. By default, commands inside the sandbox can write only to the working directory and the session temp directory. The first time a command needs a new network domain, Claude Code prompts for approval.Commands that cannot run sandboxed fall back to the regular permission flow. To widen or narrow these boundaries, see Configure sandboxing. +Ask Claude to run a command, such as a build or a test suite. By default, commands inside the sandbox can write only to the working directory and the session temp directory. The first time a command needs a new network domain, Claude Code prompts for approval, or in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) sends the request to the classifier.Commands that cannot run sandboxed fall back to the regular permission flow. To widen or narrow these boundaries, see Configure sandboxing. When you select a mode in the panel, Claude Code saves it to your project’s local settings at `.claude/settings.local.json`, which apply to the current project. Claude Code adds that file to your global gitignore when it saves a setting there. To enable the sandbox across all of your projects, set [`sandbox.enabled`](</docs/en/settings#sandbox-settings>) to `true` in your user settings at `~/.claude/settings.json`. To enforce sandboxing for every developer in an organization, use managed settings. @@ -101,14 +101,14 @@ Auto-allow mode -When a command can be sandboxed, Claude Code runs it inside the sandbox and approves it automatically, without asking your permission. Commands that cannot be sandboxed, such as those needing network access to non-allowed hosts, fall back to the regular permission flow, where Claude Code checks your [permission rules](</docs/en/permissions>) and gates any command those rules do not already allow, with a prompt in default mode or the classifier in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Even in auto-allow mode, the following still apply: +When a command can be sandboxed, Claude Code runs it inside the sandbox and approves it automatically, without asking your permission. Commands that cannot be sandboxed, such as those needing network access to non-allowed hosts, fall back to the regular permission flow, where Claude Code checks your [permission rules](</docs/en/permissions>) and gates any command those rules do not already allow, with a prompt in Manual mode or the classifier in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Even in auto-allow mode, the following still apply: * Explicit [deny rules](</docs/en/permissions>) are always respected * `rm` or `rmdir` commands that target `/`, your home directory, or other critical system paths still go through the regular permission flow * Content-scoped [ask rules](</docs/en/permissions>) like `Bash(git push *)` still force a prompt even for sandboxed commands * A bare `Bash` ask rule, or the equivalent `Bash(*)` form, is skipped for commands that run sandboxed; it still applies to commands that fall back to the regular permission flow. In [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>), the rule isn’t skipped: it prompts for sandboxed commands too, including read-only ones. Before v2.1.212, the skip applied in plan mode as well -Auto-allow mode works independently of your permission mode setting, with one exception: [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>). Even if you’re not in “accept edits” mode, sandboxed Bash commands run automatically when auto-allow is enabled. This means Bash commands that modify files within the sandbox boundaries execute without prompting, even when file edit tools would normally require approval.In plan mode, auto-allow doesn’t widen approvals; see [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for how Claude Code gates commands while you plan. Before v2.1.212, auto-allow ran sandboxed commands without a prompt in plan mode too. +Auto-allow mode works independently of your permission mode setting, with one exception: [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>). Even if you’re not in “accept edits” mode, sandboxed Bash commands run automatically when auto-allow is enabled. This means Bash commands that modify files within the sandbox boundaries execute without prompting, even in Manual mode, where the file edit tools would prompt.In plan mode, auto-allow doesn’t widen approvals; see [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) for how Claude Code gates commands while you plan. Before v2.1.212, auto-allow ran sandboxed commands without a prompt in plan mode too. #### @@ -124,7 +124,7 @@ The unsandboxed retry escape hatch -Some commands can’t run inside the sandbox at all, such as tools that are incompatible with it or that need a host you haven’t allowed. When a command fails after the sandbox denied it access, Claude Code appends the violation details to the failed command’s output, so Claude sees which file path or network host the sandbox blocked. Rather than failing the task or requiring you to turn sandboxing off, Claude Code includes an escape hatch: when a command fails because of sandbox restrictions, Claude analyzes the failure and may retry the command with the `dangerouslyDisableSandbox` parameter. The retried command runs outside the sandbox, so it goes through the regular permission flow: in default mode you get a confirmation prompt; in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) the classifier evaluates the underlying command instead of prompting you. To be prompted on every unsandboxed retry even in auto mode, add an [ask rule](</docs/en/permissions#match-by-input-parameter>) for `Bash(dangerouslyDisableSandbox:true)`. You can disable this escape hatch by setting `"allowUnsandboxedCommands": false` in your [sandbox settings](</docs/en/settings#sandbox-settings>). When disabled, which the `/sandbox` Overrides tab shows as **Strict sandbox mode** , the `dangerouslyDisableSandbox` parameter is completely ignored and all commands must run sandboxed or be explicitly listed in `excludedCommands`. +Some commands can’t run inside the sandbox at all, such as tools that are incompatible with it or that need a host you haven’t allowed. When a command fails after the sandbox denied it access, Claude Code appends the violation details to the failed command’s output, so Claude sees which file path or network host the sandbox blocked. Rather than failing the task or requiring you to turn sandboxing off, Claude Code includes an escape hatch: when a command fails because of sandbox restrictions, Claude analyzes the failure and may retry the command with the `dangerouslyDisableSandbox` parameter. The retried command runs outside the sandbox, so it goes through the regular permission flow: in Manual mode you get a confirmation prompt; in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) the classifier evaluates the underlying command instead of prompting you. To be prompted on every unsandboxed retry even in auto mode, add an [ask rule](</docs/en/permissions#match-by-input-parameter>) for `Bash(dangerouslyDisableSandbox:true)`. You can disable this escape hatch by setting `"allowUnsandboxedCommands": false` in your [sandbox settings](</docs/en/settings#sandbox-settings>). When disabled, which the `/sandbox` Overrides tab shows as **Strict sandbox mode** , the `dangerouslyDisableSandbox` parameter is completely ignored and all commands must run sandboxed or be explicitly listed in `excludedCommands`. #### @@ -446,7 +446,7 @@ Network access is controlled through a proxy server running outside the sandbox: - * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval. Choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules. + * **Domain restrictions** : no domains are pre-allowed by default. The first time a command needs a new domain, Claude Code prompts for approval, or in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) sends the request to the classifier. When you’re prompted, choosing Yes allows the host for the rest of the current session, so later connections to the same host do not prompt again. Pre-allow domains with [`allowedDomains`](</docs/en/settings#sandbox-settings>) to avoid the prompt entirely. `WebFetch` allow rules also pre-allow domains, as described in Permission rules. * **Strict allowlist** : if you set [`strictAllowlist`](</docs/en/settings#sandbox-settings>) to `true` in user, managed, or CLI `--settings` settings, Claude Code denies sandboxed commands access to any host outside the allowlist instead of prompting. The allowlist is the same one the sandbox otherwise prompts against: `allowedDomains` plus domains from `WebFetch(domain:...)` allow rules, or only the managed settings entries when `allowManagedDomainsOnly` is set. Claude Code enforces this for sandboxed commands only; in-process tools such as `WebFetch` still follow their permission rules. Setting it in a repository’s `.claude/settings.json` or `.claude/settings.local.json` has no effect. Requires Claude Code v2.1.219 or later. * **Managed lockdown** : if [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, non-allowed domains are blocked automatically instead of prompting, and only `allowedDomains` and `WebFetch(domain:...)` allow rules from managed settings are honored. * **Custom proxy support** : advanced users can implement custom rules on outgoing traffic
modified Run prompts on a schedule View current →
--- a/scheduled-tasks.md +++ b/scheduled-tasks.md @@ -1,4 +1,4 @@ -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 until a condition is met rather than on an interval, see [`/goal`](</docs/en/goal>). Tasks are session-scoped: they live in the current conversation and stop when you start a new one. Resuming with `--resume` or `--continue` brings back any task that hasn’t expired: a recurring task created within the last 7 days, or a one-shot whose scheduled time hasn’t passed yet. 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>). +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: they live in the current conversation and stop when you start a new one. Resuming with `--resume` or `--continue` brings back any task that hasn’t expired: a recurring task created within the last 7 days, or a one-shot whose scheduled time hasn’t passed yet. 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>). ##
modified Customize sessions in self-hosted environments View current →
--- a/self-hosted-environments-configuration.md +++ b/self-hosted-environments-configuration.md @@ -342,7 +342,7 @@ A self-hosted session has no terminal attached, so an unanswered permission prompt stalls the turn until the user responds in the UI. Anthropic’s control plane sends each session’s tool list and permission rules with the work payload; the default configuration pre-approves routine tool calls, including `Bash`, and cloud sessions [pre-approve file edits regardless of mode](</docs/en/permission-modes#switch-permission-modes>). A call that nothing pre-approves prompts through the session UI. -Only enable auto mode on an environment whose session containers run with [default-deny network egress](</docs/en/self-hosted-environments-deploy#default-deny-egress>) and the rest of the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>) in place. Routine tool calls, including `Bash` network requests, run without a human in the loop on both the default pre-approved tool set and in auto mode, so the network boundary is what limits where those calls can reach. +Only pin auto mode on an environment whose session containers run with [default-deny network egress](</docs/en/self-hosted-environments-deploy#default-deny-egress>) and the rest of the [hardening section](</docs/en/self-hosted-environments-deploy#harden-your-deployment>) in place. Routine tool calls, including `Bash` network requests, run without a human in the loop on both the default pre-approved tool set and in auto mode, so the network boundary is what limits where those calls can reach. To keep prompts to a minimum regardless of what the control plane sends, pin [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from your wrapper script or `command` hook. Auto mode lets sessions run without routine permission prompts: a separate classifier model reviews actions before they run and blocks the ones it rejects, and explicit ask rules still force a prompt; the permission modes page covers what the classifier checks. The runner appends server-computed flags before invoking the wrapper, and for single-value flags such as `--permission-mode` the parser honors the last occurrence, so a flag you append after `"$@"` overrides the server-sent value:
modified Deploy self-hosted environments to production View current →
--- a/self-hosted-environments-deploy.md +++ b/self-hosted-environments-deploy.md @@ -340,7 +340,13 @@ Connector traffic leaves your network -Connector tools, such as GitHub, Slack, Linear, and the other claude.ai connectors, are called from Anthropic’s side rather than from your runner, so when a self-hosted session uses a connector, that traffic routes through `api.anthropic.com`, not from inside your network boundary. To keep a connector out of self-hosted sessions, filter it like any other MCP server with the [`allowedMcpServers` and `deniedMcpServers` policy settings](</docs/en/managed-mcp#policy-based-control-with-allowlists-and-denylists>), which apply to server-delivered connectors too. An allowlist you deploy for other servers also blocks delivered connectors. To keep connectors available alongside a URL-based allowlist, add an entry matching the session proxy URL, such as `https://api.anthropic.com/v2/ccr-sessions/*`. If tool traffic must stay inside your network, run the equivalent tools as local MCP servers on the runner image instead. See [MCP servers](</docs/en/self-hosted-environments-configuration#mcp-servers>). +Connector tools, such as GitHub, Slack, Linear, and the other claude.ai connectors, are called from Anthropic’s side rather than from your runner, so when a self-hosted session uses a connector, that traffic routes through `api.anthropic.com`, not from inside your network boundary. To keep a connector out of self-hosted sessions, filter it like any other MCP server with the [`allowedMcpServers` and `deniedMcpServers` policy settings](</docs/en/managed-mcp#policy-based-control-with-allowlists-and-denylists>), which apply to server-delivered connectors too. An allowlist you deploy for other servers also blocks delivered connectors. To keep connectors available alongside a URL-based allowlist, add entries that match the Anthropic proxy paths for server-delivered MCP servers: + + * `https://api.anthropic.com/v2/ccr-sessions/*` + * `https://api.anthropic.com/v1/code/sessions/*` + * `https://api.anthropic.com/v1/code/mcp/*` + +If tool traffic must stay inside your network, run the equivalent tools as local MCP servers on the runner image instead. See [MCP servers](</docs/en/self-hosted-environments-configuration#mcp-servers>). ###
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -253,7 +253,7 @@ `disableAgentView`| Set to `true` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Typically set in [managed settings](</docs/en/permissions#managed-settings>). Equivalent to setting `CLAUDE_CODE_DISABLE_AGENT_VIEW` to `1`| `true` `disableAllHooks`| Disable all [hooks](</docs/en/hooks#disable-or-remove-hooks>), any custom [status line](</docs/en/statusline>), and any custom file suggestion command| `true` `disableArtifact`| Set to `true` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to setting `CLAUDE_CODE_DISABLE_ARTIFACT` to `1`| `true` -`disableAutoMode`| Set to `"disable"` to prevent [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from being activated. Removes `auto` from the `Shift+Tab` cycle and rejects `--permission-mode auto` at startup. Also accepted under `permissions` as `permissions.disableAutoMode`. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `"disable"` +`disableAutoMode`| Set to `"disable"` to prevent [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from being activated. Removes `auto` from the `Shift+Tab` cycle, and any session that would otherwise [start in auto mode](</docs/en/permission-modes#which-mode-a-session-starts-in>), whether from `--permission-mode auto`, a settings file, or the built-in default, starts in `default` instead. Also accepted under `permissions` as `permissions.disableAutoMode`. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `"disable"` `disableBrowserExternalNavigation`| (Managed settings only) Set to `true` to turn off external browsing in the desktop app’s [Browser pane](</docs/en/desktop#browse-external-sites>). 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| `true` `disableBundledSkills`| Set to `true` 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`](</docs/en/env-vars>) instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to setting `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS` to `1`| `true` `disableClaudeAiConnectors`| Disable [claude.ai MCP connectors](</docs/en/mcp#use-mcp-servers-from-claude-ai>) so they are not auto-fetched or connected. Set in any settings scope. `true` in any source takes precedence, so a checked-in project `.claude/settings.json` can opt a repo out of cloud connectors, but a project-level `false` cannot override a user- or policy-level `true`. Servers passed explicitly via `--mcp-config` are unaffected. To deny individual connectors instead of all of them, use [`deniedMcpServers`](</docs/en/managed-mcp>). Requires Claude Code v2.1.182 or later| `true` @@ -392,7 +392,7 @@ `ask`| Array of permission rules to ask for confirmation upon tool use. See Permission rule syntax below| `[ "Bash(git push *)" ]` `deny`| Array of permission rules to deny tool use. Use this to exclude sensitive files from Claude Code access. Tool names accept glob patterns: `"*"` denies every tool and `"mcp__*"` denies every MCP tool. Deny rules can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains. See Permission rule syntax and [Bash permission limitations](</docs/en/permissions#tool-specific-permission-rules>)| `[ "WebFetch", "Bash(curl *)", "Read(./.env)", "Read(./secrets/**)" ]` `additionalDirectories`| Additional [working directories](</docs/en/permissions#working-directories>) for file access. Most `.claude/` configuration is [not discovered](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) from these directories| `[ "../docs/" ]` -`defaultMode`| Default [permission mode](</docs/en/permission-modes>) for new sessions. In sessions the [VS Code extension](</docs/en/vs-code>) starts, the extension resolves the starting mode instead. Valid values: `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, `bypassPermissions`, and `manual` as an alias for `default`, the mode labeled Manual in the CLI, the VS Code and JetBrains extensions, and the desktop app. The `manual` alias requires Claude Code v2.1.200 or later. `auto` is ignored when set in project or local settings, so a repository can’t grant itself auto mode; set it in `~/.claude/settings.json` instead. Before v2.1.142, project settings could set `auto`. The `--permission-mode` CLI flag overrides this setting for a single session| `"acceptEdits"` +`defaultMode`| [Permission mode](</docs/en/permission-modes>) that new sessions start in. When unset, sessions start in the [built-in default](</docs/en/permission-modes#which-mode-a-session-starts-in>) for your plan and surface. For conversations the VS Code extension starts, see [what the extension reads](</docs/en/permission-modes#switch-permission-modes>). Valid values: `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, `bypassPermissions`, and `manual` as an alias for `default`, the mode labeled Manual in the CLI, the VS Code and JetBrains extensions, and the desktop app. The `manual` alias requires Claude Code v2.1.200 or later. `auto` doesn’t take effect from project or local settings; set it in `~/.claude/settings.json` instead. Before v2.1.142, project settings could set `auto`. The `--permission-mode` CLI flag overrides this setting for a single session| `"acceptEdits"` `disableAutoMode`| Set to `"disable"` to prevent [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from being activated. Equivalent to the top-level `disableAutoMode` setting, which describes the full effect. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `"disable"` `disableBypassPermissionsMode`| Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag, and Claude Code ignores an [agent definition’s](</docs/en/sub-agents#permission-modes>) `permissionMode: bypassPermissions`, so the subagent runs with the parent session’s mode. Before v2.1.223, Claude Code applied the frontmatter mode even with bypass disabled. Typically placed in [managed settings](</docs/en/permissions#managed-settings>) to enforce organizational policy, but works from any scope| `"disable"` `skipDangerousModePermissionPrompt`| Skip the confirmation prompt shown before entering bypass permissions mode via `--dangerously-skip-permissions` or `defaultMode: "bypassPermissions"`. Ignored when set in project settings (`.claude/settings.json`) to prevent untrusted repositories from auto-bypassing the prompt| `true` @@ -892,7 +892,7 @@ `extraKnownMarketplaces` -Defines additional marketplaces that should be made available for the repository. Typically used in repository-level settings to ensure team members have access to required plugin sources. When a repository’s `.claude/settings.json` includes `extraKnownMarketplaces`, Claude Code adds those marketplaces for a team member after they accept the workspace trust dialog for that repository, with no separate prompt. In a folder they haven’t trusted, including a `-p` run there or a repository under a parent folder they trusted earlier, Claude Code ignores the entries without a message. [What runs before you trust a folder](</docs/en/permissions#what-runs-before-you-trust-a-folder>) compares this with the other content a repository can supply. **Example** : +Defines additional marketplaces that should be made available for the repository. Typically used in repository-level settings to ensure team members have access to required plugin sources. When a repository’s `.claude/settings.json` includes `extraKnownMarketplaces`, Claude Code adds those marketplaces for a team member after they accept the workspace trust dialog for that repository, with no separate prompt. In a folder they haven’t trusted, including a `-p` run there, Claude Code ignores the entries without a message. [What runs before you trust a folder](</docs/en/permissions#what-runs-before-you-trust-a-folder>) compares this with the other content a repository can supply. **Example** : { "extraKnownMarketplaces": {
modified Create custom subagents View current →
Show diff (144 lines)
--- a/sub-agents.md +++ b/sub-agents.md @@ -56,7 +56,7 @@ Agent| Model| When Claude uses it ---|---|--- -claude| Inherits| When a task doesn’t fit a more specialized agent. A catch-all with every tool available to subagents. Also the [default agent](</docs/en/agent-view#permission-mode-model-and-effort>) for a dispatched [background session](</docs/en/agent-view>), which runs with your settings’ permission mode rather than a parent conversation’s +claude| Inherits| When a task doesn’t fit a more specialized agent. A catch-all with every tool available to subagents. Also the default agent for a dispatched [background session](</docs/en/agent-view>); [which permission mode it starts in](</docs/en/agent-view#permission-mode-model-and-effort>) depends on how the session was started statusline-setup| Sonnet| When you run `/statusline` to configure your status line claude-code-guide| Haiku| When you ask questions about Claude Code features @@ -180,7 +180,7 @@ } '@ -The `--agents` flag accepts JSON with the same frontmatter fields as file-based subagents: `description`, `prompt`, `tools`, `disallowedTools`, `model`, `permissionMode`, `mcpServers`, `hooks`, `maxTurns`, `skills`, `initialPrompt`, `memory`, `effort`, `background`, `isolation`, and `color`. Use `prompt` for the system prompt, equivalent to the markdown body in file-based subagents. **Managed subagents** are deployed by organization administrators. Place markdown files in `.claude/agents/` inside the [managed settings directory](</docs/en/settings#settings-files>), using the same frontmatter format as project and user subagents. Managed definitions take precedence over project and user subagents with the same name. **Plugin subagents** come from [plugins](</docs/en/plugins>) you’ve installed. They load automatically alongside your custom subagents and appear in the @-mention typeahead under their scoped name. See the [plugin components reference](</docs/en/plugins-reference#agents>) for details on creating plugin subagents. +The `--agents` flag accepts JSON with a `prompt` field plus these frontmatter fields: `description`, `tools`, `disallowedTools`, `model`, `permissionMode`, `mcpServers`, `hooks`, `maxTurns`, `skills`, `initialPrompt`, `memory`, `effort`, `background`, and `isolation`. Use `prompt` for the system prompt, equivalent to the markdown body in file-based subagents. **Managed subagents** are deployed by organization administrators. Place markdown files in `.claude/agents/` inside the [managed settings directory](</docs/en/settings#settings-files>), using the same frontmatter format as project and user subagents. Managed definitions take precedence over project and user subagents with the same name. **Plugin subagents** come from [plugins](</docs/en/plugins>) you’ve installed. They load automatically alongside your custom subagents and appear in the @-mention typeahead under their scoped name. See the [plugin components reference](</docs/en/plugins-reference#agents>) for details on creating plugin subagents. For security reasons, plugin subagents don’t support the `hooks`, `mcpServers`, or `permissionMode` frontmatter fields. These fields are ignored when loading agents from a plugin. If you need them, copy the agent file into `.claude/agents/` or `~/.claude/agents/`. You can also add rules to [`permissions.allow`](</docs/en/settings#permission-settings>) in `settings.json` or `settings.local.json`, but these rules apply to the entire session, not only the plugin subagent. @@ -211,7 +211,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 full Claude Code system prompt. In [non-interactive mode](</docs/en/headless>), the [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag appends the text you provide to the end of every subagent’s system prompt, including nested subagents. Requires Claude Code v2.1.205 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. Before v2.1.203, such a command could run in the main checkout. 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 full 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. 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. Before v2.1.203, such a command could run in the main checkout. 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: * It blocks a command that redirects git into the main checkout. * It refuses a command whose shape it can’t verify stays inside the worktree. This refusal applies even to a command that runs no git. @@ -298,7 +298,7 @@ * `WaitForMcpServers` * `Workflow` -The second filter applies to subagents running in the background. Apart from `Agent` and `ExitPlanMode`, which follow the first filter’s conditions wherever the subagent runs, a background subagent keeps every MCP tool but only these built-in tools: `Read`, `Grep`, `Glob`, `Bash`, `PowerShell`, `Edit`, `Write`, `NotebookEdit`, `WebFetch`, `WebSearch`, `TodoWrite`, `Skill`, `ToolSearch`, `EnterWorktree`, `ExitWorktree`, `Monitor`, `TaskStop`, `SendMessage`, and `Artifact`. Claude Code removes every other built-in tool from a background subagent, whether inherited or listed in the `tools` field, so the same definition can resolve to different tools in the foreground and the background. The removal reports no error unless it leaves the `tools` list [resolving to nothing](</docs/en/errors#agent-would-be-spawned-with-zero-tools>). [`ListAgents`](</docs/en/cross-session-messaging>) follows these filters like any built-in tool: a foreground subagent inherits it in sessions where cross-session messaging is enabled, and a background subagent doesn’t keep it. Teammates in [agent teams](</docs/en/agent-teams>) additionally keep the task tools and cron tools: `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, `CronCreate`, `CronDelete`, and `CronList`. To restrict tools, use the `tools` field as an allowlist or the `disallowedTools` field as a denylist. This example uses `tools` to allow only Read, Grep, Glob, and Bash. The subagent can’t edit files, write files, or use any MCP tools: +The second filter applies to subagents running in the background. Apart from `Agent` and `ExitPlanMode`, which follow the first filter’s conditions wherever the subagent runs, a background subagent keeps every MCP tool but only these built-in tools: `Read`, `Grep`, `Glob`, `Bash`, `PowerShell`, `Edit`, `Write`, `NotebookEdit`, `WebFetch`, `WebSearch`, `TodoWrite`, `Skill`, `ToolSearch`, `EnterWorktree`, `ExitWorktree`, `Monitor`, `TaskStop`, `SendMessage`, and `Artifact`. Claude Code removes every other built-in tool from a background subagent, whether inherited or listed in the `tools` field, so the same definition can resolve to different tools in the foreground and the background. The removal reports no error unless it leaves the `tools` list [resolving to nothing](</docs/en/errors#agent-would-be-spawned-with-zero-tools>). [`ListAgents`](</docs/en/cross-session-messaging>) follows these filters like any built-in tool: a foreground subagent inherits it in sessions where cross-session messaging is enabled, and a background subagent doesn’t keep it. Teammates in [agent teams](</docs/en/agent-teams>) additionally keep the task tools and cron tools: `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`, `CronCreate`, `CronDelete`, and `CronList`. In a [session without the Task tools](</docs/en/tools-reference#task-tool-availability>), Claude Code doesn’t provide the task tools to subagents either, even when the subagent runs a different model. An in-process teammate follows your session the same way, while a teammate in its own [split pane](</docs/en/agent-teams#choose-a-display-mode>) runs as a separate Claude Code process, so its own model decides. To restrict tools, use the `tools` field as an allowlist or the `disallowedTools` field as a denylist. This example uses `tools` to allow only Read, Grep, Glob, and Bash. The subagent can’t edit files, write files, or use any MCP tools: --- name: safe-researcher @@ -390,11 +390,11 @@ Permission modes -The `permissionMode` field controls how the subagent handles permission prompts. Subagents inherit the permission context from the main conversation and can override the mode, except in the cases described below. +Set `permissionMode` to choose the permission mode a subagent runs in. Use the modes’ config values, so Manual mode is `default`. If you leave it unset, the subagent inherits the main conversation’s mode, which starts as [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) on Pro, Max, and Team plans unless your settings or your organization change it. Setting it overrides that mode, except in the cases described below. Mode| Behavior ---|--- -`default`| Standard permission checking with prompts +`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`, connector tools [your organization set to `ask`](</docs/en/mcp#organization-controls-on-connector-tools>), and MCP tools marked [`requiresUserInteraction`](</docs/en/mcp#require-approval-for-a-specific-tool>) are denied even if you’ve allowed them @@ -698,7 +698,7 @@ * 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. * If an in-process [agent team](</docs/en/agent-teams#limitations>) teammate spawned the subagent, Claude Code runs it in the foreground. - * Where fork mode is on, as it is by default in an interactive session, Claude Code runs the subagent in the background, forks and named subagents alike, and Claude can’t ask for the foreground. + * 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`. Background subagents run with a smaller built-in tool set than foreground subagents, except for conversation forks, and they surface every permission prompt in your main session. 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: @@ -706,7 +706,20 @@ * 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 +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: + + * When a subagent finishes successfully, Claude Code removes its row immediately and, except in [screen reader mode](</docs/en/accessibility>), shows `/tasks to see subagents` in the footer for 30 seconds. During those 30 seconds, run [`/tasks`](</docs/en/commands>) and press `Enter` on the subagent to open its transcript. Before v2.1.232, Claude Code kept the row for 30 seconds after the subagent finished, the same as a failed one, and showed no footer hint. + * When a subagent fails or you stop it, Claude Code keeps its row for 30 seconds. To clear the row sooner, select it and press `x`. + A background subagent that completes stays listed in [`/tasks`](</docs/en/commands>), marked done and sorted below running work, until the session cleans up its task list. Its detail view stays open when the subagent finishes. Subagents that fail or that you stop leave the list. Before v2.1.208, a completed subagent left the list the moment it finished and its detail view closed. + +### + +​ + +Subagent names + +Claude can give a subagent a name by passing a `name` parameter on the Agent tool call, and may do so on its own, without asking you first. The name makes the subagent addressable: Claude can message or resume it by name after it finishes. In an interactive session with [agent teams](</docs/en/agent-teams>) enabled, a subagent that Claude spawns from the main conversation with a `name` launches as a teammate instead, unless the call is a fork or passes `isolation` on the call itself. An `isolation` value in the subagent’s frontmatter doesn’t prevent it, and the teammate then runs in the main session’s working directory. See [How Claude starts agent teams](</docs/en/agent-teams#how-claude-starts-agent-teams>). ### @@ -813,7 +826,7 @@ } } -With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. A nested subagent is configured the same way as a top-level one and resolves from the same scopes. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. The subagent panel below the prompt input shows the full tree: each row displays a `(+N)` count of descendants, and as of v2.1.193, opening a row shows that subagent’s siblings and direct children with a path back to `main`. +With this value, your subagents can delegate to a second layer of their own, and that second layer can’t delegate further. Set `1` to turn nesting off. A nested subagent is configured the same way as a top-level one and resolves from the same scopes. To keep one subagent from spawning while nesting is on, such as a reviewer that should stay read-only, omit `Agent` from its `tools` list or add it to `disallowedTools`. Claude Code shows nested subagents as a tree in the subagent panel below the prompt input and marks each row that still has descendants in the panel with a `(+N)` count of them. Open a row to see that subagent’s siblings and direct children with a path back to `main`. Earlier versions used different defaults: @@ -907,7 +920,7 @@ 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 a named 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: +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: /subtask draft unit tests for the parser changes so far @@ -919,13 +932,13 @@ Observe and steer running forks -Running forks appear in a panel below the prompt input, with one row for the main session and one for each fork. Use these keys to interact with the panel: +Running forks appear in a panel below the prompt input, with one row for the main session and one for each fork. When a fork finishes successfully, Claude Code removes its row. Claude Code keeps the row of a fork that failed or that you stopped for 30 seconds, the same as for any other background subagent. Before v2.1.232, Claude Code kept a finished fork’s row for 30 seconds as well. Use these keys to interact with the panel: Key| Action ---|--- `↑` / `↓`| Move between rows `Enter`| Open the selected fork’s transcript and send it follow-up messages -`x`| Dismiss a finished fork or stop a running one. Acts on the selected fork row. On the main session row, or on the row of the fork whose transcript you opened with `Enter`, `x` types into the prompt instead +`x`| Stop the selected fork if it’s running, or dismiss its row if it’s no longer running. On the main session row, or on the row of the fork whose transcript you opened with `Enter`, `x` types into the prompt instead `Esc`| Return focus to the prompt input With a fork’s or subagent’s transcript open, follow-up messages and [skills](</docs/en/skills>) go to that agent, but built-in commands still run in your main conversation. As of v2.1.199, typing `/model` or `/fast` in that view shows a notice that it changes the main conversation’s model or fast mode, not the viewed agent’s, instead of running it silently. @@ -934,11 +947,11 @@ ​ -How forks differ from named subagents - -A fork inherits everything the main session has at the moment it spawns. A named subagent starts from its own definition. - -| Fork| Named subagent +How forks differ from other subagents + +A fork inherits everything the main session has at the moment it spawns. Any other subagent starts fresh from its definition. + +| Fork| Non-fork subagent ---|---|--- 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 @@ -956,8 +969,8 @@ 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, and named subagents such as Explore work as usual. - * Claude Code runs the subagents Claude spawns in the background, forks and named 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. + * Claude can spawn a fork by requesting the `fork` subagent type. When Claude doesn’t request a type, it gets the general-purpose subagent, and 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:
modified Configure your terminal for Claude Code View current →
--- a/terminal-config.md +++ b/terminal-config.md @@ -213,7 +213,7 @@ Token| Controls ---|--- -`promptBorder`| Input box border in the default permission mode +`promptBorder`| Input box border in Manual mode `planMode`| Plan mode accent and border `autoAccept`| Accept-edits mode accent and border `bashBorder`| Input box border when entering a `!` shell command
modified Todo Lists View current →
Show diff (114 lines)
--- a/todo-tracking.md +++ b/todo-tracking.md @@ -1,6 +1,26 @@ The Claude Agent SDK includes built-in todo functionality that helps organize complex workflows and keep users informed about task progression. -As of TypeScript Agent SDK 0.3.142 and Claude Code v2.1.142, sessions use the structured Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList` instead of `TodoWrite`. The Python SDK gets this change from the Claude Code CLI it launches, not from the Python package version: the switch applies once that CLI — the copy bundled inside the pip package, or one you point to with `cli_path` — is v2.1.142 or later. See Migrate to Task tools for how monitoring code changes. The examples on this page set `CLAUDE_CODE_ENABLE_TASKS=0` to keep showing `TodoWrite` for sessions that have not migrated yet. +On TypeScript Agent SDK 0.3.233 and later, or Python Agent SDK 0.2.139 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in: + + * `TodoWrite` + * `TaskCreate` + * `TaskGet` + * `TaskUpdate` + * `TaskList` + +On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`. + +### + +​ + +Model availability + +On the [models that don’t get the task-tracking tools](</docs/en/tools-reference#task-tool-availability>), you see no `tool_use` blocks for them in the message stream unless you opt in. If you point `cli_path` in Python or `pathToClaudeCodeExecutable` in TypeScript at your own Claude Code install, you get whichever tools that install provides. To get the same tools as on other models, do one of the following: + + * Name one of the tools in the [`allowedTools`](</docs/en/agent-sdk/permissions#allow-and-deny-rules>) option, `allowed_tools` in Python + * List the tools in the `tools` option, which restricts the session’s built-in tools to the ones it names. Include the tools you want alongside the other built-in tools you use + * Set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` in the `env` option, as the examples on this page do. In TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables. In Python, `env` is merged on top of the inherited environment ### @@ -54,8 +74,9 @@ for await (const message of query({ prompt: "Optimize my React app performance and track progress with todos", // Re-enable TodoWrite, which this example monitors. Without it, the SDK uses - // Task tools instead and these tool_use blocks never appear. - options: { maxTurns: 15, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0" } } + // Task tools instead and these tool_use blocks never appear. ENABLE_TODO_TOOLS + // keeps the tools on models where Claude Code otherwise doesn't provide them. + options: { maxTurns: 15, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0", CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } } })) { // Todo updates are reflected in the message stream if (message.type === "assistant") { @@ -88,8 +109,9 @@ async for message in query( prompt="Optimize my React app performance and track progress with todos", # Re-enable TodoWrite, which this example monitors. Without it, the SDK uses - # Task tools instead and these tool_use blocks never appear. - options=ClaudeAgentOptions(max_turns=15, env={"CLAUDE_CODE_ENABLE_TASKS": "0"}), + # Task tools instead and these tool_use blocks never appear. ENABLE_TODO_TOOLS + # keeps the tools on models where Claude Code otherwise doesn't provide them. + options=ClaudeAgentOptions(max_turns=15, env={"CLAUDE_CODE_ENABLE_TASKS": "0", "CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}), ): # Todo updates are reflected in the message stream if isinstance(message, AssistantMessage): @@ -151,8 +173,8 @@ try { for await (const message of query({ prompt, - // Re-enable TodoWrite, which this tracker watches for. - options: { maxTurns: 20, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0" } } + // On every model, re-enable TodoWrite, which this tracker watches for. + options: { maxTurns: 20, env: { ...process.env, CLAUDE_CODE_ENABLE_TASKS: "0", CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } } })) { if (message.type === "assistant") { for (const block of message.message.content) { @@ -214,8 +236,8 @@ try: async for message in query( prompt=prompt, - # Re-enable TodoWrite, which this tracker watches for. - options=ClaudeAgentOptions(max_turns=20, env={"CLAUDE_CODE_ENABLE_TASKS": "0"}), + # On every model, re-enable TodoWrite, which this tracker watches for. + options=ClaudeAgentOptions(max_turns=20, env={"CLAUDE_CODE_ENABLE_TASKS": "0", "CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}), ): if isinstance(message, AssistantMessage): for block in message.content: @@ -240,7 +262,7 @@ Migrate to Task tools -The Task tools split the single `TodoWrite` call into `TaskCreate` for each new item and `TaskUpdate` for each status change, with `TaskList` and `TaskGet` available for the model to read back the current list. Your monitoring code still inspects `tool_use` blocks in the assistant stream, but maintains a map keyed by task ID instead of replacing the whole list on every call. The Task tools are the default as of TypeScript Agent SDK 0.3.142 and Claude Code v2.1.142, so no `options.env` change is needed. +The Task tools split the single `TodoWrite` call into `TaskCreate` for each new item and `TaskUpdate` for each status change, with `TaskList` and `TaskGet` available for the model to read back the current list. Your monitoring code still inspects `tool_use` blocks in the assistant stream, but maintains a map keyed by task ID instead of replacing the whole list on every call. With `TodoWrite`| With Task tools ---|--- @@ -249,7 +271,7 @@ Item shape: `{ content, status, activeForm }`| `TaskCreate` input: `{ subject, description, activeForm?, metadata? }`. `TaskUpdate` input: `{ taskId, status?, subject?, description?, activeForm?, addBlocks?, addBlockedBy?, owner?, metadata? }`. `status` is `"pending"`, `"in_progress"`, or `"completed"`; set `status: "deleted"` to delete Render `block.input.todos` directly| Accumulate items across calls, or read a snapshot from a `TaskList` tool result -The assigned task ID is not in the `TaskCreate` input. It comes back in the matching `tool_result` as `{ task: { id, subject } }`, so capture it from the result block to key your map. The following example shows the minimal change to the Monitoring Todo Changes loop. It reads only `tool_use` inputs and skips capturing IDs from `tool_result` blocks. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map. The streamed `tool_use` input is the raw shape the model emitted. Claude Code repairs some close-but-incorrect key names before execution, mapping `id` or `task_id` to `taskId` and `active_form` to `activeForm`, but that repair is not reflected in the stream. Read `TaskUpdate` input fields defensively, as the samples below do, rather than assuming the canonical name is always present. +The assigned task ID is not in the `TaskCreate` input. It comes back in the matching `tool_result` as `{ task: { id, subject } }`, so capture it from the result block to key your map. The following example shows the minimal change to the Monitoring Todo Changes loop. It leaves `CLAUDE_CODE_ENABLE_TASKS` unset, because the Task tools are the default, and sets only `CLAUDE_CODE_ENABLE_TODO_TOOLS=1`, the opt-in for the models that otherwise don’t get the tools. It reads only `tool_use` inputs and skips capturing IDs from `tool_result` blocks. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map. The streamed `tool_use` input is the raw shape the model emitted. Claude Code repairs some close-but-incorrect key names before execution, mapping `id` or `task_id` to `taskId` and `active_form` to `activeForm`, but that repair is not reflected in the stream. Read `TaskUpdate` input fields defensively, as the samples below do, rather than assuming the canonical name is always present. TypeScript @@ -260,7 +282,8 @@ try { for await (const message of query({ prompt: "Optimize my React app performance and track progress with todos", - options: { maxTurns: 15 }, + // Keeps the Task tools on models where Claude Code otherwise doesn't provide them. + options: { maxTurns: 15, env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" } }, })) { if (message.type !== "assistant") continue; for (const block of message.message.content) { @@ -293,7 +316,8 @@ try: async for message in query( prompt="Optimize my React app performance and track progress with todos", - options=ClaudeAgentOptions(max_turns=15), + # Keeps the Task tools on models where Claude Code otherwise doesn't provide them. + options=ClaudeAgentOptions(max_turns=15, env={"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}), ): if not isinstance(message, AssistantMessage): continue
modified Tools reference View current →
Show diff (101 lines)
--- a/tools-reference.md +++ b/tools-reference.md @@ -1,10 +1,10 @@ Claude Code has access to a set of built-in tools that help it understand and modify your codebase. The tool names are the exact strings you use in [permission rules](</docs/en/permissions#tool-specific-permission-rules>), [subagent tool lists](</docs/en/sub-agents>), and [hook matchers](</docs/en/hooks>). To control which tools Claude can use and when it asks first, configure [permission rules](</docs/en/permissions#tool-specific-permission-rules>) in your settings, [hooks](</docs/en/hooks>), or a [subagent’s tool list](</docs/en/sub-agents#supported-frontmatter-fields>). See Configure tools with permission rules and hooks for each place that accepts a tool name. To add custom tools, connect an [MCP server](</docs/en/mcp>). To extend Claude with reusable prompt-based workflows, write a [skill](</docs/en/skills>), which runs through the existing `Skill` tool rather than adding a new tool entry. -The `Permission required` column shows whether the tool prompts in the default permission mode for paths inside the working directory. File-access tools marked No, including `Read`, `Grep`, and `Glob`, still prompt for paths outside the [working directory and additional directories](</docs/en/permissions#working-directories>). `Bash` is marked Yes but runs a built-in set of [read-only commands](</docs/en/permissions#read-only-commands>) without prompting. +On Pro, Max, and Team plans, Claude Code starts sessions in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), where a classifier decides most of these prompts instead of you. The `Permission required` column shows whether the tool prompts in [Manual mode](</docs/en/permission-modes>) for paths inside the working directory. File-access tools marked No, including `Read`, `Grep`, and `Glob`, still prompt for paths outside the [working directory and additional directories](</docs/en/permissions#working-directories>). `Bash` is marked Yes but runs a built-in set of [read-only commands](</docs/en/permissions#read-only-commands>) without prompting. Tool| Description| Permission required ---|---|--- -`Agent`| Spawns a [subagent](</docs/en/sub-agents>) with its own context window to handle a task. See Agent tool behavior| No +`Agent`| Spawns a [subagent](</docs/en/sub-agents>) with its own context window to handle a task. 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. See Agent tool behavior| No `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 @@ -35,13 +35,13 @@ `SendUserFile`| Sends files from the session to you with an optional caption, so a generated report, diagram, screenshot, or built artifact reaches your device instead of only being mentioned in the transcript. As of v2.1.196, the optional `display` input controls presentation: `render` opens the file inline in the client, `attach` shows a download card only, and when unset the client decides by file type. Available when a [Remote Control](</docs/en/remote-control>) client is connected or the session runs in a managed cloud environment such as [Claude Code on the web](</docs/en/claude-code-on-the-web>). Delivery runs through Anthropic-hosted infrastructure, so the tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry| No `ShareOnboardingGuide`| Uploads `ONBOARDING.md` and returns a share link teammates can open in Claude Code. Called from `/team-onboarding` after the guide is written. Available to claude.ai subscribers on Pro, Max, Team, and Enterprise plans| Yes `Skill`| Executes a [skill](</docs/en/skills#control-who-invokes-a-skill>) within the main conversation| Yes -`TaskCreate`| Creates a new task in the task list| No -`TaskGet`| Retrieves full details for a specific task| No -`TaskList`| Lists all tasks with their current status| No +`TaskCreate`| Creates a new task in the task list. Claude Code leaves it out on the models listed under Task tool availability unless you opt in| No +`TaskGet`| Retrieves full details for a specific task. Claude Code leaves it out on the models listed under Task tool availability unless you opt in| No +`TaskList`| Lists all tasks with their current status. Claude Code leaves it out on the models listed under Task tool availability unless you opt in| No `TaskOutput`| Retrieves output from a background task. Deprecated in favor of `Read` on the task’s output file path. When no task matches the ID, the error lists the running background agents by ID and description. Before v2.1.203, the error named only the missing ID| No `TaskStop`| Stops a running background task by ID. It also accepts an [agent-team teammate](</docs/en/agent-teams>) or a named background agent by agent ID or name. Before v2.1.198, it accepted only a background task ID. When no task matches the ID, the error lists the running background agents by ID and description, including agents that another agent spawned. Before v2.1.203, the error listed running teammates and named agents but not background agents another agent spawned, so those couldn’t be identified or stopped from the main conversation| No -`TaskUpdate`| Updates task status, dependencies, details, or deletes tasks| No -`TodoWrite`| Manages the session task checklist. Disabled by default as of v2.1.142 in favor of `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate`. Set `CLAUDE_CODE_ENABLE_TASKS=0` to re-enable| No +`TaskUpdate`| Updates task status, dependencies, details, or deletes tasks. Claude Code leaves it out on the models listed under Task tool availability unless you opt in| No +`TodoWrite`| Manages the session task checklist. Disabled by default in favor of `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate`. Set `CLAUDE_CODE_ENABLE_TASKS=0` to re-enable it in sessions that have the task-tracking tools| No `ToolSearch`| Searches for and loads deferred tools when [tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is enabled| No `WaitForMcpServers`| Waits for one or more [MCP servers](</docs/en/mcp>) that are still connecting in the background, so a request can use their tools without restarting the session. Claude calls it when a needed server isn’t connected yet. Only appears when [tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled, since `ToolSearch` handles the wait when it’s enabled| No `WebFetch`| Fetches content from a specified URL. See WebFetch tool behavior| Yes @@ -85,7 +85,7 @@ Agent tool behavior -The Agent tool spawns a subagent in a separate context window. The subagent works through its task autonomously, then returns a single text result to the parent conversation. The parent doesn’t see the subagent’s intermediate tool calls or outputs, only that final result. To cap how many turns a subagent runs, set `maxTurns` in the [subagent definition](</docs/en/sub-agents#supported-frontmatter-fields>). 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 named subagents. Which tools a named 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 a single text 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>). 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>): * **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. @@ -192,7 +192,7 @@ * **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. Viewing a file with Bash also satisfies the read-before-edit requirement when the command is `cat`, `head`, `tail`, `sed -n 'X,Yp'`, `grep`, `egrep`, or `fgrep` on a single file with no pipes or redirects. Piped output and other Bash commands don’t count toward the read-before-edit check. This affects edit eligibility only, not permissions. [Read and Edit deny rules](</docs/en/permissions#tool-specific-permission-rules>) also apply to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, `sed`, and `grep`, but not to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself. The set of commands recognized for deny rules is not the same as the read-before-edit list above: for example, `egrep` and `fgrep` count for read-before-edit but are not checked against Read deny rules. For OS-level enforcement that covers every process, [enable the sandbox](</docs/en/sandboxing>). +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. Viewing a file with Bash also satisfies the read-before-edit requirement when the command is `cat`, `nl`, `bat`, `batcat`, `head`, `tail`, `sed -n 'X,Yp'`, `grep`, `egrep`, `fgrep`, or `rg` on a single file with no pipes or redirects. Piped output and other Bash commands don’t count toward the read-before-edit check. This affects edit eligibility only, not permissions. [Read and Edit deny rules](</docs/en/permissions#tool-specific-permission-rules>) also apply to file commands Claude Code recognizes in Bash, such as `cat`, `head`, `tail`, `sed`, and `grep`, but not to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself. The set of commands recognized for deny rules is not the same as the read-before-edit list above: for example, `egrep` and `fgrep` count for read-before-edit but are not checked against Read deny rules. For OS-level enforcement that covers every process, [enable the sandbox](</docs/en/sandboxing>). ## @@ -278,7 +278,7 @@ * Track output from any long-running script you point it at * Connect to a WebSocket feed and report each message as it arrives -For most watches, Claude writes a small script, runs it in the background, and receives each output line as it arrives. For a server that already pushes events, Claude can open a WebSocket instead of running a script. You keep working in the same session and Claude interjects when an event arrives. Stop a monitor by asking Claude to cancel it or by ending the session. When Monitor runs a command, it uses the same [permission rules as Bash](</docs/en/permissions#tool-specific-permission-rules>), so `allow` and `deny` patterns you have set for Bash apply here too. The WebSocket source has its own approval prompt. The tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. It is also not available when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. Plugins can declare monitors that start automatically when the plugin is active, instead of asking Claude to start them. See [plugin monitors](</docs/en/plugins-reference#monitors>). +For most watches, Claude writes a small script, runs it in the background, and receives each output line as it arrives. For a server that already pushes events, Claude can open a WebSocket instead of running a script. You keep working in the same session and Claude interjects when an event arrives. Stop a monitor by asking Claude to cancel it or by ending the session. When Monitor runs a command, it uses the same [permission rules as Bash](</docs/en/permissions#tool-specific-permission-rules>), so `allow` and `deny` patterns you have set for Bash apply here too. The WebSocket source has its own approval prompt, which the classifier decides in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). The tool is not available on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry. It is also not available when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. Plugins can declare monitors that start automatically when the plugin is active, instead of asking Claude to start them. See [plugin monitors](</docs/en/plugins-reference#monitors>). ### @@ -302,7 +302,7 @@ `url`| Yes| The endpoint to connect to. Must be a `ws://` or `wss://` URL with no embedded credentials or whitespace, using ASCII characters only `protocols`| No| WebSocket subprotocol names to offer during the handshake. Each entry must be a valid subprotocol token, and the list can’t contain duplicates -The `timeout_ms` and `persistent` inputs behave the same as they do for a command: the watch ends at the deadline unless `persistent` is set, and `TaskStop` cancels it early. Opening a WebSocket prompts for approval, and the prompt doesn’t offer an option to skip future prompts for the same host. Claude Code denies URLs that point at a private, link-local, or cloud-metadata address, including hostnames that resolve to one. It also denies hosts in `sandbox.network.deniedDomains`, and when [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, any host outside the managed allowlist. +The `timeout_ms` and `persistent` inputs behave the same as they do for a command: the watch ends at the deadline unless `persistent` is set, and `TaskStop` cancels it early. Opening a WebSocket prompts for approval; in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) the classifier decides instead. The prompt doesn’t offer an option to skip future prompts for the same host. Claude Code denies URLs that point at a private, link-local, or cloud-metadata address, including hostnames that resolve to one. It also denies hosts in `sandbox.network.deniedDomains`, and when [`allowManagedDomainsOnly`](</docs/en/settings#sandbox-settings>) is set in managed settings, any host outside the managed allowlist. ## @@ -407,6 +407,21 @@ ​ +Task tool availability + +In Claude Code v2.1.233 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in: `TodoWrite`, `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList`. Those models keep track of multi-step work without a written checklist, and the tools’ definitions and reminders take up context, so Claude Code leaves them out. Without them, Claude adds nothing to the [task list](</docs/en/interactive-mode#task-list>) while it works. On any other model, such as Opus 4.7, Claude Code provides the four Task tools by default and `TodoWrite` only when you set [`CLAUDE_CODE_ENABLE_TASKS=0`](</docs/en/env-vars>). If you’d like to use these tools on one of the listed models anyway, do one of the following: + + * Export [`CLAUDE_CODE_ENABLE_TODO_TOOLS=1`](</docs/en/env-vars>) before you start Claude Code, for example `CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude`. Claude Code then provides the same tools on every model and every provider + * Name one of the tools in [`--allowedTools`](</docs/en/cli-reference#cli-flags>), for example `claude --allowedTools TaskCreate` + * List the tools in [`--tools`](</docs/en/cli-reference#cli-flags>), which restricts the session’s built-in tools to the ones it names. Include the tools you want alongside the other built-in tools you use + * In the Agent SDK, the [`allowedTools` and `tools` options](</docs/en/agent-sdk/todo-tracking#model-availability>) work the same way as the two flags + +In [background sessions](</docs/en/agent-view>) and in [Claude Code on the web](</docs/en/claude-code-on-the-web>), Claude Code provides the same tools on every model, listed or not. Claude Code gives a subagent the tools only when your session has them, even when the subagent runs a different model. An in-process [agent team](</docs/en/agent-teams>) teammate follows your session the same way, while a teammate in its own [split pane](</docs/en/agent-teams#choose-a-display-mode>) runs as a separate Claude Code process, so its own model decides. Without the Task tools, an agent coordinates with its team through messages instead of the [shared task list](</docs/en/agent-teams#assign-and-claim-tasks>). + +## + +​ + WebFetch tool behavior WebFetch takes a URL and a prompt describing what to extract. It fetches the page, converts the response to Markdown when the server returns HTML, and runs the prompt against the content using a small, fast model. For most fetches, Claude receives that model’s answer, not the raw page. The conversion step is not configurable. This makes WebFetch lossy by design. The extraction prompt determines what reaches Claude, so a result that says a page doesn’t mention something may only mean the prompt didn’t ask about it. Ask Claude to fetch again with a more specific prompt, or use `curl` via Bash for the unprocessed page. A few behaviors shape the response Claude receives: @@ -417,7 +432,7 @@ * 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. -In the default and `acceptEdits` permission modes, WebFetch prompts the first time it reaches a new domain, except for a built-in set of preapproved documentation domains that fetch without a prompt. To allow another domain in advance without a prompt, add a permission rule like `WebFetch(domain:example.com)`. The `auto` and `bypassPermissions` [permission modes](</docs/en/permissions#permission-modes>) skip the prompt entirely. An explicit `WebFetch(domain:...)` rule in `deny`, `ask`, or `allow` takes precedence over the preapproved set, so you can block a preapproved domain or require a prompt for it. WebFetch sets a `User-Agent` header beginning with `Claude-User`, and an `Accept` header that prefers Markdown over HTML so servers that support content negotiation can return Markdown directly. You configure [sandbox](</docs/en/sandboxing>) network rules separately, so a domain you want a sandboxed process to reach still needs an explicit sandbox permission rule. +In the `default` and `acceptEdits` permission modes, WebFetch prompts the first time it reaches a new domain, except for a built-in set of preapproved documentation domains that fetch without a prompt. To allow another domain in advance without a prompt, add a permission rule like `WebFetch(domain:example.com)`. The `auto` and `bypassPermissions` [permission modes](</docs/en/permissions#permission-modes>) skip the prompt entirely. An explicit `WebFetch(domain:...)` rule in `deny`, `ask`, or `allow` takes precedence over the preapproved set, so you can block a preapproved domain or require a prompt for it. WebFetch sets a `User-Agent` header beginning with `Claude-User`, and an `Accept` header that prefers Markdown over HTML so servers that support content negotiation can return Markdown directly. You configure [sandbox](</docs/en/sandboxing>) network rules separately, so a domain you want a sandboxed process to reach still needs an explicit sandbox permission rule. ##
modified Troubleshoot installation and login View current →
--- a/troubleshoot-install.md +++ b/troubleshoot-install.md @@ -399,29 +399,7 @@ `Failed to fetch version from downloads.claude.ai` -The installer couldn’t reach the download server. This typically means `downloads.claude.ai` is blocked on your network. **Solutions:** - - 1. **Test connectivity directly** : - - curl -sI https://downloads.claude.ai/claude-code-releases/latest - -An `HTTP/2 200` line means the server is reachable. Other results point to the cause: - * `403`: usually a proxy or network filter blocking the host, or Claude Code is [not available in your region](<https://www.anthropic.com/supported-countries>) - * `5xx`: usually a temporary service issue; wait a few minutes and retry - 2. **If behind a proxy** , set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](</docs/en/network-config#proxy-configuration>) for details. - - export HTTPS_PROXY=http://proxy.example.com:8080 - curl -fsSL https://claude.ai/install.sh | bash - - 3. **If on a restricted network** , try a different network or VPN, or use an alternative install method: On macOS: - - brew install --cask claude-code - -On Windows: - - winget install Anthropic.ClaudeCode - -Then run `claude --version` to confirm: the command prints a version number such as `2.1.211 (Claude Code)`. If the shell reports `claude` isn’t found, open a new terminal window and retry: the session you installed from keeps its old `PATH`. +The installer couldn’t reach the download server. This typically means `downloads.claude.ai` is blocked on your network. See Check network connectivity. ### @@ -506,7 +484,7 @@ Installation was killed before it could finish (exit code 137). This usually means the system ran out of memory. Claude Code needs roughly 512MB of free memory to install. Free up memory, then run this script again. -Before v2.1.200, the script exited with only the shell’s bare `Killed` line and no explanation. Installing needs roughly 512 MB of free memory, and running Claude Code needs more. See the [system requirements](</docs/en/setup#system-requirements>). **Solutions:** +Installing needs roughly 512 MB of free memory, and running Claude Code needs more. See the [system requirements](</docs/en/setup#system-requirements>). **Solutions:** 1. **Add swap space** if your server has limited RAM. Swap uses disk space as overflow memory, letting the install complete even with low physical RAM. Create a 2 GB swap file and enable it:
modified Agent SDK reference - TypeScript View current →
--- a/typescript.md +++ b/typescript.md @@ -2767,7 +2767,15 @@ Creates and manages a structured task list for tracking progress. -As of TypeScript Agent SDK 0.3.142, `TodoWrite` is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`. +On TypeScript Agent SDK 0.3.233 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in: + + * `TodoWrite` + * `TaskCreate` + * `TaskGet` + * `TaskUpdate` + * `TaskList` + +On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code. ### @@ -3732,7 +3740,15 @@ Returns the previous and updated task lists. -As of TypeScript Agent SDK 0.3.142, `TodoWrite` is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. See [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`. +On TypeScript Agent SDK 0.3.233 and later, the following tools aren’t available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in: + + * `TodoWrite` + * `TaskCreate` + * `TaskGet` + * `TaskUpdate` + * `TaskList` + +On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.See [Model availability](</docs/en/agent-sdk/todo-tracking#model-availability>) to opt in and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) to update your monitoring code. ###
modified Voice dictation View current →
--- a/voice-dictation.md +++ b/voice-dictation.md @@ -154,6 +154,7 @@ * **Tapping`Space` types a space instead of recording in tap mode**: the first tap only starts recording when the prompt input is empty. Clear the input first, or check that you are in tap mode by running `/voice tap`. * **`No audio detected from microphone`** : recording started but captured silence. Confirm the correct input device is set as the system default and that its input level is not muted or near zero. On Windows, open Settings → System → Sound → Input and select your microphone. On macOS, open System Settings → Sound → Input. * **`Voice connection failed`** : your recording never reached the transcription service because the connection failed. Check your network and try again. A recording that captures no audio reports `No audio detected from microphone` instead of this message. Before v2.1.200, a silent microphone could report a connection failure, which suggested a network problem when the actual issue was the input device. + * **`Voice stream error: WebSocket upgrade rejected with HTTP<status>`**: a server refused your connection with the HTTP status shown, so this isn’t a network outage. A status in the 400 range usually means a stale sign-in, or a proxy or bot-protection service answering in place of the transcription service. Run `/login` to refresh your sign-in, and check for a VPN or proxy on your network path if the status persists. If you’re still recording when the rejection arrives, Claude Code retries a status outside the 400 range once before showing this message; it doesn’t retry a status in the 400 range. In v2.1.229 through v2.1.231, native builds didn’t show this message: Claude Code kept recording, the hold-mode footer still showed `listening…`, and it reported `Voice connection failed` after you stopped recording. * **`No speech detected`** : audio reached the transcription service but no words were recognized. Speak closer to the microphone, reduce background noise, and confirm your dictation language matches the language you are speaking. * **Transcription is garbled or in the wrong language** : dictation defaults to English. If you are dictating in another language, set it in `/config` first. See Change the dictation language.
modified Get started with Claude Code on the web View current →
--- a/web-quickstart.md +++ b/web-quickstart.md @@ -122,7 +122,13 @@ Choose a permission mode -The mode dropdown next to the input defaults to **Accept edits** , where Claude makes changes and pushes a branch without stopping for approval. Switch to **Plan** if you want Claude to propose an approach and wait for you to approve it before editing files. Cloud sessions don’t offer Manual or Bypass permissions. See the [full list of permission modes](</docs/en/permission-modes#available-modes>) for what each one allows. +The mode dropdown next to the input shows the mode the session will run in: + + * **Auto** : a classifier reviews Claude’s actions instead of asking you. Appears when your organization allows auto mode and the selected model supports it + * **Accept edits** : Claude makes changes and pushes a branch without stopping for approval + * **Plan** : Claude proposes an approach and waits for you to approve it before editing files + +Cloud sessions don’t offer Manual or Bypass permissions. See the [full list of permission modes](</docs/en/permission-modes#available-modes>) for what each one allows. 3
modified Orchestrate subagents at scale with dynamic workflows View current →
--- a/workflows.md +++ b/workflows.md @@ -176,8 +176,8 @@ Permission mode| When you’re prompted ---|--- -Default, accept edits| Every run, unless you’ve selected **Yes, and don’t ask again** for that workflow in this project Auto| First launch only. Any **Yes** records consent in your user settings, and later launches start without prompting. Skipped entirely when ultracode is on +Manual, accept edits| Every run, unless you’ve selected **Yes, and don’t ask again** for that workflow in this project Bypass permissions, `claude -p`, Agent SDK| Never. The run starts immediately In the Desktop app, an approval card shows the workflow name, the phase list, and a token-usage caution, with **Once** , **Always** , and **Deny** actions. The progress view appears in the Background tasks side pane. Your permission mode controls only the launch prompt above. The subagents the workflow spawns always run in `acceptEdits` mode and inherit your [tool allowlist](</docs/en/settings#permission-settings>), regardless of your session’s mode. File edits are auto-approved. Shell commands, web fetches, and MCP tools that aren’t in your allowlist can still prompt you mid-run. To avoid this on a long run, add the commands the agents need to your allowlist before starting. In `claude -p` and the Agent SDK there is no one to prompt, so tool calls follow your configured permission rules without interactive confirmation.
modified Run parallel sessions with worktrees View current →
--- a/worktrees.md +++ b/worktrees.md @@ -45,7 +45,7 @@ * **The worktree is clean** : for an unnamed session, Claude removes the worktree and its branch automatically. A [named](</docs/en/sessions#name-your-sessions>) session prompts you first so you can keep the worktree for later * **The worktree has work in it** : Claude prompts you to keep or remove the worktree. Keeping preserves the directory and branch so you can return later. Removing deletes the worktree directory and its branch, along with all the work in them -Non-interactive runs with `-p` have no exit prompt, so Claude doesn’t clean up their worktrees. Remove them with `git worktree remove`. On Windows, removing a worktree doesn’t delete files outside it. If a folder inside the worktree is really a link to somewhere else, such as an NTFS junction or a directory symlink, Claude Code deletes only the link and keeps the folder it points to. Before v2.1.205, removing a worktree with a link nested in a subdirectory could delete the folder it pointed to. +Non-interactive runs with `-p` have no exit prompt, so Claude doesn’t clean up their worktrees, and Claude Code leaves the lock it took on each one at creation in place until a later session’s stale-lock sweep releases it. To remove one, run `git worktree remove`; if git refuses because the worktree is locked, run `git worktree unlock` on it first. On Windows, removing a worktree doesn’t delete files outside it. If a folder inside the worktree is really a link to somewhere else, such as an NTFS junction or a directory symlink, Claude Code deletes only the link and keeps the folder it points to. Before v2.1.205, removing a worktree with a link nested in a subdirectory could delete the folder it pointed to. ## @@ -138,9 +138,17 @@ Branch from a pull request -To branch from a specific pull request, pass `--worktree` the PR number prefixed with `#`, or a full GitHub pull request URL. Claude Code fetches `pull/<number>/head` from `origin` and creates the worktree at `.claude/worktrees/pr-<number>`. Quote the argument so your shell doesn’t treat `#` as the start of a comment: +To branch from a specific pull request or merge request, pass `--worktree` the number prefixed with `#`, a GitHub pull request URL, or a GitLab merge request URL such as `https://gitlab.com/group/repo/-/merge_requests/123`. Claude Code fetches that change’s head commit from `origin` and creates the worktree at `.claude/worktrees/pr-<number>`. Quote the argument so your shell doesn’t treat `#` as the start of a comment: claude --worktree "#1234" + +Claude Code reads only the number from the URL. It always fetches from your repository’s `origin` remote, and picks the fetch path by `origin`’s host: + + * **github.com** : fetches `pull/<number>/head` + * **gitlab.com** : fetches `merge-requests/<number>/head` + * **GitHub Enterprise, self-managed GitLab, or any other host** : tries `pull/<number>/head` first, then `merge-requests/<number>/head` + +Before v2.1.233, Claude Code accepted only `#<number>` and GitHub-style pull request URLs for `--worktree`, and always fetched `pull/<number>/head`. ### @@ -168,9 +176,16 @@ * It has no uncommitted changes or untracked files. * It is still on the branch Claude Code created for it. - * It has no commits of its own, or its pull request was merged and its remote branch deleted. - -Claude Code detects the merged case from git state alone: the remote branch the worktree pushed to no longer exists, and every commit in the worktree is already on the default branch. Anything else reopens at the old tip: a worktree that fails any of the conditions, one whose state can’t be verified, and any reuse when `worktree.baseRef` is `"head"` or the name is a pull request number. Before v2.1.208, a reused name always reopened the old worktree at its old tip. + * It has no commits of its own, or its pull request or merge request was merged and its remote branch deleted. + +Claude Code detects the merged case from git state alone: the remote branch the worktree pushed to no longer exists, and every commit in the worktree is already on the default branch. In every other case, Claude Code reopens the worktree at its old tip: + + * The worktree fails any of the conditions. + * Claude Code can’t verify the worktree’s state. + * `worktree.baseRef` is `"head"`. + * The name is a pull request or merge request reference. + +Before v2.1.208, when you reused a name, Claude Code always reopened the old worktree at its old tip. ###